forked from Digiturk/wface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
60 lines (51 loc) · 2.41 KB
/
gulpfile.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const childProcess = require('child_process');
const fs = require('fs-extra');
const gulp = require('gulp');
var minimist = require('minimist');
var knownOptions = { string: 'version' };
var options = minimist(process.argv.slice(2), knownOptions);
gulp.task('publish', function () {
const command = "npm publish --access=public"
childProcess.execSync(command, { stdio: [0, 1, 2], cwd: './packages/cefsharp-container/' });
childProcess.execSync(command, { stdio: [0, 1, 2], cwd: './packages/cli/' });
childProcess.execSync(command, { stdio: [0, 1, 2], cwd: './packages/components/' });
childProcess.execSync(command, { stdio: [0, 1, 2], cwd: './packages/container/' });
childProcess.execSync(command, { stdio: [0, 1, 2], cwd: './packages/ioc/' });
childProcess.execSync(command, { stdio: [0, 1, 2], cwd: './packages/store/' });
});
gulp.task('version', function () {
const newVersion = options.version;
if (!newVersion) {
console.error('Please specify version parameter!');
return;
}
updateVersion('./packages/cefsharp-container/package.json', newVersion);
updateVersion('./packages/cli/package.json', newVersion);
updateVersion('./packages/components/package.json', newVersion);
updateVersion('./packages/container/package.json', newVersion);
updateVersion('./packages/ioc/package.json', newVersion);
updateVersion('./packages/store/package.json', newVersion);
});
gulp.task('versions', function () {
const print = (project) => {
console.log(project + ": " + require('./packages/' + project + '/package.json').version);
}
print('cli');
print('cefsharp-container');
print('components');
print('container');
print('ioc');
print('store');
});
const updateVersion = (path, version) => {
const package = require(path);
console.log(package.name + " old version is " + package.version);
package.version = version;
if (package.dependencies["@wface/cefsharp-container"]) package.dependencies["@wface/cefsharp-container"] = version;
if (package.dependencies["@wface/components"]) package.dependencies["@wface/components"] = version;
if (package.dependencies["@wface/container"]) package.dependencies["@wface/container"] = version;
if (package.dependencies["@wface/ioc"]) package.dependencies["@wface/ioc"] = version;
if (package.dependencies["@wface/store"]) package.dependencies["@wface/store"] = version;
const data = JSON.stringify(package, null, "\t");
fs.writeFileSync(path, data);
}