@shijiu/jsview-vue 0.9.243 → 0.9.246
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/doc/about-project-postinstall.md +0 -0
- package/package.json +3 -2
- package/scripts/common.js +35 -0
- package/scripts/install-local-packages.js +1 -49
- package/scripts/post-build.js +0 -1
- package/scripts/post-install.js +1 -49
- package/scripts/pre-pack.js +0 -21
- package/scripts/update-version.js +32 -0
- package/shijiu-jsview-vue-0.9.246.tgz +0 -0
package/README.md
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shijiu/jsview-vue",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.246",
|
|
4
4
|
"bin": {
|
|
5
5
|
"jsview-post-build": "./scripts/post-build.js",
|
|
6
6
|
"jsview-post-install": "./scripts/post-install.js",
|
|
7
7
|
"jsview-install-local-packages": "./scripts/install-local-packages.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"
|
|
10
|
+
"deploy": "node ./scripts/update-version.js && npm publish --access=public --registry https://registry.npmjs.com",
|
|
11
|
+
"prepack": "node ./scripts/update-version.js && node ./scripts/pre-pack.js"
|
|
11
12
|
},
|
|
12
13
|
"repository": "system/jsview-vue",
|
|
13
14
|
"bugs": "http://gitlab.qcast.cn/system/jsview-vue/issues",
|
package/scripts/common.js
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require("path");
|
|
4
4
|
const fs = require("fs");
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
|
|
7
|
+
function updateVersion(projectDir, ignoreChanges)
|
|
8
|
+
{
|
|
9
|
+
let cmdLine = 'cd ' + projectDir + ' && git rev-list --count HEAD';
|
|
10
|
+
let patchVersion = execSync(cmdLine, { stderr: "inherit" });
|
|
11
|
+
patchVersion = parseInt(patchVersion);
|
|
12
|
+
|
|
13
|
+
pkgPkgFile = path.resolve(projectDir, 'package.json');
|
|
14
|
+
if (!fs.existsSync(pkgPkgFile)) {
|
|
15
|
+
console.error('Error: Failed to install jsview patches, "' + path.relative(projectDir, pkgPkgFile) + '" is not exists.');
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
pkgPkgObj = require(pkgPkgFile);
|
|
19
|
+
console.log(pkgPkgObj.version, patchVersion)
|
|
20
|
+
if (pkgPkgObj.version.endsWith("." + patchVersion)) {
|
|
21
|
+
console.info('\nFound version: ' + pkgPkgObj.version);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!ignoreChanges) {
|
|
26
|
+
let cmdLine = 'cd ' + projectDir + ' && git status --porcelain';
|
|
27
|
+
let gitChanges = execSync(cmdLine, { stderr: "inherit" });
|
|
28
|
+
if (gitChanges) {
|
|
29
|
+
return gitChanges;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 替换PatchVersion为git 提交数。
|
|
34
|
+
pkgPkgObj.version = pkgPkgObj.version.replace(/\.[0-9]*$/, '.' + patchVersion);
|
|
35
|
+
|
|
36
|
+
fs.writeFileSync(pkgPkgFile, JSON.stringify(pkgPkgObj, null, 2));
|
|
37
|
+
console.info('\nUpdated version to ' + pkgPkgObj.version);
|
|
38
|
+
}
|
|
5
39
|
|
|
6
40
|
function cpSync(workDir, src, dest) {
|
|
7
41
|
const exists = fs.existsSync(src);
|
|
@@ -53,6 +87,7 @@ function deleteFolderRecursive(path) {
|
|
|
53
87
|
}
|
|
54
88
|
|
|
55
89
|
module.exports = {
|
|
90
|
+
updateVersion,
|
|
56
91
|
cpSync,
|
|
57
92
|
rmSync
|
|
58
93
|
}
|
|
@@ -3,55 +3,7 @@
|
|
|
3
3
|
const path = require("path");
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const { execSync } = require('child_process');
|
|
6
|
-
|
|
7
|
-
function cpSync(workDir, src, dest) {
|
|
8
|
-
const exists = fs.existsSync(src);
|
|
9
|
-
const stats = exists && fs.statSync(src);
|
|
10
|
-
const isDirectory = exists && stats.isDirectory();
|
|
11
|
-
if (isDirectory) {
|
|
12
|
-
if (fs.existsSync(dest) == false) {
|
|
13
|
-
fs.mkdirSync(dest);
|
|
14
|
-
}
|
|
15
|
-
fs.readdirSync(src).forEach(function(childItemName) {
|
|
16
|
-
cpSync(
|
|
17
|
-
workDir,
|
|
18
|
-
path.join(src, childItemName),
|
|
19
|
-
path.join(dest, childItemName)
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
console.info(
|
|
24
|
-
" " + path.relative(workDir, src) + " -> " + path.relative(workDir, dest)
|
|
25
|
-
);
|
|
26
|
-
fs.copyFileSync(src, dest);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function rmSync(path) {
|
|
31
|
-
if (!!fs.rmSync) {
|
|
32
|
-
fs.rmSync(path, { recursive: true, force: true });
|
|
33
|
-
} else {
|
|
34
|
-
deleteFolderRecursive(path)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function deleteFolderRecursive(path) {
|
|
39
|
-
var files = [];
|
|
40
|
-
if (fs.existsSync(path)) {
|
|
41
|
-
files = fs.readdirSync(path);
|
|
42
|
-
files.forEach(function(file, index) {
|
|
43
|
-
var curPath = path + "/" + file;
|
|
44
|
-
if (fs.lstatSync(curPath).isDirectory()) {
|
|
45
|
-
// recurse
|
|
46
|
-
deleteFolderRecursive(curPath);
|
|
47
|
-
} else {
|
|
48
|
-
// delete file
|
|
49
|
-
fs.unlinkSync(curPath);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
fs.rmdirSync(path);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
6
|
+
const { cpSync, rmSync } = require('./common');
|
|
55
7
|
|
|
56
8
|
function installPackages(options) {
|
|
57
9
|
// react/vue3共同的dom
|
package/scripts/post-build.js
CHANGED
package/scripts/post-install.js
CHANGED
|
@@ -2,55 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
|
|
6
|
-
function cpSync(workDir, src, dest) {
|
|
7
|
-
const exists = fs.existsSync(src);
|
|
8
|
-
const stats = exists && fs.statSync(src);
|
|
9
|
-
const isDirectory = exists && stats.isDirectory();
|
|
10
|
-
if (isDirectory) {
|
|
11
|
-
if (fs.existsSync(dest) == false) {
|
|
12
|
-
fs.mkdirSync(dest);
|
|
13
|
-
}
|
|
14
|
-
fs.readdirSync(src).forEach(function(childItemName) {
|
|
15
|
-
cpSync(
|
|
16
|
-
workDir,
|
|
17
|
-
path.join(src, childItemName),
|
|
18
|
-
path.join(dest, childItemName)
|
|
19
|
-
);
|
|
20
|
-
});
|
|
21
|
-
} else {
|
|
22
|
-
console.info(
|
|
23
|
-
' ' + path.relative(workDir, src) + ' -> ' + path.relative(workDir, dest)
|
|
24
|
-
);
|
|
25
|
-
fs.copyFileSync(src, dest);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function rmSync(path) {
|
|
30
|
-
if (!!fs.rmSync) {
|
|
31
|
-
fs.rmSync(path, { recursive: true, force: true });
|
|
32
|
-
} else {
|
|
33
|
-
deleteFolderRecursive(path)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function deleteFolderRecursive(path) {
|
|
38
|
-
var files = [];
|
|
39
|
-
if (fs.existsSync(path)) {
|
|
40
|
-
files = fs.readdirSync(path);
|
|
41
|
-
files.forEach(function(file, index) {
|
|
42
|
-
var curPath = path + '/' + file;
|
|
43
|
-
if (fs.lstatSync(curPath).isDirectory()) {
|
|
44
|
-
// recurse
|
|
45
|
-
deleteFolderRecursive(curPath);
|
|
46
|
-
} else {
|
|
47
|
-
// delete file
|
|
48
|
-
fs.unlinkSync(curPath);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
fs.rmdirSync(path);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
5
|
+
const { cpSync, rmSync } = require('./common');
|
|
54
6
|
|
|
55
7
|
function checkNpmCommand() {
|
|
56
8
|
let command = process.env.npm_command;
|
package/scripts/pre-pack.js
CHANGED
|
@@ -20,25 +20,6 @@ function buildAndInstallModules(moduleName, projectDir, sourceDir, distBinDir) {
|
|
|
20
20
|
cpSync(projectDir, path.resolve(sourceDir, 'dist'), distBinDir);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function upPackageVersion(options)
|
|
24
|
-
{
|
|
25
|
-
let patchVersion = execSync('git rev-list --count HEAD', { stderr: "inherit" });
|
|
26
|
-
patchVersion = parseInt(patchVersion);
|
|
27
|
-
|
|
28
|
-
pkgPkgFile = path.resolve(options.projectDir, 'package.json');
|
|
29
|
-
if (!fs.existsSync(pkgPkgFile)) {
|
|
30
|
-
console.error('Error: Failed to install jsview patches, "' + path.relative(options.projectDir, pkgPkgFile) + '" is not exists.');
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
pkgPkgObj = require(pkgPkgFile);
|
|
34
|
-
|
|
35
|
-
// 替换PatchVersion为git 提交数。
|
|
36
|
-
pkgPkgObj.version = pkgPkgObj.version.replace(/\.[0-9]*$/, '.' + patchVersion);
|
|
37
|
-
|
|
38
|
-
fs.writeFileSync(pkgPkgFile, JSON.stringify(pkgPkgObj, null, 2));
|
|
39
|
-
console.info('\nUpdated version to ' + pkgPkgObj.version);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
23
|
function main() {
|
|
43
24
|
const options = {};
|
|
44
25
|
options.projectDir = process.cwd();
|
|
@@ -53,8 +34,6 @@ function main() {
|
|
|
53
34
|
buildAndInstallModules('jsview-vue3-engine-widget',
|
|
54
35
|
options.projectDir,
|
|
55
36
|
options.widgetSourceDir, options.widgetBinDir);
|
|
56
|
-
|
|
57
|
-
upPackageVersion(options);
|
|
58
37
|
}
|
|
59
38
|
|
|
60
39
|
main();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const readline = require('readline')
|
|
4
|
+
const { updateVersion } = require('./common');
|
|
5
|
+
|
|
6
|
+
function main() {
|
|
7
|
+
const options = {};
|
|
8
|
+
options.projectDir = process.cwd();
|
|
9
|
+
|
|
10
|
+
const gitChanges = updateVersion(options.projectDir);
|
|
11
|
+
if (gitChanges) {
|
|
12
|
+
const input = readline.createInterface({
|
|
13
|
+
input: process.stdin,
|
|
14
|
+
output: process.stdout
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
console.log('Git changes:\n' + gitChanges);
|
|
18
|
+
|
|
19
|
+
input.question('Warning: Git working directory not clean, do you want to update version continue? [yes/NO]\n',
|
|
20
|
+
answer => {
|
|
21
|
+
input.close();
|
|
22
|
+
if (answer.toLowerCase() === 'yes') {
|
|
23
|
+
updateVersion(options.projectDir, true);
|
|
24
|
+
} else {
|
|
25
|
+
console.error("Error: User cancelled.")
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
main();
|
|
Binary file
|