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

chore: publish project to jsr registry #58

Merged
merged 3 commits into from
May 25, 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
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ jobs:
release:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -47,8 +51,11 @@ jobs:
run: |
pnpm build

- name: Publish package
- name: Publish npm package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm publish

- name: Publish jsr package
run: npx jsr publish --allow-slow-types
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Commands:
--inspect-version If set, fork-version will print the current project version and exit.

Options:
--file, -F List of the files to be updated. [Default: ["bower.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]]
--file, -F List of the files to be updated. [Default: ["bower.json", "deno.json", "jsr.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]]
--glob, -G Glob pattern to match files to be updated.
--path, -P The path fork-version will run from. [Default: process.cwd()]
--changelog Name of the changelog file. [Default: "CHANGELOG.md"]
Expand Down Expand Up @@ -262,6 +262,8 @@ By default Fork-Version will attempt to read versions from and update these file
- "package.json"
- "package-lock.json"
- "npm-shrinkwrap.json"
- "jsr.json"
- "deno.json"
- "manifest.json"
- "bower.json"

Expand Down
19 changes: 19 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@eglavin/fork-version",
"version": "1.4.83",
"exports": {
".": "./src/index.ts",
"./cli": "./src/cli.ts"
},
"publish": {
"include": [
"LICENSE",
"README.md",
"CHANGELOG.md",
"src/**/*"
],
"exclude": [
"**/__tests__/**"
]
}
}
2 changes: 1 addition & 1 deletion src/config/cli-arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Commands:
--inspect-version If set, fork-version will print the current project version and exit.

Options:
--file, -F List of the files to be updated. [Default: ["bower.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]]
--file, -F List of the files to be updated. [Default: ["bower.json", "deno.json", "jsr.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]]
--glob, -G Glob pattern to match files to be updated.
--path, -P The path fork-version will run from. [Default: process.cwd()]
--changelog Name of the changelog file. [Default: "CHANGELOG.md"]
Expand Down
2 changes: 2 additions & 0 deletions src/config/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const DEFAULT_CONFIG: ForkConfig = {
"package.json",
"package-lock.json",
"npm-shrinkwrap.json",
"jsr.json",
"deno.json",
"manifest.json", // Chrome extensions
"bower.json",
],
Expand Down
2 changes: 1 addition & 1 deletion src/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const ForkConfigSchema = z.object({
* List of the files to be updated.
* @default
* ```js
* ["bower.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]
* ["bower.json", "deno.json", "jsr.json", "manifest.json", "npm-shrinkwrap.json", "package-lock.json", "package.json"]
* ```
*/
files: z.array(z.string()).describe("List of the files to be updated."),
Expand Down
8 changes: 4 additions & 4 deletions src/utils/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ export class Git {
this.currentBranch = this.currentBranch.bind(this);
}

public add(...args: (string | undefined)[]) {
public add(...args: (string | undefined)[]): Promise<string> {
if (this.config.dryRun) {
return Promise.resolve("");
}

return this.execGit("add", args.filter(Boolean) as string[]);
}

public commit(...args: (string | undefined)[]) {
public commit(...args: (string | undefined)[]): Promise<string> {
if (this.config.dryRun) {
return Promise.resolve("");
}

return this.execGit("commit", args.filter(Boolean) as string[]);
}

public tag(...args: (string | undefined)[]) {
public tag(...args: (string | undefined)[]): Promise<string> {
if (this.config.dryRun) {
return Promise.resolve("");
}

return this.execGit("tag", args.filter(Boolean) as string[]);
}

public async currentBranch() {
public async currentBranch(): Promise<string> {
return (await this.execGit("rev-parse", ["--abbrev-ref", "HEAD"])).trim();
}

Expand Down
Loading