Skip to content

Commit 359a58c

Browse files
authored
Script/Publish cleanup (#1151)
* nuke script * Move CHANGELOG to spectacle package * Add vscode settings to ignore built files for better search * Build core before examples * Drop webpack build scripts from spectacle * Update example deps * Update package.json * Create .gitignore * Update package.json * Put back in dist/webpack build step * Update package.json * Use shx for x-platform moving, and postpack to cleanup files
1 parent 0700486 commit 359a58c

File tree

11 files changed

+104
-119
lines changed

11 files changed

+104
-119
lines changed

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"search.exclude": {
3+
"**/node_modules": true,
4+
"**/lib": true,
5+
"**/es": true,
6+
"**/dist": true
7+
}
8+
}

examples/js/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"build": "webpack --config ./webpack.config.js"
88
},
99
"dependencies": {
10-
"spectacle": "workspace:spectacle@*",
1110
"react": "^18.1.0",
12-
"react-dom": "^18.1.0"
11+
"react-dom": "^18.1.0",
12+
"spectacle": "workspace:spectacle@*"
1313
},
1414
"devDependencies": {
1515
"@babel/core": "^7.17.2",
@@ -19,8 +19,10 @@
1919
"@babel/preset-react": "^7.16.7",
2020
"@babel/preset-typescript": "^7.16.0",
2121
"babel-loader": "^8.0.6",
22+
"html-webpack-plugin": "^5.5.0",
2223
"rimraf": "^3.0.0",
2324
"webpack": "^5.68.0",
25+
"webpack-cli": "^4.10.0",
2426
"webpack-dev-server": "^4.7.4"
2527
}
2628
}

examples/md/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
"@babel/preset-react": "^7.16.7",
2020
"@babel/preset-typescript": "^7.16.0",
2121
"babel-loader": "^8.0.6",
22+
"html-webpack-plugin": "^5.5.0",
2223
"raw-loader": "^4.0.0",
2324
"rimraf": "^3.0.0",
2425
"typescript": "^4.5.2",
2526
"webpack": "^5.68.0",
27+
"webpack-cli": "^4.10.0",
2628
"webpack-dev-server": "^4.7.4"
2729
}
2830
}

examples/typescript/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
"@babel/preset-react": "^7.16.7",
2020
"@babel/preset-typescript": "^7.16.0",
2121
"babel-loader": "^8.0.6",
22+
"html-webpack-plugin": "^5.5.0",
2223
"rimraf": "^3.0.0",
2324
"typescript": "^4.5.2",
2425
"webpack": "^5.68.0",
26+
"webpack-cli": "^4.10.0",
2527
"webpack-dev-server": "^4.7.4"
2628
}
2729
}

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "spectacle-monorepo",
33
"scripts": {
4-
"start:js": "pnpm run --filter spectacle-example-js start",
5-
"start:ts": "pnpm run --filter spectacle-example-ts start",
6-
"start:md": "pnpm run --filter spectacle-example-md start",
4+
"start:js": "pnpm run build:core && pnpm run --filter spectacle-example-js start",
5+
"start:ts": "pnpm run build:core && pnpm run --filter spectacle-example-ts start",
6+
"start:md": "pnpm run build:core && pnpm run --filter spectacle-example-md start",
77
"start:one-page": "pnpm run --filter spectacle-example-one-page start",
8-
"start:examples": "pnpm run --parallel --filter \"*example*\" start",
8+
"start:examples": "pnpm run build:core && pnpm run --parallel --filter \"*example*\" start",
99
"start:cli": "pnpm run --filter spectacle-cli start",
1010
"lint": "eslint --ext .tsx,.ts,.jsx,.js ./examples ./scripts packages/spectacle/src packages/cli/src",
1111
"lint:fix": "pnpm run lint --fix",
@@ -17,9 +17,11 @@
1717
"check": "pnpm run lint && pnpm run prettier:check && pnpm run test && pnpm run typecheck",
1818
"check-ci": "pnpm run check",
1919
"clean": "pnpm run -r clean",
20+
"flush:deps": "rimraf **/node_modules",
21+
"nuke": "pnpm run -r clean && pnpm run flush:deps",
2022
"build:examples": "pnpm run --filter spectacle build && pnpm run -r --filter \"*example*\" build",
2123
"build:core": "pnpm run --filter spectacle build",
22-
"build": "pnpm run -r build",
24+
"build": "pnpm run build:core && pnpm run build:examples",
2325
"build:one-page": "node ./scripts/one-page.js",
2426
"build:cli": "pnpm run --filter spectacle-cli build",
2527
"changeset": "changeset",
@@ -38,6 +40,7 @@
3840
"eslint-plugin-prettier": "^4.0.0",
3941
"eslint-plugin-react": "^7.27.0",
4042
"eslint-plugin-react-hooks": "^4.3.0",
43+
"rimraf": "^3.0.0",
4144
"prettier": "^2.4.1",
4245
"pretty": "^2.0.0",
4346
"typescript": "^4.5.2"

packages/spectacle/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
README.md
File renamed without changes.

packages/spectacle/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
"files": [
88
"lib/",
99
"es/",
10-
"dist/",
11-
"examples/",
12-
"scripts/",
13-
"../../README.md"
10+
"dist/"
1411
],
1512
"module": "es/index.js",
1613
"scripts": {
@@ -22,11 +19,13 @@
2219
"build-babel-esm": "builder run build-babel -- -d es",
2320
"build-babel-cjs": "builder run --env \"{\\\"BABEL_ENV\\\":\\\"cjs\\\"}\" build-babel -- -d lib",
2421
"build-webpack-base": "webpack",
25-
"build-webpack-lib-dev": "builder run build-webpack-base -- --config ../../webpack.config.dev.js",
22+
"build-webpack-lib-dev": "builder run build-webpack-base -- --config ./webpack.config.dev.js",
2623
"build-webpack-lib": "builder run build-webpack-base",
2724
"build": "builder concurrent --buffer build-babel-esm build-babel-cjs build-webpack-lib build-webpack-lib-dev build-types",
2825
"build-types": "tsc --emitDeclarationOnly",
29-
"typecheck": "tsc --noEmit"
26+
"typecheck": "tsc --noEmit",
27+
"prepublishOnly": "shx cp ../../README.md ./README.md && shx cp ../../LICENSE ./LICENSE && pnpm run build",
28+
"postpack": "shx rm ./README.md && shx rm ./LICENSE"
3029
},
3130
"author": "Formidable Labs <[email protected]>",
3231
"license": "MIT",
@@ -97,6 +96,7 @@
9796
"react": "^18.1.0",
9897
"react-dom": "^18.1.0",
9998
"rimraf": "^3.0.0",
99+
"shx": "^0.3.4",
100100
"ts-jest": "^27.0.7",
101101
"typescript": "^4.5.2",
102102
"webpack": "^5.68.0",

webpack.config.dev.js renamed to packages/spectacle/webpack.config.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const base = require('./packages/spectacle/webpack.config');
1+
const base = require('./webpack.config');
22

33
module.exports = {
44
...base,
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
const path = require('path');
12
const base = require('../../webpack.config.base');
23

3-
module.exports = base;
4+
module.exports = {
5+
...base,
6+
output: {
7+
...base.output,
8+
path: path.join(__dirname, 'dist')
9+
}
10+
};

0 commit comments

Comments
 (0)