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

Clean package.json before publishing #999

Merged
merged 2 commits into from
Jun 3, 2024
Merged
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
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
"lint:js": "cross-env NODE_ENV=production eslint --fix --cache --cache-location=.cache/eslint --ext .js,.json,.mjs,.ts,.cjs --report-unused-disable-directives",
"lint:package": "sort-package-json",
"release": "yarn run build && auto shipit",
"prepack": "clean-package",
"postpack": "clean-package restore",
"publish-action": "./scripts/publish-action.mjs",
"trace": "./dist/bin.js trace",
"trim-stats": "./dist/bin.js trim-stats-file",
Expand Down Expand Up @@ -143,6 +145,7 @@
"auto": "^11.0.5",
"boxen": "^7.1.1",
"chalk": "^4.1.2",
"clean-package": "^2.2.0",
"cpy": "^8.1.2",
"cross-env": "^7.0.3",
"cross-spawn": "^7.0.2",
Expand Down Expand Up @@ -248,6 +251,16 @@
]
]
},
"clean-package": {
"indent": 2,
"remove": [
"auto",
"clean-package",
"lint-staged",
"packageManager",
"scripts"
]
},
"docs": "https://www.chromatic.com/docs/cli",
"packageManager": "[email protected]",
"storybook": {
Expand Down
2 changes: 2 additions & 0 deletions scripts/publish-action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ const publishAction = async ({ major, version, repo }) => {

const { path, cleanup } = await tmp.dir({ unsafeCleanup: true, prefix: `chromatic-action-` });

await $`yarn clean-package`;
await copy(['action/*.js', 'action/*.json', 'action.yml', 'package.json'], path, {
parents: true, // keep directory structure (i.e. action dir)
});
await copy(['action-src/CHANGELOG.md', 'action-src/LICENSE', 'action-src/README.md'], path);
await $`yarn clean-package restore`;

const $$ = (strings, ...args) => {
console.info(strings.reduce((acc, s, i) => `${acc}${s}${args[i] || ''}`, '🏃 '));
Expand Down
28 changes: 28 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6545,6 +6545,7 @@ __metadata:
auto: "npm:^11.0.5"
boxen: "npm:^7.1.1"
chalk: "npm:^4.1.2"
clean-package: "npm:^2.2.0"
cpy: "npm:^8.1.2"
cross-env: "npm:^7.0.3"
cross-spawn: "npm:^7.0.2"
Expand Down Expand Up @@ -6683,6 +6684,17 @@ __metadata:
languageName: node
linkType: hard

"clean-package@npm:^2.2.0":
version: 2.2.0
resolution: "clean-package@npm:2.2.0"
dependencies:
dot-prop: "npm:^6.0.1"
bin:
clean-package: bin/main.js
checksum: 10c0/014192ddd9ccb48288e934f9b4378ed86c57fdf7b65e38c1a61069e73d79845135d2645142f565ed4ff835a8660fa70387e5cd2a26348253cae699d4d3cedd26
languageName: node
linkType: hard

"clean-stack@npm:^2.0.0":
version: 2.2.0
resolution: "clean-stack@npm:2.2.0"
Expand Down Expand Up @@ -7736,6 +7748,15 @@ __metadata:
languageName: node
linkType: hard

"dot-prop@npm:^6.0.1":
version: 6.0.1
resolution: "dot-prop@npm:6.0.1"
dependencies:
is-obj: "npm:^2.0.0"
checksum: 10c0/30e51ec6408978a6951b21e7bc4938aad01a86f2fdf779efe52330205c6bb8a8ea12f35925c2029d6dc9d1df22f916f32f828ce1e9b259b1371c580541c22b5a
languageName: node
linkType: hard

"dotenv-expand@npm:^10.0.0":
version: 10.0.0
resolution: "dotenv-expand@npm:10.0.0"
Expand Down Expand Up @@ -10673,6 +10694,13 @@ __metadata:
languageName: node
linkType: hard

"is-obj@npm:^2.0.0":
version: 2.0.0
resolution: "is-obj@npm:2.0.0"
checksum: 10c0/85044ed7ba8bd169e2c2af3a178cacb92a97aa75de9569d02efef7f443a824b5e153eba72b9ae3aca6f8ce81955271aa2dc7da67a8b720575d3e38104208cb4e
languageName: node
linkType: hard

"is-observable@npm:^1.1.0":
version: 1.1.0
resolution: "is-observable@npm:1.1.0"
Expand Down
Loading