File tree 15 files changed +6019
-0
lines changed
15 files changed +6019
-0
lines changed Original file line number Diff line number Diff line change
1
+ version : 2
2
+ jobs :
3
+ build :
4
+ docker :
5
+ # specify the version you desire here
6
+ - image : circleci/node:latest-browsers
7
+ environment :
8
+ NPM_CONFIG_LOGLEVEL : error
9
+ JOBS : max # https://gist.github.com/ralphtheninja/f7c45bdee00784b41fed
10
+ working_directory : ~/micro-app-plugin-deploy-command
11
+ branches :
12
+ ignore :
13
+ - docs
14
+ - gh-pages
15
+
16
+ steps :
17
+ - checkout
18
+ - restore_cache :
19
+ key : micro-app-plugin-deploy-command-{{ .Branch }}-{{ checksum "yarn.lock" }}
20
+ - run : yarn --network-timeout 600000
21
+ - save_cache :
22
+ key : micro-app-plugin-deploy-command-{{ .Branch }}-{{ checksum "yarn.lock" }}
23
+ paths :
24
+ - ./node_modules
25
+ - run : yarn run test --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
26
+
Original file line number Diff line number Diff line change
1
+ # editorconfig.org
2
+ root = true
3
+
4
+ [* ]
5
+ indent_style = space
6
+ indent_size = 4
7
+ end_of_line = lf
8
+ charset = utf-8
9
+ trim_trailing_whitespace = true
10
+ insert_final_newline = true
11
+
12
+ [* .md ]
13
+ trim_trailing_whitespace = false
Original file line number Diff line number Diff line change
1
+ node_modules
2
+ coverage
3
+ .vscode
4
+ .circleci
Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+ root : true ,
3
+ env : {
4
+ browser : true ,
5
+ node : true
6
+ } ,
7
+ extends : [
8
+ "eslint-config-2o3t"
9
+ ] ,
10
+ parserOptions : {
11
+ parser : "babel-eslint"
12
+ } ,
13
+ }
Original file line number Diff line number Diff line change
1
+ # Created by .ignore support plugin (hsz.mobi)
2
+ # ## Node template
3
+ # Logs
4
+ logs
5
+ * .log
6
+ npm-debug.log *
7
+ yarn-debug.log *
8
+ yarn-error.log *
9
+
10
+ # Runtime data
11
+ pids
12
+ * .pid
13
+ * .seed
14
+ * .pid.lock
15
+
16
+ # Directory for instrumented libs generated by jscoverage/JSCover
17
+ lib-cov
18
+
19
+ # Coverage directory used by tools like istanbul
20
+ coverage
21
+
22
+ # nyc test coverage
23
+ .nyc_output
24
+
25
+ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
26
+ .grunt
27
+
28
+ # Bower dependency directory (https://bower.io/)
29
+ bower_components
30
+
31
+ # node-waf configuration
32
+ .lock-wscript
33
+
34
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
35
+ build /Release
36
+
37
+ # Dependency directories
38
+ node_modules /
39
+ jspm_packages /
40
+
41
+ # TypeScript v1 declaration files
42
+ typings /
43
+
44
+ # Optional npm cache directory
45
+ .npm
46
+
47
+ # Optional eslint cache
48
+ .eslintcache
49
+
50
+ # Optional REPL history
51
+ .node_repl_history
52
+
53
+ # Output of 'npm pack'
54
+ * .tgz
55
+
56
+ # Yarn Integrity file
57
+ .yarn-integrity
58
+
59
+ # dotenv environment variables file
60
+ .env
61
+
62
+ # parcel-bundler cache (https://parceljs.org/)
63
+ .cache
64
+
65
+ # next.js build output
66
+ .next
67
+
68
+ # nuxt.js build output
69
+ .nuxt
70
+
71
+ # Nuxt generate
72
+ dist
73
+
74
+ # vuepress build output
75
+ .vuepress /dist
76
+
77
+ # Serverless directories
78
+ .serverless
79
+
80
+ # IDE
81
+ .idea
82
+
83
+ .vscode
84
+ * .suo
85
+ * .ntvs *
86
+ * .njsproj
87
+ * .sln
88
+ * .sw *
Original file line number Diff line number Diff line change
1
+ # Micro APP Plugin - Deploy-Command
2
+
3
+ [ Plugin] auto deploy command plugin.
4
+
5
+ 基于webpack多入口的多仓库业务模块开发的插件应用框架核心库.
6
+
7
+ [ ![ Coverage Status] [ Coverage-img ]] [ Coverage-url ]
8
+ [ ![ CircleCI] [ CircleCI-img ]] [ CircleCI-url ]
9
+ [ ![ NPM Version] [ npm-img ]] [ npm-url ]
10
+ [ ![ NPM Download] [ download-img ]] [ download-url ]
11
+
12
+ [ Coverage-img ] : https://coveralls.io/repos/github/MicrosApp/MicroApp-Plugin-Deploy-Command/badge.svg?branch=master
13
+ [ Coverage-url ] : https://coveralls.io/github/MicrosApp/MicroApp-Plugin-Deploy-Command?branch=master
14
+ [ CircleCI-img ] : https://circleci.com/gh/MicrosApp/MicroApp-Plugin-Deploy-Command/tree/master.svg?style=svg
15
+ [ CircleCI-url ] : https://circleci.com/gh/MicrosApp/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
20
+
21
+ ## Install
22
+
23
+ ``` sh
24
+ yarn add @micro-app/plugin-deploy-command
25
+ ```
26
+
27
+ or
28
+
29
+ ``` sh
30
+ npm install -S @micro-app/plugin-deploy-command
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ### 在项目 ` 根目录 ` 的 ` micro-app.config.js ` 文件中配置
36
+
37
+ ``` js
38
+ module .exports = {
39
+ // ...
40
+
41
+ plugins: [ // 自定义插件
42
+ [ ' @micro-app/plugin-deploy-command' , {
43
+ // default config
44
+ git: ' ' ,
45
+ branch: {
46
+ name: ' ' ,
47
+ extends: true ,
48
+ },
49
+ message: ' ' ,
50
+ user: {
51
+ name: ' ' ,
52
+ email: ' ' ,
53
+ },
54
+ } ],
55
+ ],
56
+ };
57
+ ```
58
+
59
+
60
+ ### 创建 ` micro-app.deploy.config.js ` 文件, 并如下配置:
61
+
62
+ ``` js
63
+ {
64
+ git: ' ' ,
65
+ branch: {
66
+ name: ' ' ,
67
+ extends: true ,
68
+ },
69
+ message: ' ' , // 可选
70
+ user: { // 可选
71
+ name: ' ' ,
72
+ email: ' ' ,
73
+ },
74
+ }
75
+ ```
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ module . exports = {
4
+ name : '@micro-app/demo' ,
5
+ description : '' ,
6
+ version : '0.0.1' ,
7
+ type : '' , // types 类型
8
+
9
+ alias : { // 前端
10
+ api : 'abc' ,
11
+ config : {
12
+ link : 'abc' ,
13
+ description : '配置' ,
14
+ } ,
15
+ service : {
16
+ link : 'abc' ,
17
+ description : '接口' ,
18
+ type : 'server' ,
19
+ } ,
20
+ } ,
21
+
22
+ // 服务配置
23
+ server : {
24
+ entry : '' , // 服务端入口
25
+ port : 8088 , // 服务端口号
26
+ options : {
27
+ // 服务端回调参数
28
+ } ,
29
+ } ,
30
+ } ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ module . exports = {
4
+ git : '' ,
5
+ branch : {
6
+ name : '' ,
7
+ extends : true ,
8
+ } ,
9
+ message : '' ,
10
+ user : {
11
+ name : '' ,
12
+ email : '' ,
13
+ } ,
14
+ } ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " @micro-app/plugin-deploy-command" ,
3
+ "version" : " 0.0.1" ,
4
+ "description" : " [Plugin] auto deploy command plugin." ,
5
+ "main" : " src/index.js" ,
6
+ "scripts" : {
7
+ "test" : " jest"
8
+ },
9
+ "files" : [
10
+ " src"
11
+ ],
12
+ "homepage" : " https://github.com/MicrosApp/MicroApp-Plugin-Deploy-Command" ,
13
+ "repository" : {
14
+ "type" : " git" ,
15
+ "url" : " git+https://github.com/MicrosApp/MicroApp-Plugin-Deploy-Command.git"
16
+ },
17
+ "bugs" : {
18
+ "url" : " https://github.com/MicrosApp/MicroApp-Plugin-Deploy-Command/issues"
19
+ },
20
+ "keywords" : [
21
+ " micro" ,
22
+ " micro-app" ,
23
+ " plugin" ,
24
+ " command" ,
25
+ " deploy"
26
+ ],
27
+ "author" : {
28
+ "name" : " Zyao89" ,
29
+
30
+ },
31
+ "license" : " MIT" ,
32
+ "peerDependencies" : {
33
+ "@micro-app/core" : " >=0.1.4"
34
+ },
35
+ "devDependencies" : {
36
+ "@micro-app/cli" : " 0.1.3" ,
37
+ "@micro-app/core" : " 0.1.3" ,
38
+ "@types/jest" : " ^24.0.18" ,
39
+ "babel-eslint" : " ^10.0.3" ,
40
+ "coveralls" : " ^3.0.6" ,
41
+ "eslint" : " ^5.16.0" ,
42
+ "eslint-config-2o3t" : " ^1.1.17" ,
43
+ "jest" : " ^24.9.0"
44
+ },
45
+ "dependencies" : {
46
+ "shelljs" : " ^0.8.3"
47
+ }
48
+ }
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ module . exports = function versionCommand ( api ) {
4
+
5
+ const pkg = require ( '../../package.json' ) ;
6
+
7
+ api . addCommandVersion ( pkg ) ;
8
+
9
+ } ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ /* global expect */
4
+
5
+ const path = require ( 'path' ) ;
6
+
7
+ describe ( 'Command version' , ( ) => {
8
+
9
+ it ( 'version' , ( ) => {
10
+
11
+ const { service } = require ( '@micro-app/cli/bin/base' ) ;
12
+
13
+ service . registerPlugin ( {
14
+ id : 'test:VersionCommand' ,
15
+ link : path . join ( __dirname , './version.js' ) ,
16
+ } ) ;
17
+
18
+ const plugin = service . plugins . find ( item => item . id === 'cli:plugins-commands-version' ) ;
19
+ expect ( typeof plugin ) . toEqual ( 'object' ) ;
20
+
21
+ service . init ( ) ;
22
+
23
+ expect ( plugin . _api ) . not . toBeUndefined ( ) ;
24
+ plugin . _api . addCommandVersion ( {
25
+ name : 'a' ,
26
+ version : 'b' ,
27
+ description : 'c' ,
28
+ } ) ;
29
+
30
+ service . runCommand ( 'version' ) ;
31
+
32
+ expect ( service . commands . version ) . not . toBeNull ( ) ;
33
+ expect ( service . commands . version ) . not . toBeUndefined ( ) ;
34
+ expect ( typeof service . commands . version ) . toEqual ( 'object' ) ;
35
+ } ) ;
36
+
37
+ } ) ;
You can’t perform that action at this time.
0 commit comments