-
Notifications
You must be signed in to change notification settings - Fork 222
chore: script clean-up for packages and tokens[swc-808] #5419
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
base: CSS-Cutoff
Are you sure you want to change the base?
chore: script clean-up for packages and tokens[swc-808] #5419
Conversation
|
@@ -50,7 +50,6 @@ | |||
"lint:versions": "node ./scripts/lint-versions.js", | |||
"new-package": "cd projects/templates && plop", | |||
"postcustom-element-json": "node ./tasks/run-check-cem.js", | |||
"postdocs:analyze": "node ./scripts/add-custom-properties.js --src=\"projects/documentation/custom-elements.json\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reading in spectrum-vars.json files from the packages in this repo and those files are legacy and no longer created or committed.
Branch previewReview the following VRT differencesWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
If the changes are expected, update the |
Tachometer resultsCurrently, no packages are changed by this PR... |
e0f9c5f
to
5945a6d
Compare
@@ -14,7 +14,7 @@ governing permissions and limitations under the License. | |||
|
|||
import chokidar from 'chokidar'; | |||
import debounce from 'debounce'; | |||
import { processCSS } from './css-tools.js'; | |||
import { processCSS } from './build-css.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The css-tools file only had 1 task in it so I pulled that into build-css to simplify things a bit.
} | ||
} else { | ||
console.warn(`check-cem.js not found for ${pkg.name}`); | ||
async function checkCEM(pkg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled this functionality directly into the run script here since it seemed like an unnecessary abstraction.
'ui-icons', | ||
'dist' | ||
) | ||
const spectrumIconsPath = path.join( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path.resolve + path.join functions cause the drive to be listed twice in windows so I cleaned that up while I was here.
@@ -60,8 +60,6 @@ | |||
"case": "^1.6.1", | |||
"cheerio": "^1.0.0-rc.2", | |||
"fast-glob": "^3.2.12", | |||
"fs": "^0.0.1-security", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fs and path are bundled with node and don't need to be pulled in explicitly (in fact it can be a risk).
5945a6d
to
1045ca1
Compare
1045ca1
to
618cb83
Compare
11d4edb
to
4f12157
Compare
@@ -1,5 +1 @@ | |||
cem-react-wrapper.config.js @jianliao |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can loop in Jian if needed but we can also code review these too.
4f12157
to
8a82d29
Compare
@@ -31,7 +31,6 @@ custom-elements.json | |||
packages/*/src/**/*.css.js | |||
packages/*/custom-elements.json | |||
packages/**/*.js | |||
packages/**/spectrum-vars.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a legacy asset from the vars and expressvars days. Might be worth looking into copying over the metadata.json functionality from CSS though.
@@ -1,106 +0,0 @@ | |||
# Component Inventory | |||
|
|||
Availability of [Spectrum](https://spectrum.adobe.com) components in [Spectrum CSS](https://opensource.adobe.com/spectrum-css/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not being updated regularly anymore and the script to do so was based on outdated dependency structures. If we want to bring this back, we'll need to find new ways to automate it.
@@ -22,7 +22,6 @@ import { | |||
overviewDestinationTemplate, | |||
overviewPartialTemplate, | |||
} from './component-template-parts.js'; | |||
import { gatherUrls } from './gather-spectrum-urls.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fetching assets that no longer exist for the CSS packages.
import fg from 'fast-glob'; | ||
import { processCSS } from './css-tools.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We didn't really need this abstraction since build-css is the only script calling css-tools. I pulled that functionality directly into this script as a single-source-of-truth.
import { buildPackage } from './ts-tools.js'; | ||
import { generateIconWrapper } from '../scripts/cem-plugin-react-wrapper.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly to the build-css script, this one didn't need these abstractions or to call the exec functionality when the node utilities exist.
"create-git-tag": "node --no-warnings tasks/create-git-tag.js", | ||
"custom-element-json": "node tasks/custom-element-json.js", | ||
"docs:analyze": "cem analyze --globs \"packages/**/*.ts\" --exclude \"**/*.d.ts\" --exclude \"**/stories/**\" --exclude \"**/icons/**\" --exclude \"**/elements/**\" --outdir projects/documentation --litelement", | ||
"custom-element-json": "yarn custom-element-json:clean && node tasks/custom-element-json.js && yarn custom-element-json:validate", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love this improvement
"build:confirm": "node ./tasks/confirm-build.js", | ||
"build:css": "wireit", | ||
"build:css:watch": "wireit", | ||
"build:react": "yarn gen-react-wrapper && node ./tasks/build-react.js && yarn tsc --build tsconfig-react-wrapper.json", | ||
"build:icons": "wireit", | ||
"build:react": "node ./tasks/build-react.js && tsc --build tsconfig-react-wrapper.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I combined the gen-react-wrapper and build-react tasks into one script
@@ -10,34 +10,32 @@ | |||
}, | |||
"scripts": { | |||
"analyze": "lit-analyzer \"{packages,tools}/*/src/**/!(*.css).ts\"", | |||
"analyze:docs": "cem analyze --globs \"packages/**/*.ts\" --exclude \"**/*.d.ts\" --exclude \"**/stories/**\" --exclude \"**/icons/**\" --exclude \"**/elements/**\" --outdir projects/documentation --litelement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was previous docs: analyze
but I was aiming to group the cem tasks together so we can get a view of the manifests being generated.
"build": "wireit", | ||
"build:clear-cache": "rimraf packages/*/tsconfig.tsbuildinfo && rimraf tools/*/tsconfig.tsbuildinfo", | ||
"build:component-inventory": "node ./tasks/build-component-inventory.js", | ||
"build:clean": "rimraf packages/*/tsconfig.tsbuildinfo tools/*/tsconfig.tsbuildinfo", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I migrated build:clear-cache
to build:clean
. Clear-cache wasn't being used anywhere else but it seemed right to keep it as an available shorthand script.
"build": "wireit", | ||
"build:clear-cache": "rimraf packages/*/tsconfig.tsbuildinfo && rimraf tools/*/tsconfig.tsbuildinfo", | ||
"build:component-inventory": "node ./tasks/build-component-inventory.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The component inventory was really out-of-date and leveraging assets we no longer have in our node_modules resources so if we want to build something similar in the future, we'll need a different way to go about it.
"changeset-publish": "yarn prepublishOnly && yarn changeset version && yarn install && yarn lint:versions --fix && yarn update-version && yarn changeset publish && yarn postpublish", | ||
"changeset-snapshot-publish": "yarn prepublishOnly && yarn changeset version --snapshot && yarn install && yarn lint:versions --fix && yarn update-version && yarn changeset publish --no-git-tag --tag snapshot", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question about the changeset-publish command. Why are we setting changeset not to create the tags and then using a script to do it? Can't we just let changeset push the git tags?
"docs:production": "yarn workspace documentation build:production", | ||
"docs:review": "alex packages/**/*.md", | ||
"docs:start": "yarn workspace documentation serve --watch", | ||
"find": "test -f custom-elements.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't being used anywhere and I don't see much value in it.
"docs:production": "yarn workspace documentation build:production", | ||
"docs:review": "alex packages/**/*.md", | ||
"docs:start": "yarn workspace documentation serve --watch", | ||
"find": "test -f custom-elements.json", | ||
"format:css": "yarn lint:css --fix && pretty-quick --pattern \"{packages,tools}/**/*.css\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this formatter since we're looking to migrate to lint-staged but we can bring back a forced formatting command if we need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does lint-staged need to be merged in first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I don't think it does, the format:css
command isn't called by anything so it's really just a question of if anyone is manually using this one.
@@ -48,31 +46,20 @@ | |||
"lint:packagejson": "pretty-quick --pattern package.json --pattern \"packages/*/package.json\" --pattern \"projects/*/package.json\" --pattern \"tools/*/package.json\" --pattern \"react/*/package.json\"", | |||
"lint:ts": "pretty-quick --pattern \"packages/**/*.ts\" && eslint -f pretty \"packages/**/*.ts\" && pretty-quick --pattern \"tools/**/*.ts\" && eslint -f pretty \"tools/**/*.ts\"", | |||
"lint:versions": "node ./scripts/lint-versions.js", | |||
"new-package": "cd projects/templates && plop", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see this updated below, we don't have to move into the directory to run the command since we can leverage yarn workspaces
8a82d29
to
555d6a7
Compare
Description
Process-spectrum is a command that runs several scripts that auto-generate and compile stylesheets from @spectrum-css repo and the spectrum-config defined in component directories. This rewrites every stylesheet each time it runs to catch differences in the output.
Process-spectrum runs in many of our commands in the package.json as a dependency or directly called. We need to remove it and check that
yarn build
no longer compiles styles.Related issue(s)
How has this been tested?
yarn build
commandChecklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.