zmp-cli 3.4.0 → 3.4.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.
@@ -1,29 +1,60 @@
1
1
  "use strict";
2
2
 
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
4
+
5
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
6
+
7
+ function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
8
+
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
10
+
3
11
  var generateNpmScripts = require('./generate-npm-scripts');
4
12
 
13
+ var _require = require('./generate-npm-scripts'),
14
+ generateTailWindScripts = _require.generateTailWindScripts;
15
+
5
16
  module.exports = function generatePackageJson(options) {
6
17
  var name = options.name,
7
18
  framework = options.framework,
8
- cssPreProcessor = options.cssPreProcessor; // Dependencies
19
+ cssPreProcessor = options.cssPreProcessor,
20
+ includeTailwind = options.includeTailwind; // Dependencies
9
21
 
10
22
  var dependencies = ['zmp-framework', 'zmp-sdk', 'swiper'];
11
23
  var dependenciesVue = ['vue@3'];
12
24
  var dependenciesReact = ['react', 'react-dom', 'prop-types'];
13
- if (framework === 'vue') dependencies.push.apply(dependencies, dependenciesVue);else if (framework === 'react') dependencies.push.apply(dependencies, dependenciesReact);
14
- var devDependencies = ['cross-env', 'postcss-preset-env', 'vite']; // CSS PreProcessor
25
+ var dependenciesReactTs = ['@types/react', '@types/react-dom'];
26
+ var tailwindDependencies = ['autoprefixer', 'tailwindcss', 'postcss@^8', 'postcss-cli@^8'];
27
+
28
+ if (framework === 'vue') {
29
+ dependencies.push.apply(dependencies, dependenciesVue);
30
+ } else if (framework === 'react' || framework === 'react-typescript') {
31
+ dependencies.push.apply(dependencies, dependenciesReact);
32
+ }
33
+
34
+ if (framework === 'react-typescript') {
35
+ dependencies.push.apply(dependencies, dependenciesReactTs);
36
+ }
37
+
38
+ var devDependencies = ['cross-env', 'postcss-preset-env@6.7.0', 'vite']; // CSS PreProcessor
15
39
 
16
40
  if (cssPreProcessor === 'stylus') devDependencies.push.apply(devDependencies, ['stylus']);else if (cssPreProcessor === 'less') devDependencies.push.apply(devDependencies, ['less']);else if (cssPreProcessor === 'scss') devDependencies.push.apply(devDependencies, ['sass']); // DevDependencies
17
41
 
18
42
  var devDependenciesCore = ['zmp-loader'];
19
43
  var devDependenciesReact = ['@vitejs/plugin-react-refresh'];
20
44
  var devDependenciesVue = ['@vitejs/plugin-vue', '@vue/compiler-sfc'];
21
- if (framework === 'react') devDependencies.push.apply(devDependencies, [devDependenciesReact]);else if (framework === 'vue') devDependencies.push.apply(devDependencies, [devDependenciesVue]);else if (framework === 'core') devDependencies.push.apply(devDependencies, [devDependenciesCore]); // Scripts
45
+ if (framework === 'react' || framework === 'react-typescript') devDependencies.push.apply(devDependencies, [devDependenciesReact].concat(_toConsumableArray(includeTailwind ? tailwindDependencies : [])));else if (framework === 'vue') devDependencies.push.apply(devDependencies, [devDependenciesVue]);else if (framework === 'core') devDependencies.push.apply(devDependencies, [devDependenciesCore]); // Scripts
22
46
 
23
47
  var scripts = {};
24
48
  generateNpmScripts().forEach(function (s) {
25
49
  scripts[s.name] = s.script;
26
50
  });
51
+
52
+ if (includeTailwind) {
53
+ generateTailWindScripts().forEach(function (s) {
54
+ scripts[s.name] = s.script;
55
+ });
56
+ }
57
+
27
58
  var postInstall = [];
28
59
 
29
60
  if (postInstall.length) {
@@ -25,7 +25,7 @@ module.exports = function generatePackageJson(options) {
25
25
  if (framework === 'react-typescript') {
26
26
  dependencies.push(...dependenciesReactTs);
27
27
  }
28
- const devDependencies = ['cross-env', 'postcss-preset-env', 'vite'];
28
+ const devDependencies = ['cross-env', 'postcss-preset-env@6.7.0', 'vite'];
29
29
  // CSS PreProcessor
30
30
  if (cssPreProcessor === 'stylus') devDependencies.push(...['stylus']);
31
31
  else if (cssPreProcessor === 'less') devDependencies.push(...['less']);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmp-cli",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "description": "ZMP command line utility (CLI)",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -72,7 +72,6 @@
72
72
  "mini-css-extract-plugin": "^1.3.7",
73
73
  "minimist": "^1.2.5",
74
74
  "multer": "^1.4.2",
75
- "node-blob": "^0.0.2",
76
75
  "normalize-path": "^3.0.0",
77
76
  "opn": "^6.0.0",
78
77
  "ora": "^3.4.0",
@@ -0,0 +1,106 @@
1
+ // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js
2
+ // (MIT licensed)
3
+ // Also based on https://github.com/modulesio/window-fetch/blob/master/src/blob.js
4
+
5
+ const TYPE = Symbol('type');
6
+ const CLOSED = Symbol('closed');
7
+
8
+ class Blob {
9
+ constructor() {
10
+ Object.defineProperty(this, Symbol.toStringTag, {
11
+ value: 'Blob',
12
+ writable: false,
13
+ enumerable: false,
14
+ configurable: true
15
+ });
16
+
17
+ this[CLOSED] = false;
18
+ this[TYPE] = '';
19
+
20
+ const blobParts = arguments[0];
21
+ const options = arguments[1];
22
+
23
+ const buffers = [];
24
+
25
+ if (blobParts) {
26
+ const a = blobParts;
27
+ const length = Number(a.length);
28
+ for (let i = 0; i < length; i++) {
29
+ const element = a[i];
30
+ let buffer;
31
+ if (element instanceof Buffer) {
32
+ buffer = element;
33
+ } else if (ArrayBuffer.isView(element)) {
34
+ buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);
35
+ } else if (element instanceof ArrayBuffer) {
36
+ buffer = Buffer.from(element);
37
+ } else if (element instanceof Blob) {
38
+ buffer = element.buffer;
39
+ } else {
40
+ buffer = Buffer.from(typeof element === 'string' ? element : String(element));
41
+ }
42
+ buffers.push(buffer);
43
+ }
44
+ }
45
+
46
+ this.buffer = Buffer.concat(buffers);
47
+
48
+ let type = options && options.type !== undefined && String(options.type).toLowerCase();
49
+ if (type && !/[^\u0020-\u007E]/.test(type)) {
50
+ this[TYPE] = type;
51
+ }
52
+ }
53
+ get size() {
54
+ return this[CLOSED] ? 0 : this.buffer.length;
55
+ }
56
+ get type() {
57
+ return this[TYPE];
58
+ }
59
+ get isClosed() {
60
+ return this[CLOSED];
61
+ }
62
+ slice() {
63
+ const size = this.size;
64
+
65
+ const start = arguments[0];
66
+ const end = arguments[1];
67
+ let relativeStart, relativeEnd;
68
+ if (start === undefined) {
69
+ relativeStart = 0;
70
+ } else if (start < 0) {
71
+ relativeStart = Math.max(size + start, 0);
72
+ } else {
73
+ relativeStart = Math.min(start, size);
74
+ }
75
+ if (end === undefined) {
76
+ relativeEnd = size;
77
+ } else if (end < 0) {
78
+ relativeEnd = Math.max(size + end, 0);
79
+ } else {
80
+ relativeEnd = Math.min(end, size);
81
+ }
82
+ const span = Math.max(relativeEnd - relativeStart, 0);
83
+
84
+ const buffer = this.buffer;
85
+ const slicedBuffer = buffer.slice(
86
+ relativeStart,
87
+ relativeStart + span
88
+ );
89
+ const blob = new Blob([], { type: arguments[2] });
90
+ blob.buffer = slicedBuffer;
91
+ blob[CLOSED] = this[CLOSED];
92
+ return blob;
93
+ }
94
+ close() {
95
+ this[CLOSED] = true;
96
+ }
97
+ };
98
+
99
+ Object.defineProperty(Blob.prototype, Symbol.toStringTag, {
100
+ value: 'BlobPrototype',
101
+ writable: false,
102
+ enumerable: false,
103
+ configurable: true
104
+ });
105
+
106
+ module.exports = Blob;
@@ -1,5 +1,5 @@
1
1
  const FileAPI = require('file-api');
2
- const Blob = require('node-blob');
2
+ const Blob = require('./node-blob');
3
3
  const XMLHttpRequest = require('xhr2');
4
4
 
5
5
  const File = FileAPI.File;