Skip to content

Commit 202d403

Browse files
authored
chore: move tasks into scripts [swc-854] (#5476)
* chore: move tasks into scripts [swc-854] * chore: update custom element manifest scripts to simpify
1 parent be1ad7f commit 202d403

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+739
-2060
lines changed

.eslintrc.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,16 @@
7979
],
8080
"overrides": [
8181
{
82-
"files": ["tasks/*", "scripts/*"],
82+
"files": ["scripts/*"],
8383
"rules": {
8484
"no-console": ["off"]
8585
}
86+
},
87+
{
88+
"files": ["react/**/*.ts"],
89+
"rules": {
90+
"@typescript-eslint/no-explicit-any": "off"
91+
}
8692
}
8793
]
8894
}

.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
File renamed without changes.

tasks/build-tachometer-comment.js renamed to .github/scripts/build-tachometer-comment.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ OF ANY KIND, either express or implied. See the License for the specific languag
1111
governing permissions and limitations under the License.
1212
*/
1313

14-
import fg from 'fast-glob';
1514
import fs from 'fs';
15+
16+
import fg from 'fast-glob';
1617
import prettyBytes from 'pretty-bytes';
1718

1819
const getTachometerResults = () => {
@@ -156,7 +157,7 @@ export const buildTachometerComment = () => {
156157
const firefoxTables = results.firefox.map(buildTable);
157158
const chromeBody = chromeTables.length
158159
? chromeTables.join(`
159-
160+
160161
`)
161162
: 'Currently, no packages are changed by this PR...';
162163
const firefoxBody = firefoxTables.length

.github/workflows/browser-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
uses: actions/github-script@v7
9494
with:
9595
script: |
96-
const { buildTachometerComment } = await import('${{ github.workspace }}/tasks/build-tachometer-comment.js');
96+
const { buildTachometerComment } = await import('${{ github.workspace }}/.github/scripts/build-tachometer-comment.js');
97+
const { commentOrUpdate } = await import('${{ github.workspace }}/.github/scripts/comment-or-update.js');
9798
const body = buildTachometerComment();
98-
const { commentOrUpdate } = await import('${{ github.workspace }}/tasks/comment-or-update.js');
9999
commentOrUpdate(github, context, '## Tachometer results', body);

.github/workflows/preview-release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2828
run: |
2929
yarn changeset version --snapshot preview-${GITHUB_SHA::8}
30-
yarn constraints --fix
3130
yarn update-version
3231
3332
- name: Configure NPM for changeset publish

.github/workflows/urls-smoke-test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ jobs:
3939
uses: actions/github-script@v7
4040
with:
4141
script: |
42-
const { buildPreviewURLComment } = await import('${{ github.workspace }}/tasks/build-preview-urls-comment.js');
42+
const { buildPreviewURLComment, getDocPreviewURL } = await import('${{ github.workspace }}/.github/scripts/build-preview-urls-comment.js');
43+
const { commentOrUpdate } = await import('${{ github.workspace }}/.github/scripts/comment-or-update.js');
4344
const body = buildPreviewURLComment(process.env.GITHUB_HEAD_REF);
44-
const { getDocPreviewURL } = await import('${{ github.workspace }}/tasks/build-preview-urls-comment.js');
45-
const { commentOrUpdate } = await import('${{ github.workspace }}/tasks/comment-or-update.js');
4645
commentOrUpdate(github, context, '## Branch preview', body);
4746
4847
playwright-smoke-tests:

RELEASE_PROCESS.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
Users with permissions in the `@spectrum-web-components` organization on NPM can follow these steps to create and publish a new version.
44

5-
- [Prerequisites](#prerequisites)
6-
- [Main successfully builds](#main-successfully-builds)
7-
- [The correct version of Node is installed](#the-correct-version-of-node-is-installed)
8-
- [Using Node Version Manager](#using-node-version-manager)
9-
- [Manually checking](#manually-checking)
10-
- [Troubleshooting](#troubleshooting)
11-
- [Github Token is set up](#github-token-is-set-up)
12-
- [Generate a Github token](#generate-a-github-token)
13-
- [Logged in to NPM](#logged-in-to-npm)
14-
- [NPM 2FA authenticator app](#npm-2fa-authenticator-app)
15-
- [Releasing to NPM — the good stuff](#releasing-to-npm--the-good-stuff)
16-
- [Troubleshooting](#troubleshooting-1)
17-
- [Publishing the documentation site manually](#publishing-the-documentation-site-manually)
18-
- [From GitHub](#from-github)
19-
- [From the terminal](#from-the-terminal)
20-
- [References](#references)
5+
- [Prerequisites](#prerequisites)
6+
- [Main successfully builds](#main-successfully-builds)
7+
- [The correct version of Node is installed](#the-correct-version-of-node-is-installed)
8+
- [Using Node Version Manager](#using-node-version-manager)
9+
- [Manually checking](#manually-checking)
10+
- [Troubleshooting](#troubleshooting)
11+
- [Github Token is set up](#github-token-is-set-up)
12+
- [Generate a Github token](#generate-a-github-token)
13+
- [Logged in to NPM](#logged-in-to-npm)
14+
- [NPM 2FA authenticator app](#npm-2fa-authenticator-app)
15+
- [Releasing to NPM — the good stuff](#releasing-to-npm--the-good-stuff)
16+
- [Troubleshooting](#troubleshooting-1)
17+
- [Publishing the documentation site manually](#publishing-the-documentation-site-manually)
18+
- [From GitHub](#from-github)
19+
- [From the terminal](#from-the-terminal)
20+
- [References](#references)
2121

2222
## Prerequisites
2323

@@ -94,22 +94,22 @@ If not logged in, run `npm login` to sign in to your account.
9494
1. In your IDE search `': major` , `': minor`, `': patch` , based on the results in the order of this search list, the highest level takes precedence
9595
1. exclude files: `.changeset/README.md`
9696
4. Open your authenticator app to have it ready
97-
5. Run`yarn changeset-publish`
97+
5. Run`yarn publish:changeset`
9898
6. Enter the one-time password from your authenticator for NPM.
9999
1. Wait for a fresh password; a stale timer might cause issues.
100100
7. After the SWC packages are released, the React Wrapper packages will be generated.
101101
1. This multi-phase approach ensures that the wrapped packages share the same version as the standard packages.
102102
8. Enter a new one-time password from your authenticator for NPM.
103-
9. The `yarn changeset-publish` command will automatically commit the changes to main with a commit message of `chore: release new versions #publish`
103+
9. The `yarn publish:changeset` command will automatically commit the changes to main with a commit message of `chore: release new versions #publish`
104104
1. The docs site will publish automatically if the `#publish` string is included in the commit message and the check suite runs successfully.
105105
10. Confirm the build on `main` passes
106106

107107
### Troubleshooting
108108

109109
If publishing fails with an error:
110110

111-
- Check the [list of tags](https://github.com/adobe/spectrum-web-components/tags) to see if new tags have been released for your publishing attempt.
112-
- If they were, run `yarn changeset-publish` again.
111+
- Check the [list of tags](https://github.com/adobe/spectrum-web-components/tags) to see if new tags have been released for your publishing attempt.
112+
- If they were, run `yarn publish:changeset` again.
113113

114114
---
115115

cem-react-wrapper.config.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ OF ANY KIND, either express or implied. See the License for the specific languag
1010
governing permissions and limitations under the License.
1111
*/
1212

13-
import reactWrapperPlugin from './scripts/cem-plugin-react-wrapper.js';
14-
import defineElementPlugin from './scripts/define-element-plugin.js';
1513
import { readFileSync } from 'fs';
16-
import { resolve } from 'path';
14+
import { dirname, join } from 'path';
15+
import { fileURLToPath } from 'url';
16+
1717
import yaml from 'js-yaml';
1818

19+
import defineElementPlugin from './scripts/define-element-plugin.js';
20+
import reactWrapperPlugin from './scripts/cem-plugin-react-wrapper.js';
21+
22+
const __dirname = dirname(fileURLToPath(import.meta.url));
23+
1924
export default {
2025
globs: ['**/sp-*.ts', '**/overlay-trigger.ts', '**/src/[A-Z]*.ts'],
2126
exclude: [
@@ -26,16 +31,15 @@ export default {
2631
'node_modules/*',
2732
'**/*.dev.*',
2833
],
29-
outdir: '.',
3034
litelement: true,
3135
packagejson: false,
3236
plugins: [
3337
defineElementPlugin(),
3438
reactWrapperPlugin({
3539
exclude: ['StoryDecorator', 'TooltipOpenable'],
36-
outDir: '../../react',
40+
outDir: join(__dirname, 'react'),
3741
prettierConfig: yaml.load(
38-
readFileSync(resolve('../../.prettierrc.yaml'))
42+
readFileSync(join(__dirname, '.prettierrc.yaml'))
3943
),
4044
}),
4145
],

0 commit comments

Comments
 (0)