Skip to content

Commit 4f12157

Browse files
committed
chore: script clean-up for packages and tokens[swc-808]
1 parent 67be4f0 commit 4f12157

36 files changed

+409
-3028
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
cem-react-wrapper.config.js @jianliao
2-
scripts/cem-plugin-react-wrappers.js @jianliao
3-
scripts/generate-icon-react-wrapper.js @jianliao
4-
tasks/build-react.js @jianliao
5-
* @adobe/swc-maintainers
1+
* @adobe/swc-maintainers

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ custom-elements.json
3131
packages/*/src/**/*.css.js
3232
packages/*/custom-elements.json
3333
packages/**/*.js
34-
packages/**/spectrum-vars.json
3534
packages/**/*.js.map
3635
packages/**/*.d.ts
3736
packages/**/*.test-vrt.ts
@@ -50,7 +49,6 @@ projects/**/*.d.ts
5049

5150
tools/*/src/**/*.css.js
5251
tools/*/custom-elements.json
53-
tools/**/spectrum-vars.json
5452
tools/**/*.js
5553
tools/**/*.js.map
5654
tools/**/*.d.ts

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"files.exclude": {
33
"**/*.css.ts": { "when": "$(basename)" },
4-
"packages/*/src/spectrum-vars.json": true,
54
"packages/**/*.js.map": true,
65
"packages/**/*.js": { "when": "$(basename).ts" },
76
"packages/**/*.dev.js": { "when": "$(basename).js" },

INVENTORY.md

Lines changed: 0 additions & 106 deletions
This file was deleted.

README.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Spectrum Web Components is a future-looking project to develop Adobe Spectrum de
44

55
To this end, Spectrum Web Components only targets _modern_, evergreen browsers that fully implement the Custom Elements V1 specification, e.g. Chrome, Firefox, Safari. Polyfills will be avoided as much as possible but documented if necessary.
66

7-
# Requirements
7+
## Requirements
88

99
- NodeJS >= 20.0.0
1010
- Typescript
@@ -17,9 +17,9 @@ To this end, Spectrum Web Components only targets _modern_, evergreen browsers t
1717
- We support all viewport sizes across supported desktop browsers.
1818
- While our components are designed to be responsive and mobile-friendly, we do not yet fully support mobile browsers due to limited testing in mobile hardware. We advise testing updates on mobile devices before updating and are happy to address any reported issues.
1919

20-
# Getting started
20+
## Getting started
2121

22-
```bash
22+
```sh
2323
git clone https://github.com/adobe/spectrum-web-components.git
2424
cd spectrum-web-components
2525
yarn
@@ -33,8 +33,8 @@ Typical development will involve running `yarn storybook`, `yarn test`, and `yar
3333

3434
Creating a new component from the command line can be done by running the following:
3535

36-
```bash
37-
$ yarn new-package
36+
```sh
37+
yarn new-package
3838
```
3939

4040
This will scaffold your component's required architecture by prompting you for 2 data points - the desired name for your package and the name of the Spectrum CSS asset from which you will be building.
@@ -49,35 +49,35 @@ You can find this information in the [Spectrum CSS GitHub project](https://githu
4949

5050
For additional information, please see the [generating components documentation](https://opensource.adobe.com/spectrum-web-components/guides/generating-components) and capturing the value of the package name: `"name": "@spectrum-css/accordion"`. In this example, that name is `accordion`. _Note_ that the project scope `@spectrum-css` is stripped out of the response.
5151

52-
# Storybook
52+
## Storybook
5353

5454
Testing & reviewing changes can be done using the Storybook instance. Running `yarn storybook` will spin up a local instance of Storybook, triggering the browser to open at completion. From there you can make changes to your code and the browser will automatically refresh.
5555

5656
You can run [Storybook](https://storybook.js.org) through the command:
5757

58-
```bash
58+
```sh
5959
yarn storybook
6060
```
6161

6262
By default, the resulting site will be available at [http://localhost:8000](http://localhost:8000).
6363

64-
# Documentation
64+
## Documentation
6565

6666
The Spectrum Web Components documentation site is available via the following command:
6767

68-
```bash
68+
```sh
6969
yarn docs:start
7070
```
7171

7272
By default, the resulting site will be available at [http://localhost:8080](http://localhost:8080).
7373

7474
In the case that you'd like to serve and test a static build of the documentation from the root directory (`localhost` or otherwise), use:
7575

76-
```bash
76+
```sh
7777
yarn docs:build
7878
```
7979

80-
# Updating Spectrum CSS
80+
## Updating Spectrum CSS
8181

8282
There are two mechanisms for broadly updating SWC's Spectrum CSS dependencies:
8383

@@ -87,14 +87,12 @@ There are two mechanisms for broadly updating SWC's Spectrum CSS dependencies:
8787
We aim to keep Spectrum CSS as current as possible, to track the Spectrum design system closely.
8888
The `:nonbreaking` variant lets us release patch updates quickly in cases where more work is required to be compatible with 'latest.'
8989

90-
# Advanced development
90+
## Advanced development
9191

9292
There are several commands that can be useful in specific scenarios:
9393

94-
- `yarn build:clear-cache` to remove previously created artifacts of the `tsc build` process.
95-
- `yarn spectrum-vars` to ensure that theme files are up-to-date.
96-
- `yarn process-icons` to make sure that the most recent icons are included.
97-
- `yarn process-spectrum` to process the spectrum CSS style sources into the individual packages.
94+
- `yarn build:clean` to remove previously created artifacts of the `tsc build` process.
95+
- `yarn build:icons` to make sure that the most recent icons are included.
9896
- `yarn build` to make sure the available JS has been built from the current TS source.
9997

10098
## Linting
@@ -105,15 +103,15 @@ The project will be linted on a pre-commit hook, but you can also run the lint s
105103

106104
There are downstream issues that can arise from multiple packages in this mono-repo using dependencies with mismatched version strings. By default, changesets will bump version numbers of internal dependencies when the various packages are published and the depended version is pointing to the latest release, which can help to mitigate this issue. Running `yarn lint:versions` will check that all version strings for each dependency match across the repo.
107105

108-
`yarn list:versions --fix` will modify the `package.json` files, updating all dependencies to the latest version available in the library _a potentially dangerous operation_. If this is what you want to do when `yarn lint:versions` discovers mismatched versions, this step can greatly reduce the amount of work to achieve matching version numbers.
106+
`yarn list:versions --fix` will modify the `package.json` files, updating all dependencies to the latest version available in the library - _a potentially dangerous operation_. If this is what you want to do when `yarn lint:versions` discovers mismatched versions, this step can greatly reduce the amount of work to achieve matching version numbers.
109107

110108
## Testing
111109

112110
### Unit tests
113111

114112
Unit tests are run with [Web Test Runner](https://modern-web.dev/docs/test-runner/overview/) in Playwright using the Chai, Mocha and Sinon helper libraries. These tests can be executed with:
115113

116-
```
114+
```sh
117115
yarn test
118116
```
119117

@@ -127,7 +125,7 @@ Visual regressions are tracked via screenshot testing powered by [`@web/test-run
127125

128126
To create a local baseline for comparing your changes to later in the development cycle, use the following:
129127

130-
```bash
128+
```sh
131129
yarn test:visual:clean # start with a clean slate
132130
# yarn test:visual:clean:baseline # removes only baseline images
133131
# yarn test:visual:clean:current # removes only images updated in the most recent test pass
@@ -203,7 +201,7 @@ For a list of component waiting to be implemented, visit our [`missing component
203201

204202
The build process compiles `.css` files using PostCSS and wraps them in the `lit-html` `css` template tag and writes out a `.css.ts` file for easy import into TypeScript files. This file should not be edited, and is ignored by `.gitignore`, but you may also wish to hide the files in your IDE.
205203

206-
# Contributing
204+
## Contributing
207205

208206
We'd be very grateful if you contributed to the project! Check out our [contribution guidelines](CONTRIBUTING.md) for more information.
209207

package.json

Lines changed: 24 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,32 @@
1010
},
1111
"scripts": {
1212
"analyze": "lit-analyzer \"{packages,tools}/*/src/**/!(*.css).ts\"",
13+
"analyze:docs": "cem analyze --globs \"packages/**/*.ts\" --exclude \"**/*.d.ts\" --exclude \"**/stories/**\" --exclude \"**/icons/**\" --exclude \"**/elements/**\" --outdir projects/documentation --litelement",
14+
"analyze:storybook": "wireit",
1315
"build": "wireit",
14-
"build:clear-cache": "rimraf packages/*/tsconfig.tsbuildinfo && rimraf tools/*/tsconfig.tsbuildinfo",
15-
"build:component-inventory": "node ./tasks/build-component-inventory.js",
16+
"build:clean": "rimraf packages/*/tsconfig.tsbuildinfo tools/*/tsconfig.tsbuildinfo",
1617
"build:confirm": "node ./tasks/confirm-build.js",
1718
"build:css": "wireit",
1819
"build:css:watch": "wireit",
19-
"build:react": "yarn gen-react-wrapper && node ./tasks/build-react.js && yarn tsc --build tsconfig-react-wrapper.json",
20+
"build:icons": "wireit",
21+
"build:react": "node ./tasks/build-react.js && tsc --build tsconfig-react-wrapper.json",
2022
"build:tests": "tsc --build test/tsconfig.json && tsc --build test/tsconfig-node.json",
2123
"build:ts": "wireit",
2224
"build:ts:watch": "wireit",
2325
"build:types": "wireit",
2426
"build:watch": "wireit",
25-
"changeset-snapshot-publish": "yarn prepublishOnly && yarn changeset version --snapshot && yarn lint:versions --fix && yarn update-version && yarn changeset publish --no-git-tag --tag snapshot",
26-
"changeset-publish": "yarn prepublishOnly && yarn changeset version && yarn install && yarn lint:versions --fix && yarn update-version && yarn changeset publish --no-git-tag && yarn push-to-remote && yarn create-git-tag && yarn postpublish",
27-
"update-version": "node ./tasks/update-version.js",
27+
"changeset-publish": "yarn prepublishOnly && yarn changeset version && yarn install && yarn lint:versions --fix && yarn update-version && yarn changeset publish && yarn postpublish",
28+
"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",
2829
"chromatic": "chromatic --build-script-name storybook:build # note that --project-token must be set in your env variables",
29-
"create-git-tag": "node --no-warnings tasks/create-git-tag.js",
30-
"custom-element-json": "node tasks/custom-element-json.js",
31-
"docs:analyze": "cem analyze --globs \"packages/**/*.ts\" --exclude \"**/*.d.ts\" --exclude \"**/stories/**\" --exclude \"**/icons/**\" --exclude \"**/elements/**\" --outdir projects/documentation --litelement",
30+
"custom-element-json": "yarn custom-element-json:clean && node tasks/custom-element-json.js && yarn custom-element-json:validate",
31+
"custom-element-json:clean": "rimraf packages/*/custom-elements.json tools/*/custom-elements.json",
32+
"custom-element-json:validate": "node ./tasks/run-check-cem.js",
3233
"docs:build": "yarn workspace documentation build",
33-
"docs:ci": "yarn docs:analyze && run-p docs:production storybook:build && cp projects/documentation/custom-elements.json projects/documentation/dist/storybook",
34-
"docs:preview": "yarn docs:analyze && run-p docs:build storybook:build && cp projects/documentation/custom-elements.json projects/documentation/dist/storybook",
34+
"docs:ci": "yarn analyze:docs && run-p docs:production storybook:build && cp projects/documentation/custom-elements.json projects/documentation/dist/storybook",
35+
"docs:preview": "yarn analyze:docs && run-p docs:build storybook:build && cp projects/documentation/custom-elements.json projects/documentation/dist/storybook",
3536
"docs:production": "yarn workspace documentation build:production",
3637
"docs:review": "alex packages/**/*.md",
3738
"docs:start": "yarn workspace documentation serve --watch",
38-
"find": "test -f custom-elements.json",
39-
"format:css": "yarn lint:css --fix && pretty-quick --pattern \"{packages,tools}/**/*.css\"",
40-
"gen-react-wrapper": "node ./tasks/gen-react-wrapper.js",
4139
"icons": "wireit",
4240
"icons:ui": "wireit",
4341
"icons:workflow": "wireit",
@@ -48,31 +46,20 @@
4846
"lint:packagejson": "pretty-quick --pattern package.json --pattern \"packages/*/package.json\" --pattern \"projects/*/package.json\" --pattern \"tools/*/package.json\" --pattern \"react/*/package.json\"",
4947
"lint:ts": "pretty-quick --pattern \"packages/**/*.ts\" && eslint -f pretty \"packages/**/*.ts\" && pretty-quick --pattern \"tools/**/*.ts\" && eslint -f pretty \"tools/**/*.ts\"",
5048
"lint:versions": "node ./scripts/lint-versions.js",
51-
"new-package": "cd projects/templates && plop",
52-
"postcustom-element-json": "node ./tasks/run-check-cem.js",
53-
"postdocs:analyze": "node ./scripts/add-custom-properties.js --src=\"projects/documentation/custom-elements.json\"",
49+
"new-package": "yarn workspace swc-templates plop",
5450
"postinstall": "husky || true && patch-package",
51+
"postpack": "pinst --enable",
5552
"postpublish": "yarn prepublish:react && yarn publish:react && yarn postpublish:react",
5653
"postpublish:react": "git reset --hard HEAD^ && git prune && rimraf react",
57-
"precustom-element-json": "node tasks/remove-custom-elements-json.js",
58-
"preeleventy": "yarn docs:analyze",
5954
"prepack": "pinst --disable",
60-
"postpack": "pinst --enable",
55+
"prepublish:react": "yarn build:react && sed -i \"\" \"s/react/# react/g\" .gitignore && git commit -am \"chore: commit React watch\" --no-verify",
6156
"prepublishOnly": "rimraf react && yarn build && yarn custom-element-json && yarn verify-build-artifacts && yarn build:confirm",
62-
"prepublish:react": "yarn build:react && sed -i \"\" \"s/react/# react/g\" .gitignore && git commit -am \"Commit React Wrappers\" --no-verify",
63-
"prestorybook": "wireit",
64-
"prestorybook:build": "cem analyze --outdir storybook/",
6557
"pretest:bench": "yarn build:tests && test -f test/benchmark/cli.js ||:",
66-
"pretest:visual": "yarn build && yarn build",
67-
"process-icons": "wireit",
68-
"process-spectrum": "wireit",
6958
"publish:react": "yarn changeset publish --no-git-tag --tag snapshot --no-push",
7059
"push-to-remote": "git add . && git commit -m \"chore: release new versions #publish\" && git push",
7160
"start": "yarn storybook",
7261
"storybook": "wireit",
7362
"storybook:build": "NODE_ENV=production storybook build -o projects/documentation/dist/storybook -c storybook",
74-
"storybook:quick": "run-p build:watch storybook:run",
75-
"storybook:run": "web-dev-server --config wds-storybook.config.js",
7663
"test": "yarn test:focus unit",
7764
"test:bench": "yarn build:tests && node test/benchmark/cli.js",
7865
"test:changed": "node ./tasks/test-changes.js",
@@ -81,17 +68,15 @@
8168
"test:errors": "yarn test | grep -A 32 ❌",
8269
"test:focus": "yarn build && yarn test:ci --group",
8370
"test:start": "web-test-runner",
84-
"test:visual": "yarn test:visual:ci",
71+
"test:visual": "yarn build && yarn test:visual:ci",
8572
"test:visual:ci": "yarn test:start --group",
8673
"test:visual:clean": "yarn test:visual:clean:baseline && yarn test:visual:clean:current",
8774
"test:visual:clean:baseline": "rimraf test/visual/screenshots-baseline",
8875
"test:visual:clean:current": "rimraf test/visual/screenshots-current",
8976
"test:watch": "yarn test:watch:focus unit",
9077
"test:watch:flags:focus": "yarn build && run-p build:watch \"test:start --watch --group {1} --config web-test-runner.config.ci-chromium-flags.js\" --",
9178
"test:watch:focus": "yarn build && run-p build:watch \"test:start --watch --group {1}\" --",
92-
"update:spectrum-css": "node ./scripts/update-spectrum-css.js --latest || yarn update:spectrum-css:cleanup",
93-
"update:spectrum-css:cleanup": "yarn lint:packagejson && yarn --ignore-scripts && yarn process-spectrum",
94-
"update:spectrum-css:nonbreaking": "node ./scripts/update-spectrum-css.js || yarn update:spectrum-css:cleanup",
79+
"update-version": "node ./tasks/update-version.js",
9580
"verify-build-artifacts": "node ./scripts/verify-build-artifacts.js",
9681
"vrt:preview": "yarn wds --config test/visual/wds-vrt.config.js",
9782
"vrt:quick-link": "yarn netlify deploy --alias=vrt --dir=projects/vrt-quick-link"
@@ -190,7 +175,7 @@
190175
"pretty-bytes": "^6.1.1",
191176
"pretty-quick": "^4.1.1",
192177
"re-template-tag": "^2.0.1",
193-
"rimraf": "^5.0.1",
178+
"rimraf": "^6.0.1",
194179
"rollup": "^4.12.0",
195180
"sinon": "^17.0.1",
196181
"storybook": "^8.6.12",
@@ -212,14 +197,10 @@
212197
},
213198
"build:css": {
214199
"command": "node ./tasks/build-css.js",
215-
"dependencies": [
216-
"process-spectrum"
217-
],
218200
"files": [
219201
"packages/**/*.css",
220202
"tools/**/*.css",
221-
"tasks/build-css.js",
222-
"tasks/css-tools.js"
203+
"tasks/build-css.js"
223204
],
224205
"output": [
225206
"packages/**/*.css.ts",
@@ -234,7 +215,7 @@
234215
"build:ts": {
235216
"command": "node ./tasks/esbuild-packages.js",
236217
"dependencies": [
237-
"process-icons",
218+
"build:icons",
238219
"test:create",
239220
"build:css"
240221
],
@@ -287,7 +268,7 @@
287268
"build:types": {
288269
"command": "tsc --build tsconfig-all.json --pretty",
289270
"dependencies": [
290-
"process-icons",
271+
"build:icons",
291272
"test:create",
292273
"build:css"
293274
],
@@ -368,7 +349,7 @@
368349
],
369350
"clean": "if-file-deleted"
370351
},
371-
"prestorybook": {
352+
"analyze:storybook": {
372353
"command": "cem analyze --outdir storybook/",
373354
"files": [
374355
"packages/**/*.ts",
@@ -378,46 +359,19 @@
378359
"storybook/custom-elements.json"
379360
]
380361
},
381-
"process-icons": {
362+
"build:icons": {
382363
"dependencies": [
383364
"icons",
384365
"icons:ui",
385366
"icons:workflow"
386367
]
387368
},
388-
"process-spectrum": {
389-
"command": "node ./scripts/spectrum-vars.js && node ./tasks/process-spectrum.js && node ./scripts/generate-tokens.js && yarn format:css",
390-
"files": [
391-
"tasks/process-spectrum.js",
392-
"packages/**/spectrum-config.js",
393-
"tools/**/spectrum-config.js",
394-
"node_modules/@spectrum-css/**/index-vars.css",
395-
"scripts/generate-tokens.js",
396-
"scripts/generate-tokens-wrapper.js",
397-
"node_modules/@spectrum-css/**/*.css",
398-
"scripts/spectrum-vars.js",
399-
"tools/styles/package.json",
400-
".prettierrc.yaml",
401-
".stylelintrc.json"
402-
],
403-
"output": [
404-
"packages/*/src/spectrum-*.css",
405-
"tools/*/src/spectrum-*.css",
406-
"tools/styles/*.css",
407-
"tools/styles/express/*.css",
408-
"!tools/styles/scale-*.css",
409-
"!tools/styles/theme-*.css",
410-
"!tools/styles/express/scale-*.css",
411-
"!tools/styles/express/theme-*.css"
412-
],
413-
"clean": false
414-
},
415369
"storybook": {
416370
"command": "storybook dev -p 8080 -c storybook",
417371
"service": true,
418372
"dependencies": [
419373
"build:watch",
420-
"prestorybook"
374+
"analyze:storybook"
421375
]
422376
},
423377
"test:create": {

packages/icons-workflow/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@
6060
"case": "^1.6.1",
6161
"cheerio": "^1.0.0-rc.2",
6262
"fast-glob": "^3.2.12",
63-
"fs": "^0.0.1-security",
64-
"path": "^0.12.7",
6563
"prettier": "^3.0.0"
6664
},
6765
"types": "./src/index.d.ts",

projects/documentation/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@
222222
"../../tools/**/args.js",
223223
"../../tools/**/template.js",
224224
"scripts/gather-wcd-urls.js",
225-
"scripts/gather-spectrum-urls.js",
226225
"scripts/gather-storybook-urls.js",
227226
"scripts/copy-component-docs.js",
228227
"scripts/component-template-parts.js"

0 commit comments

Comments
 (0)