File tree Expand file tree Collapse file tree 6 files changed +950
-28
lines changed
Expand file tree Collapse file tree 6 files changed +950
-28
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @micro-app/plugin-vue-cli" ,
3- "version" : " 0.0.1 " ,
3+ "version" : " 0.0.2 " ,
44 "description" : " [Plugin] adapter vue cli plugin." ,
55 "main" : " src/index.js" ,
66 "scripts" : {
2929 },
3030 "license" : " MIT" ,
3131 "devDependencies" : {
32- "@micro-app/core" : " 0.1.0-beta.30" ,
32+ "@micro-app/cli" : " 0.1.1-rc.3" ,
33+ "@micro-app/core" : " 0.1.1" ,
3334 "@types/jest" : " ^24.0.18" ,
3435 "babel-eslint" : " ^10.0.2" ,
3536 "coveralls" : " ^3.0.6" ,
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:VueCLIVersion' ,
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+ } ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ const path = require('path');
44
55module . exports = function VueCLIAdapter ( api , opts = { } ) {
66
7+ // commands
8+ require ( './commands/version' ) ( api ) ;
9+
710 // Current working directory.
811 api . extendMethod ( 'getCwd' , ( ) => {
912 return opts . root || api . root ;
Original file line number Diff line number Diff line change 33
44module . exports = function ( api , opts ) {
55 console . log ( opts ) ;
6- const cwd = api . getCwd ( ) ;
7- console . log ( cwd ) ;
86} ;
You can’t perform that action at this time.
0 commit comments