neo-cmp-cli 1.0.0

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.
Files changed (76) hide show
  1. package/README.md +236 -0
  2. package/bin/neo.js +2 -0
  3. package/package.json +74 -0
  4. package/src/config/default.config.js +136 -0
  5. package/src/config/index.js +9 -0
  6. package/src/initData/defaultTemplate.html +13 -0
  7. package/src/initData/neo.config.js +99 -0
  8. package/src/module/index.js +244 -0
  9. package/src/module/inspect.js +40 -0
  10. package/src/module/main.js +109 -0
  11. package/src/module/neoInit.js +44 -0
  12. package/src/module/neoInitByCopy.js +37 -0
  13. package/src/oss/publish2oss.js +218 -0
  14. package/src/plugins/README.md +2 -0
  15. package/src/template/react-custom-widget-template/.editorconfig +10 -0
  16. package/src/template/react-custom-widget-template/.prettierrc.js +12 -0
  17. package/src/template/react-custom-widget-template/README.md +51 -0
  18. package/src/template/react-custom-widget-template/commitlint.config.js +59 -0
  19. package/src/template/react-custom-widget-template/neo.config.js +112 -0
  20. package/src/template/react-custom-widget-template/package.json +56 -0
  21. package/src/template/react-custom-widget-template/public/css/base.css +283 -0
  22. package/src/template/react-custom-widget-template/public/scripts/app/bluebird.js +6679 -0
  23. package/src/template/react-custom-widget-template/public/template.html +13 -0
  24. package/src/template/react-custom-widget-template/src/assets/css/common.scss +127 -0
  25. package/src/template/react-custom-widget-template/src/assets/css/mixin.scss +47 -0
  26. package/src/template/react-custom-widget-template/src/components/info-card/index.jsx +45 -0
  27. package/src/template/react-custom-widget-template/src/components/info-card/model.js +81 -0
  28. package/src/template/react-custom-widget-template/src/components/info-card/register.js +4 -0
  29. package/src/template/react-custom-widget-template/src/components/info-card/style.scss +67 -0
  30. package/src/template/react-custom-widget-template/src/preview.js +5 -0
  31. package/src/template/react-ts-custom-widget-template/.editorconfig +10 -0
  32. package/src/template/react-ts-custom-widget-template/.prettierrc.js +12 -0
  33. package/src/template/react-ts-custom-widget-template/README.md +53 -0
  34. package/src/template/react-ts-custom-widget-template/commitlint.config.js +59 -0
  35. package/src/template/react-ts-custom-widget-template/neo.config.js +106 -0
  36. package/src/template/react-ts-custom-widget-template/package.json +59 -0
  37. package/src/template/react-ts-custom-widget-template/public/css/base.css +283 -0
  38. package/src/template/react-ts-custom-widget-template/public/scripts/app/bluebird.js +6679 -0
  39. package/src/template/react-ts-custom-widget-template/public/template.html +13 -0
  40. package/src/template/react-ts-custom-widget-template/src/assets/css/common.scss +127 -0
  41. package/src/template/react-ts-custom-widget-template/src/assets/css/mixin.scss +47 -0
  42. package/src/template/react-ts-custom-widget-template/src/components/info-card/index.tsx +70 -0
  43. package/src/template/react-ts-custom-widget-template/src/components/info-card/plugin.ts +80 -0
  44. package/src/template/react-ts-custom-widget-template/src/components/info-card/register.ts +5 -0
  45. package/src/template/react-ts-custom-widget-template/src/components/info-card/style.scss +105 -0
  46. package/src/template/react-ts-custom-widget-template/src/components/list-widget/README.md +2 -0
  47. package/src/template/react-ts-custom-widget-template/src/components/list-widget/index.tsx +208 -0
  48. package/src/template/react-ts-custom-widget-template/src/components/list-widget/model.ts +92 -0
  49. package/src/template/react-ts-custom-widget-template/src/components/list-widget/register.ts +5 -0
  50. package/src/template/react-ts-custom-widget-template/src/components/list-widget/style.scss +350 -0
  51. package/src/template/react-ts-custom-widget-template/src/preview.tsx +37 -0
  52. package/src/template/react-ts-custom-widget-template/tsconfig.json +68 -0
  53. package/src/template/vue2-neo-custom-widget/.editorconfig +10 -0
  54. package/src/template/vue2-neo-custom-widget/.prettierrc.js +12 -0
  55. package/src/template/vue2-neo-custom-widget/README.md +52 -0
  56. package/src/template/vue2-neo-custom-widget/commitlint.config.js +59 -0
  57. package/src/template/vue2-neo-custom-widget/neo.config.js +122 -0
  58. package/src/template/vue2-neo-custom-widget/package.json +59 -0
  59. package/src/template/vue2-neo-custom-widget/public/css/base.css +283 -0
  60. package/src/template/vue2-neo-custom-widget/public/scripts/app/bluebird.js +6679 -0
  61. package/src/template/vue2-neo-custom-widget/public/template.html +13 -0
  62. package/src/template/vue2-neo-custom-widget/src/assets/css/common.scss +126 -0
  63. package/src/template/vue2-neo-custom-widget/src/assets/css/mixin.scss +47 -0
  64. package/src/template/vue2-neo-custom-widget/src/preview.js +9 -0
  65. package/src/template/vue2-neo-custom-widget/src/widgets/info-card/index.vue +131 -0
  66. package/src/template/vue2-neo-custom-widget/src/widgets/info-card/plugin.js +81 -0
  67. package/src/template/vue2-neo-custom-widget/src/widgets/info-card/register.js +8 -0
  68. package/src/utils/getConfigObj.js +18 -0
  69. package/src/utils/getEntries.js +54 -0
  70. package/src/utils/neoConfigInit.js +13 -0
  71. package/src/utils/neoParams.js +12 -0
  72. package/src/utils/pathUtils.js +23 -0
  73. package/src/utils/projectNameValidator.js +76 -0
  74. package/src/utils/replaceInFiles.js +47 -0
  75. package/src/utils/replaceInPackage.js +134 -0
  76. package/test/demo.js +3 -0
