-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64b18fc
commit 4566ad0
Showing
4 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"branches": [ | ||
"main", | ||
{ | ||
"name": "beta", | ||
"prerelease": true | ||
} | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
"@semantic-release/github", | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": [ | ||
"CHANGELOG.md" | ||
], | ||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" | ||
} | ||
] | ||
], | ||
"tagFormat": "${version}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { build, emptyDir } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { join } from "https://deno.land/[email protected]/path/mod.ts"; | ||
import { makeOptions } from "./meta.ts"; | ||
|
||
async function buildPkg(version: string): Promise<void> { | ||
await emptyDir("./npm"); | ||
const pkg = makeOptions(version); | ||
await Deno.copyFile("LICENSE", join(pkg.outDir, "LICENSE")); | ||
Deno.copyFile( | ||
join(".", "README.md"), | ||
join(pkg.outDir, "README.md"), | ||
); | ||
await build(pkg); | ||
} | ||
|
||
if (import.meta.main) { | ||
const version = Deno.args[0]; | ||
if (!version) { | ||
console.error("argument is required"); | ||
Deno.exit(1); | ||
} | ||
await buildPkg(version); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { BuildOptions } from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
export const makeOptions = (version: string): BuildOptions => ({ | ||
test: false, | ||
shims: {}, | ||
typeCheck: true, | ||
entryPoints: ["./mod.ts"], | ||
outDir: "./npm", | ||
package: { | ||
name: "@miyauci/format", | ||
version, | ||
description: "Formatting and printing string utilities", | ||
keywords: [ | ||
"format", | ||
"fmt", | ||
"formatter", | ||
"print", | ||
"sprintf", | ||
"format-string", | ||
"replace", | ||
"replacement", | ||
"template", | ||
"interpolate", | ||
], | ||
license: "MIT", | ||
homepage: "https://github.com/TomokiMiyauci/format", | ||
repository: { | ||
type: "git", | ||
url: "git+https://github.com/TomokiMiyauci/format.git", | ||
}, | ||
bugs: { | ||
url: "https://github.com/TomokiMiyauci/format/issues", | ||
}, | ||
sideEffects: false, | ||
type: "module", | ||
publishConfig: { | ||
access: "public", | ||
}, | ||
}, | ||
packageManager: "pnpm", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { prerelease, valid } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { makeOptions } from "./meta.ts"; | ||
|
||
if (import.meta.main) { | ||
const version = Deno.args[0]; | ||
if (!version) { | ||
console.error("arg of version is required"); | ||
Deno.exit(1); | ||
} | ||
if (!valid(version)) { | ||
console.error("The argument of version is invalid"); | ||
Deno.exit(1); | ||
} | ||
|
||
const isPrerelease = prerelease(version); | ||
const tag = isPrerelease?.[0] ?? "latest"; | ||
|
||
const pkg = makeOptions(version); | ||
const command = new Deno.Command("npm", { | ||
args: ["publish", pkg.outDir, "--tag", String(tag)], | ||
}); | ||
const result = await command.output(); | ||
|
||
if (!result.success) { | ||
console.error(new TextDecoder().decode(result.stderr)); | ||
} | ||
} |