neo-cmp-cli 1.8.6 → 1.8.7

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.
@@ -3,21 +3,26 @@ const yargs = require('yargs'); // 命令行工具
3
3
  const chalk = require('chalk'); // 带样式的log输出
4
4
  const inquirer = require('inquirer'); // 问答式交互
5
5
  const ora = require('ora');
6
- const neoInit = require('./module/neoInit.js');
7
- const neoInitByCopy = require('./module/neoInitByCopy.js');
8
- const inspect = require('./module/inspect.js'); // 输出当前项目配置文件
9
- const neoConfigInit = require('./utils/neoConfigInit.js');
10
- const { validateProjectName } = require('./utils/projectNameValidator.js');
11
- const getCmpTypeByDir = require('./utils/cmpUtils/getCmpTypeByDir.js');
12
- const NeoService = require('./neo/neoService.js');
13
- const NeoLoginService = require('./neo/neoLogin.js');
14
- const curConfig = require('./config/index'); // 获取当前项目根目录下的配置文件
15
- const hasNeoProject = require('./utils/projectUtils/hasNeoProject.js');
16
- const consoleTag = require('./utils/neoParams').consoleTag;
17
- const { errorLog, successLog } = require('./utils/common');
6
+ const {
7
+ neoInit,
8
+ neoInitByCopy,
9
+ inspect,
10
+ neoConfigInit,
11
+ validateProjectName,
12
+ getCmpTypeByDir,
13
+ NeoService,
14
+ NeoLoginService,
15
+ hasNeoProject,
16
+ consoleTag,
17
+ errorLog,
18
+ successLog
19
+ } = require('../src/main.js');
20
+ const mainAction = require('../src/main.js'); // 构建方法
18
21
  // neo 的 package 文件
19
22
  const neoPackage = require('../package.json');
20
- const mainAction = require('./main.js'); // 入口文件
23
+
24
+ // 获取当前项目根目录下的配置文件
25
+ const curConfig = mainAction.projectConfig;
21
26
 