@@ -0,0 +1,92 @@
1
+ /**
2
+ * @file 列表组件对接编辑器的描述文件
3
+ */
4
+ // @ts-ignore
5
+ import { registerNeoEditorModel } from 'neo-register';
6
+
7
+ export class ListWidgetModel {
8
+ // 自定义组件名称,用于标识组件的唯一性
9
+ cmpType: string = 'list-widget';
10
+
11
+ // 组件名称,用于设置在编辑器左侧组件面板中展示的名称
12
+ label: string = '列表组件';
13
+
14
+ // 组件描述,用于设置在编辑器左侧组件面板中展示的描述
15
+ description: string = '支持配置的列表展示组件,内置模拟数据';
16
+
17
+ // 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
18
+ tags: string[] = ['自定义组件'];
19
+
20
+ // 组件图标,用于设置在编辑器左侧组件面板中展示的图标
21
+ iconSrc: string = 'https://neo-widgets.bj.bcebos.com/favicon.png';
22
+ // iconSrc: string = 'https://custom-widgets.bj.bcebos.com/custom-icon1.svg'; // custom-icon2
23
+
24
+ // 初次插入页面的默认属性数据
25
+ defaultComProps = {
26
+ title: '内容列表',
27
+ label: '列表组件',
28
+ showImage: true,
29
+ showTags: true,
30
+ itemCount: 8,
31
+ listType: 'default',
32
+ };
33
+
34
+ // 设计器端预览时展示的默认数据
35
+ previewComProps = {
36
+ label: '列表组件',
37
+ };
38
+
39
+ /**
40
+ * 组件面板配置,用于生成编辑器右侧属性配置面板内容
41
+ */
42
+ propsSchema = [
43
+ {
44
+ type: 'text',
45
+ name: 'title',
46
+ label: '列表标题',
47
+ value: '内容列表',
48
+ },
49
+ {
50
+ type: 'switch',
51
+ name: 'showImage',
52
+ label: '显示图片',
53
+ value: true,
54
+ },
55
+ {
56
+ type: 'switch',
57
+ name: 'showTags',
58
+ label: '显示标签',
59
+ value: true,
60
+ },
61
+ {
62
+ type: 'number',
63
+ name: 'itemCount',
64
+ label: '列表项数量',
65
+ value: 8,
66
+ min: 1,
67
+ max: 50,
68
+ },
69
+ {
70
+ type: 'radios',
71
+ name: 'listType',
72
+ label: '列表样式',
73
+ value: 'default',
74
+ options: [
75
+ { label: '默认样式', value: 'default' },
76
+ { label: '卡片样式', value: 'card' },
77
+ { label: '简洁样式', value: 'simple' },
78
+ ],
79
+ },
80
+ ];
81
+
82
+ // 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
83
+ /*
84
+ propsSchemaCreator = (com: any) => {
85
+ return [];
86
+ };
87
+ */
88
+ }
89
+
90
+ registerNeoEditorModel(ListWidgetModel);
91
+
92
+ export default ListWidgetModel;
@@ -0,0 +1,5 @@
1
+ import ListWidget from './index';
2
+ // @ts-ignore
3
+ import { registerNeoCmp } from 'neo-register';
4
+
5
+ registerNeoCmp(ListWidget, 'list-widget');
@@ -0,0 +1,350 @@
1
+ :root {
2
+ --list-padding: 16px;
3
+ --list-border-radius: 8px;
4
+ --list-shadow: 0 2px 8px rgb(0 0 0 / 10%);
5
+ --list-hover-shadow: 0 4px 12px rgb(0 0 0 / 15%);
6
+ }
7
+
8
+ .list-widget-container {
9
+ position: relative;
10
+ box-sizing: border-box;
11
+ margin: 12px;
12
+ padding: var(--list-padding);
13
+ background-color: #fff;
14
+ border-radius: var(--list-border-radius);
15
+ box-shadow: var(--list-shadow);
16
+
17
+ .list-header {
18
+ margin-bottom: 20px;
19
+ padding-bottom: 16px;
20
+ border-bottom: 2px solid #f0f0f0;
21
+ position: relative;
22
+
23
+ &::after {
24
+ content: '';
25
+ position: absolute;
26
+ bottom: -2px;
27
+ left: 0;
28
+ width: 40px;
29
+ height: 2px;
30
+ background: linear-gradient(90deg, #1890ff, #40a9ff);
31
+ border-radius: 1px;
32
+ }
33
+
34
+ .list-title {
35
+ margin: 0;
36
+ color: #262626;
37
+ font-weight: 600;
38
+ font-size: 20px;
39
+ position: relative;
40
+ }
41
+ }
42
+
43
+ .list-content {
44
+ .list-item {
45
+ padding: 18px 0;
46
+ border-bottom: 1px solid #f5f5f5;
47
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
48
+ position: relative;
49
+
50
+ &::before {
51
+ content: '';
52
+ position: absolute;
53
+ left: 0;
54
+ top: 0;
55
+ bottom: 0;
56
+ width: 3px;
57
+ background: linear-gradient(180deg, #1890ff, #40a9ff);
58
+ opacity: 0;
59
+ transition: opacity 0.3s ease;
60
+ border-radius: 0 2px 2px 0;
61
+ }
62
+
63
+ &:hover {
64
+ background-color: #fafafa;
65
+ border-radius: 8px;
66
+ margin: 0 -12px;
67
+ padding: 18px 12px;
68
+ box-shadow: var(--list-hover-shadow);
69
+ transform: translateX(4px);
70
+
71
+ &::before {
72
+ opacity: 1;
73
+ }
74
+ }
75
+
76
+ &:last-child {
77
+ border-bottom: none;
78
+ }
79
+
80
+ .item-image {
81
+ width: 100%;
82
+ height: 200px;
83
+ margin-bottom: 16px;
84
+ border-radius: 8px;
85
+ overflow: hidden;
86
+ position: relative;
87
+
88
+ img {
89
+ width: 100%;
90
+ height: 100%;
91
+ object-fit: cover;
92
+ transition: transform 0.3s ease;
93
+ }
94
+
95
+ &:hover img {
96
+ transform: scale(1.05);
97
+ }
98
+ }
99
+
100
+ .item-content {
101
+ .item-header {
102
+ display: flex;
103
+ justify-content: space-between;
104
+ align-items: flex-start;
105
+ margin-bottom: 8px;
106
+ gap: 12px;
107
+
108
+ .item-title {
109
+ margin: 0;
110
+ color: #262626;
111
+ font-weight: 500;
112
+ line-height: 1.4;
113
+ flex: 1;
114
+ font-size: 16px;
115
+ }
116
+
117
+ .item-status {
118
+ padding: 2px 6px;
119
+ border-radius: 4px;
120
+ font-size: 11px;
121
+ line-height: 1.2;
122
+ font-weight: 500;
123
+
124
+ &.status-green {
125
+ background-color: #f6ffed;
126
+ color: #52c41a;
127
+ border: 1px solid #b7eb8f;
128
+ }
129
+
130
+ &.status-orange {
131
+ background-color: #fff7e6;
132
+ color: #fa8c16;
133
+ border: 1px solid #ffd591;
134
+ }
135
+
136
+ &.status-gray {
137
+ background-color: #f5f5f5;
138
+ color: #8c8c8c;
139
+ border: 1px solid #d9d9d9;
140
+ }
141
+ }
142
+ }
143
+
144
+ .item-description {
145
+ margin-bottom: 12px;
146
+ line-height: 1.6;
147
+ color: #595959;
148
+ font-size: 14px;
149
+ display: box;
150
+ -webkit-line-clamp: 2;
151
+ line-clamp: 2;
152
+ -webkit-box-orient: vertical;
153
+ overflow: hidden;
154
+ text-overflow: ellipsis;
155
+ }
156
+
157
+ .item-meta {
158
+ display: flex;
159
+ justify-content: space-between;
160
+ align-items: center;
161
+ flex-wrap: wrap;
162
+ gap: 8px;
163
+
164
+ .item-meta-info {
165
+ display: flex;
166
+ align-items: center;
167
+ gap: 8px;
168
+
169
+ .meta-item {
170
+ color: #8c8c8c;
171
+ font-size: 12px;
172
+ }
173
+
174
+ .meta-separator {
175
+ color: #8c8c8c;
176
+ font-size: 12px;
177
+ }
178
+ }
179
+
180
+ .item-tags {
181
+ display: flex;
182
+ gap: 6px;
183
+ flex-wrap: wrap;
184
+
185
+ .tag {
186
+ padding: 2px 6px;
187
+ background-color: #e6f7ff;
188
+ color: #1890ff;
189
+ border: 1px solid #91d5ff;
190
+ border-radius: 4px;
191
+ font-size: 11px;
192
+ line-height: 1.2;
193
+ }
194
+ }
195
+ }
196
+ }
197
+ }
198
+
199
+ // 卡片样式
200
+ &.list-card {
201
+ .list-item {
202
+ margin-bottom: 12px;
203
+ padding: 16px;
204
+ background: #fff;
205
+ border: 1px solid #f0f0f0;
206
+ border-radius: var(--list-border-radius);
207
+ box-shadow: 0 1px 3px rgb(0 0 0 / 10%);
208
+
209
+ &:hover {
210
+ box-shadow: var(--list-hover-shadow);
211
+ border-color: #d9d9d9;
212
+ transform: translateY(-2px);
213
+ }
214
+
215
+ &:last-child {
216
+ margin-bottom: 0;
217
+ }
218
+
219
+ .item-image {
220
+ height: 180px;
221
+ margin-bottom: 12px;
222
+ }
223
+ }
224
+ }
225
+
226
+ // 简洁样式
227
+ &.list-simple {
228
+ .list-item {
229
+ padding: 12px 0;
230
+ border-bottom: 1px solid #f0f0f0;
231
+
232
+ &:hover {
233
+ background-color: transparent;
234
+ box-shadow: none;
235
+ margin: 0;
236
+ padding: 12px 6px;
237
+ }
238
+
239
+ .item-image {
240
+ height: 120px;
241
+ margin-bottom: 8px;
242
+ }
243
+
244
+ .item-content {
245
+ .item-header {
246
+ margin-bottom: 4px;
247
+
248
+ .item-title {
249
+ font-size: 14px;
250
+ font-weight: 400;
251
+ }
252
+ }
253
+
254
+ .item-description {
255
+ font-size: 12px;
256
+ color: #8c8c8c;
257
+ margin-bottom: 8px;
258
+ -webkit-line-clamp: 1;
259
+ line-clamp: 1;
260
+ }
261
+
262
+ .item-meta {
263
+ .item-tags {
264
+ .tag {
265
+ font-size: 10px;
266
+ padding: 1px 4px;
267
+ line-height: 1.1;
268
+ }
269
+ }
270
+ }
271
+ }
272
+ }
273
+ }
274
+ }
275
+ }
276
+
277
+ // 响应式设计
278
+ @media (max-width: 768px) {
279
+ .list-widget-container {
280
+ margin: 8px;
281
+ padding: 12px;
282
+
283
+ .list-content {
284
+ .list-item {
285
+ .item-content {
286
+ .item-header {
287
+ flex-direction: column;
288
+ align-items: flex-start;
289
+ gap: 8px;
290
+
291
+ .item-title {
292
+ margin-right: 0;
293
+ }
294
+ }
295
+
296
+ .item-meta {
297
+ flex-direction: column;
298
+ align-items: flex-start;
299
+ gap: 8px;
300
+ }
301
+ }
302
+ }
303
+ }
304
+ }
305
+ }
306
+
307
+ // 暗色主题支持
308
+ @media (prefers-color-scheme: dark) {
309
+ .list-widget-container {
310
+ background-color: #1f1f1f;
311
+ color: #fff;
312
+
313
+ .list-header {
314
+ border-bottom-color: #303030;
315
+
316
+ .list-title {
317
+ color: #fff;
318
+ }
319
+ }
320
+
321
+ .list-content {
322
+ .list-item {
323
+ border-bottom-color: #303030;
324
+
325
+ &:hover {
326
+ background-color: #2a2a2a;
327
+ }
328
+
329
+ .item-content {
330
+ .item-header {
331
+ .item-title {
332
+ color: #fff;
333
+ }
334
+ }
335
+
336
+ .item-description {
337
+ color: #ccc;
338
+ }
339
+ }
340
+ }
341
+
342
+ &.list-card {
343
+ .list-item {
344
+ background: #1f1f1f;
345
+ border-color: #303030;
346
+ }
347
+ }
348
+ }
349
+ }
350
+ }
@@ -0,0 +1,37 @@
1
+ import * as React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import InfoCard from './components/info-card';
4
+ import ListWidget from './components/list-widget';
5
+
6
+ /* 引入公共的静态资源 */
7
+ import '$public/css/base.css';
8
+
9
+ // 预览 info-card 组件
10
+ ReactDOM.render(
11
+ <InfoCard
12
+ {...{
13
+ title:
14
+ 'neo-widget是开发neo自定义组件的工具集,提供注册neo自定义组件和neo-editor自定义组件模型的方法。',
15
+ backgroundImage: '',
16
+ imgCount: 101,
17
+ commentCount: 2022,
18
+ }}
19
+ />,
20
+ document.getElementById('root'),
21
+ );
22
+
23
+ /*
24
+ // 预览 list-widget 组件
25
+ ReactDOM.render(
26
+ <ListWidget
27
+ {...{
28
+ title: '内容列表预览',
29
+ showImage: true,
30
+ showTags: true,
31
+ itemCount: 6,
32
+ listType: 'default',
33
+ }}
34
+ />,
35
+ document.getElementById('root'),
36
+ );
37
+ */
@@ -0,0 +1,68 @@
1
+ {
2
+ "compilerOptions": {
3
+ "experimentalDecorators": true,
4
+ /* Basic Options */
5
+ "target": "esnext",
6
+ /* 指定编译之后的版本: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
7
+ "module": "esnext" /* 指定要使用的模板标准: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
8
+ // "lib": [], /* Specify library files to be included in the compilation. */
9
+ "allowJs": false /* 指定是否允许编译JS文件,默认false,即不编译JS文件. */,
10
+ // "checkJs": true, /* 指定是否检查和报告JS文件中的错误,默认false */
11
+ "jsx": "react" /* 指定jsx代码用于的开发环境:'preserve','react-native', or 'react'. */,
12
+ "declaration": false /* 指定是否在编译的时候生成相的d.ts声明文件 */,
13
+ // "declarationMap": true, /* 指定编译时是否生成.map文件 */
14
+ // "sourceMap": true, /* 指定编译时是否生成.map文件 */
15
+ // "outFile": "./", /* 指定输出文件合并为一个文件 */
16
+ // "outDir": "dist", /* 指定输出文件夹,值为一个文件夹路径字符串,输出的文件都将放置在这个文件夹*/
17
+ // "rootDir": "src", /* 指定编译文件的根目录,编译器会在根目录查找入口文件 */
18
+ // "composite": true, /* 是否编译构建引用项目 */
19
+ // "removeComments": true, /* 指定是否将编译后的文件注释删掉,设为true的话即删除注释,默认为false */
20
+ "noEmit": false /* 不生成编译文件 */,
21
+ "importHelpers": true /* 指定是否引入tslib里的复制工具函数,默认为false */,
22
+ // "downlevelIteration": true, /* 当target为"ES5"或"ES3"时,为"for-of" "spread"和"destructuring"中的迭代器提供完全支持 */
23
+ "isolatedModules": false /* 指定是否将每个文件作为单独的模块,默认为true */,
24
+
25
+ /* Strict Type-Checking Options */
26
+ "strict": false /* 指定是否启动所有类型检查 */,
27
+ "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
28
+ "strictNullChecks": true /* Enable strict null checks. */,
29
+ // "strictFunctionTypes": true, /* Enable strict checking of function types. */
30
+ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
31
+ "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
32
+ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
33
+
34
+ /* Additional Checks */
35
+ "noUnusedLocals": false /* Report errors on unused locals. */,
36
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
37
+ "noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
38
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
39
+
40
+ /* Module Resolution Options */
41
+ "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
42
+ "baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
43
+ "paths": {
44
+ "@": ["./src"]
45
+ } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
46
+ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
47
+ /* 指定声明文件或文件夹的路径列表,如果指定了此项,则只有在这里列出的声明文件才会被加载 */
48
+ "typeRoots": ["./@types", "./node_modules/@types"],
49
+ // "types": [], /* 指定需要包含的模块,只有在这里列出的模块的声明文件才会被加载 */
50
+ "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
51
+ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
52
+ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
53
+
54
+ /* Source Map Options */
55
+ // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
56
+ // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
57
+ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
58
+ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
59
+
60
+ /* Experimental Options */
61
+ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
62
+ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
63
+ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
64
+ // "suppressImplicitAnyIndexErrors": true /* Suppress --noImplicitAny errors for indexing objects lacking index signatures. See issue #1232 for more details. */
65
+ },
66
+ "include": ["src", "test"],
67
+ "exclude": ["node_modules"]
68
+ }
@@ -0,0 +1,10 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+ max_line_length = 80
@@ -0,0 +1,12 @@
1
+ /*
2
+ prettier 配置文件
3
+ 更多配置信息:https://prettier.io/docs/en/options.html
4
+ */
5
+ module.exports = {
6
+ semi: true, // Semicolons 分号,默认需要分号
7
+ tabWidth: 2, // 空格,默认 2,
8
+ useTabs: false,
9
+ singleQuote: true, // 单引号还是双引号,默认为false 双引号
10
+ trailingComma: 'all', // 逗号
11
+ jsxBracketSameLine: false, // 默认为false,Put the > of a multi-line JSX element at the end of the last line instead of being alone on the next line (does not apply to self closing elements).
12
+ };
@@ -0,0 +1,52 @@
1
+ ### 目录说明
2
+ - src: 自定义组件源码;
3
+ - src/assets: 存放组件静态资源,比如 css、img等;
4
+ - src/components: 存放自定义组件代码,每个自定义组件以自身名称作为目录进行存放;
5
+ - src/components/info-card/index.vue: 信息卡片自定义组件代码;
6
+ - src/components/info-card/register.js: 用于注册一个 neo 自定义组件,注册成功后编辑器画布区中才会正常展示自定义组件内容;
7
+ - src/components/info-card/model.js: 用于注册一个 neo-editor 自定义组件模型,注册成功后编辑器左侧组件面板中会展示;
8
+ - src/preview.js: 用于本地预览自定义组件内容;
9
+ - neo.config.js: neo-cmp-cli 配置文件。
10
+
11
+ ### 组件开发规范
12
+ - 存放在 src/components 目录下的自定义组件,默认 index 为自定义组件源码入口文件,register.[tj]s 为注册 Neo 组件的脚本文件,model.[tj]s 为自定义组件的描述文件(和页面设计器对接需要);
13
+ - 当 neo.config.js 中的 entry 为空或者不存在时,cli 将根据 src/components 目录下的自定义组件结构生成对应的 entry 配置(可在命令控制台查看生成的 entry 配置);
14
+ - 自定义组件中可用的配置项类型 请见 [当前可用表单项](https://github.com/wibetter/neo-register/blob/master/docs/FormItemType.md);
15
+ - 自定义组件最外层请设置一个唯一的 ClassName(比如 xx-cmpType-container),所有内容样式请放在该 ClassName 中。
16
+
17
+ ### 自定义组件注册器使用说明
18
+ - [neo-register 使用说明](https://www.npmjs.com/package/neo-register?activeTab=readme)
19
+
20
+ ### 开发说明
21
+
22
+ 1. **安装依赖**
23
+ ```bash
24
+ $ npm i 或者 yarn
25
+ ```
26
+
27
+ 2. **preview: 组件预览模式(带热更新)**
28
+ > preview模式:用于预览自定义组件内容。
29
+ ```bash
30
+ $ npm run preview
31
+ ```
32
+
33
+ 3. **linkDebug: 外链调试(在线上页面设计器端预览自定义组件)**
34
+ > linkDebug模式:用于在线上页面设计器中预览和调试自定义组件。
35
+ ```bash
36
+ $ npm run linkDebug
37
+ ```
38
+
39
+ 4. **build2lib: 构建自定义组件输出产物**
40
+ > build2lib模式:用于构建发布到 npm 中的文件,默认存放到 当前 dist 目录中。
41
+ ```bash
42
+ $ npm run build2lib
43
+ ```
44
+
45
+ 5. **发布到对象存储服务中**
46
+ > 需要确保 package.json 中的 name 值唯一,version 值不重复。
47
+ ```bash
48
+ $ npm run publish2oss
49
+ ```
50
+
51
+ ### 配置项说明(neo-cmp-cli)
52
+ [请查看neo-cmp-cli](https://github.com/wibetter/neo-cmp-cli)
@@ -0,0 +1,59 @@
1
+ /**
2
+ * https://www.npmjs.com/package/@commitlint/config-conventional\
3
+ *
4
+ * Git提交规范-配置文件
5
+ * Commit message 由Header、Body 和 Footer三个部分组成,其格式如下:
6
+ * <type>(<scope>): <subject>
7
+ * <BLANK LINE>
8
+ * <body>
9
+ * <BLANK LINE>
10
+ * <footer>
11
+ *
12
+ *【备注】
13
+ * type 用于说明 commit 的类别,常用下面 7 个标识:
14
+ * scope 用于说明当前功能点作用于哪个页面或者哪个功能模块;
15
+ * subject 用于简短的描述当前commit,不超过50个字符;
16
+ * body 用于填写对本次 commit 的详细描述,可以分成多行;
17
+ * footer 不兼容变动声明,或者关闭 Issue。
18
+ *
19
+ * 【type类型取值类型】
20
+ * feat:新功能(feature)
21
+ * fix:功能优化
22
+ * bug:修补bug
23
+ * docs:文档(documentation)
24
+ * style:格式(不影响代码运行的变动)
25
+ * refactor:重构(即不是新增功能,也不是修改bug的代码变动)
26
+ * test:增加测试
27
+ * chore:构建过程或辅助工具的变动
28
+ * build:影响构建系统或外部依赖项的更改(示例范围:gulp,broccoli,npm)
29
+ * ci:对 CI 配置文件和脚本的更改(示例范围:Travis,Circle,BrowserStack,SauceLabs)
30
+ * perf:改进性能的代码更改
31
+ *
32
+ */
33
+
34
+ module.exports = {
35
+ extends: ['@commitlint/config-conventional'],
36
+ rules: {
37
+ 'type-enum': [
38
+ 2,
39
+ 'always',
40
+ [
41
+ 'feat',
42
+ 'fix',
43
+ 'bug',
44
+ 'docs',
45
+ 'style',
46
+ 'refactor',
47
+ 'test',
48
+ 'chore',
49
+ 'perf',
50
+ 'build',
51
+ 'ci',
52
+ ],
53
+ ],
54
+ 'type-empty': [2, 'never'],
55
+ 'scope-empty': [1, 'never'],
56
+ 'subject-full-stop': [0, 'never'],
57
+ 'subject-case': [0, 'never'],
58
+ },
59
+ };