@shijiu/jsview-vue 0.9.243 → 0.9.249

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/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@shijiu/jsview-vue",
3
- "version": "0.9.243",
3
+ "version": "0.9.249",
4
4
  "bin": {
5
- "jsview-post-build": "./scripts/post-build.js",
6
- "jsview-post-install": "./scripts/post-install.js",
7
- "jsview-install-local-packages": "./scripts/install-local-packages.js"
5
+ "jsview-post-build": "./scripts/jsview-post-build.js",
6
+ "jsview-post-install": "./scripts/jsview-post-install.js",
7
+ "jsview-install-local-packages": "./scripts/jsview-install-local-packages.js"
8
8
  },
9
9
  "scripts": {
10
- "prepack": "./scripts/pre-pack.js"
10
+ "fast-publish": "node ./scripts/deploy-fast-publish.js",
11
+ "fast-pack": "node ./scripts/deploy-fast-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
@@ -1,7 +1,63 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const path = require("path");
4
3
  const fs = require("fs");
4
+ const path = require("path");
5
+ const readline = require('readline')
6
+ const { execSync } = require('child_process');
7
+
8
+ function updateVersion(projectDir, ignoreChanges)
9
+ {
10
+ let cmdLine = 'cd ' + projectDir + ' && git rev-list --count HEAD';
11
+ let patchVersion = execSync(cmdLine, { stderr: "inherit" });
12
+ patchVersion = parseInt(patchVersion);
13
+
14
+ pkgPkgFile = path.resolve(projectDir, 'package.json');
15
+ if (!fs.existsSync(pkgPkgFile)) {
16
+ console.error('Error: Failed to install jsview patches, "' + path.relative(projectDir, pkgPkgFile) + '" is not exists.');
17
+ process.exit(1);
18
+ }
19
+ pkgPkgObj = require(pkgPkgFile);
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
+ gitChanges = gitChanges.toString();
29
+ if (gitChanges) {
30
+ return gitChanges;
31
+ }
32
+ }
33
+
34
+ // 替换PatchVersion为git 提交数。
35
+ pkgPkgObj.version = pkgPkgObj.version.replace(/\.[0-9]*$/, '.' + patchVersion);
36
+
37
+ fs.writeFileSync(pkgPkgFile, JSON.stringify(pkgPkgObj, null, 2));
38
+ console.info('\nUpdated version to ' + pkgPkgObj.version);
39
+ }
40
+
41
+ async function syncReadIO(prompt) {
42
+ const input = readline.createInterface({
43
+ input: process.stdin,
44
+ output: process.stdout
45
+ });
46
+ input.on('SIGINT', function () {
47
+ console.error("Error: User cancelled.")
48
+ process.exit(1);
49
+ });
50
+
51
+ let ret;
52
+ input.question(prompt,
53
+ answer => {
54
+ input.close();
55
+ ret = answer;
56
+ });
57
+ for await (const line of input) {}
58
+
59
+ return ret;
60
+ }
5
61
 
