neo-cmp-cli 1.0.16 → 1.0.18
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/README.md +1 -2
- package/package.json +1 -1
- package/src/module/index.js +2 -0
- package/src/module/previewCmp.js +8 -4
- package/src/template/react-custom-cmp-template/README.md +1 -7
- package/src/template/react-custom-cmp-template/neo.config.js +0 -4
- package/src/template/react-ts-custom-cmp-template/README.md +1 -8
- package/src/template/react-ts-custom-cmp-template/neo.config.js +0 -4
- package/src/template/vue2-custom-cmp-template/README.md +1 -8
- package/src/template/vue2-custom-cmp-template/neo.config.js +0 -5
- package/src/template/react-custom-cmp-template/src/preview.js +0 -5
- package/src/template/react-ts-custom-cmp-template/src/preview.tsx +0 -32
- package/src/template/vue2-custom-cmp-template/src/preview.js +0 -9
package/README.md
CHANGED
|
@@ -90,13 +90,12 @@ module.exports = {
|
|
|
90
90
|
}
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
### 2) 构建入口(优先级:
|
|
93
|
+
### 2) 构建入口(优先级:linkDebug/build2lib/publish2oss.entry > webpack.entry)
|
|
94
94
|
```bash
|
|
95
95
|
module.exports = {
|
|
96
96
|
webpack: {
|
|
97
97
|
entry: { index: './src/index.js' },
|
|
98
98
|
},
|
|
99
|
-
preview: { entry: {} },
|
|
100
99
|
linkDebug: { entry: {} },
|
|
101
100
|
build2lib: { entry: {} },
|
|
102
101
|
publish2oss: { entry: {} },
|
package/package.json
CHANGED
package/src/module/index.js
CHANGED
package/src/module/previewCmp.js
CHANGED
|
@@ -30,7 +30,8 @@ module.exports = (config, cmpName, defaultComponentsDir = './src/components') =>
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// 创建存放预览文件的临时目录
|
|
33
|
-
const tempDir =
|
|
33
|
+
const tempDir = resolveToCurrentRoot('./.neo-cli');
|
|
34
|
+
|
|
34
35
|
if (!fs.existsSync(tempDir)) {
|
|
35
36
|
fs.mkdirSync(tempDir);
|
|
36
37
|
}
|
|
@@ -43,14 +44,17 @@ module.exports = (config, cmpName, defaultComponentsDir = './src/components') =>
|
|
|
43
44
|
fs.writeFileSync(`${tempCmpDir}/preview.jsx`, cmpPreviewContent);
|
|
44
45
|
|
|
45
46
|
// 将临时预览文件添加到预览配置中
|
|
46
|
-
config.dev.entry
|
|
47
|
+
if (!config.dev.entry) {
|
|
48
|
+
config.dev.entry = {};
|
|
49
|
+
}
|
|
50
|
+
// 添加预览入口文件
|
|
51
|
+
config.dev.entry.index = `${tempCmpDir}/preview.jsx`;
|
|
52
|
+
|
|
47
53
|
if (config.webpack.projectDir) {
|
|
48
54
|
config.webpack.projectDir.push(tempCmpDir);
|
|
49
55
|
} else {
|
|
50
56
|
config.webpack.projectDir = [tempCmpDir];
|
|
51
57
|
}
|
|
52
58
|
|
|
53
|
-
console.log(`${consoleTag}预览文件已保存至 ${tempCmpDir}/preview.jsx:`, config);
|
|
54
|
-
|
|
55
59
|
akfun.dev(config, consoleTag);
|
|
56
60
|
};
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
- src/components/info-card/index.jsx: 信息卡片自定义组件代码;
|
|
6
6
|
- src/components/info-card/register.js: 用于注册一个 neo 自定义组件,注册成功后编辑器画布区中才会正常展示自定义组件内容;
|
|
7
7
|
- src/components/info-card/model.js: 用于注册一个 neo-editor 自定义组件模型,注册成功后编辑器左侧组件面板中会展示;
|
|
8
|
-
- src/preview.js: 用于本地预览自定义组件内容;
|
|
9
8
|
- neo.config.js: neo-cmp-cli 配置文件。
|
|
10
9
|
|
|
11
10
|
### 组件开发规范
|
|
@@ -37,13 +36,8 @@ $ npm run preview
|
|
|
37
36
|
```bash
|
|
38
37
|
$ npm run linkDebug
|
|
39
38
|
```
|
|
40
|
-
4. **build2lib: 构建自定义组件输出产物**
|
|
41
|
-
> build2lib模式:用于构建发布到 oss 中的文件,默认存放到 当前 dist 目录中。
|
|
42
|
-
```bash
|
|
43
|
-
$ npm run build2lib
|
|
44
|
-
```
|
|
45
39
|
|
|
46
|
-
|
|
40
|
+
4. **发布到对象存储服务中**
|
|
47
41
|
> 需要确保 package.json 中的 name 值唯一,version 值不重复。
|
|
48
42
|
```bash
|
|
49
43
|
$ npm run publish2oss
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
- src/components/info-card/index.tsx: 信息卡片自定义组件代码;
|
|
6
6
|
- src/components/info-card/register.ts: 用于注册一个 neo 自定义组件,注册成功后编辑器画布区中才会正常展示自定义组件内容;
|
|
7
7
|
- src/components/info-card/model.ts: 用于注册一个 neo-editor 自定义组件模型,注册成功后编辑器左侧组件面板中会展示;
|
|
8
|
-
- src/preview.tsx: 用于本地预览自定义组件内容;
|
|
9
8
|
- neo.config.js: neo-cmp-cli 配置文件。
|
|
10
9
|
|
|
11
10
|
### 组件开发规范
|
|
@@ -38,13 +37,7 @@ $ npm run preview
|
|
|
38
37
|
$ npm run linkDebug
|
|
39
38
|
```
|
|
40
39
|
|
|
41
|
-
4.
|
|
42
|
-
> build2lib模式:用于构建发布到 oss 中的文件,默认存放到 当前 dist 目录中。
|
|
43
|
-
```bash
|
|
44
|
-
$ npm run build2lib
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
5. **发布到对象存储服务中**
|
|
40
|
+
4. **发布到对象存储服务中**
|
|
48
41
|
> 需要确保 package.json 中的 name 值唯一,version 值不重复。
|
|
49
42
|
```bash
|
|
50
43
|
$ npm run publish2oss
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
- src/components/info-card/index.vue: 信息卡片自定义组件代码;
|
|
6
6
|
- src/components/info-card/register.js: 用于注册一个 neo 自定义组件,注册成功后编辑器画布区中才会正常展示自定义组件内容;
|
|
7
7
|
- src/components/info-card/model.js: 用于注册一个 neo-editor 自定义组件模型,注册成功后编辑器左侧组件面板中会展示;
|
|
8
|
-
- src/preview.js: 用于本地预览自定义组件内容;
|
|
9
8
|
- neo.config.js: neo-cmp-cli 配置文件。
|
|
10
9
|
|
|
11
10
|
### 组件开发规范
|
|
@@ -38,13 +37,7 @@ $ npm run preview
|
|
|
38
37
|
$ npm run linkDebug
|
|
39
38
|
```
|
|
40
39
|
|
|
41
|
-
4.
|
|
42
|
-
> build2lib模式:用于构建发布到 npm 中的文件,默认存放到 当前 dist 目录中。
|
|
43
|
-
```bash
|
|
44
|
-
$ npm run build2lib
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
5. **发布到对象存储服务中**
|
|
40
|
+
4. **发布到对象存储服务中**
|
|
48
41
|
> 需要确保 package.json 中的 name 值唯一,version 值不重复。
|
|
49
42
|
```bash
|
|
50
43
|
$ npm run publish2oss
|
|
@@ -49,10 +49,6 @@ module.exports = {
|
|
|
49
49
|
},
|
|
50
50
|
preview: {
|
|
51
51
|
// 用于开启本地预览模式的相关配置信息
|
|
52
|
-
entry: {
|
|
53
|
-
// 本地预览自定义组件内容
|
|
54
|
-
index: './src/preview.js',
|
|
55
|
-
},
|
|
56
52
|
/*
|
|
57
53
|
【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
|
|
58
54
|
NODE_ENV: 'development',
|
|
@@ -71,7 +67,6 @@ module.exports = {
|
|
|
71
67
|
*/
|
|
72
68
|
},
|
|
73
69
|
linkDebug: {
|
|
74
|
-
NODE_ENV: 'development',
|
|
75
70
|
// 用于开启本地调试模式的相关配置信息
|
|
76
71
|
/*
|
|
77
72
|
【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
import InfoCardModel from './components/info-card/model';
|
|
6
|
-
|
|
7
|
-
const InfoCardDefaultComProps = new InfoCardModel().defaultComProps;
|
|
8
|
-
|
|
9
|
-
/* 引入公共的静态资源 */
|
|
10
|
-
import '$public/css/base.css';
|
|
11
|
-
|
|
12
|
-
// 预览 info-card 组件
|
|
13
|
-
ReactDOM.render(
|
|
14
|
-
<InfoCard {...InfoCardDefaultComProps} />,
|
|
15
|
-
document.getElementById('root'),
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
/*
|
|
19
|
-
// 预览 list-widget 组件
|
|
20
|
-
ReactDOM.render(
|
|
21
|
-
<ListWidget
|
|
22
|
-
{...{
|
|
23
|
-
title: '内容列表预览',
|
|
24
|
-
showImage: true,
|
|
25
|
-
showTags: true,
|
|
26
|
-
itemCount: 6,
|
|
27
|
-
listType: 'default',
|
|
28
|
-
}}
|
|
29
|
-
/>,
|
|
30
|
-
document.getElementById('root'),
|
|
31
|
-
);
|
|
32
|
-
*/
|