Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 7c3932d

Browse files
chore(prepublish): change script name; accepts --distTag option (#662) (#663)
1 parent d812d5d commit 7c3932d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

build/prepublish-next.js renamed to build/prepublish.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33
const { dirname: pathDirname } = require("path");
44
const { getPackageJson, writePackageJson } = require("../projectHelpers");
55

6-
const tag = "next";
6+
let processArgs = process.argv;
7+
const distTag = processArgs.includes("--distTag") ? processArgs[processArgs.indexOf("--distTag") + 1] : undefined;
8+
9+
const tag = distTag || process.env["distTag"] || "next";
10+
711
const projectDir = pathDirname(__dirname);
812
const packageJson = getPackageJson(projectDir);
9-
const [, , packageVersion = new Date() ] = process.argv;
13+
14+
if (distTag) {
15+
processArgs = processArgs.splice(processArgs.indexOf("--distTag"), 2);
16+
}
17+
const [, , packageVersion = new Date()] = processArgs;
1018

1119
packageJson.publishConfig = Object.assign(
1220
packageJson.publishConfig || {},

0 commit comments

Comments
 (0)