6
62
  function cpSync(workDir, src, dest) {
7
63
  const exists = fs.existsSync(src);
@@ -54,5 +110,7 @@ function deleteFolderRecursive(path) {
54
110
 
55
111
  module.exports = {
56
112
  cpSync,
57
- rmSync
113
+ rmSync,
114
+ syncReadIO,
115
+ updateVersion,
58
116
  }
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require('child_process');
4
+
5
+ function main() {
6
+ const options = {};
7
+ options.projectDir = process.cwd();
8
+
9
+ let cmdLine = 'cd ' + options.projectDir + '&& node ./scripts/deploy-prepare.js';
10
+ console.info('Run [' + cmdLine + ']... ');
11
+ execSync(cmdLine, { stdio: 'inherit', stderr: 'inherit' });
12
+
13
+ cmdLine = 'cd ' + options.projectDir + '&& npm pack';
14
+ console.info('Run [' + cmdLine + ']... ');
15
+ execSync(cmdLine, { stdio: 'inherit', stderr: 'inherit' });
16
+ }
17
+ main();
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+
3
+ const readline = require('readline')
4
+ const { execSync } = require('child_process');
5
+ const { syncReadIO } = require('./common');
6
+
7
+ async function login() {
8
+ const password = await syncReadIO('\nPlease input password of qcast@npmjs.com: ');
9
+ if (!password) {
10
+ console.error("Error: Bad password.")
11
+ process.exit(1);
12
+ }
13
+
14
+ let cmdLine = 'npm-cli-login -u qcast -e support@qcast.cn -p ' + password;
15
+ console.info('Run [' + cmdLine + ']... ');
16
+ try {
17
+ ret = execSync(cmdLine, { stdio: 'inherit', stderr: 'inherit' });
18
+ } catch (err) {
19
+ console.error("Failed to exec npm-cli-login.")
20
+ console.error("If you are not you can install this command with `npm install -g npm-cli-login`.")
21
+ process.exit(1)
22
+ }
23
+ }
24
+
25
+ async function main() {
26
+ const options = {};
27
+ options.projectDir = process.cwd();
28
+
29
+ cmdLine = 'cd ' + options.projectDir + '&& node ./scripts/deploy-prepare.js';
30
+ console.info('Run [' + cmdLine + ']... ');
31
+ execSync(cmdLine, { stdio: 'inherit', stderr: 'inherit' });
32
+
33
+ await login();
34
+
35
+ cmdLine = 'cd ' + options.projectDir + '&& npm publish --tag latest --access=public --registry https://registry.npmjs.com';
36
+ console.info('Run [' + cmdLine + ']... ');
37
+ execSync(cmdLine, { stdio: 'inherit', stderr: 'inherit' });
38
+ }
39
+ main();
@@ -3,7 +3,25 @@
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
5
  const { execSync } = require('child_process');
6
- const { cpSync } = require('./common');
6
+ const { cpSync, syncReadIO, updateVersion } = require('./common');
7
+
8
+ async function updateVersionWithPrompt() {
9
+ const options = {};
10
+ options.projectDir = process.cwd();
11
+
12
+ const gitChanges = updateVersion(options.projectDir);
13
+ if (gitChanges) {
14
+ console.log('Git changes:\n' + gitChanges);
15
+
16
+ const answer = await syncReadIO('Warning: Git working directory not clean, do you want to update version continue? [yes/NO]\n');
17
+ if (answer?.toLowerCase() === 'yes') {
18
+ updateVersion(options.projectDir, true);
19
+ } else {
20
+ console.error("Error: User cancelled.")
21
+ process.exit(1);
22
+ }
23
+ }
24
+ }
7
25
 
8
26
  function buildAndInstallModules(moduleName, projectDir, sourceDir, distBinDir) {
9
27
  console.info('\nBuilding ' + moduleName + '... ');
@@ -14,32 +32,13 @@ function buildAndInstallModules(moduleName, projectDir, sourceDir, distBinDir) {
14
32
  }
15
33
 
16
34
  cmdLine = 'cd ' + sourceDir + ' && npm install && npm run build';
17
- console.info('Rnn [' + cmdLine + ']... ');
35
+ console.info('Run [' + cmdLine + ']... ');
18
36
  execSync(cmdLine, { stdio: 'inherit', stderr: 'inherit' });
19
37
 
20
38
  cpSync(projectDir, path.resolve(sourceDir, 'dist'), distBinDir);
21
39
  }
22
40
 
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
- function main() {
41
+ async function main() {
43
42
  const options = {};
44
43
  options.projectDir = process.cwd();
45
44
  options.domBinDir = path.resolve(options.projectDir, 'dom/bin');
@@ -47,14 +46,14 @@ function main() {
47
46
  options.domSourceDir = path.resolve(options.projectDir, 'deps/jsview-dom');
48
47
  options.widgetSourceDir = path.resolve(options.projectDir, 'deps/jsview-vue3-engine-widget');
49
48
 
49
+ const ret = await updateVersionWithPrompt();
50
+
50
51
  buildAndInstallModules('jsview-dom',
51
52
  options.projectDir,
52
53
  options.domSourceDir, options.domBinDir);
53
54
  buildAndInstallModules('jsview-vue3-engine-widget',
54
55
  options.projectDir,
55
56
  options.widgetSourceDir, options.widgetBinDir);
56
-
57
- upPackageVersion(options);
58
57
  }
59
58
 
60
59
  main();
@@ -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
@@ -7,7 +7,6 @@ const path = require('path');
7
7
  // main.js处理AppData信息
8
8
  function prepareMainAppData(options, fileMd5)
9
9
  {
10
-
11
10
  // 加载私钥文件
12
11
  const privateKeyFile = path.resolve(options.appConfigDir, 'app_sign_private_key.crt');
13
12
  if (!fs.existsSync(privateKeyFile)) {
@@ -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/.gitmodules DELETED
@@ -1,6 +0,0 @@
1
- [submodule "deps/jsview-dom"]
2
- path = deps/jsview-dom
3
- url = http://gitlab.qcast.cn/system/jsview-dom.git
4
- [submodule "deps/jsview-vue3-engine-widget"]
5
- path = deps/jsview-vue3-engine-widget
6
- url = http://gitlab.qcast.cn/system/jsview-vue3-engine-widget.git
package/README.md DELETED
@@ -1,11 +0,0 @@
1
- 1. 更新git submodule:
2
-
3
- ``` git submodule update --init --recursive ```
4
-
5
- 2. 打包:
6
-
7
- ``` npm pack ```
8
-
9
- 3. 发布:
10
-
11
- ``` npm publish --access=public --registry https://registry.npmjs.com ```
@@ -1,3 +0,0 @@
1
- 2021.9.1
2
- ====================================
3
- 1. 代码从jsview-export-react-sample分离后出版上传
package/doc/git_commit.md DELETED
@@ -1,15 +0,0 @@
1
- 提交规范:
2
-
3
- 主模块:子模块:改动点
4
-
5
- 主模块: react_js 或者 java_app
6
-
7
- 子模块:
8
- react_js
9
- 红包雨
10
- Video播放
11
- 简易Simplewidget
12
- ...
13
- java_app: DemoApp
14
-
15
- 例如: react_js:红包雨:提交XXXX修改
@@ -1 +0,0 @@
1
- +8332