Skip to content

Commit 03585af

Browse files
committed
♻️ change name
1 parent f712aaf commit 03585af

File tree

6 files changed

+47
-101
lines changed

6 files changed

+47
-101
lines changed

README.md

+16-17
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
# Micro APP Plugin - Deploy Command
1+
# Micro APP Plugin - Deploy
22

3-
[Plugin] auto deploy command plugin.
3+
[Plugin] auto deploy plugin.
44

5-
基于webpack多入口的多仓库业务模块开发的插件应用框架核心库.
5+
集成自动部署配置. 用于 `@micro-app/cli` 的插件.
66

7+
[![Github Actions Coveralls][Github-Actions-Coveralls]][Github-Actions-Coveralls-url]
78
[![Coverage Status][Coverage-img]][Coverage-url]
8-
[![CircleCI][CircleCI-img]][CircleCI-url]
99
[![NPM Version][npm-img]][npm-url]
1010
[![NPM Download][download-img]][download-url]
1111

12-
[Coverage-img]: https://coveralls.io/repos/github/MicroAppJS/MicroApp-Plugin-Deploy-Command/badge.svg?branch=master
13-
[Coverage-url]: https://coveralls.io/github/MicroAppJS/MicroApp-Plugin-Deploy-Command?branch=master
14-
[CircleCI-img]: https://circleci.com/gh/MicroAppJS/MicroApp-Plugin-Deploy-Command/tree/master.svg?style=svg
15-
[CircleCI-url]: https://circleci.com/gh/MicroAppJS/MicroApp-Plugin-Deploy-Command/tree/master
16-
[npm-img]: https://img.shields.io/npm/v/@micro-app/plugin-deploy-command.svg?style=flat-square
17-
[npm-url]: https://npmjs.org/package/@micro-app/plugin-deploy-command
18-
[download-img]: https://img.shields.io/npm/dm/@micro-app/plugin-deploy-command.svg?style=flat-square
19-
[download-url]: https://npmjs.org/package/@micro-app/plugin-deploy-command
12+
[Github-Actions-Coveralls]: https://github.com/MicroAppJS/plugin-deploy/workflows/Coveralls/badge.svg
13+
[Github-Actions-Coveralls-url]: https://github.com/MicroAppJS/plugin-deploy
14+
[Coverage-img]: https://coveralls.io/repos/github/MicroAppJS/plugin-deploy/badge.svg?branch=master
15+
[Coverage-url]: https://coveralls.io/github/MicroAppJS/plugin-deploy?branch=master
16+
[npm-img]: https://img.shields.io/npm/v/@micro-app/plugin-deploy.svg?style=flat-square
17+
[npm-url]: https://npmjs.org/package/@micro-app/plugin-deploy
18+
[download-img]: https://img.shields.io/npm/dm/@micro-app/plugin-deploy.svg?style=flat-square
19+
[download-url]: https://npmjs.org/package/@micro-app/plugin-deploy
2020

2121
## Install
2222

2323
```sh
24-
yarn add @micro-app/plugin-deploy-command
24+
yarn add @micro-app/plugin-deploy
2525
```
2626

2727
or
2828

2929
```sh
30-
npm install -S @micro-app/plugin-deploy-command
30+
npm install -S @micro-app/plugin-deploy
3131
```
3232

