Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update to Node 20 #6385

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b9b1fca
Update to Node 22
snowystinger May 15, 2024
e173ba7
go to node 20 instead
snowystinger Jun 23, 2024
9ecd8c7
fix formatting test
snowystinger Jun 24, 2024
c1d99bb
run verdaccio build
snowystinger Jun 24, 2024
829125f
turn off verdaccio build
snowystinger Jun 24, 2024
bc507dd
try limiting concurrent tests
snowystinger Jun 24, 2024
57cc9f2
try to debug on ci where error happens more
snowystinger Jun 24, 2024
a63767a
keep debugging
snowystinger Jun 24, 2024
13b26a4
try a longer timeout
snowystinger Jun 24, 2024
bfc1945
remove debugging
snowystinger Jun 24, 2024
d00a0d7
turn on verdaccio build
snowystinger Sep 27, 2024
07c6a49
fix lint
snowystinger Sep 27, 2024
795c55b
update yarn lock
snowystinger Sep 27, 2024
f0b6492
fix verdaccio and tsdiffer
snowystinger Sep 27, 2024
56b980a
fix node corepack
snowystinger Sep 27, 2024
4fce024
fix forkpoint
snowystinger Sep 27, 2024
6a7a86d
try to fix buildWebsite
snowystinger Sep 27, 2024
9760674
turn verdaccio build back off
snowystinger Sep 27, 2024
6d37be1
fix rebase
snowystinger Oct 14, 2024
96dbf2c
Merge branch 'main' into node-22
snowystinger Dec 1, 2024
816dda2
turn on verdaccio on CI
snowystinger Dec 1, 2024
899cc56
Merge branch 'main' into node-22
snowystinger Feb 7, 2025
99ef2eb
turn off verdaccio again and remove concurrency restriction
snowystinger Feb 7, 2025
cf62730
turn back on verdaccio
snowystinger Feb 7, 2025
6c12845
fix spectrum-css local builder
snowystinger Feb 10, 2025
2c6b350
remove obselete patch
snowystinger Feb 10, 2025
840a3f2
fix lint and flakey ssr
snowystinger Feb 10, 2025
1be8a56
remove verdaccio
snowystinger Feb 11, 2025
ffbb8e1
update to latest node 20
snowystinger Feb 11, 2025
8ee2e60
Merge branch 'main' into node-22
snowystinger Feb 11, 2025
0a7375a
Merge branch 'main' into node-22
snowystinger Feb 20, 2025
912e8b6
Merge branch 'main' into node-22
snowystinger Feb 26, 2025
2a445ca
Merge branch 'main' into node-22
snowystinger Mar 6, 2025
b62f850
Merge branch 'main' into node-22
snowystinger Mar 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ orbs:
executors:
rsp:
docker:
- image: cimg/node:18.20.3
- image: cimg/node:20.18.2
environment:
CACHE_VERSION: v1
working_directory: ~/react-spectrum

rsp-large:
docker:
- image: cimg/node:18.20.3
- image: cimg/node:20.18.2
resource_class: large
environment:
CACHE_VERSION: v1
working_directory: ~/react-spectrum

rsp-xlarge:
docker:
- image: cimg/node:18.20.3
- image: cimg/node:20.18.2
resource_class: xlarge
environment:
CACHE_VERSION: v1
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/branch/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Branch from fork'
description: 'creates a branch based off PR from fork'
runs:
using: 'node18'
using: 'node20'
main: 'index.js'
2 changes: 1 addition & 1 deletion .github/actions/comment/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'PR Comment'
description: 'Comment on the PR attached to a commit'
runs:
using: 'node12'
using: 'node20'
main: 'index.js'
2 changes: 1 addition & 1 deletion .github/actions/permissions/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Check permissions'
description: 'Checks if commentor has write access or above'
runs:
using: 'node18'
using: 'node20'
main: 'index.js'
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.*
20.*
2 changes: 1 addition & 1 deletion examples/remix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"vite-tsconfig-paths": "^4.2.1"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.0.0"
},
"workspaces": [
"../../packages/react-aria-components",
Expand Down
2 changes: 1 addition & 1 deletion jest.ssr.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
'packages/'
],

testTimeout: 30000,
testTimeout: 50000,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof, was it the SSR tests you mentioned that prompted this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I'm not sure why they take longer now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attempting to fix with maxConcurrency instead, might just be something with how node does concurrency now


globalSetup: require.resolve('@react-spectrum/test-utils-internal/src/ssrSetup'),
globalTeardown: require.resolve('@react-spectrum/test-utils-internal/src/ssrTeardown'),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"test-storybook": "test-storybook --url http://localhost:9003 --browsers chromium --no-cache",
"test:docs": "yarn playwright install && node scripts/testDocs.js",
"build": "make build",
"test:ssr": "cross-env STRICT_MODE=1 yarn jest --config jest.ssr.config.js",
"test:ssr": "cross-env STRICT_MODE=1 yarn jest --runInBand --config jest.ssr.config.js",
"ci-test": "cross-env STRICT_MODE=1 yarn jest --maxWorkers=2 && cross-env STRICT_MODE=1 yarn test:ssr --runInBand",
"lint": "concurrently \"yarn check-types\" \"eslint packages\" \"node scripts/lint-packages.js\" \"yarn constraints\"",
"jest": "node scripts/jest.js",
Expand Down
149 changes: 149 additions & 0 deletions packages/@adobe/spectrum-css-builder-temp/css/lib/varUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
Copyright 2019 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

const gulp = require('gulp');
const postcss = require('postcss');
const concat = require('gulp-concat');
const through = require('through2');
const fsp = require('fs').promises;
const logger = require('gulplog');
const path = require('path');

