neo-cmp-cli 1.1.0 → 1.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 +1 -1
- package/src/cmpUtils/getCmpPreview.js +2 -0
- package/src/cmpUtils/getEntries.js +3 -2
- package/src/cmpUtils/getEntriesWithAutoRegister.js +3 -2
- package/src/module/main.js +1 -1
- package/src/template/react-custom-cmp-template/package.json +2 -2
- package/src/template/react-ts-custom-cmp-template/package.json +2 -2
- package/src/template/vue2-custom-cmp-template/package.json +2 -2
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ const getCmpPreview = (cmpsDir, cmpName) => {
|
|
|
11
11
|
const cpmDir = resolveToCurrentRoot(`${cmpsDir}/${cmpName}`);
|
|
12
12
|
const cpmModelDir = resolveToCurrentRoot(`${cmpsDir}/${cmpName}/model`);
|
|
13
13
|
|
|
14
|
+
/*
|
|
14
15
|
if (!fs.existsSync(cpmDir)) {
|
|
15
16
|
console.error(`未找到 ${cmpName} 组件入口文件,请检查 ${cpmDir} 是否存在。`);
|
|
16
17
|
|
|
@@ -24,6 +25,7 @@ const getCmpPreview = (cmpsDir, cmpName) => {
|
|
|
24
25
|
// 退出进程
|
|
25
26
|
process.exit(1);
|
|
26
27
|
}
|
|
28
|
+
*/
|
|
27
29
|
|
|
28
30
|
return `
|
|
29
31
|
import * as React from 'react';
|
|
@@ -35,6 +35,7 @@ module.exports = (buildType = 'build2lib', defaultComponentsDir = './src/compone
|
|
|
35
35
|
if (stat.isDirectory() && !dir.startsWith('.') && dir !== 'node_modules') {
|
|
36
36
|
const curCmpPath = path.join(componentsBaseDir, dir);
|
|
37
37
|
const curCmpName = dir; // _.camelCase(dir);
|
|
38
|
+
const cmpNameKey = _.camelCase(curCmpName);
|
|
38
39
|
|
|
39
40
|
fs.readdirSync(curCmpPath)
|
|
40
41
|
.filter((file) => file.match(/[register|model]\.[tj]sx?$/))
|
|
@@ -43,9 +44,9 @@ module.exports = (buildType = 'build2lib', defaultComponentsDir = './src/compone
|
|
|
43
44
|
console.log(filePath);
|
|
44
45
|
const curPath = `./${filePath}`;
|
|
45
46
|
if (filePath.match(/register\.[tj]sx?$/)) {
|
|
46
|
-
widgetEntries[
|
|
47
|
+
widgetEntries[cmpNameKey] = curPath;
|
|
47
48
|
} else if (filePath.match(/model\.[tj]sx?$/)) {
|
|
48
|
-
widgetEntries[`${
|
|
49
|
+
widgetEntries[`${cmpNameKey}Model`] = curPath;
|
|
49
50
|
}
|
|
50
51
|
linkDebugEntries.index.push(curPath);
|
|
51
52
|
});
|
|
@@ -45,6 +45,7 @@ module.exports = (buildType = 'build2lib', defaultComponentsDir = './src/compone
|
|
|
45
45
|
|
|
46
46
|
// 当前自定义组件名称
|
|
47
47
|
const curCmpName = dir; // _.camelCase(dir);
|
|
48
|
+
const cmpNameKey = _.camelCase(curCmpName);
|
|
48
49
|
|
|
49
50
|
// 当前自定义组件临时目录
|
|
50
51
|
const cmpTempDir = `${cliTempDir}/${curCmpName}`;
|
|
@@ -64,7 +65,7 @@ module.exports = (buildType = 'build2lib', defaultComponentsDir = './src/compone
|
|
|
64
65
|
// 写入注册文件
|
|
65
66
|
fs.writeFileSync(registerDir, registerContent);
|
|
66
67
|
|
|
67
|
-
widgetEntries[
|
|
68
|
+
widgetEntries[cmpNameKey] = registerDir;
|
|
68
69
|
linkDebugEntries.index.push(registerDir);
|
|
69
70
|
} else if (filePath.match(/model\.[tj]sx?$/)) {
|
|
70
71
|
// 自动创建对应的模型注册文件
|
|
@@ -74,7 +75,7 @@ module.exports = (buildType = 'build2lib', defaultComponentsDir = './src/compone
|
|
|
74
75
|
// 写入模型注册文件
|
|
75
76
|
fs.writeFileSync(modelRegisterDir, modelRegisterContent);
|
|
76
77
|
|
|
77
|
-
widgetEntries[`${
|
|
78
|
+
widgetEntries[`${cmpNameKey}Model`] = modelRegisterDir;
|
|
78
79
|
linkDebugEntries.index.push(modelRegisterDir);
|
|
79
80
|
}
|
|
80
81
|
});
|
package/src/module/main.js
CHANGED
|
@@ -66,7 +66,7 @@ module.exports = {
|
|
|
66
66
|
if (!curEntry || Object.keys(curEntry).length === 0) {
|
|
67
67
|
// 如果未配置 entry,则自动生成 entry
|
|
68
68
|
let entries = {};
|
|
69
|
-
if (curConfig.
|
|
69
|
+
if (curConfig.dev.disableAutoRegister) {
|
|
70
70
|
// disableAutoRegister 为 true 时,仅自动生成入口文件(不自动注册)
|
|
71
71
|
entries = getEntries('linkDebug', curConfig.componentsDir);
|
|
72
72
|
} else {
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"url": "https://github.com/wibetter/react-custom-cmp-template/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"neo-register": "^1.0.
|
|
40
|
+
"neo-register": "^1.0.1",
|
|
41
41
|
"react": "^16.9.0",
|
|
42
42
|
"react-dom": "^16.9.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@commitlint/cli": "^8.3.5",
|
|
46
46
|
"@commitlint/config-conventional": "^9.1.1",
|
|
47
|
-
"neo-cmp-cli": "^1.1.
|
|
47
|
+
"neo-cmp-cli": "^1.1.2",
|
|
48
48
|
"husky": "^4.2.5",
|
|
49
49
|
"lint-staged": "^10.2.9",
|
|
50
50
|
"prettier": "^2.0.5"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"url": "https://github.com/wibetter/react-ts-custom-cmp-template/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"neo-register": "^1.0.
|
|
40
|
+
"neo-register": "^1.0.1",
|
|
41
41
|
"antd": "4.9.4",
|
|
42
42
|
"react": "^16.9.0",
|
|
43
43
|
"react-dom": "^16.9.0"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@commitlint/config-conventional": "^9.1.1",
|
|
48
48
|
"@types/react": "^16.9.11",
|
|
49
49
|
"@types/react-dom": "^16.9.15",
|
|
50
|
-
"neo-cmp-cli": "^1.1.
|
|
50
|
+
"neo-cmp-cli": "^1.1.2",
|
|
51
51
|
"husky": "^4.2.5",
|
|
52
52
|
"lint-staged": "^10.2.9",
|
|
53
53
|
"prettier": "^2.0.5"
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"url": "https://github.com/wibetter/vue2-custom-cmp-template/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"neo-register": "^1.0.
|
|
40
|
+
"neo-register": "^1.0.1",
|
|
41
41
|
"vue": "^2.6.14",
|
|
42
42
|
"element-ui": "^2.15.12"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@commitlint/cli": "^8.3.5",
|
|
46
46
|
"@commitlint/config-conventional": "^9.1.1",
|
|
47
|
-
"neo-cmp-cli": "^1.1.
|
|
47
|
+
"neo-cmp-cli": "^1.1.2",
|
|
48
48
|
"husky": "^4.2.5",
|
|
49
49
|
"lint-staged": "^10.2.9",
|
|
50
50
|
"prettier": "^2.0.5",
|