@maxelms/create-plugin-cli 1.1.35 → 1.1.36

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/lib/index.js CHANGED
@@ -69,9 +69,9 @@ var ConfigTypeEnum;
69
69
  ConfigTypeEnum["HTML"] = "html";
70
70
  })(ConfigTypeEnum || (ConfigTypeEnum = {}));
71
71
  var create = function (pluginName, options) { return __awaiter(void 0, void 0, void 0, function () {
72
- var targetDir, PROJECT_TYPE, PROJECT_FRAME, PROJECT_CONFIG_TYPE, _a, TEMPLATE, type, _b, framework, configurationType, choices, _c, _d, templateName, templateDir, ignore, files, ejsData;
73
- return __generator(this, function (_e) {
74
- switch (_e.label) {
72
+ var targetDir, PROJECT_TYPE, PROJECT_FRAME, PROJECT_CONFIG_TYPE, _a, TEMPLATE, type, _b, framework, configurationType, choices, _c, templateName, templateDir, ignore, files, ejsData;
73
+ return __generator(this, function (_d) {
74
+ switch (_d.label) {
75
75
  case 0:
76
76
  console.log(figlet_1.default.textSync('maxelms cli'));
77
77
  targetDir = path_1.default.resolve(process.cwd(), pluginName);
@@ -88,29 +88,29 @@ var create = function (pluginName, options) { return __awaiter(void 0, void 0, v
88
88
  message: '请选择项目类型:',
89
89
  choices: [
90
90
  {
91
- name: '页面组件(组件将会在布局设计器中作为基础物料拖拽使用)',
91
+ name: '页面组件(页面设计器配置)',
92
92
  value: ProjectTypeEnum.MICROPLUGIN
93
93
  },
94
94
  {
95
- name: '属性组件(替换系统内置属性组件)',
95
+ name: '属性组件(属性组件配置)',
96
96
  value: ProjectTypeEnum.MICROFIELD
97
97
  },
98
98
  {
99
- name: '微应用(可以在业务前台、业务后台)',
99
+ name: '微应用(菜单应用)',
100
100
  value: ProjectTypeEnum.MICROAPP
101
101
  },
102
102
  {
103
- name: '按钮组件(自定义标准实体按钮行为、扩展业务后台)',
103
+ name: '按钮组件(按钮配置)',
104
104
  value: ProjectTypeEnum.MICROBUTTON
105
105
  },
106
106
  // {
107
107
  // name: '导航组件(替换系统内置的导航组件)',
108
108
  // value: ProjectTypeEnum.NAV
109
109
  // },
110
- {
111
- name: '主题样式(通过 css 样式表覆盖系统默认样式)',
112
- value: ProjectTypeEnum.STYLE
113
- },
110
+ // {
111
+ // name: '主题样式(通过 css 样式表覆盖系统默认样式)',
112
+ // value: ProjectTypeEnum.STYLE
113
+ // },
114
114
  // {
115
115
  // name: '扩展脚本(在系统初始化时加载并执行指定的 js 文件)',
116
116
  // value: ProjectTypeEnum.SCRIPT
@@ -118,8 +118,8 @@ var create = function (pluginName, options) { return __awaiter(void 0, void 0, v
118
118
  ],
119
119
  }).then(function (re) { return re.type; })];
120
120
  case 1:
121
- _b = (_e.sent());
122
- _e.label = 2;
121
+ _b = (_d.sent());
122
+ _d.label = 2;
123
123
  case 2:
124
124
  type = _b;
125
125
  framework = '';
@@ -128,7 +128,7 @@ var create = function (pluginName, options) { return __awaiter(void 0, void 0, v
128
128
  ProjectTypeEnum.NAV,
129
129
  ProjectTypeEnum.STYLE,
130
130
  ProjectTypeEnum.SCRIPT
131
- ].includes(type)) return [3 /*break*/, 7];
131
+ ].includes(type)) return [3 /*break*/, 5];
132
132
  choices = frameworks.map(function (framework) {
133
133
  return {
134
134
  name: framework,
@@ -149,31 +149,29 @@ var create = function (pluginName, options) { return __awaiter(void 0, void 0, v
149
149
  choices: choices,
150
150
  }).then(function (re) { return re.framework; })];
151
151
  case 3:
152
- _c = (_e.sent());
153
- _e.label = 4;
152
+ _c = (_d.sent());
153
+ _d.label = 4;
154
154
  case 4:
155
155
  framework = _c;
156
- if (!(type === ProjectTypeEnum.MICROFIELD || type === ProjectTypeEnum.MICROPLUGIN || type === ProjectTypeEnum.MICROBUTTON)) return [3 /*break*/, 7];
157
- _d = ConfigTypeEnum[PROJECT_CONFIG_TYPE];
158
- if (_d) return [3 /*break*/, 6];
159
- return [4 /*yield*/, inquirer_1.default.prompt({
160
- name: 'configurationType',
161
- type: 'list',
162
- message: '请选择配置类型:',
163
- choices: Object.keys(ConfigTypeEnum).map(function (key) {
164
- return {
165
- name: key,
166
- value: ConfigTypeEnum[key],
167
- };
168
- }),
169
- }).then(function (re) { return re.configurationType; })];
156
+ if (type === ProjectTypeEnum.MICROFIELD || type === ProjectTypeEnum.MICROPLUGIN || type === ProjectTypeEnum.MICROBUTTON) {
157
+ configurationType = ConfigTypeEnum.JSON;
158
+ // } else {
159
+ // configurationType = ConfigTypeEnum[PROJECT_CONFIG_TYPE] || await inquirer.prompt(
160
+ // {
161
+ // name: 'configurationType',
162
+ // type: 'list',
163
+ // message: '请选择配置类型:',
164
+ // choices: Object.keys(ConfigTypeEnum).map((key) => {
165
+ // return {
166
+ // name: key,
167
+ // value: ConfigTypeEnum[key as keyof typeof ConfigTypeEnum],
168
+ // };
169
+ // }),
170
+ // },
171
+ // ).then((re: any) => re.configurationType)
172
+ }
173
+ _d.label = 5;
170
174
  case 5:
171
- _d = (_e.sent());
172
- _e.label = 6;
173
- case 6:
174
- configurationType = _d;
175
- _e.label = 7;
176
- case 7:
177
175
  templateName = "".concat(framework, "-").concat(type);
178
176
  if (type === ProjectTypeEnum.NAV) {
179
177
  templateName = 'maxelms-navigation';
@@ -199,8 +197,8 @@ var create = function (pluginName, options) { return __awaiter(void 0, void 0, v
199
197
  ignore.push.apply(ignore, ['**/configuration/**', '**/configuration.html']);
200
198
  }
201
199
  return [4 /*yield*/, (0, utils_1.readFiles)(templateDir, ignore)];
202
- case 8:
203
- files = _e.sent();
200
+ case 6:
201
+ files = _d.sent();
204
202
  ejsData = {
205
203
  pluginName: pluginName,
206
204
  configurationType: configurationType,
@@ -210,8 +208,8 @@ var create = function (pluginName, options) { return __awaiter(void 0, void 0, v
210
208
  };
211
209
  (0, utils_1.replaceTplVars)(files, ejsData);
212
210
  return [4 /*yield*/, (0, utils_1.writeFiles)(targetDir, files)];
213
- case 9:
214
- _e.sent();
211
+ case 7:
212
+ _d.sent();
215
213
  // if (
216
214
  // [
217
215
  // ProjectTypeEnum.MICROFIELD,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxelms/create-plugin-cli",
3
- "version": "1.1.35",
3
+ "version": "1.1.36",
4
4
  "main": "./bin/index.js",
5
5
  "author": "jackc_001",
6
6
  "bin": {
@@ -40,7 +40,7 @@ const config = {
40
40
  cookieDomainRewrite: '',
41
41
  },
42
42
  },
43
- static: [{
43
+ static: [ {
44
44
  directory: path.join(__dirname, 'public/'),
45
45
  }],
46
46
  },
@@ -40,7 +40,7 @@ const config = {
40
40
  cookieDomainRewrite: '',
41
41
  },
42
42
  },
43
- static: [ {
43
+ static: [{
44
44
  directory: path.join(__dirname, 'public/'),
45
45
  }],
46
46
  },
@@ -7,25 +7,13 @@ import styles from './index.less'
7
7
  const Home = () => {
8
8
  /** 平台传递给微应用的状态数据 */
9
9
  const props = React.useContext(MasterContext)
10
- /** 当组件运行在 系统应用时才存在 props 属性 */
11
- const { configurations } = props || {}
12
- /** configurations 是组件的配置项信息 */
13
- const {
14
- propName1: placeholder,
15
- propName2: width = 350,
16
- propName3: disabled,
17
- } = configurations || {}
10
+ console.log('props', props)
18
11
 
19
12
  return (
20
13
  <div className={styles.container}>
21
- <div>
22
- <Input
23
- style={{ width }}
24
- disabled={disabled}
25
- placeholder={placeholder}
26
- defaultValue="欢迎使用 Maxelms 微应用"
27
- />
28
- </div>
14
+ <Input
15
+ defaultValue="欢迎使用 Maxelms 微应用"
16
+ />
29
17
  </div>
30
18
  );
31
19
  };
@@ -6,6 +6,7 @@ const App = (props: any) => {
6
6
  const { originalButtonProps, bizData, pluginEnv, userInfo } = props
7
7
  const { name = <button>自定义按钮</button> } = originalButtonProps || {}
8
8
  const [visible, setVisible] = React.useState(false)
9
+ console.log('props', props)
9
10
 
10
11
  const onOk = () => {
11
12
  setVisible(false)
@@ -7,12 +7,7 @@ const prefixCls = 'maxelms-customize-component-<%= timestamp %>'
7
7
  const App = (props: any) => {
8
8
  /** 当组件运行在 系统应用时才存在 props 属性 */
9
9
  const { configurations, value, onChange, readOnly } = props
10
- /** configurations 是组件的配置项信息 */
11
- const {
12
- propName1: placeholder,
13
- propName2: width = 350,
14
- propName3: disabled,
15
- } = configurations || {}
10
+ console.log('props', props)
16
11
 
17
12
  /** value、onChange 是属性组件作为表单受控组件的必要属性 */
18
13
  const inputValue = value?.value || "欢迎使用 Maxelms 属性组件"
@@ -36,11 +31,8 @@ const App = (props: any) => {
36
31
  <div className={prefixCls}>
37
32
  <div>
38
33
  <Input
39
- style={{ width }}
40
34
  value={inputValue}
41
35
  onChange={onInputChange}
42
- disabled={disabled}
43
- placeholder={placeholder}
44
36
  />
45
37
  </div>
46
38
  </div>
@@ -32,7 +32,7 @@ const config = {
32
32
  port: 8080,
33
33
  headers: {
34
34
  'Access-Control-Allow-Origin': '*',
35
- },
35
+ }
36
36
  },
37
37
  plugins: [
38
38
  new CleanWebpackPlugin(),
@@ -6,21 +6,12 @@ const prefixCls = 'maxelms-customize-component-<%= timestamp %>'
6
6
 
7
7
  const App = (props: any) => {
8
8
  /** 当组件运行在 系统应用时才存在 props 属性 */
9
- /** configurations 是组件的配置项信息 */
10
- const { configurations } = props
11
- const {
12
- propName1: placeholder,
13
- propName2: width = 350,
14
- propName3: disabled,
15
- } = configurations || {}
9
+ console.log('props', props)
16
10
 
17
11
  return (
18
12
  <div className={prefixCls}>
19
13
  <div>
20
14
  <Input
21
- style={{ width }}
22
- disabled={disabled}
23
- placeholder={placeholder}
24
15
  defaultValue="欢迎使用 Maxelms 页面组件"
25
16
  />
26
17
  </div>
@@ -28,7 +28,6 @@ module.exports = {
28
28
  "Access-Control-Allow-Origin": "*",
29
29
  },
30
30
  port: 8080,
31
- // open: ['/'],
32
31
  },
33
32
  chainWebpack: (config) => {
34
33
  config.module
@@ -45,6 +44,11 @@ module.exports = {
45
44
  { from: 'README.md' },
46
45
  { from: 'manifest.json' },
47
46
  ]),
48
- ]
47
+ ],
48
+ resolve: {
49
+ alias: {
50
+ 'vue$': 'vue/dist/vue.esm-bundler.js'
51
+ }
52
+ }
49
53
  },
50
54
  };
@@ -28,7 +28,7 @@ module.exports = {
28
28
  "Access-Control-Allow-Origin": "*",
29
29
  },
30
30
  port: 8080,
31
- open: ['/']
31
+ open: ['/'],
32
32
  },
33
33
  chainWebpack: (config) => {
34
34
  config.module
@@ -44,7 +44,12 @@ module.exports = {
44
44
  new CopyWebpackPlugin([
45
45
  { from: 'README.md' },
46
46
  { from: 'manifest.json' },
47
- ]),
48
- ]
47
+ ])
48
+ ],
49
+ resolve: {
50
+ alias: {
51
+ 'vue$': 'vue/dist/vue.esm-bundler.js'
52
+ }
53
+ }
49
54
  },
50
55
  };
@@ -28,7 +28,7 @@ module.exports = {
28
28
  "Access-Control-Allow-Origin": "*",
29
29
  },
30
30
  port: 8080,
31
- open: ['/']
31
+ open: ['/'],
32
32
  },
33
33
  chainWebpack: (config) => {
34
34
  config.module
@@ -47,6 +47,11 @@ module.exports = {
47
47
  { from: 'README.md' },
48
48
  { from: 'manifest.json' },
49
49
  ]),
50
- ]
50
+ ],
51
+ resolve: {
52
+ alias: {
53
+ 'vue$': 'vue/dist/vue.esm-bundler.js'
54
+ }
55
+ }
51
56
  },
52
57
  };
@@ -31,8 +31,10 @@ export default {
31
31
  },
32
32
  methods: {
33
33
  updateMasterProps(newProps) {
34
- // 更新本地数据,这会触发响应式更新
35
- Object.assign(this.masterProps, newProps);
34
+ if (this.masterProps) {
35
+ // 更新本地数据,触发响应式更新
36
+ Object.assign(this.masterProps, newProps);
37
+ }
36
38
  },
37
39
  },
38
40
  created() {
@@ -40,6 +40,7 @@ module.exports = {
40
40
  { from: 'README.md' },
41
41
  { from: 'manifest.json' },
42
42
  ]),
43
+
43
44
  ],
44
45
  resolve: {
45
46
  alias: {
@@ -34,8 +34,10 @@ export default {
34
34
  },
35
35
  methods: {
36
36
  updateMasterProps(newProps) {
37
- // 更新本地数据,触发响应式更新
38
- Object.assign(this.masterProps, newProps);
37
+ if (this.masterProps) {
38
+ // 更新本地数据,触发响应式更新
39
+ Object.assign(this.masterProps, newProps);
40
+ }
39
41
  },
40
42
  change(e) {
41
43
  this.onChange && this.onChange({
@@ -22,12 +22,19 @@ export default {
22
22
  props: {
23
23
  mainProps: {}
24
24
  },
25
+ data() {
26
+ return {
27
+ masterProps: { ...this.mainProps }
28
+ }
29
+ },
25
30
  components: {
26
31
  },
27
32
  methods: {
28
33
  updateMasterProps(newProps) {
29
- // 更新本地数据,触发响应式更新
30
- Object.assign(this.masterProps, newProps);
34
+ if (this.masterProps) {
35
+ // 更新本地数据,触发响应式更新
36
+ Object.assign(this.masterProps, newProps);
37
+ }
31
38
  },
32
39
  },
33
40
  computed: {
@@ -28,12 +28,14 @@ export default {
28
28
  methods: {
29
29
  // 正确的方法来更新 masterProps
30
30
  updateMasterProps(newProps) {
31
- // 更新本地数据,触发响应式更新
32
- Object.assign(this.masterProps, newProps);
31
+ if (this.masterProps) {
32
+ // 更新本地数据,触发响应式更新
33
+ Object.assign(this.masterProps, newProps);
34
+ }
33
35
  },
34
36
  },
35
37
  created() {
36
-
38
+ console.log('masterProps', this.masterProps)
37
39
  }
38
40
  }
39
41
  </script>
@@ -28,8 +28,10 @@ export default {
28
28
  methods: {
29
29
  // 正确的方法来更新 masterProps
30
30
  updateMasterProps(newProps) {
31
- // 更新本地数据,触发响应式更新
32
- Object.assign(this.masterProps, newProps);
31
+ if (this.masterProps) {
32
+ // 更新本地数据,触发响应式更新
33
+ Object.assign(this.masterProps, newProps);
34
+ }
33
35
  },
34
36
  },
35
37
  computed: {