Skip to content
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

Granular clean commands, build commands, util for using workspace package in examples #1695

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,32 @@
},
"private": true,
"scripts": {
"bump": "node scripts/bump.js",

"build": "pnpm run packages:build",
"build:all": "pnpm run packages:build && pnpm run examples:build && pnpm run docs:build",

"clean": "pnpm run clean:all",
"clean:root": "rimraf node_modules",
"clean:all": "rimraf ./node_modules ./*/**/node_modules",
"clean:all": "pnpm run examples:clean && pnpm run packages:clean && pnpm run clean:root",
"clean:root": "pnpx rimraf ./node_modules ./.vinxi/ ./.output/",

"docs:dev": "pnpm --filter solid-start-docs dev",
"docs:build": "pnpm --filter solid-start-docs build",
"docs:start": "pnpm --filter solid-start-docs start",
"docs:clean": "pnpx rimraf ./docs/node_modules ./docs/.vinxi/ ./docs/.output/",
"clean:test": "rimraf .tmp",
"build": "pnpm --filter @solidjs/start build",
"build:all": "pnpm run build && pnpm --filter './examples/*' --if-present build",

"examples:build": "pnpm --filter './examples/*' --if-present build",
"examples:clean": "pnpx rimraf ./examples/*/node_modules/ ./examples/*/.vinxi/ ./examples/*/.output/",
"examples:use-workspace-package": "node ./util/use-workspace-package-in-examples.js",

"packages:build": "pnpm --filter @solidjs/start build",
"packages:clean": "pnpx rimraf ./packages/*/node_modules/ ./packages/*/dist/",

"install:playwright": "pnpm --filter solid-start-tests run install:playwright",
"clean:test": "pnpx rimraf .tmp",
"test:all": "pnpm run clean:test && cross-env START_ADAPTER=solid-start-node npm run test",
"test": "pnpm run clean:test && pnpm --filter solid-start-tests test --",
"show:test-report": "pnpm --filter solid-start-tests show:test-report",
"bump": "node scripts/bump.js"
"show:test-report": "pnpm --filter solid-start-tests show:test-report"
},
"devDependencies": {
"@changesets/cli": "^2.25.2",
Expand All @@ -34,7 +45,6 @@
"coveralls": "^3.1.1",
"debug": "^4.3.4",
"graphql": "^16.7.1",
"rimraf": "^3.0.2",
"tinyglobby": "^0.2.2",
"tippy.js": "^6.3.7",
"turbo": "^1.10.7",
Expand Down
67 changes: 9 additions & 58 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions util/use-workspace-package-in-examples.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const examplesDir = join(__dirname, '../examples');

// Get all directories in examples folder
const examples = readdirSync(examplesDir)
.filter(file => statSync(join(examplesDir, file)).isDirectory());

// Process each example's package.json
examples.forEach(example => {
const packagePath = join(examplesDir, example, 'package.json');

if (existsSync(packagePath)) {
const packageJson = JSON.parse(readFileSync(packagePath, 'utf8'));

if (packageJson.dependencies && packageJson.dependencies['@solidjs/start']) {
packageJson.dependencies['@solidjs/start'] = 'workspace:*';

writeFileSync(
packagePath,
JSON.stringify(packageJson, null, 2) + '\n',
'utf8'
);

console.log(`Updated ${packagePath}`);
}
}
});

Loading