1- import * as path from "path" ;
21import Generator from "yeoman-generator" ;
32import traits from "../../traits" ;
43
@@ -19,88 +18,17 @@ export = class LibraryGenerator extends Generator {
1918 this . composeWith ( require . resolve ( "../config-lint" ) , { } ) ;
2019 this . composeWith ( require . resolve ( "../config-doc" ) , { } ) ;
2120 this . composeWith ( require . resolve ( "../config-rollup" ) , { } ) ;
22- }
23-
24- public async prompting ( ) {
25- const questions : Generator . Questions = [
26- {
27- type : "list" ,
28- name : "structure" ,
29- message : "Library structure" ,
30- choices : [
31- {
32- name : "Single package repository" ,
33- value : "single"
34- } ,
35- {
36- name : "Multi package repository (monorepo)" ,
37- value : "multi"
38- }
39- ]
40- }
41- ] ;
42-
43- this . answers = ( await this . prompt ( questions ) ) as Answers ;
44- }
45-
46- public configuring ( ) {
47- switch ( this . answers . structure ) {
48- case "single" :
49- this . traits . extendPackageJson ( {
50- scripts : {
51- release : "standard-version" ,
52- publish : "yarn publish"
53- } ,
54- devDependencies : {
55- "standard-version" : "^5.0.2"
56- }
57- } ) ;
58- break ;
59-
60- case "multi" :
61- this . fs . copyTpl (
62- this . templatePath ( "multi/lerna.json" ) ,
63- this . destinationPath ( "lerna.json" ) ,
64- {
65- ...this . answers ,
66- ...this . config . getAll ( )
67- }
68- ) ;
69-
70- this . traits . extendPackageJson ( {
71- private : true ,
72- scripts : {
73- release : "lerna bootstrap && lerna version" ,
74- publish : "lerna publish from-git"
75- } ,
76- workspaces : [ "packages/*" ] ,
77- devDependencies : {
78- lerna : "^3.11.0"
79- }
80- } ) ;
81-
82- break ;
83- }
21+ this . composeWith ( require . resolve ( "../config-release" ) , { } ) ;
8422 }
8523
8624 public writing ( ) {
87- switch ( this . answers . structure ) {
88- case "single" :
89- [ "src/index.ts" , "test/index.spec.ts" ] . forEach ( file => {
90- this . fs . copyTpl (
91- this . templatePath ( path . join ( "single" , file ) ) ,
92- this . destinationPath ( file ) ,
93- {
94- ...this . answers ,
95- ...this . config . getAll ( )
96- }
97- ) ;
98- } ) ;
99- break ;
100-
101- case "multi" :
102- break ;
103- }
25+ [ "src/index.ts" , "test/index.spec.ts" ] . forEach ( file => {
26+ this . fs . copyTpl (
27+ this . templatePath ( file ) ,
28+ this . destinationPath ( file ) ,
29+ this . config . getAll ( )
30+ ) ;
31+ } ) ;
10432 }
10533
10634 public install ( ) {
0 commit comments