@shijiu/jsview 2.0.1192-next-vue.0 → 2.1.2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview",
3
- "version": "2.0.1192-next-vue.0",
3
+ "version": "2.1.2",
4
4
  "bin": {
5
5
  "jsview-post-build": "./tools/jsview-post-build.js",
6
6
  "jsview-post-install": "./tools/jsview-post-install.js"
@@ -47,7 +47,7 @@ const jsviewConfig = defineConfig({
47
47
  optimizeDeps: {
48
48
  include: [
49
49
  'gifuct-js',
50
- 'mockjs',
50
+ // 'mockjs',
51
51
  'qr.js'
52
52
  ],
53
53
  exclude: [
@@ -138,9 +138,14 @@ function jsvCreateJsViewViteConfig(originConfig) {
138
138
  default:
139
139
  throw new Error('JsView Error: Failed to support framework: ' + framework);
140
140
  }
141
-
142
141
  jsviewConfig.resolve.alias['jsview'] = aliasJsView;
143
142
 
143
+ // 解决templete工程中没有mockjs导致的报错。
144
+ const mockjs = path.resolve(moduleDir, 'mockjs');
145
+ if(fs.existsSync(mockjs)) {
146
+ jsviewConfig.optimizeDeps.include.push('mockjs');
147
+ }
148
+
144
149
  return jsviewConfig;
145
150
  }
146
151
 
@@ -98,8 +98,7 @@ function getOptions(argv)
98
98
  Logger.Info('Are you sure to upgrade it?');
99
99
  const answer = askAndAnswer('(y/N) ');
100
100
  if (answer.substring(0, 1) != 'y' && answer.substring(0, 3) != 'yes') {
101
- Logger.Warn('User cancelled.')
102
- process.exit(1);
101
+ Logger.ErrorAndExitNoException('User cancelled.')
103
102
  }
104
103
 
105
104
  options.sourcePathList = getFilesRecursive(options.upgradeDir);
@@ -20,28 +20,43 @@ class Logger {
20
20
  }
21
21
 
22
22
  static ErrorNoException(...args) {
23
- console.error();
24
- console.error(Logger.Red("JsView Error:"), ...args);
23
+ console.log();
24
+
25
+ const size = args?.length ?? 0;
26
+ for(let idx = 0; idx < size; idx++) {
27
+ args[idx] = Logger.Red(Logger.Bold(args[idx]));
28
+ }
29
+ console.error(Logger.Red(Logger.Bold('JsView Error:')), ...args);
25
30
  }
26
31
 
27
32
  static Error(...args) {
28
- console.error();
29
- console.error(Logger.Red("JsView Error:"), ...args, new Error());
33
+ console.log();
34
+
35
+ const size = args?.length ?? 0;
36
+ for(let idx = 0; idx < size; idx++) {
37
+ args[idx] = Logger.Red(Logger.Bold(args[idx]));
38
+ }
39
+ console.error(Logger.Red(Logger.Bold('JsView Error:')), ...args, '\n', new Error());
30
40
  }
31
41
 
32
42
  static Warn(...args) {
33
- console.error();
34
- console.warn(Logger.Yellow("JsView Warning:"), ...args);
43
+ console.log();
44
+
45
+ const size = args?.length ?? 0;
46
+ for(let idx = 0; idx < size; idx++) {
47
+ args[idx] = Logger.Yellow(Logger.Bold(args[idx]));
48
+ }
49
+ console.warn(Logger.Yellow(Logger.Bold('JsView Warning:')), ...args);
35
50
  }
36
51
 
37
52
  static Info(...args) {
38
- console.info(Logger.Green("JsView Info:"), ...args);
53
+ console.info(Logger.Green('JsView Info:'), ...args);
39
54
  }
40
55
 
41
56
  static Debug(...args) {
42
57
  const stack = new Error().stack;
43
- const caller = stack.split("\n")[2].trim().split(" ")[1] + "()";
44
- console.debug("JsView Debug:", caller, ...args);
58
+ const caller = stack.split('\n')[2].trim().split(' ')[1] + '()';
59
+ console.debug('JsView Debug:', caller, ...args);
45
60
  }
46
61
 
47
62
  static GetFileTag(filePath) {
@@ -64,6 +79,10 @@ class Logger {
64
79
  static Blue(log) {
65
80
  return '\x1b[34m' + log + '\x1b[39m';
66
81
  }
82
+
83
+ static Bold(log) {
84
+ return '\x1B[1m' + log + '\x1B[22m';
85
+ }
67
86
  }
68
87
 
69
88
  module.exports = {
@@ -171,8 +171,10 @@ function doPostInstall(framework, pkgNeedPatch, skipCheckVersion)
171
171
  '@shijiu/jsview',
172
172
  '@shijiu/jsview-vue',
173
173
  '@shijiu/jsview-vue-samples',
174
+ '@shijiu/jsview-vue-extra-samples',
174
175
  '@shijiu/jsview-react',
175
176
  '@shijiu/jsview-react-samples',
177
+ '@shijiu/jsview-react-extra-samples',
176
178
  ];
177
179
 
178
180
  checkNpmCommand();