Skip to content

Commit

Permalink
feat: 新增自动构建 npm 功能
Browse files Browse the repository at this point in the history
  • Loading branch information
murongg committed Dec 21, 2020
1 parent 85328ef commit daef37c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ async function create(dirName) {
tip_style_1.Success(`${tip_style_1.success(`Waiting...`)}`);
tip_style_1.Success(`${tip_style_1.success(`Dependencies are now being installed`)}`);
shelljs_1.default.cd(dirName).exec('npm install');
file_handle_1.checkFileExistsAndCreate(rootPath + '/miniprogram_npm');
file_handle_1.checkFileExistsAndCreate(rootPath + '/miniprogram_npm/lin-ui');
file_handle_1.copyFolder(`${rootPath}/node_modules/lin-ui/dist`, rootPath + '/miniprogram_npm/lin-ui');
tip_style_1.Success(`${tip_style_1.success(`Successfully created project ${tip_style_1.primary(name)}, directory name is ${tip_style_1.primary(dirName)}`)}`);
shelljs_1.default.exit(1);
}
Expand Down
5 changes: 4 additions & 1 deletion src/create.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { copyFolder, checkFileExistsAndCreate } from './file-handle'
import { checkFileExistsAndCreateType } from './enum'
import { CNPM_BASE_URL, CLI_VERSION, USER_CONFIG_FILE_NAME, CLI_NAME, MINI_VERSION_URL } from './config'
import { CNPM_BASE_URL, CLI_VERSION, USER_CONFIG_FILE_NAME, CLI_NAME, MINI_VERSION_URL, MINI_PROGRAM_LIN_UI_DIR } from './config'
import { packageJsonContent, projectConfigContent, linuiConfigContent } from './template'
import { PromptInput } from './interface'
import { join } from 'path'
Expand Down Expand Up @@ -98,6 +98,9 @@ export default async function create(dirName: string) {
Success(`${success(`Waiting...`)}`)
Success(`${success(`Dependencies are now being installed`)}`)
shell.cd(dirName).exec('npm install')
checkFileExistsAndCreate(rootPath + '/miniprogram_npm')
checkFileExistsAndCreate(rootPath + '/miniprogram_npm/lin-ui')
copyFolder(`${rootPath}/node_modules/lin-ui/dist`, rootPath + '/miniprogram_npm/lin-ui')
Success(`${success(`Successfully created project ${primary(name)}, directory name is ${primary(dirName)}`)}`)
shell.exit(1)
} catch (err) {
Expand Down

0 comments on commit daef37c

Please sign in to comment.