Skip to content

Commit

Permalink
feat: publish 1st version
Browse files Browse the repository at this point in the history
  • Loading branch information
chenghao committed Jun 1, 2020
1 parent 76a0529 commit 8463aae
Show file tree
Hide file tree
Showing 24 changed files with 17,518 additions and 2,832 deletions.
8 changes: 4 additions & 4 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"packages": [
"packages/*"
],
"version": "0.0.0"
"name": "dasheng",
"npmClient": "yarn",
"packages": ["packages/*"],
"version": "0.1.0"
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "root",
"version": "0.0.0",
"version": "0.1.0",
"scripts": {
"commit": "git-cz",
"pretty": "pretty-quick",
"deploy": "lerna publish",
"install": "lerna bootstrap"
"install": "lerna bootstrap",
"dep": "lerna publish from-package"
},
"config": {
"commitizen": {
Expand Down
9 changes: 9 additions & 0 deletions packages/dasheng-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# dasheng-cli

dasheng<大圣>-微前端 CLI 脚手架,一键安装大圣微前端模板

推荐使用 npx,以便保证每次使用的 dasheng-cli 是最新版本(或者全局安装使用,不推荐)

```
npx dasheng-cli dasheng-micro
```
5 changes: 3 additions & 2 deletions packages/dasheng-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dasheng-cli",
"version": "0.0.3-beta8",
"version": "0.1.0",
"description": "dasheng cli",
"main": "build/src/index.js",
"bin": {
Expand All @@ -15,7 +15,8 @@
"license": "MIT",
"files": [
"build",
"bin"
"bin",
"yarn.lock.cached"
],
"dependencies": {
"chalk": "^4.0.0",
Expand Down
9 changes: 7 additions & 2 deletions packages/dasheng-cli/src/createApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function installTemplate(root: string, useYarn: boolean) {
}

function installDependencies(root: string, useYarn: boolean) {
copyLock(root);
log(chalk('\n正在安装依赖包,请耐心等待几分钟...\n'));
const dependenciesToInstall = [
'react',
Expand Down Expand Up @@ -78,8 +79,8 @@ function runCmd({
}) {
let command, args;
if (useYarn) {
command = 'yarn';
args = [cmds[0], '--cwd', root, ...dependencies];
command = 'yarnpkg';
args = [cmds[0], '--exact', '--cwd', root, ...dependencies];
} else {
command = 'npm';
args = [cmds[0], ...dependencies];
Expand All @@ -101,6 +102,10 @@ function copyTemplateToRoot(root: string, template: string) {
fs.copySync(tempDir, root);
}

function copyLock(root: string) {
fs.copySync(require.resolve('../../yarn.lock.cached'), path.join(root, 'yarn.lock'));
}

function setLastTips(appName: string) {
log(chalk('\n✅ 已经成功安装dasheng<大圣>微前端模板项目✨\n'));
log(chalk(`请进入项目目录进行编程:cd ${appName}\n`));
Expand Down
2 changes: 1 addition & 1 deletion packages/dasheng-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as validator from './validator';
import * as cmd from './command';
import { chalk } from './chalk';
import createApp from './createApp';
const packageJson = require(require('path').resolve(process.cwd(), 'package.json'));
const packageJson = require('../../package.json');

let projectName: string = '';
const program = new Command()
Expand Down
Loading

0 comments on commit 8463aae

Please sign in to comment.