@pplancq/create-react-app 1.5.1 → 2.0.1
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 +37 -0
- package/README.md +108 -14
- package/dist/main.js +82 -0
- package/package.json +43 -6
- package/index.js +0 -152
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
## @pplancq/create-react-app [2.0.1](https://github.com/pplancq/dev-tools/compare/@pplancq/create-react-app@2.0.0...@pplancq/create-react-app@2.0.1) (2025-11-03)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **create-react-app:** fix version of create react app ([5f2b3ba](https://github.com/pplancq/dev-tools/commit/5f2b3bad525436b58b2e8504f65bf3bd9a1baed0))
|
|
6
|
+
|
|
7
|
+
## @pplancq/create-react-app [2.0.0](https://github.com/pplancq/dev-tools/compare/@pplancq/create-react-app@1.5.1...@pplancq/create-react-app@2.0.0) (2025-09-15)
|
|
8
|
+
|
|
9
|
+
### ⚠ BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* **create-react-app:** only npm is supported for project creation, yarn and pnpm are no longer compatible
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **create-react-app:** add interactive project name prompt with cancellation support ([3f1dba7](https://github.com/pplancq/dev-tools/commit/3f1dba752c7aa49cba9eb1b78671a33f94102d32))
|
|
16
|
+
* **react-template:** add option --template to use a custom template ([12c0007](https://github.com/pplancq/dev-tools/commit/12c0007f50d1c49941d5923fa0ee92a681ac6dd5))
|
|
17
|
+
* **create-react-app:** add option to skip git initialization during project setup ([6deaef9](https://github.com/pplancq/dev-tools/commit/6deaef958b485f6413067eb0dff111fd0c4c16ea))
|
|
18
|
+
* **react-template:** add post-install script check and warning ([851defc](https://github.com/pplancq/dev-tools/commit/851defcd935820a863e2efe8bc22c452710ffac6))
|
|
19
|
+
* **create-react-app:** add project name validation to interactive prompt ([8d5ac97](https://github.com/pplancq/dev-tools/commit/8d5ac97a69b1f351ffa54234a3f34c3c4a413451))
|
|
20
|
+
* **create-react-app:** add skip dependency installation option to interactive prompt ([3b34c55](https://github.com/pplancq/dev-tools/commit/3b34c55f7800b93bd7159649e79278448012b7da))
|
|
21
|
+
* **create-react-app:** argument project name is now optional ([a2eee97](https://github.com/pplancq/dev-tools/commit/a2eee976b7ce3d36b3f29110f7e4071b9e392a0d))
|
|
22
|
+
* **create-react-app:** enhance interactive prompt with improved logging and user guidance ([49c51e5](https://github.com/pplancq/dev-tools/commit/49c51e505f66fd49c8d954231be90b0a4e2d066b))
|
|
23
|
+
* **create-react-app:** implement spinner feedback for all long-running steps ([6392686](https://github.com/pplancq/dev-tools/commit/6392686dff4d70fa0af25b84facd719f56c2f9a4))
|
|
24
|
+
* **create-react-app:** migrate build configuration to rslib and typescript ([75ff896](https://github.com/pplancq/dev-tools/commit/75ff896fe524b469c868e3413338f369c25c0a24))
|
|
25
|
+
* **create-react-app:** move in project name validation check existing directories ([cf97c03](https://github.com/pplancq/dev-tools/commit/cf97c03144ed08b4683b06b71a8b5945ad62c8ba))
|
|
26
|
+
* **create-react-app:** remove yarn and pnpm compatibility ([74707ff](https://github.com/pplancq/dev-tools/commit/74707ff1afa0f18085353b1da1bbbab7f8f550a7))
|
|
27
|
+
* **create-react-app:** replace chalk with picocolors for console output ([2f035f4](https://github.com/pplancq/dev-tools/commit/2f035f45adb424d455a3ead478acdac7c6ab2184))
|
|
28
|
+
* **react-template:** run post-install template script ([eefbd6e](https://github.com/pplancq/dev-tools/commit/eefbd6e7430b305d90d2efa01ba794705b3570e2))
|
|
29
|
+
* **create-react-app:** update npm install template command to use nested strategy ([55dd48d](https://github.com/pplancq/dev-tools/commit/55dd48d7017cfe98f27e145885b2604cec3ecfdc))
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* **create-react-app:** remove node_modules directory after template installation ([37ff28a](https://github.com/pplancq/dev-tools/commit/37ff28a3f64e2c503b84c199a5746d562d478a93))
|
|
34
|
+
* **create-react-app:** replace console.error with log.error for better logging ([531dd1d](https://github.com/pplancq/dev-tools/commit/531dd1d0eb58f13030d25226e8b05e50d837e991))
|
|
35
|
+
* **create-react-app:** runCommand to use execFileSync for improved security ([79f34ef](https://github.com/pplancq/dev-tools/commit/79f34ef09a5549a9e0de47cf4c0dea9310e399aa))
|
|
36
|
+
* **deps:** update dependency chalk to ^5.6.0 ([614fe09](https://github.com/pplancq/dev-tools/commit/614fe0955f6b6e445a79d682860ce69810942667))
|
|
37
|
+
|
|
1
38
|
## @pplancq/create-react-app [1.5.1](https://github.com/pplancq/dev-tools/compare/@pplancq/create-react-app@1.5.0...@pplancq/create-react-app@1.5.1) (2025-08-11)
|
|
2
39
|
|
|
3
40
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -1,40 +1,134 @@
|
|
|
1
1
|
# @pplancq/create-react-app
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 🚀 Introduction
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`@pplancq/create-react-app` is a CLI tool designed to help you quickly start a new React application using the [@pplancq/react-template](https://www.npmjs.com/package/@pplancq/react-template). It streamlines the setup process so you can focus on building your app, not on boilerplate.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 🏁 Quick Start
|
|
8
|
+
|
|
9
|
+
To create a new React project, run:
|
|
8
10
|
|
|
9
11
|
```shell
|
|
10
|
-
npm create @pplancq/react-app@latest
|
|
12
|
+
npm create @pplancq/react-app@latest
|
|
11
13
|
```
|
|
12
14
|
|
|
13
15
|
or
|
|
14
16
|
|
|
15
17
|
```shell
|
|
16
|
-
npx @pplancq/create-react-app@latest
|
|
18
|
+
npx @pplancq/create-react-app@latest
|
|
17
19
|
```
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
## 🖥️ Command Line Usage
|
|
22
|
+
|
|
23
|
+
You can use the starter via the command line to quickly scaffold a new React project with your preferred options.
|
|
24
|
+
|
|
25
|
+
To display the help menu with all available options:
|
|
20
26
|
|
|
21
27
|
```shell
|
|
22
|
-
|
|
28
|
+
npm create @pplancq/react-app -- --help
|
|
23
29
|
```
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
**Usage:**
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
create-react-app [options] [project-name]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Arguments:**
|
|
38
|
+
|
|
39
|
+
- `[project-name]`
|
|
40
|
+
The name of your new project directory (optional).
|
|
41
|
+
|
|
42
|
+
**Options:**
|
|
43
|
+
|
|
44
|
+
- `-t, --template <template>`
|
|
45
|
+
Specify a template to use (default: `@pplancq/react-template`).
|
|
46
|
+
- `--skip-dep-install`
|
|
47
|
+
Skip installing dependencies (`npm install`).
|
|
48
|
+
- `--skip-git-init`
|
|
49
|
+
Skip initializing a git repository.
|
|
50
|
+
- `-v, --version`
|
|
51
|
+
Show the version of the starter.
|
|
52
|
+
|
|
53
|
+
**Examples:**
|
|
54
|
+
|
|
55
|
+
- Create a project named `my-project`:
|
|
56
|
+
```shell
|
|
57
|
+
npm create @pplancq/react-app my-project
|
|
58
|
+
```
|
|
59
|
+
- Use `npx` to create a project and skip dependency installation:
|
|
60
|
+
```shell
|
|
61
|
+
npx @pplancq/create-react-app --skip-dep-install my-project
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
After running the command, follow the interactive prompts if you did not specify all arguments or options.
|
|
65
|
+
|
|
66
|
+
## 📦 Template
|
|
67
|
+
|
|
68
|
+
By default, this package uses the [`@pplancq/react-template`](https://www.npmjs.com/package/@pplancq/react-template) to generate a new React project. For more information about this template, please consult its documentation.
|
|
69
|
+
|
|
70
|
+
### Using Custom Templates
|
|
71
|
+
|
|
72
|
+
You can use custom templates by specifying the `--template` option with any template published on the npm registry:
|
|
26
73
|
|
|
27
74
|
```shell
|
|
28
|
-
|
|
75
|
+
npm create @pplancq/react-app my-project -- --template my-custom-template
|
|
29
76
|
```
|
|
30
77
|
|
|
31
|
-
|
|
78
|
+
#### Custom Template Requirements
|
|
79
|
+
|
|
80
|
+
To create a custom template that works with this tool:
|
|
81
|
+
|
|
82
|
+
1. **Publish on npm registry**: Your custom template must be published as an npm package and available for installation via `npm install`.
|
|
83
|
+
|
|
84
|
+
2. **Optional post-install script**: If your template requires specific configuration or setup, you can provide a post-install script by adding the following to your template's `package.json`:
|
|
85
|
+
|
|
86
|
+
```json5
|
|
87
|
+
// package.json
|
|
88
|
+
{
|
|
89
|
+
bin: {
|
|
90
|
+
'template-install': 'bin/template-install.js',
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The post-install script will be executed automatically after the template installation using:
|
|
96
|
+
|
|
97
|
+
```shell
|
|
98
|
+
npx template-install projectName
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The script will receive the project name as a parameter, allowing you to perform any template-specific configuration or setup tasks.
|
|
102
|
+
|
|
103
|
+
**Important**: The post-install script must be autonomous and not depend on external libraries, as they may not be installed during the template setup process. If your script requires external dependencies, you must provide a built/bundled version of the script that includes all necessary dependencies.
|
|
104
|
+
|
|
105
|
+
## 🧪 How to test locally
|
|
106
|
+
|
|
107
|
+
To test the starter locally before publishing:
|
|
108
|
+
|
|
109
|
+
1. In the repository folder, link the package:
|
|
110
|
+
|
|
111
|
+
```shell
|
|
112
|
+
npm link
|
|
113
|
+
npm run start
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
2. In another working directory, link and use the starter:
|
|
32
117
|
|
|
33
|
-
|
|
118
|
+
```shell
|
|
119
|
+
npm link @pplancq/create-react-app
|
|
120
|
+
npm create @pplancq/create-react-app
|
|
121
|
+
```
|
|
34
122
|
|
|
35
|
-
|
|
36
|
-
|
|
123
|
+
3. Once finished, unlink:
|
|
124
|
+
```shell
|
|
125
|
+
npm unlink @pplancq/create-react-app
|
|
126
|
+
```
|
|
127
|
+
And in the repository folder:
|
|
128
|
+
```shell
|
|
129
|
+
npm unlink
|
|
130
|
+
```
|
|
37
131
|
|
|
38
|
-
## License
|
|
132
|
+
## 📄 License
|
|
39
133
|
|
|
40
134
|
This project is under the MIT license.
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import*as t from"node:child_process";import*as e from"node:events";import*as u from"node:fs";import*as i from"node:path";import*as D from"node:process";import{promisify as r,stripVTControlCharacters as s}from"node:util";import n,{clearLine as o,createInterface as a,emitKeypressEvents as l,moveCursor as h}from"node:readline";import{Writable as p}from"node:stream";var m={"../../node_modules/picocolors/picocolors.js":function(t){let e=process||{},u=e.argv||[],i=e.env||{},D=!(i.NO_COLOR||u.includes("--no-color"))&&(!!i.FORCE_COLOR||u.includes("--color")||"win32"===e.platform||(e.stdout||{}).isTTY&&"dumb"!==i.TERM||!!i.CI),r=(t,e,u=t)=>i=>{let D=""+i,r=D.indexOf(e,t.length);return~r?t+s(D,e,u,r)+e:t+D+e},s=(t,e,u,i)=>{let D="",r=0;do D+=t.substring(r,i)+u,r=i+e.length,i=t.indexOf(e,r);while(~i);return D+t.substring(r)},n=(t=D)=>{let e=t?r:()=>String;return{isColorSupported:t,reset:e("\x1b[0m","\x1b[0m"),bold:e("\x1b[1m","\x1b[22m","\x1b[22m\x1b[1m"),dim:e("\x1b[2m","\x1b[22m","\x1b[22m\x1b[2m"),italic:e("\x1b[3m","\x1b[23m"),underline:e("\x1b[4m","\x1b[24m"),inverse:e("\x1b[7m","\x1b[27m"),hidden:e("\x1b[8m","\x1b[28m"),strikethrough:e("\x1b[9m","\x1b[29m"),black:e("\x1b[30m","\x1b[39m"),red:e("\x1b[31m","\x1b[39m"),green:e("\x1b[32m","\x1b[39m"),yellow:e("\x1b[33m","\x1b[39m"),blue:e("\x1b[34m","\x1b[39m"),magenta:e("\x1b[35m","\x1b[39m"),cyan:e("\x1b[36m","\x1b[39m"),white:e("\x1b[37m","\x1b[39m"),gray:e("\x1b[90m","\x1b[39m"),bgBlack:e("\x1b[40m","\x1b[49m"),bgRed:e("\x1b[41m","\x1b[49m"),bgGreen:e("\x1b[42m","\x1b[49m"),bgYellow:e("\x1b[43m","\x1b[49m"),bgBlue:e("\x1b[44m","\x1b[49m"),bgMagenta:e("\x1b[45m","\x1b[49m"),bgCyan:e("\x1b[46m","\x1b[49m"),bgWhite:e("\x1b[47m","\x1b[49m"),blackBright:e("\x1b[90m","\x1b[39m"),redBright:e("\x1b[91m","\x1b[39m"),greenBright:e("\x1b[92m","\x1b[39m"),yellowBright:e("\x1b[93m","\x1b[39m"),blueBright:e("\x1b[94m","\x1b[39m"),magentaBright:e("\x1b[95m","\x1b[39m"),cyanBright:e("\x1b[96m","\x1b[39m"),whiteBright:e("\x1b[97m","\x1b[39m"),bgBlackBright:e("\x1b[100m","\x1b[49m"),bgRedBright:e("\x1b[101m","\x1b[49m"),bgGreenBright:e("\x1b[102m","\x1b[49m"),bgYellowBright:e("\x1b[103m","\x1b[49m"),bgBlueBright:e("\x1b[104m","\x1b[49m"),bgMagentaBright:e("\x1b[105m","\x1b[49m"),bgCyanBright:e("\x1b[106m","\x1b[49m"),bgWhiteBright:e("\x1b[107m","\x1b[49m")}};t.exports=n(),t.exports.createColors=n},"../../node_modules/sisteransi/src/index.js":function(t){let e=`\x1b[`,u={to:(t,u)=>u?`${e}${u+1};${t+1}H`:`${e}${t+1}G`,move(t,u){let i="";return t<0?i+=`${e}${-t}D`:t>0&&(i+=`${e}${t}C`),u<0?i+=`${e}${-u}A`:u>0&&(i+=`${e}${u}B`),i},up:(t=1)=>`${e}${t}A`,down:(t=1)=>`${e}${t}B`,forward:(t=1)=>`${e}${t}C`,backward:(t=1)=>`${e}${t}D`,nextLine:(t=1)=>`${e}E`.repeat(t),prevLine:(t=1)=>`${e}F`.repeat(t),left:`${e}G`,hide:`${e}?25l`,show:`${e}?25h`,save:`\x1b7`,restore:`\x1b8`},i={screen:`${e}2J`,up:(t=1)=>`${e}1J`.repeat(t),down:(t=1)=>`${e}J`.repeat(t),line:`${e}2K`,lineEnd:`${e}K`,lineStart:`${e}1K`,lines(t){let e="";for(let i=0;i<t;i++)e+=this.line+(i<t-1?u.up():"");return t&&(e+=u.left),e}};t.exports={cursor:u,scroll:{up:(t=1)=>`${e}S`.repeat(t),down:(t=1)=>`${e}T`.repeat(t)},erase:i,beep:"\x07"}},"node:child_process":function(e){e.exports=t},"node:events":function(t){t.exports=e},"node:fs":function(t){t.exports=u},"node:path":function(t){t.exports=i},"node:process":function(t){t.exports=D},"../../node_modules/commander/index.js":function(t,e,u){let{Argument:i}=u("../../node_modules/commander/lib/argument.js"),{Command:D}=u("../../node_modules/commander/lib/command.js"),{CommanderError:r,InvalidArgumentError:s}=u("../../node_modules/commander/lib/error.js"),{Help:n}=u("../../node_modules/commander/lib/help.js"),{Option:o}=u("../../node_modules/commander/lib/option.js");e.program=new D,e.createCommand=t=>new D(t),e.createOption=(t,e)=>new o(t,e),e.createArgument=(t,e)=>new i(t,e),e.Command=D,e.Option=o,e.Argument=i,e.Help=n,e.CommanderError=r,e.InvalidArgumentError=s,e.InvalidOptionArgumentError=s},"../../node_modules/commander/lib/argument.js":function(t,e,u){let{InvalidArgumentError:i}=u("../../node_modules/commander/lib/error.js");e.Argument=class{constructor(t,e){switch(this.description=e||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,e){return e!==this.defaultValue&&Array.isArray(e)?(e.push(t),e):[t]}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(t,e)=>{if(!this.argChoices.includes(t))throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,e):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},e.humanReadableArgName=function(t){let e=t.name()+(!0===t.variadic?"...":"");return t.required?"<"+e+">":"["+e+"]"}},"../../node_modules/commander/lib/command.js":function(t,e,u){let i=u("node:events").EventEmitter,D=u("node:child_process"),r=u("node:path"),s=u("node:fs"),n=u("node:process"),{Argument:o,humanReadableArgName:a}=u("../../node_modules/commander/lib/argument.js"),{CommanderError:l}=u("../../node_modules/commander/lib/error.js"),{Help:h,stripColor:p}=u("../../node_modules/commander/lib/help.js"),{Option:m,DualOptions:c}=u("../../node_modules/commander/lib/option.js"),{suggestSimilar:d}=u("../../node_modules/commander/lib/suggestSimilar.js");class C extends i{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:t=>n.stdout.write(t),writeErr:t=>n.stderr.write(t),outputError:(t,e)=>e(t),getOutHelpWidth:()=>n.stdout.isTTY?n.stdout.columns:void 0,getErrHelpWidth:()=>n.stderr.isTTY?n.stderr.columns:void 0,getOutHasColors:()=>g()??(n.stdout.isTTY&&n.stdout.hasColors?.()),getErrHasColors:()=>g()??(n.stderr.isTTY&&n.stderr.hasColors?.()),stripColor:t=>p(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let e=this;e;e=e.parent)t.push(e);return t}command(t,e,u){let i=e,D=u;"object"==typeof i&&null!==i&&(D=i,i=null),D=D||{};let[,r,s]=t.match(/([^ ]+) *(.*)/),n=this.createCommand(r);return(i&&(n.description(i),n._executableHandler=!0),D.isDefault&&(this._defaultCommandName=n._name),n._hidden=!!(D.noHelp||D.hidden),n._executableFile=D.executableFile||null,s&&n.arguments(s),this._registerCommand(n),n.parent=this,n.copyInheritedSettings(this),i)?this:n}createCommand(t){return new C(t)}createHelp(){return Object.assign(new h,this.configureHelp())}configureHelp(t){return void 0===t?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return void 0===t?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return"string"!=typeof t&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,e){if(!t._name)throw Error(`Command passed to .addCommand() must have a name
|
|
3
|
+
- specify the name in Command constructor or using .name()`);return(e=e||{}).isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,e){return new o(t,e)}argument(t,e,u,i){let D=this.createArgument(t,e);return"function"==typeof u?D.default(i).argParser(u):D.default(u),this.addArgument(D),this}arguments(t){return t.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(t){let e=this.registeredArguments.slice(-1)[0];if(e?.variadic)throw Error(`only the last argument can be variadic '${e.name()}'`);if(t.required&&void 0!==t.defaultValue&&void 0===t.parseArg)throw Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,e){if("boolean"==typeof t)return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,u,i]=(t??"help [command]").match(/([^ ]+) *(.*)/),D=e??"display help for command",r=this.createCommand(u);return r.helpOption(!1),i&&r.arguments(i),D&&r.description(D),this._addImplicitHelpCommand=!0,this._helpCommand=r,(t||e)&&this._initCommandGroup(r),this}addHelpCommand(t,e){return"object"!=typeof t?this.helpCommand(t,e):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t)),this}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(void 0===this._helpCommand&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,e){let u=["preSubcommand","preAction","postAction"];if(!u.includes(t))throw Error(`Unexpected value for event passed to hook : '${t}'.
|
|
4
|
+
Expecting one of '${u.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(e):this._lifeCycleHooks[t]=[e],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=t=>{if("commander.executeSubCommandAsync"!==t.code)throw t},this}_exit(t,e,u){this._exitCallback&&this._exitCallback(new l(t,e,u)),n.exit(t)}action(t){let e=e=>{let u=this.registeredArguments.length,i=e.slice(0,u);return this._storeOptionsAsProperties?i[u]=this:i[u]=this.opts(),i.push(this),t.apply(this,i)};return this._actionHandler=e,this}createOption(t,e){return new m(t,e)}_callParseArg(t,e,u,i){try{return t.parseArg(e,u)}catch(t){if("commander.invalidArgument"===t.code){let e=`${i} ${t.message}`;this.error(e,{exitCode:t.exitCode,code:t.code})}throw t}}_registerOption(t){let e=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(e){let u=t.long&&this._findOption(t.long)?t.long:t.short;throw Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${u}'
|
|
5
|
+
- already used by option '${e.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){let e=t=>[t.name()].concat(t.aliases()),u=e(t).find(t=>this._findCommand(t));if(u){let i=e(this._findCommand(u)).join("|"),D=e(t).join("|");throw Error(`cannot add command '${D}' as already have command '${i}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);let e=t.name(),u=t.attributeName();if(t.negate){let e=t.long.replace(/^--no-/,"--");this._findOption(e)||this.setOptionValueWithSource(u,void 0===t.defaultValue||t.defaultValue,"default")}else void 0!==t.defaultValue&&this.setOptionValueWithSource(u,t.defaultValue,"default");let i=(e,i,D)=>{null==e&&void 0!==t.presetArg&&(e=t.presetArg);let r=this.getOptionValue(u);null!==e&&t.parseArg?e=this._callParseArg(t,e,r,i):null!==e&&t.variadic&&(e=t._collectValue(e,r)),null==e&&(e=!t.negate&&(!!t.isBoolean()||!!t.optional||"")),this.setOptionValueWithSource(u,e,D)};return this.on("option:"+e,e=>{let u=`error: option '${t.flags}' argument '${e}' is invalid.`;i(e,u,"cli")}),t.envVar&&this.on("optionEnv:"+e,e=>{let u=`error: option '${t.flags}' value '${e}' from env '${t.envVar}' is invalid.`;i(e,u,"env")}),this}_optionEx(t,e,u,i,D){if("object"==typeof e&&e instanceof m)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(e,u);if(r.makeOptionMandatory(!!t.mandatory),"function"==typeof i)r.default(D).argParser(i);else if(i instanceof RegExp){let t=i;i=(e,u)=>{let i=t.exec(e);return i?i[0]:u},r.default(D).argParser(i)}else r.default(i);return this.addOption(r)}option(t,e,u,i){return this._optionEx({},t,e,u,i)}requiredOption(t,e,u,i){return this._optionEx({mandatory:!0},t,e,u,i)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(t=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,e){return this.setOptionValueWithSource(t,e,void 0)}setOptionValueWithSource(t,e,u){return this._storeOptionsAsProperties?this[t]=e:this._optionValues[t]=e,this._optionValueSources[t]=u,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let e;return this._getCommandAndAncestors().forEach(u=>{void 0!==u.getOptionValueSource(t)&&(e=u.getOptionValueSource(t))}),e}_prepareUserArgs(t,e){let u;if(void 0!==t&&!Array.isArray(t))throw Error("first parameter to parse must be array or undefined");if(e=e||{},void 0===t&&void 0===e.from){n.versions?.electron&&(e.from="electron");let t=n.execArgv??[];(t.includes("-e")||t.includes("--eval")||t.includes("-p")||t.includes("--print"))&&(e.from="eval")}switch(void 0===t&&(t=n.argv),this.rawArgs=t.slice(),e.from){case void 0:case"node":this._scriptPath=t[1],u=t.slice(2);break;case"electron":n.defaultApp?(this._scriptPath=t[1],u=t.slice(2)):u=t.slice(1);break;case"user":u=t.slice(0);break;case"eval":u=t.slice(1);break;default:throw Error(`unexpected parse option { from: '${e.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",u}parse(t,e){this._prepareForParse();let u=this._prepareUserArgs(t,e);return this._parseCommand([],u),this}async parseAsync(t,e){this._prepareForParse();let u=this._prepareUserArgs(t,e);return await this._parseCommand([],u),this}_prepareForParse(){null===this._savedState?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
6
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(t,e,u){if(s.existsSync(t))return;let i=e?`searched for local subcommand relative to directory '${e}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";throw Error(`'${t}' does not exist
|
|
7
|
+
- if '${u}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
8
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
9
|
+
- ${i}`)}_executeSubCommand(t,e){let u;e=e.slice();let i=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function a(t,e){let u=r.resolve(t,e);if(s.existsSync(u))return u;if(o.includes(r.extname(e)))return;let i=o.find(t=>s.existsSync(`${u}${t}`));if(i)return`${u}${i}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let h=t._executableFile||`${this._name}-${t._name}`,p=this._executableDir||"";if(this._scriptPath){let t;try{t=s.realpathSync(this._scriptPath)}catch{t=this._scriptPath}p=r.resolve(r.dirname(t),p)}if(p){let e=a(p,h);if(!e&&!t._executableFile&&this._scriptPath){let u=r.basename(this._scriptPath,r.extname(this._scriptPath));u!==this._name&&(e=a(p,`${u}-${t._name}`))}h=e||h}i=o.includes(r.extname(h)),"win32"!==n.platform?i?(e.unshift(h),e=F(n.execArgv).concat(e),u=D.spawn(n.argv[0],e,{stdio:"inherit"})):u=D.spawn(h,e,{stdio:"inherit"}):(this._checkForMissingExecutable(h,p,t._name),e.unshift(h),e=F(n.execArgv).concat(e),u=D.spawn(n.execPath,e,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(t=>{n.on(t,()=>{!1===u.killed&&null===u.exitCode&&u.kill(t)})});let m=this._exitCallback;u.on("close",t=>{t=t??1,m?m(new l(t,"commander.executeSubCommandAsync","(close)")):n.exit(t)}),u.on("error",e=>{if("ENOENT"===e.code)this._checkForMissingExecutable(h,p,t._name);else if("EACCES"===e.code)throw Error(`'${h}' not executable`);if(m){let t=new l(1,"commander.executeSubCommandAsync","(error)");t.nestedError=e,m(t)}else n.exit(1)}),this.runningCommand=u}_dispatchSubcommand(t,e,u){let i,D=this._findCommand(t);return D||this.help({error:!0}),D._prepareForParse(),i=this._chainOrCallSubCommandHook(i,D,"preSubcommand"),i=this._chainOrCall(i,()=>{if(!D._executableHandler)return D._parseCommand(e,u);this._executeSubCommand(D,e.concat(u))})}_dispatchHelpCommand(t){t||this.help();let e=this._findCommand(t);return e&&!e._executableHandler&&e.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,e)=>{t.required&&null==this.args[e]&&this.missingArgument(t.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic||this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(t,e,u)=>{let i=e;if(null!==e&&t.parseArg){let D=`error: command-argument value '${e}' is invalid for argument '${t.name()}'.`;i=this._callParseArg(t,e,u,D)}return i};this._checkNumberOfArguments();let e=[];this.registeredArguments.forEach((u,i)=>{let D=u.defaultValue;u.variadic?i<this.args.length?(D=this.args.slice(i),u.parseArg&&(D=D.reduce((e,i)=>t(u,i,e),u.defaultValue))):void 0===D&&(D=[]):i<this.args.length&&(D=this.args[i],u.parseArg&&(D=t(u,D,u.defaultValue))),e[i]=D}),this.processedArgs=e}_chainOrCall(t,e){return t?.then&&"function"==typeof t.then?t.then(()=>e()):e()}_chainOrCallHooks(t,e){let u=t,i=[];return this._getCommandAndAncestors().reverse().filter(t=>void 0!==t._lifeCycleHooks[e]).forEach(t=>{t._lifeCycleHooks[e].forEach(e=>{i.push({hookedCommand:t,callback:e})})}),"postAction"===e&&i.reverse(),i.forEach(t=>{u=this._chainOrCall(u,()=>t.callback(t.hookedCommand,this))}),u}_chainOrCallSubCommandHook(t,e,u){let i=t;return void 0!==this._lifeCycleHooks[u]&&this._lifeCycleHooks[u].forEach(t=>{i=this._chainOrCall(i,()=>t(this,e))}),i}_parseCommand(t,e){let u=this.parseOptions(e);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(u.operands),e=u.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),e);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(e),this._dispatchSubcommand(this._defaultCommandName,t,e);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),this._outputHelpIfRequested(u.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{u.unknown.length>0&&this.unknownOption(u.unknown[0])},D=`command:${this.name()}`;if(this._actionHandler){let u;return i(),this._processArguments(),u=this._chainOrCallHooks(u,"preAction"),u=this._chainOrCall(u,()=>this._actionHandler(this.processedArgs)),this.parent&&(u=this._chainOrCall(u,()=>{this.parent.emit(D,t,e)})),u=this._chainOrCallHooks(u,"postAction")}if(this.parent?.listenerCount(D))i(),this._processArguments(),this.parent.emit(D,t,e);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,e);this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(e=>e._name===t||e._aliases.includes(t))}_findOption(t){return this.options.find(e=>e.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(e=>{e.mandatory&&void 0===t.getOptionValue(e.attributeName())&&t.missingMandatoryOptionValue(e)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(t=>{let e=t.attributeName();return void 0!==this.getOptionValue(e)&&"default"!==this.getOptionValueSource(e)});t.filter(t=>t.conflictsWith.length>0).forEach(e=>{let u=t.find(t=>e.conflictsWith.includes(t.attributeName()));u&&this._conflictingOption(e,u)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let e=[],u=[],i=e;function D(t){return t.length>1&&"-"===t[0]}let r=t=>!!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(t)&&!this._getCommandAndAncestors().some(t=>t.options.map(t=>t.short).some(t=>/^-\d$/.test(t))),s=null,n=null,o=0;for(;o<t.length||n;){let a=n??t[o++];if(n=null,"--"===a){i===u&&i.push(a),i.push(...t.slice(o));break}if(s&&(!D(a)||r(a))){this.emit(`option:${s.name()}`,a);continue}if(s=null,D(a)){let e=this._findOption(a);if(e){if(e.required){let u=t[o++];void 0===u&&this.optionMissingArgument(e),this.emit(`option:${e.name()}`,u)}else if(e.optional){let u=null;o<t.length&&(!D(t[o])||r(t[o]))&&(u=t[o++]),this.emit(`option:${e.name()}`,u)}else this.emit(`option:${e.name()}`);s=e.variadic?e:null;continue}}if(a.length>2&&"-"===a[0]&&"-"!==a[1]){let t=this._findOption(`-${a[1]}`);if(t){t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,a.slice(2)):(this.emit(`option:${t.name()}`),n=`-${a.slice(2)}`);continue}}if(/^--[^=]+=/.test(a)){let t=a.indexOf("="),e=this._findOption(a.slice(0,t));if(e&&(e.required||e.optional)){this.emit(`option:${e.name()}`,a.slice(t+1));continue}}if(i===e&&D(a)&&!(0===this.commands.length&&r(a))&&(i=u),(this._enablePositionalOptions||this._passThroughOptions)&&0===e.length&&0===u.length){if(this._findCommand(a)){e.push(a),u.push(...t.slice(o));break}else if(this._getHelpCommand()&&a===this._getHelpCommand().name()){e.push(a,...t.slice(o));break}else if(this._defaultCommandName){u.push(a,...t.slice(o));break}}if(this._passThroughOptions){i.push(a,...t.slice(o));break}i.push(a)}return{operands:e,unknown:u}}opts(){if(this._storeOptionsAsProperties){let t={},e=this.options.length;for(let u=0;u<e;u++){let e=this.options[u].attributeName();t[e]=e===this._versionOptionName?this._version:this[e]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,e)=>Object.assign(t,e.opts()),{})}error(t,e){this._outputConfiguration.outputError(`${t}
|
|
10
|
+
`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
11
|
+
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));let u=e||{},i=u.exitCode||1,D=u.code||"commander.error";this._exit(i,D,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in n.env){let e=t.attributeName();(void 0===this.getOptionValue(e)||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,n.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new c(this.options),e=t=>void 0!==this.getOptionValue(t)&&!["default","implied"].includes(this.getOptionValueSource(t));this.options.filter(u=>void 0!==u.implied&&e(u.attributeName())&&t.valueFromOption(this.getOptionValue(u.attributeName()),u)).forEach(t=>{Object.keys(t.implied).filter(t=>!e(t)).forEach(e=>{this.setOptionValueWithSource(e,t.implied[e],"implied")})})}missingArgument(t){let e=`error: missing required argument '${t}'`;this.error(e,{code:"commander.missingArgument"})}optionMissingArgument(t){let e=`error: option '${t.flags}' argument missing`;this.error(e,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let e=`error: required option '${t.flags}' not specified`;this.error(e,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,e){let u=t=>{let e=t.attributeName(),u=this.getOptionValue(e),i=this.options.find(t=>t.negate&&e===t.attributeName()),D=this.options.find(t=>!t.negate&&e===t.attributeName());return i&&(void 0===i.presetArg&&!1===u||void 0!==i.presetArg&&u===i.presetArg)?i:D||t},i=t=>{let e=u(t),i=e.attributeName();return"env"===this.getOptionValueSource(i)?`environment variable '${e.envVar}'`:`option '${e.flags}'`},D=`error: ${i(t)} cannot be used with ${i(e)}`;this.error(D,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let e="";if(t.startsWith("--")&&this._showSuggestionAfterError){let u=[],i=this;do{let t=i.createHelp().visibleOptions(i).filter(t=>t.long).map(t=>t.long);u=u.concat(t),i=i.parent}while(i&&!i._enablePositionalOptions);e=d(t,u)}let u=`error: unknown option '${t}'${e}`;this.error(u,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let e=this.registeredArguments.length,u=this.parent?` for '${this.name()}'`:"",i=`error: too many arguments${u}. Expected ${e} argument${1===e?"":"s"} but got ${t.length}.`;this.error(i,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],e="";if(this._showSuggestionAfterError){let u=[];this.createHelp().visibleCommands(this).forEach(t=>{u.push(t.name()),t.alias()&&u.push(t.alias())}),e=d(t,u)}let u=`error: unknown command '${t}'${e}`;this.error(u,{code:"commander.unknownCommand"})}version(t,e,u){if(void 0===t)return this._version;this._version=t,e=e||"-V, --version",u=u||"output the version number";let i=this.createOption(e,u);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${t}
|
|
12
|
+
`),this._exit(0,"commander.version",t)}),this}description(t,e){return void 0===t&&void 0===e?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){return void 0===t?this._summary:(this._summary=t,this)}alias(t){if(void 0===t)return this._aliases[0];let e=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw Error("Command alias can't be the same as its name");let u=this.parent?._findCommand(t);if(u){let e=[u.name()].concat(u.aliases()).join("|");throw Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${e}'`)}return e._aliases.push(t),this}aliases(t){return void 0===t?this._aliases:(t.forEach(t=>this.alias(t)),this)}usage(t){if(void 0===t){if(this._usage)return this._usage;let t=this.registeredArguments.map(t=>a(t));return[].concat(this.options.length||null!==this._helpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=t,this}name(t){return void 0===t?this._name:(this._name=t,this)}helpGroup(t){return void 0===t?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return void 0===t?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return void 0===t?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=r.basename(t,r.extname(t)),this}executableDir(t){return void 0===t?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let e=this.createHelp(),u=this._getOutputContext(t);e.prepareContext({error:u.error,helpWidth:u.helpWidth,outputHasColors:u.hasColors});let i=e.formatHelp(this,e);return u.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(t){let e,u,i,D=!!(t=t||{}).error;return D?(e=t=>this._outputConfiguration.writeErr(t),u=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(e=t=>this._outputConfiguration.writeOut(t),u=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:D,write:t=>(u||(t=this._outputConfiguration.stripColor(t)),e(t)),hasColors:u,helpWidth:i}}outputHelp(t){let e;"function"==typeof t&&(e=t,t=void 0);let u=this._getOutputContext(t),i={error:u.error,write:u.write,command:this};this._getCommandAndAncestors().reverse().forEach(t=>t.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let D=this.helpInformation({error:u.error});if(e&&"string"!=typeof(D=e(D))&&!Buffer.isBuffer(D))throw Error("outputHelp callback must return a string or a Buffer");u.write(D),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(t=>t.emit("afterAllHelp",i))}helpOption(t,e){return"boolean"==typeof t?t?(null===this._helpOption&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null:(this._helpOption=this.createOption(t??"-h, --help",e??"display help for command"),(t||e)&&this._initOptionGroup(this._helpOption)),this}_getHelpOption(){return void 0===this._helpOption&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let e=Number(n.exitCode??0);0===e&&t&&"function"!=typeof t&&t.error&&(e=1),this._exit(e,"commander.help","(outputHelp)")}addHelpText(t,e){let u=["beforeAll","before","after","afterAll"];if(!u.includes(t))throw Error(`Unexpected value for position to addHelpText.
|
|
13
|
+
Expecting one of '${u.join("', '")}'`);let i=`${t}Help`;return this.on(i,t=>{let u;(u="function"==typeof e?e({error:t.error,command:t.command}):e)&&t.write(`${u}
|
|
14
|
+
`)}),this}_outputHelpIfRequested(t){let e=this._getHelpOption();e&&t.find(t=>e.is(t))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function F(t){return t.map(t=>{let e,u;if(!t.startsWith("--inspect"))return t;let i="127.0.0.1",D="9229";return(null!==(u=t.match(/^(--inspect(-brk)?)$/))?e=u[1]:null!==(u=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(e=u[1],/^\d+$/.test(u[3])?D=u[3]:i=u[3]):null!==(u=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(e=u[1],i=u[3],D=u[4]),e&&"0"!==D)?`${e}=${i}:${parseInt(D)+1}`:t})}function g(){return!n.env.NO_COLOR&&"0"!==n.env.FORCE_COLOR&&"false"!==n.env.FORCE_COLOR&&(!!n.env.FORCE_COLOR||void 0!==n.env.CLICOLOR_FORCE||void 0)}e.Command=C,e.useColor=g},"../../node_modules/commander/lib/error.js":function(t,e){class u extends Error{constructor(t,e,u){super(u),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=e,this.exitCode=t,this.nestedError=void 0}}e.CommanderError=u,e.InvalidArgumentError=class extends u{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}},"../../node_modules/commander/lib/help.js":function(t,e,u){let{humanReadableArgName:i}=u("../../node_modules/commander/lib/argument.js");function D(t){return t.replace(/\x1b\[\d*(;\d*)*m/g,"")}e.Help=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let e=t.commands.filter(t=>!t._hidden),u=t._getHelpCommand();return u&&!u._hidden&&e.push(u),this.sortSubcommands&&e.sort((t,e)=>t.name().localeCompare(e.name())),e}compareOptions(t,e){let u=t=>t.short?t.short.replace(/^-/,""):t.long.replace(/^--/,"");return u(t).localeCompare(u(e))}visibleOptions(t){let e=t.options.filter(t=>!t.hidden),u=t._getHelpOption();if(u&&!u.hidden){let i=u.short&&t._findOption(u.short),D=u.long&&t._findOption(u.long);i||D?u.long&&!D?e.push(t.createOption(u.long,u.description)):u.short&&!i&&e.push(t.createOption(u.short,u.description)):e.push(u)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let e=[];for(let u=t.parent;u;u=u.parent){let t=u.options.filter(t=>!t.hidden);e.push(...t)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleArguments(t){return(t._argsDescription&&t.registeredArguments.forEach(e=>{e.description=e.description||t._argsDescription[e.name()]||""}),t.registeredArguments.find(t=>t.description))?t.registeredArguments:[]}subcommandTerm(t){let e=t.registeredArguments.map(t=>i(t)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(e?" "+e:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,e){return e.visibleCommands(t).reduce((t,u)=>Math.max(t,this.displayWidth(e.styleSubcommandTerm(e.subcommandTerm(u)))),0)}longestOptionTermLength(t,e){return e.visibleOptions(t).reduce((t,u)=>Math.max(t,this.displayWidth(e.styleOptionTerm(e.optionTerm(u)))),0)}longestGlobalOptionTermLength(t,e){return e.visibleGlobalOptions(t).reduce((t,u)=>Math.max(t,this.displayWidth(e.styleOptionTerm(e.optionTerm(u)))),0)}longestArgumentTermLength(t,e){return e.visibleArguments(t).reduce((t,u)=>Math.max(t,this.displayWidth(e.styleArgumentTerm(e.argumentTerm(u)))),0)}commandUsage(t){let e=t._name;t._aliases[0]&&(e=e+"|"+t._aliases[0]);let u="";for(let e=t.parent;e;e=e.parent)u=e.name()+" "+u;return u+e+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map(t=>JSON.stringify(t)).join(", ")}`),void 0!==t.defaultValue&&(t.required||t.optional||t.isBoolean()&&"boolean"==typeof t.defaultValue)&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),void 0!==t.presetArg&&t.optional&&e.push(`preset: ${JSON.stringify(t.presetArg)}`),void 0!==t.envVar&&e.push(`env: ${t.envVar}`),e.length>0){let u=`(${e.join(", ")})`;return t.description?`${t.description} ${u}`:u}return t.description}argumentDescription(t){let e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map(t=>JSON.stringify(t)).join(", ")}`),void 0!==t.defaultValue&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),e.length>0){let u=`(${e.join(", ")})`;return t.description?`${t.description} ${u}`:u}return t.description}formatItemList(t,e,u){return 0===e.length?[]:[u.styleTitle(t),...e,""]}groupItems(t,e,u){let i=new Map;return t.forEach(t=>{let e=u(t);i.has(e)||i.set(e,[])}),e.forEach(t=>{let e=u(t);i.has(e)||i.set(e,[]),i.get(e).push(t)}),i}formatHelp(t,e){let u=e.padWidth(t,e),i=e.helpWidth??80;function D(t,i){return e.formatItem(t,u,i,e)}let r=[`${e.styleTitle("Usage:")} ${e.styleUsage(e.commandUsage(t))}`,""],s=e.commandDescription(t);s.length>0&&(r=r.concat([e.boxWrap(e.styleCommandDescription(s),i),""]));let n=e.visibleArguments(t).map(t=>D(e.styleArgumentTerm(e.argumentTerm(t)),e.styleArgumentDescription(e.argumentDescription(t))));if(r=r.concat(this.formatItemList("Arguments:",n,e)),this.groupItems(t.options,e.visibleOptions(t),t=>t.helpGroupHeading??"Options:").forEach((t,u)=>{let i=t.map(t=>D(e.styleOptionTerm(e.optionTerm(t)),e.styleOptionDescription(e.optionDescription(t))));r=r.concat(this.formatItemList(u,i,e))}),e.showGlobalOptions){let u=e.visibleGlobalOptions(t).map(t=>D(e.styleOptionTerm(e.optionTerm(t)),e.styleOptionDescription(e.optionDescription(t))));r=r.concat(this.formatItemList("Global Options:",u,e))}return this.groupItems(t.commands,e.visibleCommands(t),t=>t.helpGroup()||"Commands:").forEach((t,u)=>{let i=t.map(t=>D(e.styleSubcommandTerm(e.subcommandTerm(t)),e.styleSubcommandDescription(e.subcommandDescription(t))));r=r.concat(this.formatItemList(u,i,e))}),r.join("\n")}displayWidth(t){return D(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(t=>"[options]"===t?this.styleOptionText(t):"[command]"===t?this.styleSubcommandText(t):"["===t[0]||"<"===t[0]?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(t=>"[options]"===t?this.styleOptionText(t):"["===t[0]||"<"===t[0]?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,e){return Math.max(e.longestOptionTermLength(t,e),e.longestGlobalOptionTermLength(t,e),e.longestSubcommandTermLength(t,e),e.longestArgumentTermLength(t,e))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,e,u,i){let D,r=" ".repeat(2);if(!u)return r+t;let s=t.padEnd(e+t.length-i.displayWidth(t)),n=(this.helpWidth??80)-e-2-2;return D=n<this.minWidthToWrap||i.preformatted(u)?u:i.boxWrap(u,n).replace(/\n/g,"\n"+" ".repeat(e+2)),r+s+" ".repeat(2)+D.replace(/\n/g,`
|
|
15
|
+
${r}`)}boxWrap(t,e){if(e<this.minWidthToWrap)return t;let u=t.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,D=[];return u.forEach(t=>{let u=t.match(i);if(null===u)return void D.push("");let r=[u.shift()],s=this.displayWidth(r[0]);u.forEach(t=>{let u=this.displayWidth(t);if(s+u<=e){r.push(t),s+=u;return}D.push(r.join(""));let i=t.trimStart();r=[i],s=this.displayWidth(i)}),D.push(r.join(""))}),D.join("\n")}},e.stripColor=D},"../../node_modules/commander/lib/option.js":function(t,e,u){let{InvalidArgumentError:i}=u("../../node_modules/commander/lib/error.js");function D(t){return t.split("-").reduce((t,e)=>t+e[0].toUpperCase()+e.slice(1))}e.Option=class{constructor(t,e){this.flags=t,this.description=e||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let u=function(t){let e,u,i=/^-[^-]$/,D=/^--[^-]/,r=t.split(/[ |,]+/).concat("guard");if(i.test(r[0])&&(e=r.shift()),D.test(r[0])&&(u=r.shift()),!e&&i.test(r[0])&&(e=r.shift()),!e&&D.test(r[0])&&(e=u,u=r.shift()),r[0].startsWith("-")){let e=r[0],u=`option creation failed due to '${e}' in option flags '${t}'`;if(/^-[^-][^-]/.test(e))throw Error(`${u}
|
|
16
|
+
- a short flag is a single dash and a single character
|
|
17
|
+
- either use a single dash and a single character (for a short flag)
|
|
18
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(i.test(e))throw Error(`${u}
|
|
19
|
+
- too many short flags`);if(D.test(e))throw Error(`${u}
|
|
20
|
+
- too many long flags`);throw Error(`${u}
|
|
21
|
+
- unrecognised flag format`)}if(void 0===e&&void 0===u)throw Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:u}}(t);this.short=u.shortFlag,this.long=u.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let e=t;return"string"==typeof t&&(e={[t]:!0}),this.implied=Object.assign(this.implied||{},e),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_collectValue(t,e){return e!==this.defaultValue&&Array.isArray(e)?(e.push(t),e):[t]}choices(t){return this.argChoices=t.slice(),this.parseArg=(t,e)=>{if(!this.argChoices.includes(t))throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,e):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?D(this.name().replace(/^no-/,"")):D(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},e.DualOptions=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,e)=>{this.positiveOptions.has(e)&&this.dualOptions.add(e)})}valueFromOption(t,e){let u=e.attributeName();if(!this.dualOptions.has(u))return!0;let i=this.negativeOptions.get(u).presetArg;return e.negate===((void 0!==i&&i)===t)}}},"../../node_modules/commander/lib/suggestSimilar.js":function(t,e){e.suggestSimilar=function(t,e){if(!e||0===e.length)return"";e=Array.from(new Set(e));let u=t.startsWith("--");u&&(t=t.slice(2),e=e.map(t=>t.slice(2)));let i=[],D=3;return(e.forEach(e=>{if(e.length<=1)return;let u=function(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let u=[];for(let e=0;e<=t.length;e++)u[e]=[e];for(let t=0;t<=e.length;t++)u[0][t]=t;for(let i=1;i<=e.length;i++)for(let D=1;D<=t.length;D++){let r=1;r=+(t[D-1]!==e[i-1]),u[D][i]=Math.min(u[D-1][i]+1,u[D][i-1]+1,u[D-1][i-1]+r),D>1&&i>1&&t[D-1]===e[i-2]&&t[D-2]===e[i-1]&&(u[D][i]=Math.min(u[D][i],u[D-2][i-2]+1))}return u[t.length][e.length]}(t,e),r=Math.max(t.length,e.length);(r-u)/r>.4&&(u<D?(D=u,i=[e]):u===D&&i.push(e))}),i.sort((t,e)=>t.localeCompare(e)),u&&(i=i.map(t=>`--${t}`)),i.length>1)?`
|
|
22
|
+
(Did you mean one of ${i.join(", ")}?)`:1===i.length?`
|
|
23
|
+
(Did you mean ${i[0]}?)`:""}}},c={};function d(t){var e=c[t];if(void 0!==e)return e.exports;var u=c[t]={exports:{}};return m[t](u,u.exports,d),u.exports}d.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return d.d(e,{a:e}),e},d.d=(t,e)=>{for(var u in e)d.o(e,u)&&!d.o(t,u)&&Object.defineProperty(t,u,{enumerable:!0,get:e[u]})},d.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let C=(t=!1)=>{process.exit(+!!t)};class F extends Error{constructor(t){super(t),this.name="RunCommandError"}}let g=r(d("node:child_process").execFile),E=async(t,e=[],u)=>{try{await g(t,e,u)}catch{let u=[t,...e].join(" ");throw new F(`Failed to execute ${u}`)}};var f=d("../../node_modules/sisteransi/src/index.js"),_=d("node:process"),b=d("../../node_modules/picocolors/picocolors.js"),A=d.n(b);let B=function({onlyFirst:t=!1}={}){return RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))",t?void 0:"g")}();function v(t){if("string"!=typeof t)throw TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(B,"")}function x(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var y={exports:{}},w={};function O(t){return t.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}y.exports=w,w.eastAsianWidth=function(t){var e=t.charCodeAt(0),u=2==t.length?t.charCodeAt(1):0,i=e;return 55296<=e&&e<=56319&&56320<=u&&u<=57343&&(e&=1023,u&=1023,i=(e<<10|u)+65536),12288==i||65281<=i&&i<=65376||65504<=i&&i<=65510?"F":8361==i||65377<=i&&i<=65470||65474<=i&&i<=65479||65482<=i&&i<=65487||65490<=i&&i<=65495||65498<=i&&i<=65500||65512<=i&&i<=65518?"H":4352<=i&&i<=4447||4515<=i&&i<=4519||4602<=i&&i<=4607||9001<=i&&i<=9002||11904<=i&&i<=11929||11931<=i&&i<=12019||12032<=i&&i<=12245||12272<=i&&i<=12283||12289<=i&&i<=12350||12353<=i&&i<=12438||12441<=i&&i<=12543||12549<=i&&i<=12589||12593<=i&&i<=12686||12688<=i&&i<=12730||12736<=i&&i<=12771||12784<=i&&i<=12830||12832<=i&&i<=12871||12880<=i&&i<=13054||13056<=i&&i<=19903||19968<=i&&i<=42124||42128<=i&&i<=42182||43360<=i&&i<=43388||44032<=i&&i<=55203||55216<=i&&i<=55238||55243<=i&&i<=55291||63744<=i&&i<=64255||65040<=i&&i<=65049||65072<=i&&i<=65106||65108<=i&&i<=65126||65128<=i&&i<=65131||110592<=i&&i<=110593||127488<=i&&i<=127490||127504<=i&&i<=127546||127552<=i&&i<=127560||127568<=i&&i<=127569||131072<=i&&i<=194367||177984<=i&&i<=196605||196608<=i&&i<=262141?"W":32<=i&&i<=126||162<=i&&i<=163||165<=i&&i<=166||172==i||175==i||10214<=i&&i<=10221||10629<=i&&i<=10630?"Na":161==i||164==i||167<=i&&i<=168||170==i||173<=i&&i<=174||176<=i&&i<=180||182<=i&&i<=186||188<=i&&i<=191||198==i||208==i||215<=i&&i<=216||222<=i&&i<=225||230==i||232<=i&&i<=234||236<=i&&i<=237||240==i||242<=i&&i<=243||247<=i&&i<=250||252==i||254==i||257==i||273==i||275==i||283==i||294<=i&&i<=295||299==i||305<=i&&i<=307||312==i||319<=i&&i<=322||324==i||328<=i&&i<=331||333==i||338<=i&&i<=339||358<=i&&i<=359||363==i||462==i||464==i||466==i||468==i||470==i||472==i||474==i||476==i||593==i||609==i||708==i||711==i||713<=i&&i<=715||717==i||720==i||728<=i&&i<=731||733==i||735==i||768<=i&&i<=879||913<=i&&i<=929||931<=i&&i<=937||945<=i&&i<=961||963<=i&&i<=969||1025==i||1040<=i&&i<=1103||1105==i||8208==i||8211<=i&&i<=8214||8216<=i&&i<=8217||8220<=i&&i<=8221||8224<=i&&i<=8226||8228<=i&&i<=8231||8240==i||8242<=i&&i<=8243||8245==i||8251==i||8254==i||8308==i||8319==i||8321<=i&&i<=8324||8364==i||8451==i||8453==i||8457==i||8467==i||8470==i||8481<=i&&i<=8482||8486==i||8491==i||8531<=i&&i<=8532||8539<=i&&i<=8542||8544<=i&&i<=8555||8560<=i&&i<=8569||8585==i||8592<=i&&i<=8601||8632<=i&&i<=8633||8658==i||8660==i||8679==i||8704==i||8706<=i&&i<=8707||8711<=i&&i<=8712||8715==i||8719==i||8721==i||8725==i||8730==i||8733<=i&&i<=8736||8739==i||8741==i||8743<=i&&i<=8748||8750==i||8756<=i&&i<=8759||8764<=i&&i<=8765||8776==i||8780==i||8786==i||8800<=i&&i<=8801||8804<=i&&i<=8807||8810<=i&&i<=8811||8814<=i&&i<=8815||8834<=i&&i<=8835||8838<=i&&i<=8839||8853==i||8857==i||8869==i||8895==i||8978==i||9312<=i&&i<=9449||9451<=i&&i<=9547||9552<=i&&i<=9587||9600<=i&&i<=9615||9618<=i&&i<=9621||9632<=i&&i<=9633||9635<=i&&i<=9641||9650<=i&&i<=9651||9654<=i&&i<=9655||9660<=i&&i<=9661||9664<=i&&i<=9665||9670<=i&&i<=9672||9675==i||9678<=i&&i<=9681||9698<=i&&i<=9701||9711==i||9733<=i&&i<=9734||9737==i||9742<=i&&i<=9743||9748<=i&&i<=9749||9756==i||9758==i||9792==i||9794==i||9824<=i&&i<=9825||9827<=i&&i<=9829||9831<=i&&i<=9834||9836<=i&&i<=9837||9839==i||9886<=i&&i<=9887||9918<=i&&i<=9919||9924<=i&&i<=9933||9935<=i&&i<=9953||9955==i||9960<=i&&i<=9983||10045==i||10071==i||10102<=i&&i<=10111||11093<=i&&i<=11097||12872<=i&&i<=12879||57344<=i&&i<=63743||65024<=i&&i<=65039||65533==i||127232<=i&&i<=127242||127248<=i&&i<=127277||127280<=i&&i<=127337||127344<=i&&i<=127386||917760<=i&&i<=917999||983040<=i&&i<=1048573||1048576<=i&&i<=1114109?"A":"N"},w.characterLength=function(t){var e=this.eastAsianWidth(t);return"F"==e||"W"==e||"A"==e?2:1},w.length=function(t){for(var e=O(t),u=0,i=0;i<e.length;i++)u+=this.characterLength(e[i]);return u},w.slice=function(t,e,u){textLen=w.length(t),u=u||1,(e=e||0)<0&&(e=textLen+e),u<0&&(u=textLen+u);for(var i="",D=0,r=O(t),s=0;s<r.length;s++){var n=r[s],o=w.length(n);if(D>=e-(2==o))if(D+o<=u)i+=n;else break;D+=o}return i};let $=x(y.exports),k=x(function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g});function S(t,e={}){if("string"!=typeof t||0===t.length||(e={ambiguousIsNarrow:!0,...e},0===(t=v(t)).length))return 0;t=t.replace(k()," ");let u=e.ambiguousIsNarrow?1:2,i=0;for(let e of t){let t=e.codePointAt(0);if(!(t<=31)&&(!(t>=127)||!(t<=159))&&(!(t>=768)||!(t<=879)))switch($.eastAsianWidth(e)){case"F":case"W":i+=2;break;case"A":i+=u;break;default:i+=1}}return i}let T=(t=0)=>e=>`\x1b[${e+t}m`,H=(t=0)=>e=>`\x1b[${38+t};5;${e}m`,V=(t=0)=>(e,u,i)=>`\x1b[${38+t};2;${e};${u};${i}m`,j={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(j.modifier),[...Object.keys(j.color),...Object.keys(j.bgColor)];let M=function(){let t=new Map;for(let[e,u]of Object.entries(j)){for(let[e,i]of Object.entries(u))j[e]={open:`\x1b[${i[0]}m`,close:`\x1b[${i[1]}m`},u[e]=j[e],t.set(i[0],i[1]);Object.defineProperty(j,e,{value:u,enumerable:!1})}return Object.defineProperty(j,"codes",{value:t,enumerable:!1}),j.color.close="\x1b[39m",j.bgColor.close="\x1b[49m",j.color.ansi=T(),j.color.ansi256=H(),j.color.ansi16m=V(),j.bgColor.ansi=T(10),j.bgColor.ansi256=H(10),j.bgColor.ansi16m=V(10),Object.defineProperties(j,{rgbToAnsi256:{value:(t,e,u)=>t===e&&e===u?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(e/255*5)+Math.round(u/255*5),enumerable:!1},hexToRgb:{value:t=>{let e=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!e)return[0,0,0];let[u]=e;3===u.length&&(u=[...u].map(t=>t+t).join(""));let i=Number.parseInt(u,16);return[i>>16&255,i>>8&255,255&i]},enumerable:!1},hexToAnsi256:{value:t=>j.rgbToAnsi256(...j.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{let e,u,i;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)u=e=((t-232)*10+8)/255,i=e;else{let D=(t-=16)%36;e=Math.floor(t/36)/5,u=Math.floor(D/6)/5,i=D%6/5}let D=2*Math.max(e,u,i);if(0===D)return 30;let r=30+(Math.round(i)<<2|Math.round(u)<<1|Math.round(e));return 2===D&&(r+=60),r},enumerable:!1},rgbToAnsi:{value:(t,e,u)=>j.ansi256ToAnsi(j.rgbToAnsi256(t,e,u)),enumerable:!1},hexToAnsi:{value:t=>j.ansi256ToAnsi(j.hexToAnsi256(t)),enumerable:!1}}),j}(),G=new Set(["\x1b","\x9b"]),W="]8;;",P=t=>`${G.values().next().value}[${t}m`,I=t=>`${G.values().next().value}${W}${t}\x07`,N=(t,e,u)=>{let i=[...e],D=!1,r=!1,s=S(v(t[t.length-1]));for(let[e,n]of i.entries()){let o=S(n);if(s+o<=u?t[t.length-1]+=n:(t.push(n),s=0),G.has(n)&&(D=!0,r=i.slice(e+1).join("").startsWith(W)),D){r?"\x07"===n&&(D=!1,r=!1):"m"===n&&(D=!1);continue}(s+=o)===u&&e<i.length-1&&(t.push(""),s=0)}!s&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())};function R(t,e,u){return String(t).normalize().replace(/\r\n/g,`
|
|
24
|
+
`).split(`
|
|
25
|
+
`).map(t=>((t,e,u={})=>{if(!1!==u.trim&&""===t.trim())return"";let i="",D,r,s=t.split(" ").map(t=>S(t)),n=[""];for(let[i,D]of t.split(" ").entries()){!1!==u.trim&&(n[n.length-1]=n[n.length-1].trimStart());let t=S(n[n.length-1]);if(0!==i&&(t>=e&&(!1===u.wordWrap||!1===u.trim)&&(n.push(""),t=0),(t>0||!1===u.trim)&&(n[n.length-1]+=" ",t++)),u.hard&&s[i]>e){let u=e-t,r=1+Math.floor((s[i]-u-1)/e);Math.floor((s[i]-1)/e)<r&&n.push(""),N(n,D,e);continue}if(t+s[i]>e&&t>0&&s[i]>0){if(!1===u.wordWrap&&t<e){N(n,D,e);continue}n.push("")}if(t+s[i]>e&&!1===u.wordWrap){N(n,D,e);continue}n[n.length-1]+=D}!1!==u.trim&&(n=n.map(t=>(t=>{let e=t.split(" "),u=e.length;for(;u>0&&!(S(e[u-1])>0);)u--;return u===e.length?t:e.slice(0,u).join(" ")+e.slice(u).join("")})(t)));let o=[...n.join(`
|
|
26
|
+
`)];for(let[t,e]of o.entries()){if(i+=e,G.has(e)){let{groups:e}=RegExp(`(?:\\[(?<code>\\d+)m|\\${W}(?<uri>.*)\x07)`).exec(o.slice(t).join(""))||{groups:{}};if(void 0!==e.code){let t=Number.parseFloat(e.code);D=39===t?void 0:t}else void 0!==e.uri&&(r=0===e.uri.length?void 0:e.uri)}let u=M.codes.get(Number(D));o[t+1]===`
|
|
27
|
+
`?(r&&(i+=I("")),D&&u&&(i+=P(u))):e===`
|
|
28
|
+
`&&(D&&u&&(i+=P(D)),r&&(i+=I(r)))}return i})(t,e,u)).join(`
|
|
29
|
+
`)}let L={actions:new Set(["up","down","left","right","space","enter","cancel"]),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function q(t,e){if("string"==typeof t)return L.aliases.get(t)===e;for(let u of t)if(void 0!==u&&q(u,e))return!0;return!1}let U=globalThis.process.platform.startsWith("win"),z=Symbol("clack:cancel");function Y(t,e){t.isTTY&&t.setRawMode(e)}var J=Object.defineProperty,K=(t,e,u)=>{let i;return(i="symbol"!=typeof e?e+"":e)in t?J(t,i,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[i]=u,u};class Z{constructor(t,e=!0){K(this,"input"),K(this,"output"),K(this,"_abortSignal"),K(this,"rl"),K(this,"opts"),K(this,"_render"),K(this,"_track",!1),K(this,"_prevFrame",""),K(this,"_subscribers",new Map),K(this,"_cursor",0),K(this,"state","initial"),K(this,"error",""),K(this,"value");let{input:u=_.stdin,output:i=_.stdout,render:D,signal:r,...s}=t;this.opts=s,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=D.bind(this),this._track=e,this._abortSignal=r,this.input=u,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(t,e){let u=this._subscribers.get(t)??[];u.push(e),this._subscribers.set(t,u)}on(t,e){this.setSubscriber(t,{cb:e})}once(t,e){this.setSubscriber(t,{cb:e,once:!0})}emit(t,...e){let u=this._subscribers.get(t)??[],i=[];for(let t of u)t.cb(...e),t.once&&i.push(()=>u.splice(u.indexOf(t),1));for(let t of i)t()}prompt(){return new Promise((t,e)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(z);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let u=new p;u._write=(t,e,u)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),u()},this.input.pipe(u),this.rl=n.createInterface({input:this.input,output:u,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),n.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),void 0!==this.opts.initialValue&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Y(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(f.cursor.show),this.output.off("resize",this.render),Y(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(f.cursor.show),this.output.off("resize",this.render),Y(this.input,!1),t(z)})})}onKeypress(t,e){if("error"===this.state&&(this.state="active"),e?.name&&(!this._track&&L.aliases.has(e.name)&&this.emit("cursor",L.aliases.get(e.name)),L.actions.has(e.name)&&this.emit("cursor",e.name)),t&&("y"===t.toLowerCase()||"n"===t.toLowerCase())&&this.emit("confirm","y"===t.toLowerCase())," "===t&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),e?.name==="return"){if(this.opts.validate){let t=this.opts.validate(this.value);t&&(this.error=t instanceof Error?t.message:t,this.state="error",this.rl?.write(this.value))}"error"!==this.state&&(this.state="submit")}q([t,e?.name,e?.sequence],"cancel")&&(this.state="cancel"),("submit"===this.state||"cancel"===this.state)&&this.emit("finalize"),this.render(),("submit"===this.state||"cancel"===this.state)&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
30
|
+
`),Y(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=R(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
31
|
+
`).length-1;this.output.write(f.cursor.move(-999,-1*t))}render(){let t=R(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if("initial"===this.state)this.output.write(f.cursor.hide);else{let e=function(t,e){if(t===e)return;let u=t.split(`
|
|
32
|
+
`),i=e.split(`
|
|
33
|
+
`),D=[];for(let t=0;t<Math.max(u.length,i.length);t++)u[t]!==i[t]&&D.push(t);return D}(this._prevFrame,t);if(this.restoreCursor(),e&&e?.length===1){let u=e[0];this.output.write(f.cursor.move(0,u)),this.output.write(f.erase.lines(1));let i=t.split(`
|
|
34
|
+
`);this.output.write(i[u]),this._prevFrame=t,this.output.write(f.cursor.move(0,i.length-u-1));return}if(e&&e?.length>1){let u=e[0];this.output.write(f.cursor.move(0,u)),this.output.write(f.erase.down());let i=t.split(`
|
|
35
|
+
`).slice(u);this.output.write(i.join(`
|
|
36
|
+
`)),this._prevFrame=t;return}this.output.write(f.erase.down())}this.output.write(t),"initial"===this.state&&(this.state="active"),this._prevFrame=t}}}class Q extends Z{get cursor(){return+!this.value}get _value(){return 0===this.cursor}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",t=>{this.output.write(f.cursor.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}new WeakMap;class X extends Z{get valueWithCursor(){if("submit"===this.state)return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let t=this.value.slice(0,this.cursor),[e,...u]=this.value.slice(this.cursor);return`${t}${b.inverse(e)}${u.join("")}`}get cursor(){return this._cursor}constructor(t){super(t),this.on("finalize",()=>{this.value||(this.value=t.defaultValue)})}}let tt="win32"!==_.default.platform?"linux"!==_.default.env.TERM:!!_.default.env.CI||!!_.default.env.WT_SESSION||!!_.default.env.TERMINUS_SUBLIME||"{cmd::Cmder}"===_.default.env.ConEmuTask||"Terminus-Sublime"===_.default.env.TERM_PROGRAM||"vscode"===_.default.env.TERM_PROGRAM||"xterm-256color"===_.default.env.TERM||"alacritty"===_.default.env.TERM||"JetBrains-JediTerm"===_.default.env.TERMINAL_EMULATOR,te=(t,e)=>tt?t:e,tu=te("◆","*"),ti=te("■","x"),tD=te("▲","x"),tr=te("◇","o"),ts=te("┌","T"),tn=te("│","|"),to=te("└","—"),ta=te("●",">"),tl=te("○"," "),th=(te("◻","[•]"),te("◼","[+]"),te("◻","[ ]"),te("▪","•"),te("─","-")),tp=te("╮","+"),tm=te("├","+"),tc=te("╯","+"),td=te("●","•"),tC=te("◆","*"),tF=te("▲","!"),tg=te("■","x"),tE=t=>{switch(t){case"initial":case"active":return b.cyan(tu);case"cancel":return b.red(ti);case"error":return b.yellow(tD);case"submit":return b.green(tr)}},tf=t=>new X({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${b.gray(tn)}
|
|
37
|
+
${tE(this.state)} ${t.message}
|
|
38
|
+
`,u=t.placeholder?b.inverse(t.placeholder[0])+b.dim(t.placeholder.slice(1)):b.inverse(b.hidden("_")),i=this.value?this.valueWithCursor:u;switch(this.state){case"error":return`${e.trim()}
|
|
39
|
+
${b.yellow(tn)} ${i}
|
|
40
|
+
${b.yellow(to)} ${b.yellow(this.error)}
|
|
41
|
+
`;case"submit":return`${e}${b.gray(tn)} ${b.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${b.gray(tn)} ${b.strikethrough(b.dim(this.value??""))}${this.value?.trim()?`
|
|
42
|
+
${b.gray(tn)}`:""}`;default:return`${e}${b.cyan(tn)} ${i}
|
|
43
|
+
${b.cyan(to)}
|
|
44
|
+
`}}}).prompt(),t_=t=>{let e=t.active??"Yes",u=t.inactive??"No";return new Q({active:e,inactive:u,initialValue:t.initialValue??!0,render(){let i=`${b.gray(tn)}
|
|
45
|
+
${tE(this.state)} ${t.message}
|
|
46
|
+
`,D=this.value?e:u;switch(this.state){case"submit":return`${i}${b.gray(tn)} ${b.dim(D)}`;case"cancel":return`${i}${b.gray(tn)} ${b.strikethrough(b.dim(D))}
|
|
47
|
+
${b.gray(tn)}`;default:return`${i}${b.cyan(tn)} ${this.value?`${b.green(ta)} ${e}`:`${b.dim(tl)} ${b.dim(e)}`} ${b.dim("/")} ${this.value?`${b.dim(tl)} ${b.dim(u)}`:`${b.green(ta)} ${u}`}
|
|
48
|
+
${b.cyan(to)}
|
|
49
|
+
`}}}).prompt()},tb=(t="")=>{process.stdout.write(`${b.gray(tn)}
|
|
50
|
+
${b.gray(to)} ${t}
|
|
51
|
+
|
|
52
|
+
`)},tA={message:(t="",{symbol:e=b.gray(tn)}={})=>{let u=[`${b.gray(tn)}`];if(t){let[i,...D]=t.split(`
|
|
53
|
+
`);u.push(`${e} ${i}`,...D.map(t=>`${b.gray(tn)} ${t}`))}process.stdout.write(`${u.join(`
|
|
54
|
+
`)}
|
|
55
|
+
`)},info:t=>{tA.message(t,{symbol:b.blue(td)})},success:t=>{tA.message(t,{symbol:b.green(tC)})},step:t=>{tA.message(t,{symbol:b.green(tr)})},warn:t=>{tA.message(t,{symbol:b.yellow(tF)})},warning:t=>{tA.warn(t)},error:t=>{tA.message(t,{symbol:b.red(tg)})}},tB=(b.gray(tn),({indicator:t="dots"}={})=>{let e=tt?["◒","◐","◓","◑"]:["•","o","O","0"],u=tt?80:120,i="true"===process.env.CI,D,r,s=!1,n="",p,m=performance.now(),c=t=>{s&&E(t>1?"Something went wrong":"Canceled",t)},d=()=>c(2),C=()=>c(1),F=()=>{if(void 0===p)return;i&&process.stdout.write(`
|
|
56
|
+
`);let t=p.split(`
|
|
57
|
+
`);process.stdout.write(f.cursor.move(-999,t.length-1)),process.stdout.write(f.erase.down(t.length))},g=t=>{let e=(performance.now()-t)/1e3,u=Math.floor(e/60),i=Math.floor(e%60);return u>0?`[${u}m ${i}s]`:`[${i}s]`},E=(e="",u=0)=>{s=!1,clearInterval(r),F();let i=0===u?b.green(tr):1===u?b.red(ti):b.red(tD);n=(e??n).replace(/\.+$/,""),"timer"===t?process.stdout.write(`${i} ${n} ${g(m)}
|
|
58
|
+
`):process.stdout.write(`${i} ${n}
|
|
59
|
+
`),process.removeListener("uncaughtExceptionMonitor",d),process.removeListener("unhandledRejection",d),process.removeListener("SIGINT",C),process.removeListener("SIGTERM",C),process.removeListener("exit",c),D()};return{start:(E="")=>{s=!0,D=function({input:t=_.stdin,output:e=_.stdout,overwrite:u=!0,hideCursor:i=!0}={}){let D=a({input:t,output:e,prompt:"",tabSize:1});l(t,D),t.isTTY&&t.setRawMode(!0);let r=(D,{name:s,sequence:n})=>{if(q([String(D),s,n],"cancel")){i&&e.write(f.cursor.show),process.exit(0);return}u&&h(e,"return"===s?0:-1,"return"===s?-1:0,()=>{o(e,1,()=>{t.once("keypress",r)})})};return i&&e.write(f.cursor.hide),t.once("keypress",r),()=>{t.off("keypress",r),i&&e.write(f.cursor.show),t.isTTY&&!U&&t.setRawMode(!1),D.terminal=!1,D.close()}}(),n=E.replace(/\.+$/,""),m=performance.now(),process.stdout.write(`${b.gray(tn)}
|
|
60
|
+
`);let A=0,B=0;process.on("uncaughtExceptionMonitor",d),process.on("unhandledRejection",d),process.on("SIGINT",C),process.on("SIGTERM",C),process.on("exit",c),r=setInterval(()=>{if(i&&n===p)return;F(),p=n;let u=b.magenta(e[A]);if(i)process.stdout.write(`${u} ${n}...`);else if("timer"===t)process.stdout.write(`${u} ${n} ${g(m)}`);else{let t=".".repeat(Math.floor(B)).slice(0,3);process.stdout.write(`${u} ${n}${t}`)}A=A+1<e.length?A+1:0,B=B<e.length?B+.125:0},u)},stop:E,message:(t="")=>{n=(t??n).replace(/\.+$/,"")}}}),tv=async(t,e)=>{let u={};for(let i of Object.keys(t)){let D=t[i],r=await D({results:u})?.catch(t=>{throw t});if("function"==typeof e?.onCancel&&r===z){u[i]="canceled",e.onCancel({results:u});continue}u[i]=r}return u};var tx=d("node:fs"),ty=d("node:path");let tw=async t=>{let e=tB(),u=(0,ty.resolve)(_.default.cwd(),t);return e.start(`Creating a React App in ${A().green(u)}.`),(0,tx.mkdirSync)(u),await E("npm",["init","-y"],{cwd:u}),e.stop(`React App created in ${A().green(u)}.`),{repoDir:u}},tO=t=>(t===z&&(((t="")=>{process.stdout.write(`${b.gray(to)} ${b.red(t)}
|
|
61
|
+
|
|
62
|
+
`)})("Operation cancelled."),C()),t),t$=t=>"string"==typeof t&&/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(t)?(0,tx.existsSync)((0,ty.resolve)(_.default.cwd(),t))?`The directory ${A().green(t)} already exists.
|
|
63
|
+
Either try using a new directory name, or remove the files listed above.`:"":`The project name '${t}' is not valid.
|
|
64
|
+
|
|
65
|
+
A valid npm project name must start with a lowercase letter, a number, a hyphen, or a tilde, and can include dots, hyphens, tildes, or underscores.
|
|
66
|
+
|
|
67
|
+
If the project name starts with '@', it must be followed by a valid scope name and a '/'.`,tk=t=>"string"==typeof t&&/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*(?:@[^\s@][^\s]*)?$/.test(t)?"":`The template name '${t}' is not valid.`,tS=async({projectName:t,skipDepInstall:e,skipGitInit:u,template:i})=>({projectName:t||tO(await tf({message:"What is the name of your project?",placeholder:"my-project",validate:t$})).toString(),skipDepInstall:e||!!tO(await t_({message:"Do you want to skip installing dependencies (npm install)?",initialValue:!1})),skipGitInit:u||!!tO(await t_({message:"Do you want to skip initializing a git repository?",initialValue:!1})),template:i||tO((await tv({useCustomTemplate:async()=>!!await t_({message:"Do you want to use a custom template?",initialValue:!1}),template:async({results:t})=>t.useCustomTemplate?(await tf({message:"Enter the custom template name (e.g., @pplancq/react-template):",placeholder:"@pplancq/react-template",validate:tk})).toString():"@pplancq/react-template"})).template)}),{program:tT,createCommand:tH,createArgument:tV,createOption:tj,CommanderError:tM,InvalidArgumentError:tG,InvalidOptionArgumentError:tW,Command:tP,Argument:tI,Option:tN,Help:tR}=d("../../node_modules/commander/index.js");var tL=JSON.parse('{"UU":"@pplancq/create-react-app","rE":"2.0.1"}');let tq=async(t,e)=>{if(e)return;let u=tB();u.start("Creating git commit."),await E("git",["add","."],{cwd:t}),await E("git",["commit","--no-verify","--message","Initial commit"],{cwd:t}),u.stop("Git commit created.")},tU=async(t,e)=>{if(e)return;let u=tB();u.start("Initializing git repository."),await E("git",["init","--initial-branch=main"],{cwd:t}),u.stop("Git repository initialized.")},tz=async(t,e)=>{if(e)return;let u=tB();u.start("Installing packages. This might take a couple of minutes."),await E("npm",["install"],{cwd:t}),u.stop("Packages installed.")},tY=async(t,e)=>{let u=tB(),i=(0,ty.resolve)(t,`node_modules/${e}`);u.start(`Installing react template from ${A().green(e)}. This might take a couple of minutes.`),await E("npm",["install",e,"--install-strategy=nested"],{cwd:t}),(0,tx.cpSync)(i,t,{recursive:!0,dereference:!0}),(0,tx.rmSync)(`${t}/package-lock.json`),(0,tx.rmSync)(`${t}/node_modules`,{recursive:!0}),u.stop("React template installed.")},tJ=async(t,e)=>{let u=tB(),i=!1,D=JSON.parse((0,tx.readFileSync)((0,ty.resolve)(e,"package.json"),{encoding:"utf-8"}));if(D?.bin?.["template-install"]===void 0)return void tA.warn("No post install template script found.");u.start("Running post install template script...");try{await E("npx",["template-install",t],{cwd:e})}catch(t){if(i=!0,!(t instanceof F))throw t;tA.error("Failed to run template-install command")}finally{u.stop(i?"Failed to run post install template script.":"Post install template script finished.")}};class tK extends Error{constructor(t){super(t),this.name="InvalidProjectNameError"}}class tZ extends Error{constructor(t){super(t),this.name="InvalidTemplateNameError"}}(async()=>{let t,e=(t={},new tP(tL.UU).argument("[project-name]","The name of the project to create.").option("-t, --template <template>","Specify a template for the project.").option("--skip-dep-install","Skip installing dependencies (npm install).").option("--skip-git-init","Skip initializing a git repository.").version(tL.rE,"-v, --version").name(A().green("create-react-app")).usage(`[options] ${A().yellow("[project-name]")}`).addHelpText("after",`
|
|
68
|
+
Examples:
|
|
69
|
+
$ npm create @pplancq/react-app my-project
|
|
70
|
+
$ npx @pplancq/create-react-app my-project`).action((e,u)=>{e&&(t.projectName=e),u?.skipDepInstall&&(t.skipDepInstall=u.skipDepInstall),u?.skipGitInit&&(t.skipGitInit=u.skipGitInit),u?.template&&(t.template=u.template)}).parse(_.default.argv),t);((t="")=>{process.stdout.write(`${b.gray(ts)} ${t}
|
|
71
|
+
`)})(`Create ${A().blue("React")} App`),(({projectName:t,template:e})=>{if(t){let e=t$(t);if(""!==e)throw new tK(e)}if(e){let t=tk(e);if(""!==t)throw new tZ(t)}})(e);let{projectName:u,skipDepInstall:i,skipGitInit:D,template:r}=await tS(e),{repoDir:n}=await tw(u);await tY(n,r),await tJ(u,n),await tU(n,D),await tz(n,i),await tq(n,D),tA.success(`${A().yellow("Success \\o/")} Created ${A().green(u)} at ${A().green(n)}`),((t="",e="")=>{let u=`
|
|
72
|
+
${t}
|
|
73
|
+
`.split(`
|
|
74
|
+
`),i=s(e).length,D=Math.max(u.reduce((t,e)=>{let u=s(e);return u.length>t?u.length:t},0),i)+2,r=u.map(t=>`${b.gray(tn)} ${b.dim(t)}${" ".repeat(D-s(t).length)}${b.gray(tn)}`).join(`
|
|
75
|
+
`);process.stdout.write(`${b.gray(tn)}
|
|
76
|
+
${b.green(tr)} ${b.reset(e)} ${b.gray(th.repeat(Math.max(D-i-1,1))+tp)}
|
|
77
|
+
${r}
|
|
78
|
+
${b.gray(tm+th.repeat(D+2)+tc)}
|
|
79
|
+
`)})(`We suggest that you begin by typing:
|
|
80
|
+
${A().cyan("cd")} ${u}${i?`
|
|
81
|
+
${A().cyan("npm install")}`:""}
|
|
82
|
+
${A().cyan("npm start")}`,"What next?")})().then(()=>{tb("Happy hacking!"),C()}).catch(t=>{tA.error(t.message),tb("Please check and try again."),C(!0)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pplancq/create-react-app",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "pplancq create-react-app",
|
|
6
6
|
"author": "pplancq <paul.plancq@outlook.fr>",
|
|
@@ -10,24 +10,61 @@
|
|
|
10
10
|
"directory": "packages/create-react-app"
|
|
11
11
|
},
|
|
12
12
|
"bin": {
|
|
13
|
-
"create-react-app": "
|
|
13
|
+
"create-react-app": "dist/main.js"
|
|
14
14
|
},
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/pplancq/dev-tools/issues"
|
|
17
17
|
},
|
|
18
|
-
"
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "dist/main.js",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"start": "rslib build --watch",
|
|
22
|
+
"build": "rslib build",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:watch": "vitest",
|
|
25
|
+
"lint:eslint": "eslint \"**/*.{js,mjs,ts}\"",
|
|
26
|
+
"lint:eslint:fix": "eslint \"**/*.{js,mjs,ts}\" --fix",
|
|
27
|
+
"lint:prettier": "prettier \"**/*.!(js|mjs|ts)\" --check --ignore-unknown",
|
|
28
|
+
"lint:prettier:fix": "prettier \"**/*.!(js|mjs|ts)\" --write --ignore-unknown",
|
|
29
|
+
"prepublishOnly": "npm run build"
|
|
30
|
+
},
|
|
19
31
|
"keywords": [
|
|
20
32
|
"create",
|
|
21
33
|
"react"
|
|
22
34
|
],
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"index.js",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE",
|
|
40
|
+
"CHANGELOG.md"
|
|
41
|
+
],
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@clack/prompts": "^0.11.0",
|
|
44
|
+
"@rslib/core": "^0.17.0",
|
|
45
|
+
"@vitest/coverage-v8": "^4.0.5",
|
|
46
|
+
"commander": "^14.0.2",
|
|
47
|
+
"eslint": "^9.38.0",
|
|
48
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
49
|
+
"lint-staged": "^16.2.6",
|
|
50
|
+
"picocolors": "^1.1.1",
|
|
51
|
+
"prettier": "^3.6.2",
|
|
52
|
+
"tsc-files": "^1.1.4",
|
|
53
|
+
"typescript": "^5.9.3",
|
|
54
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
55
|
+
"vitest": "^4.0.5",
|
|
56
|
+
"vitest-sonar-reporter": "^3.0.0"
|
|
26
57
|
},
|
|
27
58
|
"engines": {
|
|
28
59
|
"node": ">=20.12.2"
|
|
29
60
|
},
|
|
30
61
|
"volta": {
|
|
31
62
|
"extends": "../../package.json"
|
|
63
|
+
},
|
|
64
|
+
"prettier": "@pplancq/prettier-config",
|
|
65
|
+
"lint-staged": {
|
|
66
|
+
"*.(js|mjs|ts)": "eslint --fix",
|
|
67
|
+
"*.ts": "tsc-files --noEmit",
|
|
68
|
+
"*.!(js|mjs|ts)": "prettier --write --ignore-unknown"
|
|
32
69
|
}
|
|
33
70
|
}
|
package/index.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const { execSync } = require('child_process');
|
|
3
|
-
const { Command } = require('commander');
|
|
4
|
-
const { cpSync, existsSync, readFileSync, renameSync, rmSync, writeFileSync, mkdirSync } = require('fs');
|
|
5
|
-
const { resolve } = require('path');
|
|
6
|
-
|
|
7
|
-
const NPM = 'npm';
|
|
8
|
-
const YARN = 'yarn';
|
|
9
|
-
const PNPM = 'pnpm';
|
|
10
|
-
|
|
11
|
-
const runCommand = (command, options = { stdio: 'inherit' }) => {
|
|
12
|
-
try {
|
|
13
|
-
execSync(command, options);
|
|
14
|
-
} catch (e) {
|
|
15
|
-
console.error(`Failed to execute ${command}`, e);
|
|
16
|
-
process.exit(-1);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const getPackageManager = () => {
|
|
21
|
-
switch (true) {
|
|
22
|
-
case process.env.npm_config_user_agent.includes(YARN):
|
|
23
|
-
return YARN;
|
|
24
|
-
case process.env.npm_config_user_agent.includes(PNPM):
|
|
25
|
-
return PNPM;
|
|
26
|
-
default:
|
|
27
|
-
return NPM;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const main = async () => {
|
|
32
|
-
const chalk = await import('chalk').then(m => m.default);
|
|
33
|
-
|
|
34
|
-
let projectName = '';
|
|
35
|
-
const packageJson = JSON.parse(readFileSync(resolve(__dirname, './package.json'), { encoding: 'utf-8' }));
|
|
36
|
-
|
|
37
|
-
const cli = new Command(packageJson.name);
|
|
38
|
-
cli
|
|
39
|
-
.version(packageJson.version)
|
|
40
|
-
.argument('<project-name>')
|
|
41
|
-
.usage(chalk.green('<project-name>'))
|
|
42
|
-
.action(name => {
|
|
43
|
-
projectName = name;
|
|
44
|
-
})
|
|
45
|
-
.parse(process.argv);
|
|
46
|
-
|
|
47
|
-
const packageManager = getPackageManager();
|
|
48
|
-
|
|
49
|
-
if (!/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName)) {
|
|
50
|
-
console.error(`The project name '${projectName}' is not valid.`);
|
|
51
|
-
console.error(
|
|
52
|
-
'A valid npm project name must start with a lowercase letter, a number, a hyphen, or a tilde, and can include dots, hyphens, tildes, or underscores.',
|
|
53
|
-
);
|
|
54
|
-
console.error(
|
|
55
|
-
"If the project name starts with '@', it must be followed by a valid scope name and a '/'. Please check and try again.",
|
|
56
|
-
);
|
|
57
|
-
process.exit(-1);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const reactTemplate = '@pplancq/react-template';
|
|
61
|
-
|
|
62
|
-
const repoDir = resolve(process.cwd(), `./${projectName}`);
|
|
63
|
-
const templateDir = resolve(repoDir, `./node_modules/${reactTemplate}`);
|
|
64
|
-
|
|
65
|
-
if (existsSync(repoDir)) {
|
|
66
|
-
console.error(`\nThe directory ${chalk.green(projectName)} is already exist.`);
|
|
67
|
-
console.error('Either try using a new directory name, or remove the files listed above.');
|
|
68
|
-
process.exit(-1);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
console.info(`\nCreating a new App React in ${chalk.green(repoDir)}.`);
|
|
72
|
-
|
|
73
|
-
console.info(`\nInstall react template from ${chalk.green(reactTemplate)}`);
|
|
74
|
-
mkdirSync(repoDir);
|
|
75
|
-
runCommand(`cd ${repoDir} && npm init -y`, { stdio: 'ignore' });
|
|
76
|
-
if (packageManager === YARN) {
|
|
77
|
-
runCommand(`cd ${repoDir} && yarn config set nodeLinker node-modules`, { stdio: 'ignore' });
|
|
78
|
-
}
|
|
79
|
-
runCommand(`cd ${repoDir} && ${packageManager} ${packageManager === YARN ? 'add' : 'install'} ${reactTemplate}`);
|
|
80
|
-
cpSync(templateDir, repoDir, { recursive: true, dereference: true });
|
|
81
|
-
renameSync(`${repoDir}/_gitignore`, `${repoDir}/.gitignore`);
|
|
82
|
-
const repoPackageJson = JSON.parse(readFileSync(resolve(repoDir, 'package.json'), { encoding: 'utf-8' }));
|
|
83
|
-
repoPackageJson.name = projectName;
|
|
84
|
-
repoPackageJson.description = projectName;
|
|
85
|
-
const { _prepare, _postinstall, ...scripts } = repoPackageJson.scripts;
|
|
86
|
-
repoPackageJson.scripts = { ...scripts, prepare: _prepare, postinstall: _postinstall };
|
|
87
|
-
repoPackageJson.version = '0.1.0';
|
|
88
|
-
|
|
89
|
-
delete repoPackageJson.author;
|
|
90
|
-
delete repoPackageJson.repository;
|
|
91
|
-
delete repoPackageJson.bugs;
|
|
92
|
-
delete repoPackageJson.keywords;
|
|
93
|
-
delete repoPackageJson.engines;
|
|
94
|
-
|
|
95
|
-
writeFileSync(resolve(repoDir, 'package.json'), JSON.stringify(repoPackageJson, null, 2), { encoding: 'utf-8' });
|
|
96
|
-
rmSync(`${repoDir}/node_modules`, { recursive: true });
|
|
97
|
-
rmSync(`${repoDir}/LICENSE`);
|
|
98
|
-
rmSync(`${repoDir}/CHANGELOG.md`);
|
|
99
|
-
rmSync(`${repoDir}/README.md`);
|
|
100
|
-
renameSync(`${repoDir}/_README.md`, `${repoDir}/README.md`);
|
|
101
|
-
|
|
102
|
-
let readme = readFileSync(resolve(repoDir, 'README.md'), { encoding: 'utf-8' });
|
|
103
|
-
switch (packageManager) {
|
|
104
|
-
case YARN:
|
|
105
|
-
rmSync(`${repoDir}/yarn.lock`);
|
|
106
|
-
readme = readme.replaceAll('npm install', 'yarn');
|
|
107
|
-
readme = readme.replaceAll('npm', 'yarn');
|
|
108
|
-
break;
|
|
109
|
-
case PNPM:
|
|
110
|
-
rmSync(`${repoDir}/pnpm-lock.yaml`);
|
|
111
|
-
readme = readme.replaceAll('npm', 'pnpm');
|
|
112
|
-
break;
|
|
113
|
-
default:
|
|
114
|
-
rmSync(`${repoDir}/package-lock.json`);
|
|
115
|
-
}
|
|
116
|
-
writeFileSync(resolve(repoDir, 'README.md'), readme, { encoding: 'utf-8' });
|
|
117
|
-
|
|
118
|
-
console.info('\nInitialized a git repository.');
|
|
119
|
-
runCommand(`cd ${repoDir} && git init --initial-branch=main`, { stdio: 'ignore' });
|
|
120
|
-
|
|
121
|
-
console.info('\nInstalling packages. This might take a couple of minutes.');
|
|
122
|
-
runCommand(`cd ${repoDir} && ${packageManager} install`);
|
|
123
|
-
|
|
124
|
-
if (packageManager === PNPM) {
|
|
125
|
-
runCommand(`cd ${repoDir} && ${packageManager} install -D vite`);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
console.info('\nCreated git commit.');
|
|
129
|
-
runCommand(`cd ${repoDir} && git add . && git commit --no-verify --message "Initial commit"`, {
|
|
130
|
-
stdio: 'ignore',
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
console.info(`\n${chalk.yellow('Success \\o/')} Created ${chalk.green(projectName)} at ${chalk.green(repoDir)}`);
|
|
134
|
-
console.info('Inside that directory, you can run several commands:');
|
|
135
|
-
const logCommand = command => {
|
|
136
|
-
console.info(`\n ${chalk.cyan(command)}`);
|
|
137
|
-
};
|
|
138
|
-
logCommand(`${packageManager} start`);
|
|
139
|
-
console.info(' Starts the development server.');
|
|
140
|
-
logCommand(`${packageManager} run build`);
|
|
141
|
-
console.info(' Bundles the app into static files for production.');
|
|
142
|
-
logCommand(`${packageManager} test`);
|
|
143
|
-
console.info(' Starts the test runner.');
|
|
144
|
-
logCommand(`${packageManager} run remove:demo`);
|
|
145
|
-
console.info(' Remove the demo application.');
|
|
146
|
-
console.info('\nWe suggest that you begin by typing:');
|
|
147
|
-
console.info(`\n ${chalk.cyan('cd')} ${projectName}`);
|
|
148
|
-
logCommand(`${packageManager} start`);
|
|
149
|
-
console.info('\nHappy hacking!');
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
main();
|