Skip to content

Commit

Permalink
Add make auto-publish.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarron committed Jun 5, 2024
1 parent 2b58a0f commit f027966
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 37 deletions.
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@ app-clean:
clean:
rm -rf ./dist && npm run app-clean

.PHONY: roll-cubing-commit
roll-cubing-commit:
./script/roll-cubing-commit.bash

.PHONY: bump-version-to-match-app-template-cubing
bump-version-to-match-app-template-cubing:
bun run ./script/bump-version-to-match-app-template-cubing.ts
.PHONY: auto-publish
auto-publish:
bun run ./script/auto-publish.ts

.PHONY: publish
publish:
Expand Down
87 changes: 87 additions & 0 deletions package-lock.json

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

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@
},
"devDependencies": {
"@biomejs/biome": "^1.8.0",
"@types/bun": "^1.1.3",
"@types/validate-npm-package-name": "^4.0.2",
"barely-a-dev-server": "^0.6.1",
"esbuild": "^0.20.1",
"validate-npm-package-name": "^5.0.0"
},
"files": ["./app-template", "./bin", "./script", "./src", "./tsconfig.json"]
"files": [
"./app-template",
"./bin",
"./script",
"./src",
"./tsconfig.json"
]
}
18 changes: 18 additions & 0 deletions script/auto-publish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { exit } from "node:process";
import { $ } from "bun";

if ((await $`git status --porcelain`).stdout.toString().trim()) {
console.error("git status must be clean.");
exit(1);
}

const version = (await $`npm show cubing version`).stdout.toString().trim();

console.log(new URL(import.meta.resolve("../app-template/")).pathname);
await $`npm install --prefix ${new URL(import.meta.resolve("../app-template/")).pathname} "cubing@v${version}"`;
await $`npm version --no-git-tag-version "v${version}"`;
await $`git commit --all --message "v${version}"`;
await $`git push`;
await $`git tag "v${version}"`;
await $`git push origin "v${version}"`;
await $`npm publish`;
9 changes: 0 additions & 9 deletions script/bump-version-to-match-app-template-cubing.ts

This file was deleted.

20 changes: 0 additions & 20 deletions script/roll-cubing-commit.bash

This file was deleted.

0 comments on commit f027966

Please sign in to comment.