From c9cdb9f60b6a366bb58146b4783e003131a11285 Mon Sep 17 00:00:00 2001 From: Orion Kindel Date: Mon, 10 Jun 2024 11:40:57 -0500 Subject: [PATCH] fix: prep for publish --- README.md | 2 ++ bun/prepare.js | 34 ++++++++++++++++++++++++++++++++++ spago.yaml | 6 ++++++ 3 files changed, 42 insertions(+) create mode 100644 README.md create mode 100644 bun/prepare.js diff --git a/README.md b/README.md new file mode 100644 index 0000000..763022b --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# url-immutable +Type-safe immutable bindings to the `URL` web / node api. diff --git a/bun/prepare.js b/bun/prepare.js new file mode 100644 index 0000000..db46bed --- /dev/null +++ b/bun/prepare.js @@ -0,0 +1,34 @@ +import { readFile, writeFile } from "fs/promises"; +import { execSync } from "child_process"; + +let ver = process.argv[2]; +if (!ver) { + console.error(`tag required: bun bun/prepare.js v1.0.0`); + process.exit(1); +} else if (!/v\d+\.\d+\.\d+/.test(ver)) { + console.error(`invalid tag: ${ver}`); + process.exit(1); +} + +ver = (/\d+\.\d+\.\d+/.exec(ver) || [])[0] || ""; + +const pkg = await readFile("./package.json", "utf8"); +const pkgnew = pkg.replace(/"version": ".+"/, `"version": "v${ver}"`); +await writeFile("./package.json", pkgnew); + +const spago = await readFile("./spago.yaml", "utf8"); +const spagonew = spago.replace(/version: .+/, `version: '${ver}'`); +await writeFile("./spago.yaml", spagonew); + +const readme = await readFile("./README.md", "utf8"); +const readmenew = readme.replace( + /packages\/purescript-url-immutable\/.+?\//g, + `/packages/purescript-url-immutable/${ver}/`, +); +await writeFile("./README.md", readmenew); + +execSync(`git add spago.yaml package.json README.md`); +execSync(`git commit -m 'chore: prepare v${ver}'`); +execSync(`git tag v${ver}`); +execSync(`git push --tags`); +execSync(`git push --mirror github-mirror`); diff --git a/spago.yaml b/spago.yaml index 64909c7..2a34a20 100644 --- a/spago.yaml +++ b/spago.yaml @@ -2,6 +2,12 @@ package: build: strict: true pedanticPackages: true + publish: + version: '0.0.0' + license: 'GPL-3.0-or-later' + location: + githubOwner: 'cakekindel' + githubRepo: 'purescript-url-immutable' name: url-immutable test: main: Test.Main