Skip to content

Commit

Permalink
Use custom build script to temporarily bump version and build
Browse files Browse the repository at this point in the history
  • Loading branch information
codykaup committed Oct 4, 2024
1 parent 4271453 commit 035c9b7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"lint": "yarn lint:js bin-src node-src test-stories ./isChromatic.js ./isChromatic.mjs",
"lint:js": "cross-env NODE_ENV=production eslint --cache --cache-location=.cache/eslint --report-unused-disable-directives",
"lint:package": "sort-package-json",
"release": "yarn run build && auto shipit",
"release": "./scripts/versionAndBuild.mjs && auto shipit",
"prepack": "clean-package",
"postpack": "clean-package restore",
"publish-action": "./scripts/publish-action.mjs",
Expand Down
26 changes: 26 additions & 0 deletions scripts/versionAndBuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env node

import { $ } from 'execa';

async function main() {
const { stdout: status } = await $`git status --porcelain`;
if (status) {
console.error(`❗️ Working directory is not clean:\n${status}`);
return;
}

const { stdout: nextVersion } = await $`auto shipit --dry-run --quiet`;

console.info(`📌 Temporarily bumping version to '${nextVersion}' for build step`);
await $`npm --no-git-tag-version version ${nextVersion}`;

console.info('📦 Building with new version');
await $`yarn build`;

console.info('🧹 Resetting changes to let `auto` do its thing');
await $`git reset --hard`;

console.info('✅ Build with new version completed');
}

main();

0 comments on commit 035c9b7

Please sign in to comment.