Skip to content

Commit 4980931

Browse files
committed
improve package maintenance scripts
1 parent eec48d4 commit 4980931

File tree

3 files changed

+55
-14
lines changed

3 files changed

+55
-14
lines changed

package.json

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,32 @@
1111
},
1212
"private": true,
1313
"scripts": {
14+
"bump": "node scripts/bump.js",
15+
16+
"build": "pnpm run packages:build",
17+
"build:all": "pnpm run packages:build && pnpm run examples:build && pnpm run docs:build",
18+
1419
"clean": "pnpm run clean:all",
15-
"clean:root": "rimraf node_modules",
16-
"clean:all": "rimraf ./node_modules ./*/**/node_modules",
17-
"docs:dev": "pnpm --filter solid-start-docs dev",
18-
"docs:build": "pnpm --filter solid-start-docs build",
19-
"docs:start": "pnpm --filter solid-start-docs start",
20+
"clean:all": "pnpm run examples:clean && pnpm run packages:clean && pnpm run clean:root",
21+
"clean:root": "pnpx rimraf ./node_modules ./.vinxi/ ./.output/",
22+
23+
"docs:dev": "vinxi dev",
24+
"docs:build": "vinxi build",
25+
"docs:start": "node ./.output/server/index.mjs",
2026
"docs:clean": "pnpx rimraf ./docs/node_modules ./docs/.vinxi/ ./docs/.output/",
21-
"clean:test": "rimraf .tmp",
22-
"build": "pnpm --filter @solidjs/start build",
23-
"build:all": "pnpm run build && pnpm --filter './examples/*' --if-present build",
27+
28+
"examples:build": "pnpm --filter './examples/*' --if-present build",
29+
"examples:clean": "pnpx rimraf ./examples/*/node_modules/ ./examples/*/.vinxi/ ./examples/*/.output/",
30+
"examples:use-workspace-package": "node ./util/use-workspace-package-in-examples.js",
31+
32+
"packages:build": "pnpm --filter @solidjs/start build",
33+
"packages:clean": "pnpx rimraf ./packages/*/node_modules/ ./packages/*/dist/",
34+
2435
"install:playwright": "pnpm --filter solid-start-tests run install:playwright",
36+
"clean:test": "pnpx rimraf .tmp",
2537
"test:all": "pnpm run clean:test && cross-env START_ADAPTER=solid-start-node npm run test",
2638
"test": "pnpm run clean:test && pnpm --filter solid-start-tests test --",
27-
"show:test-report": "pnpm --filter solid-start-tests show:test-report",
28-
"bump": "node scripts/bump.js"
39+
"show:test-report": "pnpm --filter solid-start-tests show:test-report"
2940
},
3041
"devDependencies": {
3142
"@changesets/cli": "^2.25.2",
@@ -34,7 +45,6 @@
3445
"coveralls": "^3.1.1",
3546
"debug": "^4.3.4",
3647
"graphql": "^16.7.1",
37-
"rimraf": "^3.0.2",
3848
"tinyglobby": "^0.2.2",
3949
"tippy.js": "^6.3.7",
4050
"turbo": "^1.10.7",

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from 'fs';
2+
import { dirname, join } from 'path';
3+
import { fileURLToPath } from 'url';
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
7+
8+
const examplesDir = join(__dirname, '../examples');
9+
10+
// Get all directories in examples folder
11+
const examples = readdirSync(examplesDir)
12+
.filter(file => statSync(join(examplesDir, file)).isDirectory());
13+
14+
// Process each example's package.json
15+
examples.forEach(example => {
16+
const packagePath = join(examplesDir, example, 'package.json');
17+
18+
if (existsSync(packagePath)) {
19+
const packageJson = JSON.parse(readFileSync(packagePath, 'utf8'));
20+
21+
if (packageJson.dependencies && packageJson.dependencies['@solidjs/start']) {
22+
packageJson.dependencies['@solidjs/start'] = 'workspace:*';
23+
24+
writeFileSync(
25+
packagePath,
26+
JSON.stringify(packageJson, null, 2) + '\n',
27+
'utf8'
28+
);
29+
30+
console.log(`Updated ${packagePath}`);
31+
}
32+
}
33+
});
34+

0 commit comments

Comments
 (0)