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

chore(prepublish): change script name; accepts --distTag option (#662) #663

Merged
merged 1 commit into from
Sep 17, 2018
Merged
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
12 changes: 10 additions & 2 deletions build/prepublish-next.js → build/prepublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
const { dirname: pathDirname } = require("path");
const { getPackageJson, writePackageJson } = require("../projectHelpers");

const tag = "next";
let processArgs = process.argv;
const distTag = processArgs.includes("--distTag") ? processArgs[processArgs.indexOf("--distTag") + 1] : undefined;

const tag = distTag || process.env["distTag"] || "next";

const projectDir = pathDirname(__dirname);
const packageJson = getPackageJson(projectDir);
const [, , packageVersion = new Date() ] = process.argv;

if (distTag) {
processArgs = processArgs.splice(processArgs.indexOf("--distTag"), 2);
}
const [, , packageVersion = new Date()] = processArgs;

packageJson.publishConfig = Object.assign(
packageJson.publishConfig || {},
Expand Down