3333
## Usage
@@ -39,7 +39,7 @@ module.exports = {
3939
// ...
4040

4141
plugins: [ // 自定义插件
42-
[ '@micro-app/plugin-deploy-command', {
42+
[ '@micro-app/plugin-deploy', {
4343
// default config
4444
git: '',
4545
branch: {
@@ -56,8 +56,7 @@ module.exports = {
5656
};
5757
```
5858

59-
60-
### 创建 `micro-app.deploy.config.js` 文件, 并如下配置:
59+
### 创建 `micro-app.deploy.config.js` 文件, 并如下配置
6160

6261
```js
6362
{

micro-app.config.js

-30
This file was deleted.

package.json

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@micro-app/plugin-deploy-command",
3-
"version": "0.1.5",
4-
"description": "[Plugin] auto deploy command plugin.",
2+
"name": "@micro-app/plugin-deploy",
3+
"version": "0.0.1",
4+
"description": "[Plugin] auto deploy plugin.",
55
"main": "src/index.js",
66
"scripts": {
77
"prepublishOnly": "npm run test",
@@ -10,13 +10,13 @@
1010
"files": [
1111
"src"
1212
],
13-
"homepage": "https://github.com/MicroAppJS/MicroApp-Plugin-Deploy-Command",
13+
"homepage": "https://github.com/MicroAppJS/plugin-deploy",
1414
"repository": {
1515
"type": "git",
16-
"url": "git+https://github.com/MicroAppJS/MicroApp-Plugin-Deploy-Command.git"
16+
"url": "git+https://github.com/MicroAppJS/plugin-deploy.git"
1717
},
1818
"bugs": {
19-
"url": "https://github.com/MicroAppJS/MicroApp-Plugin-Deploy-Command/issues"
19+
"url": "https://github.com/MicroAppJS/plugin-deploy/issues"
2020
},
2121
"keywords": [
2222
"micro",
@@ -40,5 +40,8 @@
4040
"eslint": "^5.16.0",
4141
"eslint-config-2o3t": "^1.1.17",
4242
"jest": "^24.9.0"
43+
},
44+
"dependencies": {
45+
"@micro-app/shared-utils": "^0.1.11"
4346
}
4447
}

src/commands/git/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const path = require('path');
44
const { fs, _, chalk, execa, Env } = require('@micro-app/shared-utils');
55
const CONSTANTS = require('../../constants');
6-
const { execGit, getCurrBranch, getGitBranch, getGitUser } = require('./utils');
6+
const { execGit, execGitSync, getCurrBranch, getGitBranch, getGitUser } = require('./utils');
77

88
function createCNAMEFile({ deployConfig, deployDir }) {
99
const cname = deployConfig.cname;
@@ -65,17 +65,17 @@ function gitPush(api, { args, deployConfig, deployDir, gitURL, gitBranch, commit
6565
function getCommitHash(api, { isHooks, gitBranch }) {
6666
let commitHash = '';
6767
if (isHooks) {
68-
commitHash = ((execa.commandSync('git rev-parse --verify HEAD', { silent: true }) || {}).stdout || '').trim();
68+
commitHash = execGitSync([ 'rev-parse', '--verify', 'HEAD' ]);
6969
} else {
70-
commitHash = ((execa.commandSync(`git rev-parse origin/${gitBranch}`, { silent: true }) || {}).stdout || '').trim();
70+
commitHash = execGitSync([ 'rev-parse', `origin/${gitBranch}` ]);
7171
}
7272
return commitHash;
7373
}
7474

7575
function getGitMessage(api, { deployConfig, commitHash }) {
7676
let gitMessage = deployConfig.message && ` | ${deployConfig.message}` || '';
7777
if (!gitMessage) {
78-
const msg = ((execa.commandSync(`git log --pretty=format:“%s” ${commitHash} -1`, { silent: true }) || {}).stdout || '').trim();
78+
const msg = execGitSync([ 'log', '--pretty=format:“%s”', commitHash, '-1' ]);
7979
if (msg) {
8080
gitMessage = ` | ${msg}`;
8181
}

src/commands/git/utils.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const TIMEOUT = 1000 * 60 * 3;
66

77
module.exports = {
88
execGit,
9+
execGitSync,
910
getCurrBranch,
1011
getGitBranch,
1112
getGitUser,
@@ -22,8 +23,13 @@ function execGit(args, options = {}) {
2223
});
2324
}
2425

26+
function execGitSync(args, options = {}) {
27+
const { stdout, exitCode } = execa.sync('git', args, Object.assign({ stdio: 'ignore', timeout: TIMEOUT }, options));
28+
return exitCode === 0 ? (stdout || '').trim() : '';
29+
}
30+
2531
function getCurrBranch() {
26-
const currBranch = ((execa.commandSync('git rev-parse --abbrev-ref HEAD', { silent: true }) || {}).stdout || '').trim();
32+
const currBranch = execGitSync([ 'rev-parse', '--abbrev-ref', 'HEAD' ]);
2733
return currBranch;
2834
}
2935

@@ -44,11 +50,11 @@ function getGitBranch(deployConfig) {
4450
function getGitUser(deployConfig) {
4551
let userName = deployConfig.userName;
4652
if (_.isEmpty(userName)) {
47-
userName = ((execa.commandSync('git config user.name', { silent: true }) || {}).stdout || '').trim();
53+
userName = execGitSync([ 'config', 'user.name' ]);
4854
}
4955
let userEmail = deployConfig.userEmail;
5056
if (_.isEmpty(userEmail)) {
51-
userEmail = ((execa.commandSync('git config user.email', { silent: true }) || {}).stdout || '').trim();
57+
userEmail = execGitSync([ 'config', 'user.email' ]);
5258
}
5359
return {
5460
name: userName || 'Git Deploy Anonymous',

yarn.lock

+9-41
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@
386386
"@types/istanbul-reports" "^1.1.1"
387387
"@types/yargs" "^13.0.0"
388388

389-
"@micro-app/cli@^0.3.0-alpha.2":
389+
"@micro-app/cli@^0.3.0-alpha.3":
390390
version "0.3.0-alpha.3"
391391
resolved "https://registry.yarnpkg.com/@micro-app/cli/-/cli-0.3.0-alpha.3.tgz#066e952cb4119f91e5ede684485a52207e285e05"
392392
integrity sha512-WfdCV1dWkOfHhWXoXUUsBKLjpT72soaOmen3/HyWtaKwoqqX9vYswqMOfsEt/bYU8po2eThwU2TlAApoCBRn4A==
@@ -552,17 +552,12 @@
552552
"@types/istanbul-lib-coverage" "*"
553553
"@types/istanbul-lib-report" "*"
554554

555-
"@types/jest-diff@*":
556-
version "20.0.1"
557-
resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89"
558-
integrity sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA==
559-
560-
"@types/jest@^24.0.18":
561-
version "24.0.18"
562-
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.18.tgz#9c7858d450c59e2164a8a9df0905fc5091944498"
563-
integrity sha512-jcDDXdjTcrQzdN06+TSVsPPqxvsZA/5QkYfIZlq1JMw7FdP5AZylbOc+6B/cuDurctRe+MziUMtQ3xQdrbjqyQ==
555+
"@types/jest@^24.0.25":
556+
version "24.0.25"
557+
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.25.tgz#2aba377824ce040114aa906ad2cac2c85351360f"
558+
integrity sha512-hnP1WpjN4KbGEK4dLayul6lgtys6FPz0UfxMeMQCv0M+sTnzN3ConfiO72jHgLxl119guHgI8gLqDOrRLsyp2g==
564559
dependencies:
565-
"@types/jest-diff" "*"
560+
jest-diff "^24.3.0"
566561

567562
"@types/json-schema@^7.0.3":
568563
version "7.0.3"
@@ -1353,18 +1348,6 @@ [email protected], core-util-is@~1.0.0:
13531348
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
13541349
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
13551350

1356-
coveralls@^3.0.6:
1357-
version "3.0.6"
1358-
resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.0.6.tgz#5c63b2759b6781118e7439bd870ba5e9ee428b25"
1359-
integrity sha512-Pgh4v3gCI4T/9VijVrm8Ym5v0OgjvGLKj3zTUwkvsCiwqae/p6VLzpsFNjQS2i6ewV7ef+DjFJ5TSKxYt/mCrA==
1360-
dependencies:
1361-
growl "~> 1.10.0"
1362-
js-yaml "^3.13.1"
1363-
lcov-parse "^0.0.10"
1364-
log-driver "^1.2.7"
1365-
minimist "^1.2.0"
1366-
request "^2.86.0"
1367-
13681351
cross-spawn@^5.0.1:
13691352
version "5.1.0"
13701353
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
@@ -2515,11 +2498,6 @@ graceful-fs@^4.1.6, graceful-fs@^4.2.0:
25152498
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423"
25162499
integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==
25172500

2518-
"growl@~> 1.10.0":
2519-
version "1.10.5"
2520-
resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e"
2521-
integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==
2522-
25232501
growly@^1.3.0:
25242502
version "1.3.0"
25252503
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
@@ -3179,7 +3157,7 @@ jest-config@^24.9.0:
31793157
pretty-format "^24.9.0"
31803158
realpath-native "^1.1.0"
31813159

3182-
jest-diff@^24.9.0:
3160+
jest-diff@^24.3.0, jest-diff@^24.9.0:
31833161
version "24.9.0"
31843162
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da"
31853163
integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ==
@@ -3492,7 +3470,7 @@ js-tokens@^3.0.0:
34923470
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
34933471
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
34943472

3495-
js-yaml@^3.13.0, js-yaml@^3.13.1:
3473+
js-yaml@^3.13.0:
34963474
version "3.13.1"
34973475
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
34983476
integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
@@ -3711,11 +3689,6 @@ lcid@^2.0.0:
37113689
dependencies:
37123690
invert-kv "^2.0.0"
37133691

3714-
lcov-parse@^0.0.10:
3715-
version "0.0.10"
3716-
resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-0.0.10.tgz#1b0b8ff9ac9c7889250582b70b71315d9da6d9a3"
3717-
integrity sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=
3718-
37193692
left-pad@^1.3.0:
37203693
version "1.3.0"
37213694
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e"
@@ -3790,11 +3763,6 @@ lodash@^4.15.0, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.
37903763
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
37913764
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
37923765

3793-
log-driver@^1.2.7:
3794-
version "1.2.7"
3795-
resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8"
3796-
integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==
3797-
37983766
log-symbols@^2.2.0:
37993767
version "2.2.0"
38003768
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a"
@@ -4942,7 +4910,7 @@ request-promise-native@^1.0.5:
49424910
stealthy-require "^1.1.1"
49434911
tough-cookie "^2.3.3"
49444912

4945-
request@^2.86.0, request@^2.87.0:
4913+
request@^2.87.0:
49464914
version "2.88.0"
49474915
resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef"
49484916
integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==

0 commit comments

Comments
 (0)