create-storm-workspace 1.5.4 → 1.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/bin/index.ts +116 -108
- package/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.5.4](https://github.com/storm-software/storm-ops/compare/create-storm-workspace-v1.5.3...create-storm-workspace-v1.5.4) (2023-11-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **create-storm-workspace:** Resolved issue with missing package executable ([4256731](https://github.com/storm-software/storm-ops/commit/4256731041c36bcf54d965b9b8d44f5b2163566e))
|
|
7
|
+
|
|
1
8
|
## [1.5.3](https://github.com/storm-software/storm-ops/compare/create-storm-workspace-v1.5.2...create-storm-workspace-v1.5.3) (2023-11-07)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
15
15
|
|
|
16
16
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.org" target="_blank">stormsoftware.org</a> to stay up to date with this developer</h3><br />
|
|
17
17
|
|
|
18
|
-
[](https://prettier.io/)
|
|
19
19
|
[](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://docusaurus.io/) 
|
|
20
20
|
|
|
21
21
|
<h3 align="center" bold="true">⚠️ <b>Attention</b> ⚠️ - This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be availible through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.</h3><br />
|
package/bin/index.ts
CHANGED
|
@@ -3,128 +3,136 @@
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
4
|
|
|
5
5
|
import { getNpmPackageVersion } from "@nx/workspace/src/generators/utils/get-npm-package-version";
|
|
6
|
+
import type {
|
|
7
|
+
NxClientMode,
|
|
8
|
+
PresetGeneratorSchema
|
|
9
|
+
} from "@storm-software/workspace-tools";
|
|
6
10
|
import { createWorkspace } from "create-nx-workspace";
|
|
7
11
|
import { prompt } from "enquirer";
|
|
8
12
|
|
|
9
13
|
async function main() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
try {
|
|
15
|
+
let name = process.argv[2];
|
|
16
|
+
if (!name) {
|
|
17
|
+
const response = await prompt<{ name: string }>({
|
|
18
|
+
type: "input",
|
|
19
|
+
name: "name",
|
|
20
|
+
message: "What is the name of the workspace?"
|
|
21
|
+
});
|
|
22
|
+
name = response.name;
|
|
23
|
+
}
|
|
19
24
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
let organization = process.argv[3];
|
|
26
|
+
if (!organization) {
|
|
27
|
+
const response = await prompt<{ organization: string }>({
|
|
28
|
+
type: "input",
|
|
29
|
+
name: "organization",
|
|
30
|
+
message: "What organization owns this repository?",
|
|
31
|
+
initial: "storm-software"
|
|
32
|
+
});
|
|
33
|
+
organization = response.organization;
|
|
34
|
+
}
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
let namespace = process.argv[4];
|
|
37
|
+
if (!namespace) {
|
|
38
|
+
const response = await prompt<{ namespace: string }>({
|
|
39
|
+
type: "input",
|
|
40
|
+
name: "namespace",
|
|
41
|
+
message: "What is the namespace of this repository (npm scope)?",
|
|
42
|
+
initial: organization ? organization : "storm-software"
|
|
43
|
+
});
|
|
44
|
+
namespace = response.namespace;
|
|
45
|
+
}
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
let includeApps = process.argv[5] ? Boolean(process.argv[3]) : null;
|
|
48
|
+
if (!includeApps && typeof includeApps !== "boolean") {
|
|
49
|
+
const response = await prompt<{ includeApps: boolean }>({
|
|
50
|
+
type: "confirm",
|
|
51
|
+
name: "includeApps",
|
|
52
|
+
message:
|
|
53
|
+
"Should a separate `apps` folder be created for this workspace (if Yes: `apps` and `libs` folders will be added, if No: `packages` folders will be added)?",
|
|
54
|
+
initial: false
|
|
55
|
+
});
|
|
56
|
+
includeApps = response.includeApps;
|
|
57
|
+
}
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
let description = process.argv[6];
|
|
60
|
+
if (!description) {
|
|
61
|
+
const response = await prompt<{ description: string }>({
|
|
62
|
+
type: "input",
|
|
63
|
+
name: "description",
|
|
64
|
+
message:
|
|
65
|
+
"Provide a description of the workspace to use in the package.json and README.md files.",
|
|
66
|
+
initial: `⚡ The ${
|
|
67
|
+
namespace ? namespace : name
|
|
68
|
+
} monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.`
|
|
69
|
+
});
|
|
70
|
+
description = response.description;
|
|
71
|
+
}
|
|
67
72
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
let repositoryUrl = process.argv[7];
|
|
74
|
+
if (!repositoryUrl) {
|
|
75
|
+
const response = await prompt<{ repositoryUrl: string }>({
|
|
76
|
+
type: "input",
|
|
77
|
+
name: "repositoryUrl",
|
|
78
|
+
message: "What is the workspace's Git repository's URL?",
|
|
79
|
+
initial: `https://github.com/${
|
|
80
|
+
organization ? organization : "storm-software"
|
|
81
|
+
}/${name}`
|
|
82
|
+
});
|
|
83
|
+
repositoryUrl = response.repositoryUrl;
|
|
84
|
+
}
|
|
80
85
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
let nxCloud = process.argv[8] ? Boolean(process.argv[3]) : null;
|
|
87
|
+
if (!nxCloud && typeof nxCloud !== "boolean") {
|
|
88
|
+
const response = await prompt<{ nxCloud: boolean }>({
|
|
89
|
+
type: "confirm",
|
|
90
|
+
name: "nxCloud",
|
|
91
|
+
message:
|
|
92
|
+
"Should Nx Cloud be enabled for the workspace (allows for remote workspace caching)?",
|
|
93
|
+
initial: false
|
|
94
|
+
});
|
|
95
|
+
nxCloud = response.nxCloud;
|
|
96
|
+
}
|
|
92
97
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
98
|
+
let mode: NxClientMode = process.argv[9] as NxClientMode;
|
|
99
|
+
if (!mode) {
|
|
100
|
+
mode = (
|
|
101
|
+
await prompt<{ mode: "light" | "dark" }>({
|
|
102
|
+
name: "mode",
|
|
103
|
+
message: "Which mode should be used?",
|
|
104
|
+
initial: "dark" as any,
|
|
105
|
+
type: "autocomplete",
|
|
106
|
+
choices: [
|
|
107
|
+
{ name: "light", message: "light" },
|
|
108
|
+
{ name: "dark", message: "dark" }
|
|
109
|
+
]
|
|
110
|
+
})
|
|
111
|
+
).mode;
|
|
112
|
+
}
|
|
108
113
|
|
|
109
|
-
|
|
114
|
+
console.log(`⚡ Creating the Storm Workspace: ${name}`);
|
|
110
115
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
const version = getNpmPackageVersion("@storm-software/workspace-tools");
|
|
117
|
+
const { directory } = await createWorkspace<PresetGeneratorSchema>(
|
|
118
|
+
`@storm-software/workspace-tools@${version ? version : "latest"}`,
|
|
119
|
+
{
|
|
120
|
+
name,
|
|
121
|
+
organization,
|
|
122
|
+
namespace,
|
|
123
|
+
description,
|
|
124
|
+
includeApps,
|
|
125
|
+
repositoryUrl,
|
|
126
|
+
packageManager: "pnpm",
|
|
127
|
+
nxCloud,
|
|
128
|
+
mode
|
|
129
|
+
}
|
|
130
|
+
);
|
|
126
131
|
|
|
127
|
-
|
|
132
|
+
console.log(`⚡ Successfully created the workspace: ${directory}.`);
|
|
133
|
+
} catch (error) {
|
|
134
|
+
console.error(error);
|
|
135
|
+
}
|
|
128
136
|
}
|
|
129
137
|
|
|
130
138
|
main();
|
package/index.js
CHANGED
|
@@ -48,7 +48,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof P))re
|
|
|
48
48
|
`);return i&&(p=this.styles.cyan(p),b=this.styles.cyan(b)),w()}async renderChoices(){if(this.state.submitted)return"";let e=this.visible.map(async(i,n)=>await this.renderChoice(i,n)),r=await Promise.all(e);return r.length||r.push(this.styles.danger("No matching choices")),r.join(`
|
|
49
49
|
`)}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.scaleIdx)).join(", "):""}async render(){let{submitted:e,size:r}=this.state,i=await this.prefix(),n=await this.separator(),s=await this.message(),a=[i,s,n].filter(Boolean).join(" ");this.state.prompt=a;let o=await this.header(),l=await this.format(),u=await this.error()||await this.hint(),c=await this.renderChoices(),h=await this.footer();(l||!u)&&(a+=" "+l),u&&!a.includes(u)&&(a+=" "+u),e&&!l&&!c&&this.multiple&&this.type!=="form"&&(a+=this.styles.danger(this.emptyError)),this.clear(r),this.write([a,o,c,h].filter(Boolean).join(`
|
|
50
50
|
`)),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIdx;return this.base.submit.call(this)}};function Yb(t,e={}){if(Array.isArray(e.scale))return e.scale.map(i=>({...i}));let r=[];for(let i=1;i<t+1;i++)r.push({i,selected:!1});return r}bf.exports=Ks});var _f=m((E_,wf)=>{wf.exports=Ns()});var Ef=m((S_,xf)=>{"use strict";var Xb=yi(),Ys=class extends Xb{async initialize(){await super.initialize(),this.value=this.initial=this.resolve(this.options.initial),this.disabled=this.options.disabled||"no",this.enabled=this.options.enabled||"yes",await this.render()}reset(){this.value=this.initial,this.render()}delete(){this.alert()}toggle(){this.value=!this.value,this.render()}enable(){if(this.value===!0)return this.alert();this.value=!0,this.render()}disable(){if(this.value===!1)return this.alert();this.value=!1,this.render()}up(){this.toggle()}down(){this.toggle()}right(){this.toggle()}left(){this.toggle()}next(){this.toggle()}prev(){this.toggle()}dispatch(e="",r){switch(e.toLowerCase()){case" ":return this.toggle();case"1":case"y":case"t":return this.enable();case"0":case"n":case"f":return this.disable();default:return this.alert()}}format(){let e=i=>this.styles.primary.underline(i);return[this.value?this.disabled:e(this.disabled),this.value?e(this.enabled):this.enabled].join(this.styles.muted(" / "))}async render(){let{size:e}=this.state,r=await this.header(),i=await this.prefix(),n=await this.separator(),s=await this.message(),a=await this.format(),o=await this.error()||await this.hint(),l=await this.footer(),u=[i,s,n,a].join(" ");this.state.prompt=u,o&&!u.includes(o)&&(u+=" "+o),this.clear(e),this.write([r,u,l].filter(Boolean).join(`
|
|
51
|
-
`)),this.write(this.margin[2]),this.restore()}};xf.exports=Ys});var Of=m((O_,Sf)=>{"use strict";var Zb=Te(),Xs=class extends Zb{constructor(e){if(super(e),typeof this.options.correctChoice!="number"||this.options.correctChoice<0)throw new Error("Please specify the index of the correct answer from the list of choices")}async toChoices(e,r){let i=await super.toChoices(e,r);if(i.length<2)throw new Error("Please give at least two choices to the user");if(this.options.correctChoice>i.length)throw new Error("Please specify the index of the correct answer from the list of choices");return i}check(e){return e.index===this.options.correctChoice}async result(e){return{selectedAnswer:e,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}};Sf.exports=Xs});var kf=m(Zs=>{"use strict";var Cf=W(),I=(t,e)=>{Cf.defineExport(Zs,t,e),Cf.defineExport(Zs,t.toLowerCase(),e)};I("AutoComplete",()=>jh());I("BasicAuth",()=>Lh());I("Confirm",()=>Gh());I("Editable",()=>Uh());I("Form",()=>gi());I("Input",()=>Ns());I("Invisible",()=>Zh());I("List",()=>Jh());I("MultiSelect",()=>tf());I("Numeral",()=>sf());I("Password",()=>of());I("Scale",()=>cf());I("Select",()=>Te());I("Snippet",()=>mf());I("Sort",()=>yf());I("Survey",()=>vf());I("Text",()=>_f());I("Toggle",()=>Ef());I("Quiz",()=>Of())});var Af=m((k_,Rf)=>{Rf.exports={ArrayPrompt:Xt(),AuthPrompt:Ts(),BooleanPrompt:yi(),NumberPrompt:$s(),StringPrompt:ze()}});var jf=m((R_,qf)=>{"use strict";var Tf=require("assert"),Js=require("events"),qe=W(),ne=class extends Js{constructor(e,r){super(),this.options=qe.merge({},e),this.answers={...r}}register(e,r){if(qe.isObject(e)){for(let n of Object.keys(e))this.register(n,e[n]);return this}Tf.equal(typeof r,"function","expected a function");let i=e.toLowerCase();return r.prototype instanceof this.Prompt?this.prompts[i]=r:this.prompts[i]=r(this.Prompt,this),this}async prompt(e=[]){for(let r of[].concat(e))try{typeof r=="function"&&(r=await r.call(this)),await this.ask(qe.merge({},this.options,r))}catch(i){return Promise.reject(i)}return this.answers}async ask(e){typeof e=="function"&&(e=await e.call(this));let r=qe.merge({},this.options,e),{type:i,name:n}=e,{set:s,get:a}=qe;if(typeof i=="function"&&(i=await i.call(this,e,this.answers)),!i)return this.answers[n];i==="number"&&(i="numeral"),Tf(this.prompts[i],`Prompt "${i}" is not registered`);let o=new this.prompts[i](r),l=a(this.answers,n);o.state.answers=this.answers,o.enquirer=this,n&&o.on("submit",c=>{this.emit("answer",n,c,o),s(this.answers,n,c)});let u=o.emit.bind(o);return o.emit=(...c)=>(this.emit.call(this,...c),u(...c)),this.emit("prompt",o,this),r.autofill&&l!=null?(o.value=o.input=l,r.autofill==="show"&&await o.submit()):l=o.value=await o.run(),l}use(e){return e.call(this,this),this}set Prompt(e){this._Prompt=e}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(e){this._Prompt=e}static get Prompt(){return this._Prompt||_t()}static get prompts(){return kf()}static get types(){return Af()}static get prompt(){let e=(r,...i)=>{let n=new this(...i),s=n.emit.bind(n);return n.emit=(...a)=>(e.emit(...a),s(...a)),n.prompt(r)};return qe.mixinEmitter(e,new Js),e}};qe.mixinEmitter(ne,new Js);var Qs=ne.prompts;for(let t of Object.keys(Qs)){let e=t.toLowerCase(),r=i=>new Qs[t](i).run();ne.prompt[e]=r,ne[e]=r,ne[t]||Reflect.defineProperty(ne,t,{get:()=>Qs[t]})}var Zt=t=>{qe.defineExport(ne,t,()=>ne.types[t])};Zt("ArrayPrompt");Zt("AuthPrompt");Zt("BooleanPrompt");Zt("NumberPrompt");Zt("StringPrompt");qf.exports=ne});var Mf=xi(sa()),Pf=xi(zc()),me=xi(jf());async function Qb(){let t=process.argv[2];t||(t=(await(0,me.prompt)({type:"input",name:"name",message:"What is the name of the workspace?"})).name);let e=process.argv[3];e||(e=(await(0,me.prompt)({type:"input",name:"organization",message:"What organization owns this repository?",initial:"storm-software"})).organization);let r=process.argv[4];r||(r=(await(0,me.prompt)({type:"input",name:"namespace",message:"What is the namespace of this repository (npm scope)?",initial:e||"storm-software"})).namespace);let i=process.argv[5]?!!process.argv[3]:null;!i&&typeof i!="boolean"&&(i=(await(0,me.prompt)({type:"confirm",name:"includeApps",message:"Should a separate `apps` folder be created for this workspace (if Yes: `apps` and `libs` folders will be added, if No: `packages` folders will be added)?",initial:!1})).includeApps);let n=process.argv[6];n||(n=(await(0,me.prompt)({type:"input",name:"description",message:"Provide a description of the workspace to use in the package.json and README.md files.",initial:`\u26A1 The ${r||t} monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.`})).description);let s=process.argv[7];s||(s=(await(0,me.prompt)({type:"input",name:"repositoryUrl",message:"What is the workspace's Git repository's URL?",initial:`https://github.com/${e||"storm-software"}/${t}`})).repositoryUrl);let a=process.argv[8]?!!process.argv[3]:null;!a&&typeof a!="boolean"&&(a=(await(0,me.prompt)({type:"confirm",name:"nxCloud",message:"Should Nx Cloud be enabled for the workspace (allows for remote workspace caching)?",initial:!1})).nxCloud);let o=process.argv[9];o||(o=(await(0,me.prompt)({name:"mode",message:"Which mode should be used?",initial:"dark",type:"autocomplete",choices:[{name:"light",message:"light"},{name:"dark",message:"dark"}]})).mode),console.log(`\u26A1 Creating the Storm Workspace: ${t}`);let l=(0,Mf.getNpmPackageVersion)("@storm-software/workspace-tools"),{directory:u}=await(0,Pf.createWorkspace)(`@storm-software/workspace-tools@${l||"latest"}`,{name:t,organization:e,namespace:r,description:n,includeApps:i,repositoryUrl:s,
|
|
51
|
+
`)),this.write(this.margin[2]),this.restore()}};xf.exports=Ys});var Of=m((O_,Sf)=>{"use strict";var Zb=Te(),Xs=class extends Zb{constructor(e){if(super(e),typeof this.options.correctChoice!="number"||this.options.correctChoice<0)throw new Error("Please specify the index of the correct answer from the list of choices")}async toChoices(e,r){let i=await super.toChoices(e,r);if(i.length<2)throw new Error("Please give at least two choices to the user");if(this.options.correctChoice>i.length)throw new Error("Please specify the index of the correct answer from the list of choices");return i}check(e){return e.index===this.options.correctChoice}async result(e){return{selectedAnswer:e,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}};Sf.exports=Xs});var kf=m(Zs=>{"use strict";var Cf=W(),I=(t,e)=>{Cf.defineExport(Zs,t,e),Cf.defineExport(Zs,t.toLowerCase(),e)};I("AutoComplete",()=>jh());I("BasicAuth",()=>Lh());I("Confirm",()=>Gh());I("Editable",()=>Uh());I("Form",()=>gi());I("Input",()=>Ns());I("Invisible",()=>Zh());I("List",()=>Jh());I("MultiSelect",()=>tf());I("Numeral",()=>sf());I("Password",()=>of());I("Scale",()=>cf());I("Select",()=>Te());I("Snippet",()=>mf());I("Sort",()=>yf());I("Survey",()=>vf());I("Text",()=>_f());I("Toggle",()=>Ef());I("Quiz",()=>Of())});var Af=m((k_,Rf)=>{Rf.exports={ArrayPrompt:Xt(),AuthPrompt:Ts(),BooleanPrompt:yi(),NumberPrompt:$s(),StringPrompt:ze()}});var jf=m((R_,qf)=>{"use strict";var Tf=require("assert"),Js=require("events"),qe=W(),ne=class extends Js{constructor(e,r){super(),this.options=qe.merge({},e),this.answers={...r}}register(e,r){if(qe.isObject(e)){for(let n of Object.keys(e))this.register(n,e[n]);return this}Tf.equal(typeof r,"function","expected a function");let i=e.toLowerCase();return r.prototype instanceof this.Prompt?this.prompts[i]=r:this.prompts[i]=r(this.Prompt,this),this}async prompt(e=[]){for(let r of[].concat(e))try{typeof r=="function"&&(r=await r.call(this)),await this.ask(qe.merge({},this.options,r))}catch(i){return Promise.reject(i)}return this.answers}async ask(e){typeof e=="function"&&(e=await e.call(this));let r=qe.merge({},this.options,e),{type:i,name:n}=e,{set:s,get:a}=qe;if(typeof i=="function"&&(i=await i.call(this,e,this.answers)),!i)return this.answers[n];i==="number"&&(i="numeral"),Tf(this.prompts[i],`Prompt "${i}" is not registered`);let o=new this.prompts[i](r),l=a(this.answers,n);o.state.answers=this.answers,o.enquirer=this,n&&o.on("submit",c=>{this.emit("answer",n,c,o),s(this.answers,n,c)});let u=o.emit.bind(o);return o.emit=(...c)=>(this.emit.call(this,...c),u(...c)),this.emit("prompt",o,this),r.autofill&&l!=null?(o.value=o.input=l,r.autofill==="show"&&await o.submit()):l=o.value=await o.run(),l}use(e){return e.call(this,this),this}set Prompt(e){this._Prompt=e}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(e){this._Prompt=e}static get Prompt(){return this._Prompt||_t()}static get prompts(){return kf()}static get types(){return Af()}static get prompt(){let e=(r,...i)=>{let n=new this(...i),s=n.emit.bind(n);return n.emit=(...a)=>(e.emit(...a),s(...a)),n.prompt(r)};return qe.mixinEmitter(e,new Js),e}};qe.mixinEmitter(ne,new Js);var Qs=ne.prompts;for(let t of Object.keys(Qs)){let e=t.toLowerCase(),r=i=>new Qs[t](i).run();ne.prompt[e]=r,ne[e]=r,ne[t]||Reflect.defineProperty(ne,t,{get:()=>Qs[t]})}var Zt=t=>{qe.defineExport(ne,t,()=>ne.types[t])};Zt("ArrayPrompt");Zt("AuthPrompt");Zt("BooleanPrompt");Zt("NumberPrompt");Zt("StringPrompt");qf.exports=ne});var Mf=xi(sa()),Pf=xi(zc()),me=xi(jf());async function Qb(){try{let t=process.argv[2];t||(t=(await(0,me.prompt)({type:"input",name:"name",message:"What is the name of the workspace?"})).name);let e=process.argv[3];e||(e=(await(0,me.prompt)({type:"input",name:"organization",message:"What organization owns this repository?",initial:"storm-software"})).organization);let r=process.argv[4];r||(r=(await(0,me.prompt)({type:"input",name:"namespace",message:"What is the namespace of this repository (npm scope)?",initial:e||"storm-software"})).namespace);let i=process.argv[5]?!!process.argv[3]:null;!i&&typeof i!="boolean"&&(i=(await(0,me.prompt)({type:"confirm",name:"includeApps",message:"Should a separate `apps` folder be created for this workspace (if Yes: `apps` and `libs` folders will be added, if No: `packages` folders will be added)?",initial:!1})).includeApps);let n=process.argv[6];n||(n=(await(0,me.prompt)({type:"input",name:"description",message:"Provide a description of the workspace to use in the package.json and README.md files.",initial:`\u26A1 The ${r||t} monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.`})).description);let s=process.argv[7];s||(s=(await(0,me.prompt)({type:"input",name:"repositoryUrl",message:"What is the workspace's Git repository's URL?",initial:`https://github.com/${e||"storm-software"}/${t}`})).repositoryUrl);let a=process.argv[8]?!!process.argv[3]:null;!a&&typeof a!="boolean"&&(a=(await(0,me.prompt)({type:"confirm",name:"nxCloud",message:"Should Nx Cloud be enabled for the workspace (allows for remote workspace caching)?",initial:!1})).nxCloud);let o=process.argv[9];o||(o=(await(0,me.prompt)({name:"mode",message:"Which mode should be used?",initial:"dark",type:"autocomplete",choices:[{name:"light",message:"light"},{name:"dark",message:"dark"}]})).mode),console.log(`\u26A1 Creating the Storm Workspace: ${t}`);let l=(0,Mf.getNpmPackageVersion)("@storm-software/workspace-tools"),{directory:u}=await(0,Pf.createWorkspace)(`@storm-software/workspace-tools@${l||"latest"}`,{name:t,organization:e,namespace:r,description:n,includeApps:i,repositoryUrl:s,packageManager:"pnpm",nxCloud:a,mode:o});console.log(`\u26A1 Successfully created the workspace: ${u}.`)}catch(t){console.error(t)}}Qb();
|
|
52
52
|
/*! Bundled license information:
|
|
53
53
|
|
|
54
54
|
safe-buffer/index.js:
|