-
Notifications
You must be signed in to change notification settings - Fork 0
/
npm-handler.js
37 lines (28 loc) · 944 Bytes
/
npm-handler.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const fs = require("fs");
const path = require("path");
// const npmModule = require("npm");
const client_packge_path = "../client/package.json";
const packagesPath = [ "../package.json", client_packge_path ];
function rename_package({ projectName, version, gitUrl }) {
packagesPath.forEach(path => {
console.log(path);
let package = JSON.parse(fs.readFileSync(path));
package.name = projectName;
package.version = version;
package.repository.url = gitUrl;
fs.writeFileSync(path, JSON.stringify(package, null, 4));
});
}
function clean_client_packge_json() {
let package = JSON.parse(fs.readFileSync(client_packge_path));
delete package.scripts.p_link;
delete package.scripts.p_publish;
delete package.scripts.p_build;
fs.writeFileSync(client_packge_path, JSON.stringify(package, null, 4));
}
function install_dependencies() {}
module.exports = {
rename_package,
clean_client_packge_json,
install_dependencies
};