akfun 1.5.19 → 1.6.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.
package/module/index.js CHANGED
@@ -129,7 +129,7 @@ let argv = yargs
129
129
  )
130
130
  .command(
131
131
  'build',
132
- '构建生产环境的代码',
132
+ '构建生产环境代码',
133
133
  (yargs) => {
134
134
  yargs
135
135
  .reset()
@@ -142,7 +142,7 @@ let argv = yargs
142
142
  )
143
143
  .command(
144
144
  'build2lib',
145
- '构建第三方功能包',
145
+ '构建lib库',
146
146
  (yargs) => {
147
147
  yargs
148
148
  .reset()
@@ -155,7 +155,7 @@ let argv = yargs
155
155
  )
156
156
  .command(
157
157
  'build2esm',
158
- '构建esm功能包',
158
+ '构建esm模块',
159
159
  (yargs) => {
160
160
  yargs
161
161
  .reset()
package/module/inspect.js CHANGED
@@ -4,7 +4,7 @@ const fs = require('fs');
4
4
  const getCurWebpackConfig = require('../src/utils/getCurWebpackConfig.js'); // 用于获取当前webpack配置的方法
5
5
 
6
6
  // 根据当前配置文件内容创建指定名称的文件
7
- const createConfigJs = function (fileCont, fileName) {
7
+ const createConfigJs = function (fileName, fileCont) {
8
8
  let filePath = path.resolve(process.cwd(), fileName);
9
9
 
10
10
  fs.writeFile(filePath, JSON.stringify(fileCont, null, 2), (err) => {
@@ -21,18 +21,18 @@ module.exports = (type) => {
21
21
  const spinner = ora( '[akfun]正在获取当前环境的配置数据...').start();
22
22
  if (type === 'dev') {
23
23
  const devConfig = getCurWebpackConfig(type);
24
- createConfigJs(devConfig, 'current-akfun-dev-config.js');
24
+ createConfigJs('current-akfun-dev-config.js', devConfig);
25
25
  spinner.succeed( '[akfun]当前配置数据已输出至akfun-dev-config.js中!');
26
26
  } else if (type === 'lib') {
27
27
  const libraryConfig = getCurWebpackConfig(type);
28
- createConfigJs(libraryConfig, 'current-akfun-build2lib-config.js');
28
+ createConfigJs('current-akfun-build2lib-config.js', libraryConfig);
29
29
  spinner.succeed( '[akfun]当前配置数据已输出至akfun-build2lib-config.js中!');
30
30
  } else if (type === 'build') {
31
31
  const prodConfig = getCurWebpackConfig(type);
32
32
  // 默认输出生产环境的配置文件
33
- createConfigJs(prodConfig, 'current-akfun-build-config.js');
33
+ createConfigJs('current-akfun-build-config.js', prodConfig);
34
34
  spinner.succeed( '[akfun]当前配置数据已输出至akfun-build-config.js中!');
35
35
  } else {
36
- console.log(`不能识别type=${type}。`)
36
+ console.log(`不能识别type=${type}。`);
37
37
  }
38
38
  };
package/module/main.js CHANGED
@@ -2,11 +2,24 @@
2
2
  const buildAction = require('../src/build.js'); // 构建脚本:生产环境
3
3
  const devAction = require('../src/dev-server.js'); // 构建脚本:开发环境
4
4
  const build2esm = require('../src/build2esm.js'); // 构建esm输出模块
5
+ const inspect = require('./inspect.js');
6
+ const gitClone = require('../src/utils/gitClone.js');
7
+ const createFile = require('../src/utils/createFile');
8
+ const {resolve} = require('../src/utils/pathUtils');
9
+ const getConfigObj = require('../src/utils/getConfigObj');
10
+ const deepMergeConfig = require('../src/utils/deepMergeConfig');
5
11
  const getCurWebpackConfig = require('../src/utils/getCurWebpackConfig.js'); // 用于获取当前webpack配置的方法
6
12
 
7
13
  module.exports = {
8
14
  dev: devAction,
9
15
  build: buildAction,
10
16
  build2esm,
17
+ inspect,
18
+ gitClone,
19
+ createFile,
20
+ resolve,
21
+ getConfigObj,
22
+ deepMergeConfig,
23
+ getCurWebpackConfig,
11
24
  curWebpackBaseConfPath: getCurWebpackConfig('base'),
12
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akfun",
3
- "version": "1.5.19",
3
+ "version": "1.6.0",
4
4
  "description": "前端脚手架:支持Vue技术栈和react技术栈",
5
5
  "keywords": [
6
6
  "前端工程",
@@ -1,4 +1,3 @@
1
- 'use strict';
2
1
  // 统一路径解析:
3
2
  const { resolve } = require('../utils/pathUtils');
4
3
 
@@ -22,7 +22,7 @@ module.exports = {
22
22
  },
23
23
  resolve: {
24
24
  // webpack的resolve配置
25
- extensions: ['.js', '.jsx', '.vue', 'json'], // 用于配置webpack在尝试过程中用到的后缀列表
25
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', 'json'], // 用于配置webpack在尝试过程中用到的后缀列表
26
26
  alias: {
27
27
  '@': resolve('src'),
28
28
  $components: resolve('src/components'),
@@ -31,6 +31,8 @@ module.exports = {
31
31
  $utils: resolve('src/utils')
32
32
  }
33
33
  },
34
+ createDeclaration: false, // 打包时是否创建ts声明文件
35
+ ignoreNodeModules: false, // 打包时是否忽略 node_modules
34
36
  externals: [], // 从输出的 bundle 中排除依赖
35
37
  template: resolve('src/index.html'), // 默认使用的页面模板
36
38
  sassResources: []
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * 用于获取当前项目配置文件
3
3
  */
4
- module.exports = (type) => {
4
+ module.exports = (type, akfunConfig) => {
5
5
  let curConfig = {};
6
6
  if (type === 'dev') {
7
- curConfig = require('../webpack/webpack.dev.conf')();
7
+ curConfig = require('../webpack/webpack.dev.conf')(akfunConfig);
8
8
  } else if (type === 'lib') {
9
- curConfig = require('../webpack/webpack.library.conf')();
9
+ curConfig = require('../webpack/webpack.library.conf')(akfunConfig);
10
10
  } else if (type === 'build') {
11
- curConfig = require('../webpack/webpack.prod.conf')();
11
+ curConfig = require('../webpack/webpack.prod.conf')(akfunConfig);
12
12
  } else if (type === 'base') {
13
- curConfig = require('../webpack/webpack.base.conf')();
13
+ curConfig = require('../webpack/webpack.base.conf')(akfunConfig);
14
14
  }
15
15
  return curConfig;
16
16
  };