Browse Source

chore: 打包生成.npmrc

es6
iapyang 5 years ago
parent
commit
f353ade69b
  1. 7
      lib/prepublish/prepublish.js
  2. 2
      package.json

7
lib/publish/publish.js → lib/prepublish/prepublish.js

@ -1,8 +1,7 @@
const { execSync } = require("child_process");
const { resolve } = require("path"); const { resolve } = require("path");
const { writeFileSync } = require("fs"); const { writeFileSync } = require("fs");
if (!process.env.PASSWORD) { if (!process.env.VERDACCIO_AUTH) {
return; return;
} }
@ -12,6 +11,4 @@ packageJSON.version = `2.0.${new Date().getTime()}`;
writeFileSync(resolve(__dirname, "../../package.json"), JSON.stringify(packageJSON, null, 2)); writeFileSync(resolve(__dirname, "../../package.json"), JSON.stringify(packageJSON, null, 2));
execSync([ writeFileSync(resolve(__dirname, "../../.npmrc"), `//192.168.5.154:4873/:_authToken="${process.env.VERDACCIO_AUTH}"`);
"npm publish --registry http://192.168.5.154:4873/",
].join(" && "));

2
package.json

@ -77,7 +77,7 @@
"test": "karma start", "test": "karma start",
"analyze": "grunt analyze", "analyze": "grunt analyze",
"dev": "npm-run-all --parallel grunt webpack:dev", "dev": "npm-run-all --parallel grunt webpack:dev",
"publish": "node ./lib/publish/publish.js" "prepublish": "node ./lib/prepublish/prepublish.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

Loading…
Cancel
Save