semantic-release-pub 0.10.9 → 0.10.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![GitHub Actions](https://github.com/zeshuaro/semantic-release-pub/actions/workflows/github-actions.yml/badge.svg)](https://github.com/zeshuaro/semantic-release-pub/actions/workflows/github-actions.yml)
6
6
  [![codecov](https://codecov.io/github/zeshuaro/semantic-release-pub/graph/badge.svg?token=P40ZNZNXG2)](https://codecov.io/github/zeshuaro/semantic-release-pub)
7
7
  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/2694cc48a8dd416798eaab232948090a)](https://app.codacy.com/gh/zeshuaro/semantic-release-pub/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
8
- [![Code Style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
8
+ [![Checked with Biome](https://img.shields.io/badge/Checked_with-Biome-60a5fa?style=flat&logo=biome)](https://biomejs.dev)
9
9
 
10
10
  [![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/zeshuaro)
11
11
  [![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/zeshuaro)
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { verifyConditions } from "./verifyConditions.js";
2
1
  export { prepare } from "./prepare.js";
3
2
  export { publish } from "./publish.js";
3
+ export { verifyConditions } from "./verifyConditions.js";
package/dist/prepare.js CHANGED
@@ -1,5 +1,5 @@
1
+ import { writeFileSync } from "node:fs";
1
2
  import SemanticReleaseError from "@semantic-release/error";
2
- import { writeFileSync } from "fs";
3
3
  import { PUBSPEC_PATH, getConfig, getPubspecFromString, getPubspecString, } from "./utils.js";
4
4
  export const prepare = async (pluginConfig, { nextRelease: { version }, logger }) => {
5
5
  const { updateBuildNumber } = getConfig(pluginConfig);
@@ -10,7 +10,7 @@ export const prepare = async (pluginConfig, { nextRelease: { version }, logger }
10
10
  if (updateBuildNumber) {
11
11
  const parts = pubspec.version.split("+");
12
12
  const buildNumber = parts.length > 1 ? Number(parts[1]) : 0;
13
- if (isNaN(buildNumber)) {
13
+ if (Number.isNaN(buildNumber)) {
14
14
  throw new SemanticReleaseError(`Invalid build number: ${buildNumber} in ${pubspec.version}`);
15
15
  }
16
16
  nextVersion = `${version}+${buildNumber + 1}`;
package/dist/publish.js CHANGED
@@ -1,3 +1,4 @@
1
+ import SemanticReleaseError from "@semantic-release/error";
1
2
  import { execa } from "execa";
2
3
  import { getConfig, getGithubIdentityToken, getGoogleIdentityToken, getPubspec, } from "./utils.js";
3
4
  const SEMANTIC_RELEASE_PUB_TOKEN = "SEMANTIC_RELEASE_PUB_TOKEN";
@@ -25,6 +26,9 @@ const getPubToken = async (useGithubOidc, logger) => {
25
26
  }
26
27
  logger.log("Using Google identity token to publish to pub.dev");
27
28
  const { GOOGLE_SERVICE_ACCOUNT_KEY } = process.env;
29
+ if (!GOOGLE_SERVICE_ACCOUNT_KEY) {
30
+ throw new SemanticReleaseError("Environment variable not found: GOOGLE_SERVICE_ACCOUNT_KEY");
31
+ }
28
32
  return await getGoogleIdentityToken(GOOGLE_SERVICE_ACCOUNT_KEY);
29
33
  };
30
34
  const setPubToken = async (cli, idToken) => {
package/dist/utils.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { readFileSync } from "node:fs";
1
2
  import core from "@actions/core";
2
3
  import SemanticReleaseError from "@semantic-release/error";
3
- import { readFileSync } from "fs";
4
4
  import { JWT } from "google-auth-library";
5
5
  import { parse } from "yaml";
6
6
  import { Pubspec, ServiceAccount } from "./schemas.js";
@@ -17,7 +17,11 @@ export const getConfig = (config) => {
17
17
  };
18
18
  export const getGoogleIdentityToken = async (serviceAccountStr) => {
19
19
  const serviceAccountJson = getServiceAccount(serviceAccountStr);
20
- const jwtClient = new JWT(serviceAccountJson.client_email, undefined, serviceAccountJson.private_key, PUB_DEV_AUDIENCE);
20
+ const jwtClient = new JWT({
21
+ email: serviceAccountJson.client_email,
22
+ key: serviceAccountJson.private_key,
23
+ scopes: PUB_DEV_AUDIENCE,
24
+ });
21
25
  const creds = await jwtClient.authorize();
22
26
  if (!creds.id_token) {
23
27
  throw new SemanticReleaseError("Failed to retrieve identity token from Google");
@@ -25,9 +25,7 @@ const verifyPublishToken = async (useGithubOidc) => {
25
25
  if (!GOOGLE_SERVICE_ACCOUNT_KEY) {
26
26
  throw new SemanticReleaseError("Environment variable not found: GOOGLE_SERVICE_ACCOUNT_KEY");
27
27
  }
28
- else {
29
- await getGoogleIdentityToken(GOOGLE_SERVICE_ACCOUNT_KEY);
30
- }
28
+ await getGoogleIdentityToken(GOOGLE_SERVICE_ACCOUNT_KEY);
31
29
  }
32
30
  };
33
31
  const verifyCommand = async (command) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semantic-release-pub",
3
- "version": "0.10.9",
3
+ "version": "0.10.11",
4
4
  "description": "semantic-release plugin to publish a Dart or Flutter package",
5
5
  "main": "dist/index.js",
6
6
  "author": "zeshuaro@gmail.com",
@@ -25,8 +25,8 @@
25
25
  "scripts": {
26
26
  "build": "tsc",
27
27
  "test": "vitest run tests --coverage",
28
- "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .ts src tests && prettier --check src/**/*.ts tests/**/*.ts",
29
- "format": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .ts --fix src tests && prettier --write src/**/*.ts tests/**/*.ts"
28
+ "lint": "biome check src tests && tsc --noEmit && tsc -p tsconfig.test.json",
29
+ "lint:write": "biome check src tests --write"
30
30
  },
31
31
  "engines": {
32
32
  "node": ">=22.16.0"
@@ -35,33 +35,28 @@
35
35
  "@actions/core": "^1.11.1",
36
36
  "@semantic-release/error": "^4.0.0",
37
37
  "execa": "^9.6.0",
38
- "google-auth-library": "^9.15.1",
38
+ "google-auth-library": "^10.1.0",
39
39
  "yaml": "^2.8.0",
40
- "zod": "^3.25.51"
40
+ "zod": "^3.25.67"
41
41
  },
42
42
  "devDependencies": {
43
+ "@biomejs/biome": "1.9.4",
43
44
  "@semantic-release/changelog": "6.0.3",
44
45
  "@semantic-release/git": "10.0.1",
46
+ "@tsconfig/node-ts": "^23.6.1",
47
+ "@tsconfig/node22": "^22.0.2",
48
+ "@tsconfig/recommended": "^1.0.10",
49
+ "@tsconfig/strictest": "^2.0.5",
45
50
  "@types/common-tags": "1.8.4",
46
51
  "@types/semantic-release": "20.0.6",
47
52
  "@types/semantic-release__error": "3.0.3",
48
53
  "@types/signale": "1.4.7",
49
- "@typescript-eslint/eslint-plugin": "8.33.1",
50
- "@typescript-eslint/parser": "8.33.1",
51
- "@vitest/coverage-v8": "3.2.1",
54
+ "@vitest/coverage-v8": "3.2.4",
52
55
  "common-tags": "1.8.2",
53
56
  "conventional-changelog-conventionalcommits": "9.0.0",
54
- "eslint": "9.28.0",
55
- "eslint-config-prettier": "^10.1.5",
56
- "eslint-config-semistandard": "17.0.0",
57
- "eslint-config-standard": "17.1.0",
58
- "eslint-plugin-import": "2.31.0",
59
- "eslint-plugin-n": "17.19.0",
60
- "eslint-plugin-promise": "7.2.1",
61
- "prettier": "3.5.3",
62
57
  "semantic-release": "24.2.5",
63
58
  "typescript": "5.8.3",
64
- "vitest": "3.2.1",
59
+ "vitest": "3.2.4",
65
60
  "vitest-mock-extended": "3.1.0"
66
61
  }
67
62
  }
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export { verifyConditions } from "./verifyConditions.js";
2
- export { PluginConfig } from "./types.js";
3
- export { prepare } from "./prepare.js";
4
- export { publish } from "./publish.js";
package/dist/prepare.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { PrepareContext } from "semantic-release";
2
- import { PluginConfig } from "./types.js";
3
- export declare const prepare: (pluginConfig: PluginConfig, { nextRelease: { version }, logger }: PrepareContext) => Promise<void>;
package/dist/publish.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { PublishContext } from "semantic-release";
2
- import { PluginConfig } from "./types.js";
3
- export declare const publish: (pluginConfig: PluginConfig, { nextRelease: { version }, logger }: PublishContext) => Promise<{
4
- name: string;
5
- url: string;
6
- }>;
package/dist/schemas.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import { z } from "zod";
2
- export declare const ServiceAccount: z.ZodObject<{
3
- client_email: z.ZodString;
4
- private_key: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- client_email?: string;
7
- private_key?: string;
8
- }, {
9
- client_email?: string;
10
- private_key?: string;
11
- }>;
12
- export type ServiceAccount = z.infer<typeof ServiceAccount>;
13
- export declare const Pubspec: z.ZodObject<{
14
- name: z.ZodString;
15
- version: z.ZodString;
16
- }, "strip", z.ZodTypeAny, {
17
- name?: string;
18
- version?: string;
19
- }, {
20
- name?: string;
21
- version?: string;
22
- }>;
23
- export type Pubspec = z.infer<typeof Pubspec>;
package/dist/types.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export type PluginConfig = {
2
- cli: "dart" | "flutter";
3
- publishPub: boolean;
4
- updateBuildNumber: boolean;
5
- useGithubOidc: boolean;
6
- };
package/dist/utils.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import { PluginConfig } from "./types.js";
2
- export declare const PUBSPEC_PATH = "pubspec.yaml";
3
- export declare const getConfig: (config: PluginConfig) => PluginConfig;
4
- export declare const getGoogleIdentityToken: (serviceAccountStr: string) => Promise<string>;
5
- export declare const getGithubIdentityToken: () => Promise<string>;
6
- export declare const getPubspecString: () => string;
7
- export declare const getPubspecFromString: (data: string) => {
8
- name?: string;
9
- version?: string;
10
- };
11
- export declare const getPubspec: () => {
12
- name?: string;
13
- version?: string;
14
- };
@@ -1,3 +0,0 @@
1
- import { VerifyConditionsContext } from "semantic-release";
2
- import { PluginConfig } from "./types.js";
3
- export declare const verifyConditions: (pluginConfig: PluginConfig, { logger }: VerifyConditionsContext) => Promise<void>;