create-storm-workspace 1.5.8 → 1.5.10

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.5.9](https://github.com/storm-software/storm-ops/compare/create-storm-workspace-v1.5.8...create-storm-workspace-v1.5.9) (2023-11-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **workspace-tools:** Resolve issue with preset CI action's env config ([e6f7b8a](https://github.com/storm-software/storm-ops/commit/e6f7b8a81be6197d9f5d0fe71dafabf90189c669))
7
+
8
+ ## [1.5.8](https://github.com/storm-software/storm-ops/compare/create-storm-workspace-v1.5.7...create-storm-workspace-v1.5.8) (2023-11-08)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **workspace-tools:** Resolved issue with README template in preset ([5824423](https://github.com/storm-software/storm-ops/commit/5824423e787aa2bec7e94cca89105a2bee2828f4))
14
+
1
15
  ## [1.5.7](https://github.com/storm-software/storm-ops/compare/create-storm-workspace-v1.5.6...create-storm-workspace-v1.5.7) (2023-11-08)
2
16
 
3
17
 
package/bin/index.ts CHANGED
@@ -12,7 +12,7 @@ import { prompt } from "enquirer";
12
12
 
13
13
  async function main() {
14
14
  try {
15
- let name = process.argv[2];
15
+ let name = process.argv.length > 2 ? process.argv[2] : null;
16
16
  if (!name) {
17
17
  const response = await prompt<{ name: string }>({
18
18
  type: "input",
@@ -22,7 +22,7 @@ async function main() {
22
22
  name = response.name;
23
23
  }
24
24
 
25
- let organization = process.argv[3];
25
+ let organization = process.argv.length > 3 ? process.argv[3] : null;
26
26
  if (!organization) {
27
27
  const response = await prompt<{ organization: string }>({
28
28
  type: "input",
@@ -33,7 +33,7 @@ async function main() {
33
33
  organization = response.organization;
34
34
  }
35
35
 
36
- let namespace = process.argv[4];
36
+ let namespace = process.argv.length > 4 ? process.argv[4] : null;
37
37
  if (!namespace) {
38
38
  const response = await prompt<{ namespace: string }>({
39
39
  type: "input",
@@ -44,7 +44,10 @@ async function main() {
44
44
  namespace = response.namespace;
45
45
  }
46
46
 
47
- let includeApps = process.argv[5] ? Boolean(process.argv[5]) : null;
47
+ let includeApps =
48
+ process.argv.length > 5 && process.argv[5]
49
+ ? Boolean(process.argv[5])
50
+ : null;
48
51
  if (!includeApps && typeof includeApps !== "boolean") {
49
52
  const response = await prompt<{ includeApps: boolean }>({
50
53
  type: "confirm",
@@ -56,7 +59,7 @@ async function main() {
56
59
  includeApps = response.includeApps;
57
60
  }
58
61
 
59
- let description = process.argv[6];
62
+ let description = process.argv.length > 6 ? process.argv[6] : null;
60
63
  if (!description) {
61
64
  const response = await prompt<{ description: string }>({
62
65
  type: "input",
@@ -70,7 +73,7 @@ async function main() {
70
73
  description = response.description;
71
74
  }
72
75
 
73
- let repositoryUrl = process.argv[7];
76
+ let repositoryUrl = process.argv.length > 7 ? process.argv[7] : null;
74
77
  if (!repositoryUrl) {
75
78
  const response = await prompt<{ repositoryUrl: string }>({
76
79
  type: "input",
@@ -83,7 +86,9 @@ async function main() {
83
86
  repositoryUrl = response.repositoryUrl;
84
87
  }
85
88
 
86
- let mode: NxClientMode = process.argv[8] as NxClientMode;
89
+ let mode: NxClientMode = (
90
+ process.argv.length > 8 ? process.argv[8] : null
91
+ ) as NxClientMode;
87
92
  if (!mode) {
88
93
  mode = (
89
94
  await prompt<{ mode: "light" | "dark" }>({
@@ -119,6 +124,9 @@ async function main() {
119
124
 
120
125
  console.log(`⚡ Successfully created the workspace: ${directory}.`);
121
126
  } catch (error) {
127
+ console.log(
128
+ "❌ An error occurred while creating the workspace. Please correct the below issue:"
129
+ );
122
130
  console.error(error);
123
131
  }
124
132
  }
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(),h=await this.renderChoices(),c=await this.footer();(l||!u)&&(a+=" "+l),u&&!a.includes(u)&&(a+=" "+u),e&&!l&&!h&&this.multiple&&this.type!=="form"&&(a+=this.styles.danger(this.emptyError)),this.clear(r),this.write([a,o,h,c].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=Ae(),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",()=>Ae());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"),Te=W(),ne=class extends Js{constructor(e,r){super(),this.options=Te.merge({},e),this.answers={...r}}register(e,r){if(Te.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(Te.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=Te.merge({},this.options,e),{type:i,name:n}=e,{set:s,get:a}=Te;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",h=>{this.emit("answer",n,h,o),s(this.answers,n,h)});let u=o.emit.bind(o);return o.emit=(...h)=>(this.emit.call(this,...h),u(...h)),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 Te.mixinEmitter(e,new Js),e}};Te.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=>{Te.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()),qe=xi(jf());async function Qb(){try{let t=process.argv[2];t||(t=(await(0,qe.prompt)({type:"input",name:"name",message:"What is the name of the workspace?"})).name);let e=process.argv[3];e||(e=(await(0,qe.prompt)({type:"input",name:"organization",message:"What organization owns this repository?",initial:"storm-software"})).organization);let r=process.argv[4];r||(r=(await(0,qe.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[5]:null;!i&&typeof i!="boolean"&&(i=(await(0,qe.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,qe.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,qe.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];a||(a=(await(0,qe.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 o=(0,Mf.getNpmPackageVersion)("@storm-software/workspace-tools"),{directory:l}=await(0,Pf.createWorkspace)(`@storm-software/workspace-tools@${o||"latest"}`,{name:t,organization:e,namespace:r,description:n,includeApps:i,repositoryUrl:s,packageManager:"pnpm",nxCloud:!1,mode:a});console.log(`\u26A1 Successfully created the workspace: ${l}.`)}catch(t){console.error(t)}}Qb();
51
+ `)),this.write(this.margin[2]),this.restore()}};xf.exports=Ys});var Of=m((O_,Sf)=>{"use strict";var Zb=Ae(),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",()=>Ae());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"),Te=W(),ne=class extends Js{constructor(e,r){super(),this.options=Te.merge({},e),this.answers={...r}}register(e,r){if(Te.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(Te.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=Te.merge({},this.options,e),{type:i,name:n}=e,{set:s,get:a}=Te;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",h=>{this.emit("answer",n,h,o),s(this.answers,n,h)});let u=o.emit.bind(o);return o.emit=(...h)=>(this.emit.call(this,...h),u(...h)),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 Te.mixinEmitter(e,new Js),e}};Te.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=>{Te.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()),qe=xi(jf());async function Qb(){try{let t=process.argv.length>2?process.argv[2]:null;t||(t=(await(0,qe.prompt)({type:"input",name:"name",message:"What is the name of the workspace?"})).name);let e=process.argv.length>3?process.argv[3]:null;e||(e=(await(0,qe.prompt)({type:"input",name:"organization",message:"What organization owns this repository?",initial:"storm-software"})).organization);let r=process.argv.length>4?process.argv[4]:null;r||(r=(await(0,qe.prompt)({type:"input",name:"namespace",message:"What is the namespace of this repository (npm scope)?",initial:e||"storm-software"})).namespace);let i=process.argv.length>5&&process.argv[5]?!!process.argv[5]:null;!i&&typeof i!="boolean"&&(i=(await(0,qe.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.length>6?process.argv[6]:null;n||(n=(await(0,qe.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.length>7?process.argv[7]:null;s||(s=(await(0,qe.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.length>8?process.argv[8]:null;a||(a=(await(0,qe.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 o=(0,Mf.getNpmPackageVersion)("@storm-software/workspace-tools"),{directory:l}=await(0,Pf.createWorkspace)(`@storm-software/workspace-tools@${o||"latest"}`,{name:t,organization:e,namespace:r,description:n,includeApps:i,repositoryUrl:s,packageManager:"pnpm",nxCloud:!1,mode:a});console.log(`\u26A1 Successfully created the workspace: ${l}.`)}catch(t){console.log("\u274C An error occurred while creating the workspace. Please correct the below issue:"),console.error(t)}}Qb();
52
52
  /*! Bundled license information:
53
53
 
54
54
  safe-buffer/index.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-storm-workspace",
3
- "version": "1.5.8",
3
+ "version": "1.5.10",
4
4
  "private": false,
5
5
  "description": "⚡A CLI tool used to generate and fully configure a Storm Workspace repository.",
6
6
  "keywords": [