22
27
  const titleTip = function (msg) {
23
28
  return chalk.green(chalk.bold(msg));
package/bin/neo.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- require('../src/index');
2
+ require('./index');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo-cmp-cli",
3
- "version": "1.8.6",
3
+ "version": "1.8.7",
4
4
  "description": "Neo 自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -9,11 +9,13 @@
9
9
  "author": "wibetter",
10
10
  "license": "MIT",
11
11
  "bin": {
12
- "neo": "./bin/neo.js"
12
+ "neo": "./bin/neo.js",
13
+ "build2esm": "neo build2esm"
13
14
  },
14
15
  "main": "src/main.js",
15
16
  "scripts": {
16
17
  "neo": "neo",
18
+ "build2esm": "neo build2esm",
17
19
  "format": "prettier --write \"src/**/**/*.{js,jsx,vue,tsx,ts,scss,less,json}\""
18
20
  },
19
21
  "files": [
@@ -42,7 +44,7 @@
42
44
  },
43
45
  "dependencies": {
44
46
  "adm-zip": "^0.5.10",
45
- "akfun": "^5.1.20",
47
+ "akfun": "^5.1.21",
46
48
  "axios": "^0.27.2",
47
49
  "babel-plugin-import": "^1.13.8",
48
50
  "chalk": "^4.0.0",
package/src/main.js CHANGED
@@ -18,6 +18,12 @@ const deleteCmp = require('./utils/cmpUtils/deleteCmp');
18
18
  const openProject = require('./utils/projectUtils/openProject');
19
19
  const { configureNeoBuild } = require('./utils/configureNeoBuild');
20
20
  const { errorLog, successLog } = require('./utils/common');
21
+ // 导出工具函数
22
+ const { validateProjectName } = require('./utils/projectNameValidator.js');
23
+ const getCmpTypeByDir = require('./utils/cmpUtils/getCmpTypeByDir.js');
24
+ const NeoService = require('./neo/neoService.js');
25
+ const NeoLoginService = require('./neo/neoLogin.js');
26
+ const hasNeoProject = require('./utils/projectUtils/hasNeoProject.js');
21
27
 
22
28
  const getValue = (originValue, defaultValue) => {
23
29
  return originValue !== undefined ? originValue : defaultValue;
@@ -77,6 +83,15 @@ module.exports = {
77
83
  neoInitByCopy,
78
84
  inspect,
79
85
  neoConfigInit,
86
+ projectConfig: curConfig,
87
+ consoleTag,
88
+ errorLog,
89
+ successLog,
90
+ validateProjectName,
91
+ getCmpTypeByDir,
92
+ NeoService,
93
+ NeoLoginService,
94
+ hasNeoProject,
80
95
  createCmpProjectByTemplate,
81
96
  createCmpByTemplate,
82
97
  dev: () => {
@@ -8,7 +8,7 @@ const { errorLog } = require('../common');
8
8
  /**
9
9
  * 打开自定义组件项目
10
10
  */
11
- module.exports = async function (editorType, targetPath) {
11
+ const openProject = async function (editorType, targetPath) {
12
12
  const targetDir = targetPath ? path.resolve(targetPath) : process.cwd();
13
13
 
14
14
  // 检查目录是否存在
@@ -92,3 +92,5 @@ module.exports = async function (editorType, targetPath) {
92
92
 
93
93
  await tryOpenEditor(0);
94
94
  };
95
+
96
+ module.exports = openProject;
package/test/demo.js CHANGED
@@ -1,7 +1,7 @@
1
- const {neoInit, neoConfigInit, inspect, preview, debug, build2lib, build2esm, neoInitByCopy, previewCmp } = require('../src/main');
1
+ const {neoInit, neoConfigInit, inspect, preview, debug, build2lib, build2esm, neoInitByCopy, previewCmp } = require('../dist/main');
2
2
  const getEntries = require('../src/utils/projectUtils/getEntries');
3
3
  const getEntriesWithAutoRegister = require('../src/utils/projectUtils/getEntriesWithAutoRegister');
4
- // inspect('dev');
4
+ inspect('dev');
5
5
  // neoInitByCopy('react-ts', 'test123');
6
6
 
7
7
  // previewCmp('info-card');
@@ -1,7 +1,7 @@
1
1
  const { execSync } = require('child_process');
2
2
 
3
3
  // 所有需要废弃的版本
4
- const versionsToDeprecate = ["1.8.0", "1.8.1", "1.8.2", "1.8.3", "1.8.5"];
4
+ const versionsToDeprecate = ["1.8.6-beta.1", "1.8.6-beta.2", "1.8.6-beta.3", "1.8.6-beta.5", "1.8.6-beta.6"];
5
5
 
6
6
  const packageName = 'neo-cmp-cli';
7
7
  const deprecateMessage = '此版本为开发中版本(存在 bug),请升级到最新版本。';
@@ -32,34 +32,10 @@ module.exports = {
32
32
  moduleRules: [], // 用于配置自定义loaders
33
33
  plugins: [], // 用于配置自定义plugins
34
34
  },
35
- build2lib: {
36
- entry: {
37
- index: './src/index.js', // 构建lib的入口
38
- main: './src/main.js', // 构建lib的入口
39
- },
40
- output: {
41
- filename: '[name].js',
42
- library: {
43
- type: 'commonjs2', // 使用 CommonJS 模式构建
44
- }
45
- },
46
- // 用于构建生产环境代码的相关配置信息
47
- NODE_ENV: 'development', // development / production
48
- assetsRoot: resolve('./dist'), // 打包后的文件绝对路径(物理路径)
49
- assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
50
- assetsSubDirectory: '', // 资源引用二级路径
51
- ignoreNodeModules: true, // 打包时是否忽略 node_modules
52
- // allowList: ['vue'], // ignoreNodeModules为true时生效
53
- productionSourceMap: false,
54
- productionGzip: false,
55
- productionGzipExtensions: ['js', 'css', 'json'],
56
- // bundleAnalyzerReport: false
57
- },
58
35
  build2esm: {
59
- type: 'js',
36
+ type: 'node',
60
37
  compress: false,
61
38
  input: {
62
- index: resolve('src/index.js'),
63
39
  main: resolve('src/main.js')
64
40
  },
65
41
  output: {