@vitejs/release-scripts 1.1.0 → 1.2.1

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/dist/index.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  export declare function publish(options: {
2
2
  defaultPackage: string;
3
3
  getPkgDir?: (pkg: string) => string;
4
+ /**
5
+ * Enables npm package provenance https://docs.npmjs.com/generating-provenance-statements
6
+ * @default false
7
+ */
8
+ provenance?: boolean;
4
9
  }): Promise<void>;
5
10
 
6
11
  export declare function release(options: {
package/dist/index.js CHANGED
@@ -7,8 +7,8 @@ import path from "node:path";
7
7
  import colors from "picocolors";
8
8
  import { execa } from "execa";
9
9
  import semver from "semver";
10
- import minimist from "minimist";
11
- var args = minimist(process.argv.slice(2));
10
+ import mri from "mri";
11
+ var args = mri(process.argv.slice(2));
12
12
  var isDryRun = !!args.dry;
13
13
  if (isDryRun) {
14
14
  console.log(colors.inverse(colors.yellow(" DRY RUN ")));
@@ -99,11 +99,14 @@ function updateVersion(pkgPath, version) {
99
99
  pkg.version = version;
100
100
  writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
101
101
  }
102
- async function publishPackage(pkdDir, tag) {
102
+ async function publishPackage(pkdDir, tag, provenance) {
103
103
  const publicArgs = ["publish", "--access", "public"];
104
104
  if (tag) {
105
105
  publicArgs.push(`--tag`, tag);
106
106
  }
107
+ if (provenance) {
108
+ publicArgs.push(`--provenance`);
109
+ }
107
110
  await runIfNotDry("npm", publicArgs, {
108
111
  cwd: pkdDir
109
112
  });
@@ -119,7 +122,11 @@ async function getActiveVersion(npmName) {
119
122
  }
120
123
 
121
124
  // src/publish.ts
122
- var publish = async ({ defaultPackage, getPkgDir }) => {
125
+ var publish = async ({
126
+ defaultPackage,
127
+ getPkgDir,
128
+ provenance
129
+ }) => {
123
130
  const tag = args._[0];
124
131
  if (!tag)
125
132
  throw new Error("No tag specified");
@@ -139,7 +146,7 @@ var publish = async ({ defaultPackage, getPkgDir }) => {
139
146
  const activeVersion = await getActiveVersion(pkg.name);
140
147
  step("Publishing package...");
141
148
  const releaseTag = version.includes("beta") ? "beta" : version.includes("alpha") ? "alpha" : activeVersion && semver2.lt(pkg.version, activeVersion) ? "previous" : void 0;
142
- await publishPackage(pkgDir, releaseTag);
149
+ await publishPackage(pkgDir, releaseTag, provenance);
143
150
  };
144
151
 
145
152
  // src/release.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitejs/release-scripts",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "@vitejs release scripts",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -15,31 +15,27 @@
15
15
  }
16
16
  },
17
17
  "scripts": {
18
- "build": "tsx scripts/build.ts",
18
+ "build": "tnode scripts/build.ts",
19
19
  "prettier": "pnpm prettier-ci --write",
20
20
  "prettier-ci": "prettier --cache --ignore-path=.gitignore --check '**/*.{ts,json,md,yml}'",
21
- "ci": "tsc && pnpm prettier-ci && pnpm build",
22
- "release": "tsx scripts/release.ts"
23
- },
24
- "prettier": {
25
- "trailingComma": "all"
21
+ "qa": "tsc && pnpm prettier-ci && pnpm build",
22
+ "release": "tnode scripts/release.ts"
26
23
  },
27
24
  "dependencies": {
28
- "execa": "^6.1.0",
29
- "minimist": "^1.2.7",
25
+ "execa": "^7.1.1",
26
+ "mri": "^1.2.0",
30
27
  "picocolors": "^1.0.0",
31
28
  "prompts": "^2.4.2",
32
- "publint": "^0.1.9",
33
- "semver": "^7.3.8"
29
+ "publint": "^0.1.16",
30
+ "semver": "^7.5.4"
34
31
  },
35
32
  "devDependencies": {
36
- "@types/minimist": "^1.2.2",
37
- "@types/node": "^18.11.18",
38
- "@types/prompts": "^2.4.2",
39
- "@types/semver": "^7.3.13",
40
- "esbuild": "^0.17.4",
41
- "prettier": "^2.8.3",
42
- "tsx": "^3.12.2",
43
- "typescript": "^4.9.4"
33
+ "@arnaud-barre/tnode": "^0.18.0",
34
+ "@types/node": "^18.16.19",
35
+ "@types/prompts": "^2.4.4",
36
+ "@types/semver": "^7.5.0",
37
+ "esbuild": "^0.18.13",
38
+ "prettier": "^3.0.0",
39
+ "typescript": "^5.1.6"
44
40
  }
45
41
  }