function getVarsFromCSS(css) {
let variableList = [];
let root = postcss.parse(css);

root.walkRules((rule, ruleIndex) => {
rule.walkDecls((decl) => {
let matches = decl.value.match(/var\(.*?\)/g);
if (matches) {
matches.forEach(function (match) {
let varName = match.replace(/var\((--[\w-]+),?.*?\)/, '$1').trim();
if (variableList.indexOf(varName) === -1) {
variableList.push(varName);
}
});
}
});
});
return variableList;
}

function getVarValues(css) {
let root = postcss.parse(css);
let variables = {};

root.walkRules((rule, ruleIndex) => {
rule.walkDecls((decl) => {
variables[decl.prop] = decl.value;
});
});

return variables;
}

function getClassNames(contents, pkgName) {
let classNames = [];

if (classNames.length === 0) {
logger.error(`Could not find classNames for ${pkgName}, assuming no classNames`);
classNames.push('');
}

logger.debug(`Found classNames ${classNames.join(', ')} for ${pkgName}`);

return classNames;
}

function resolveValue(value, vars) {
if (value) {
let match = value.match(/var\((.+),?.*?\)/);
if (match) {
return match[1];
}
return value;
}
}

const varDir = path.join(path.dirname(require.resolve('@spectrum-css/vars')), '..');

async function readDNAVariables(file) {
let css = await fsp.readFile(path.join(varDir, 'css', file));
let vars = getVarValues(css);
return vars;
}

function getVariableDeclarations(classNames, vars) {
let varNames = Object.keys(vars);
if (varNames.length) {
return `
${classNames.map((className) => `${className}`).join(',\n')} {
${varNames.map((varName) => ` ${varName}: ${vars[varName]};`).join('\n')}
}
`;
}

return '';
}

function getAllVars() {
return new Promise((resolve, reject) => {
let variableList;

gulp.src([
`${varDir}/css/themes/*.css`,
`${varDir}/css/scales/*.css`,
`${varDir}/css/components/*.css`,
`${varDir}/css/globals/*.css`
])
.pipe(concat('everything.css'))
.pipe(through.obj(function getAllVars(file, enc, cb) {
variableList = getVarValues(file.contents.toString());

cb(null, file);
}))
.on('finish', () => {
resolve(variableList);
})
.on('error', reject);
});
}

function getAllComponentVars() {
return new Promise((resolve, reject) => {
let variableList;

gulp.src([
`${varDir}/css/components/*.css`,
`${varDir}/css/globals/*.css`
])
.pipe(concat('everything.css'))
.pipe(through.obj(function getAllVars(file, enc, cb) {
variableList = getVarValues(file.contents.toString());

cb(null, file);
}))
.on('finish', () => {
resolve(variableList);
})
.on('error', reject);
});
}

exports.getAllComponentVars = getAllComponentVars;
exports.getAllVars = getAllVars;
exports.getVarsFromCSS = getVarsFromCSS;
exports.getVarValues = getVarValues;
exports.getClassNames = getClassNames;
exports.resolveValue = resolveValue;
exports.readDNAVariables = readDNAVariables;
exports.getVariableDeclarations = getVariableDeclarations;
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
Copyright 2019 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
var valueParser = require('postcss-value-parser');
let varUtils = require('../lib/varUtils.js');

// match custom property inclusions
const customPropertiesRegExp = /(^|[^\w-])var\([\W\w]+\)/;

let staticVars;
let allVars;
async function fetchVars() {
if (staticVars && allVars) {
return true;
}

// Read in all static vars
staticVars = Object.assign(
{},
await varUtils.readDNAVariables('globals/spectrum-staticAliases.css'),
await varUtils.readDNAVariables('globals/spectrum-fontGlobals.css'),
await varUtils.readDNAVariables('globals/spectrum-fontGlobals.css'),
await varUtils.readDNAVariables('globals/spectrum-dimensionGlobals.css'),
await varUtils.readDNAVariables('globals/spectrum-colorGlobals.css'),
await varUtils.readDNAVariables('globals/spectrum-animationGlobals.css')
);

// Read in all variables so we have the value they resolve to
allVars = await varUtils.getAllComponentVars();

return true;
}

let fetchVarsPromise;
module.exports = function () {
return {
postcssPlugin: 'postcss-custom-properties-mapping',
OnceExit: async function (root, result) {
fetchVarsPromise ??= fetchVars();
await fetchVarsPromise;

root.walkRules((rule, ruleIndex) => {
rule.walkDecls((decl) => {
if (customPropertiesRegExp.test(decl.value)) {
let value = valueParser(decl.value);

value.walk((node, index, nodes) => {
if (node.type === 'function' && node.value === 'var') {
let v = node.nodes[0].value;

// If the value is static, replace the variable with the value.
// Otherwise, change the variable name to the mapped name.
if (staticVars[v]) {
nodes.splice(index, 1, ...valueParser(`var(${v}, ${staticVars[v]})`).nodes);
} else if (allVars[v]) {
nodes.splice(index, 1, ...valueParser(`var(${v}, ${allVars[v]})`).nodes);
}
}
});

decl.value = value.toString();
}
});
});
}
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
Copyright 2019 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

module.exports = function (opts) {
opts = opts || {};

return function (root, result) {
root.walkRules((rule, ruleIndex) => {
rule.walkDecls((decl) => {
if (decl.value.match('xvar(.*?)')) {
decl.value = decl.value.substr(1);
}
if (decl.prop.substr(0, 3) === 'x--') {
decl.prop = decl.prop.substr(1);
}
});
});
};
};
Loading