Skip to content

Commit aa29902

Browse files
authored
Merge pull request #32564 from storybookjs/svelte-ecosystem-ci
Svelte: Add scripts for ecosystem CI
2 parents df23220 + 60a567c commit aa29902

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@
33
"scripts": {
44
"ci-tests": "cd code; yarn ci-tests",
55
"get-report-message": "cd scripts; yarn get-report-message",
6-
"get-template": "cd scripts; yarn get-template",
76
"get-sandbox-dir": "cd scripts; yarn get-sandbox-dir",
7+
"get-template": "cd scripts; yarn get-template",
88
"i": "yarn --cwd scripts && yarn --cwd code",
99
"knip": "cd code; yarn knip",
1010
"lint": "cd code; yarn lint",
1111
"nx": "cd code; yarn nx",
1212
"pretty-docs": "cd scripts; yarn install >/dev/null; yarn docs:prettier:write",
1313
"start": "yarn task --task dev --template react-vite/default-ts --start-from=install",
14+
"svelte-ecosystem-ci:before-test": "node ./scripts/ecosystem-ci/before-test.js svelte-kit/skeleton-ts && cd ./sandbox/svelte-kit-skeleton-ts && yarn install",
15+
"svelte-ecosystem-ci:build": "yarn task --task install && yarn --cwd code build svelte && yarn task --task sandbox --template svelte-kit/skeleton-ts --start-from=compile --no-link --skip-cache",
16+
"svelte-ecosystem-ci:test": "yarn task --task test-runner --template svelte-kit/skeleton-ts --start-from=build --no-link --skip-cache && yarn task --task vitest-integration --template svelte-kit/skeleton-ts --start-from vitest-integration --no-link --skip-cache",
1417
"task": "echo 'Installing Script Dependencies...'; cd scripts; yarn install >/dev/null; cd ..; yarn --cwd=./scripts task",
1518
"test": "cd code; yarn test",
1619
"test:watch": "cd code; yarn test:watch",
1720
"upload-bench": "cd scripts; yarn upload-bench",
18-
"vite-ecosystem-ci:before-test": "node ./scripts/vite-ecosystem-ci/before-test.js && cd ./sandbox/react-vite-default-ts && yarn install",
19-
"vite-ecosystem-ci:build": "yarn task --task sandbox --template react-vite/default-ts --start-from=install",
21+
"vite-ecosystem-ci:before-test": "node ./scripts/ecosystem-ci/before-test.js react-vite/default-ts && cd ./sandbox/react-vite-default-ts && yarn install",
22+
"vite-ecosystem-ci:build": "yarn task --task sandbox --template react-vite/default-ts --start-from=install --skip-cache",
2023
"vite-ecosystem-ci:test": "yarn task --task test-runner-dev --template react-vite/default-ts --start-from=dev && yarn task --task test-runner --template react-vite/default-ts --start-from=build && yarn task --task vitest-integration --template react-vite/default-ts --start-from vitest-integration"
2124
},
2225
"packageManager": "[email protected]",

scripts/vite-ecosystem-ci/before-test.js renamed to scripts/ecosystem-ci/before-test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ import { execaCommand } from 'execa';
1414
const filename = fileURLToPath(import.meta.url);
1515
const __dirname = dirname(filename);
1616

17+
const sandbox = process.argv[2] ?? 'react-vite/default-ts';
18+
1719
const rootPackageJsonPath = resolve(__dirname, '../../package.json');
1820
const sandboxPackageJsonPath = resolve(
1921
__dirname,
20-
'../../sandbox/react-vite-default-ts/package.json'
22+
`../../sandbox/${sandbox.replace('/', '-')}/package.json`
2123
);
2224

2325
const rootPackageJson = JSON.parse(await readFile(rootPackageJsonPath, 'utf-8'));
@@ -29,7 +31,7 @@ sandboxPackageJson.resolutions = {
2931
};
3032

3133
await writeFile(sandboxPackageJsonPath, JSON.stringify(sandboxPackageJson, null, 2));
32-
const sandboxFolder = dirname(sandboxPackageJsonPath);
34+
const sandboxDir = dirname(sandboxPackageJsonPath);
3335

34-
await execaCommand('yarn add playwright', { cwd: sandboxFolder, shell: true });
35-
await execaCommand('yarn playwright install', { cwd: sandboxFolder, shell: true });
36+
await execaCommand('yarn add playwright', { cwd: sandboxDir, shell: true });
37+
await execaCommand('yarn playwright install', { cwd: sandboxDir, shell: true });

0 commit comments

Comments
 (0)