From f353ade69bf72a5fde409fdcf3439036455c2f79 Mon Sep 17 00:00:00 2001 From: iapyang Date: Wed, 8 Jan 2020 17:28:39 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=89=93=E5=8C=85=E7=94=9F=E6=88=90.n?= =?UTF-8?q?pmrc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/{publish/publish.js => prepublish/prepublish.js} | 7 ++----- package.json | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) rename lib/{publish/publish.js => prepublish/prepublish.js} (64%) diff --git a/lib/publish/publish.js b/lib/prepublish/prepublish.js similarity index 64% rename from lib/publish/publish.js rename to lib/prepublish/prepublish.js index 7c128263a3..cd545a4338 100644 --- a/lib/publish/publish.js +++ b/lib/prepublish/prepublish.js @@ -1,8 +1,7 @@ -const { execSync } = require("child_process"); const { resolve } = require("path"); const { writeFileSync } = require("fs"); -if (!process.env.PASSWORD) { +if (!process.env.VERDACCIO_AUTH) { return; } @@ -12,6 +11,4 @@ packageJSON.version = `2.0.${new Date().getTime()}`; writeFileSync(resolve(__dirname, "../../package.json"), JSON.stringify(packageJSON, null, 2)); -execSync([ - "npm publish --registry http://192.168.5.154:4873/", -].join(" && ")); +writeFileSync(resolve(__dirname, "../../.npmrc"), `//192.168.5.154:4873/:_authToken="${process.env.VERDACCIO_AUTH}"`); diff --git a/package.json b/package.json index da76ac1df1..51ee89bdd4 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "test": "karma start", "analyze": "grunt analyze", "dev": "npm-run-all --parallel grunt webpack:dev", - "publish": "node ./lib/publish/publish.js" + "prepublish": "node ./lib/prepublish/prepublish.js" }, "repository": { "type": "git",