create-playcanvas 0.2.6 → 0.3.0
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/README.md +39 -47
- package/dist/index.mjs +48 -47
- package/package.json +53 -49
- package/templates/index.ts +15 -57
- package/templates/react-ts/README.md +32 -59
- package/templates/react-ts/eslint.config.mjs +14 -0
- package/templates/react-ts/index.html +10 -10
- package/templates/react-ts/package.json +34 -27
- package/templates/react-ts/prettier.config.mjs +1 -0
- package/templates/react-ts/src/App.css +37 -49
- package/templates/react-ts/src/App.tsx +38 -41
- package/templates/react-ts/src/Scene.tsx +50 -50
- package/templates/react-ts/src/index.css +30 -52
- package/templates/react-ts/src/main.tsx +9 -8
- package/templates/react-ts/src/vite-env.d.ts +12 -0
- package/templates/react-ts/tsconfig.json +24 -5
- package/templates/react-ts/vite.config.ts +4 -4
- package/templates/vanilla-ts/README.md +31 -91
- package/templates/vanilla-ts/eslint.config.mjs +3 -0
- package/templates/vanilla-ts/index.html +10 -10
- package/templates/vanilla-ts/package.json +28 -21
- package/templates/vanilla-ts/prettier.config.mjs +1 -0
- package/templates/vanilla-ts/src/App.ts +149 -151
- package/templates/vanilla-ts/src/main.ts +7 -7
- package/templates/vanilla-ts/src/style.css +60 -93
- package/templates/vanilla-ts/src/utils.ts +9 -8
- package/templates/vanilla-ts/src/vite-env.d.ts +12 -0
- package/templates/vanilla-ts/tsconfig.json +22 -22
- package/index.js +0 -3
- package/templates/react-ts/scripts/ensure-node-version.cjs +0 -12
- package/templates/react-ts/tsconfig.app.json +0 -27
- package/templates/react-ts/tsconfig.node.json +0 -25
- package/templates/vanilla-ts/scripts/ensure-node-version.cjs +0 -12
package/README.md
CHANGED
|
@@ -1,78 +1,70 @@
|
|
|
1
1
|
# create-playcanvas
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/create-playcanvas)
|
|
4
|
-
[](https://npmtrends.com/create-playcanvas)
|
|
5
|
+
[](https://github.com/playcanvas/create-playcanvas/blob/main/LICENSE)
|
|
6
|
+
[](https://discord.gg/RSaMRzg)
|
|
7
|
+
[](https://www.reddit.com/r/PlayCanvas)
|
|
8
|
+
[](https://x.com/intent/follow?screen_name=playcanvas)
|
|
5
9
|
|
|
6
|
-
|
|
10
|
+
| [Engine Manual](https://developer.playcanvas.com/user-manual/engine/) | [React Manual](https://developer.playcanvas.com/user-manual/react/) | [Examples](https://playcanvas.github.io/) | [Forum](https://forum.playcanvas.com/) |
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
npm create playcanvas@latest
|
|
10
|
-
```
|
|
12
|
+
Scaffold a Vite-powered PlayCanvas project with TypeScript. Choose the PlayCanvas Engine directly or build with [`@playcanvas/react`](https://github.com/playcanvas/react).
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
## Getting Started
|
|
15
|
+
|
|
16
|
+
Requires Node.js 22.23.2 or later.
|
|
13
17
|
|
|
14
18
|
```bash
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
npm create playcanvas@latest
|
|
20
|
+
cd playcanvas-project
|
|
21
|
+
npm install
|
|
22
|
+
npm run dev
|
|
18
23
|
```
|
|
19
24
|
|
|
20
|
-
The
|
|
21
|
-
|
|
22
|
-
1. **Project name** - folder to create (defaults to `playcanvas-project`)
|
|
23
|
-
2. **Overwrite behavior** - if the folder already exists
|
|
24
|
-
3. **Package name** - used in `package.json`
|
|
25
|
-
4. **Framework & variant** - pick from templates below
|
|
26
|
-
|
|
27
|
-
## Non-interactive Usage
|
|
25
|
+
The interactive setup asks for a project name, handles an existing target directory, sets the package name and lets you choose a template.
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
You can also use another package manager:
|
|
30
28
|
|
|
31
29
|
```bash
|
|
32
|
-
|
|
30
|
+
pnpm create playcanvas@latest
|
|
31
|
+
yarn create playcanvas
|
|
32
|
+
bun x create-playcanvas@latest
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
| Flag | Shorthand | Description |
|
|
36
|
-
| ------------------- | --------- | -------------------------------------------------- |
|
|
37
|
-
| `--template <name>` | `-t` | Directly choose template variant (see list below) |
|
|
38
|
-
| `--overwrite` | | Remove existing files in target directory |
|
|
39
|
-
| `--help` | `-h` | Show help/usage information |
|
|
40
|
-
|
|
41
35
|
## Templates
|
|
42
36
|
|
|
43
|
-
| Template | Description
|
|
44
|
-
| ------------ |
|
|
45
|
-
| `vanilla-ts` |
|
|
46
|
-
| `react-ts` |
|
|
37
|
+
| Template | Description |
|
|
38
|
+
| ------------ | ----------------------------------- |
|
|
39
|
+
| `vanilla-ts` | TypeScript with PlayCanvas Engine |
|
|
40
|
+
| `react-ts` | TypeScript with `@playcanvas/react` |
|
|
47
41
|
|
|
48
|
-
|
|
42
|
+
Both templates include Vite, hot module replacement, ESLint, Prettier and a production build.
|
|
49
43
|
|
|
50
|
-
##
|
|
44
|
+
## CLI Options
|
|
51
45
|
|
|
52
|
-
|
|
46
|
+
Pass a project name and template to skip the prompts:
|
|
53
47
|
|
|
54
48
|
```bash
|
|
55
|
-
npm
|
|
56
|
-
npm run dev # stub build for local development
|
|
57
|
-
node index.js # test the CLI locally
|
|
49
|
+
npm create playcanvas@latest my-game -- --template react-ts
|
|
58
50
|
```
|
|
59
51
|
|
|
60
|
-
|
|
52
|
+
| Option | Shorthand | Description |
|
|
53
|
+
| ------------------- | --------- | ------------------------------------------------------- |
|
|
54
|
+
| `--template <name>` | `-t` | Use a template from the list above |
|
|
55
|
+
| `--overwrite` | | Remove existing files from a non-empty target directory |
|
|
56
|
+
| `--help` | `-h` | Show command help |
|
|
57
|
+
|
|
58
|
+
## Development
|
|
61
59
|
|
|
62
60
|
```bash
|
|
63
|
-
npm
|
|
64
|
-
|
|
61
|
+
npm install
|
|
62
|
+
npm run build
|
|
63
|
+
node dist/index.mjs
|
|
65
64
|
```
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
Bug reports, feature requests and PRs are welcome! Want to create a new template? Please file an issue first if you plan major changes.
|
|
70
|
-
|
|
71
|
-
1. Fork / clone
|
|
72
|
-
2. Create a branch: `git checkout -b feat/my-awesome-idea`
|
|
73
|
-
3. Commit with conventional-commit messages
|
|
74
|
-
4. Push and open a PR
|
|
66
|
+
Contributions are welcome. Please open an issue before proposing a new template or another substantial change.
|
|
75
67
|
|
|
76
68
|
## License
|
|
77
69
|
|
|
78
|
-
MIT
|
|
70
|
+
[MIT](LICENSE)
|
package/dist/index.mjs
CHANGED
|
@@ -1,58 +1,59 @@
|
|
|
1
|
-
import{styleText as m}from"node:util";import D,{stdin as Te,stdout as oe}from"node:process";import ke from"node:readline";import"node:tty";import B from"node:fs";import _ from"node:path";import{fileURLToPath as Me}from"node:url";import{promises as Re}from"fs";import Le from"path";function Y(e){return e==null?[]:Array.isArray(e)?e:[e]}function Oe(e,t,r,s){var o,l=e[t],n=~s.string.indexOf(t)?r==null||r===!0?"":String(r):typeof r=="boolean"?r:~s.boolean.indexOf(t)?r==="false"?!1:r==="true"||(e._.push((o=+r,o*0===0?o:r)),!!r):(o=+r,o*0===0?o:r);e[t]=l==null?n:Array.isArray(l)?l.concat(n):[l,n]}function je(e,t){e=e||[],t=t||{};var r,s,o,l,n,a={_:[]},i=0,c=0,d=0,u=e.length;const f=t.alias!==void 0,g=t.unknown!==void 0,p=t.default!==void 0;if(t.alias=t.alias||{},t.string=Y(t.string),t.boolean=Y(t.boolean),f)for(r in t.alias)for(s=t.alias[r]=Y(t.alias[r]),i=0;i<s.length;i++)(t.alias[s[i]]=s.concat(r)).splice(i,1);for(i=t.boolean.length;i-- >0;)for(s=t.alias[t.boolean[i]]||[],c=s.length;c-- >0;)t.boolean.push(s[c]);for(i=t.string.length;i-- >0;)for(s=t.alias[t.string[i]]||[],c=s.length;c-- >0;)t.string.push(s[c]);if(p){for(r in t.default)if(l=typeof t.default[r],s=t.alias[r]=t.alias[r]||[],t[l]!==void 0)for(t[l].push(r),i=0;i<s.length;i++)t[l].push(s[i])}const h=g?Object.keys(t.alias):[];for(i=0;i<u;i++){if(o=e[i],o==="--"){a._=a._.concat(e.slice(++i));break}for(c=0;c<o.length&&o.charCodeAt(c)===45;c++);if(c===0)a._.push(o);else if(o.substring(c,c+3)==="no-"){if(l=o.substring(c+3),g&&!~h.indexOf(l))return t.unknown(o);a[l]=!1}else{for(d=c+1;d<o.length&&o.charCodeAt(d)!==61;d++);for(l=o.substring(c,d),n=o.substring(++d)||i+1===u||(""+e[i+1]).charCodeAt(0)===45||e[++i],s=c===2?[l]:l,d=0;d<s.length;d++){if(l=s[d],g&&!~h.indexOf(l))return t.unknown("-".repeat(c)+l);Oe(a,l,d+1<s.length||n,t)}}}if(p)for(r in t.default)a[r]===void 0&&(a[r]=t.default[r]);if(f)for(r in a)for(s=t.alias[r]||[];s.length>0;)a[s.shift()]=a[r];return a}const We=e=>e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,Ne=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Pe=e=>e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141,Z=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,N=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,P=/\t{1,1000}/y,X=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),V=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Ve=new RegExp("\\p{M}+","gu"),Ue={limit:1/0,ellipsis:""},le=(e,t={},r={})=>{const s=t.limit??1/0,o=t.ellipsis??"",l=t?.ellipsisWidth??(o?le(o,Ue,r).width:0),n=r.ansiWidth??0,a=r.controlWidth??0,i=r.tabWidth??8,c=r.ambiguousWidth??1,d=r.emojiWidth??2,u=r.fullWidthWidth??2,f=r.regularWidth??1,g=r.wideWidth??2;let p=0,h=0,y=e.length,x=0,w=!1,v=y,C=Math.max(0,s-l),E=0,$=0,F=0,b=0;e:for(;;){if($>E||h>=y&&h>p){const R=e.slice(E,$)||e.slice(p,h);x=0;for(const W of R.replaceAll(Ve,"")){const L=W.codePointAt(0)||0;if(Ne(L)?b=u:Pe(L)?b=g:c!==f&&We(L)?b=c:b=f,F+b>C&&(v=Math.min(v,Math.max(E,p)+x)),F+b>s){w=!0;break e}x+=W.length,F+=b}E=$=0}if(h>=y)break;if(V.lastIndex=h,V.test(e)){if(x=V.lastIndex-h,b=x*f,F+b>C&&(v=Math.min(v,h+Math.floor((C-F)/f))),F+b>s){w=!0;break}F+=b,E=p,$=h,h=p=V.lastIndex;continue}if(Z.lastIndex=h,Z.test(e)){if(F+n>C&&(v=Math.min(v,h)),F+n>s){w=!0;break}F+=n,E=p,$=h,h=p=Z.lastIndex;continue}if(N.lastIndex=h,N.test(e)){if(x=N.lastIndex-h,b=x*a,F+b>C&&(v=Math.min(v,h+Math.floor((C-F)/a))),F+b>s){w=!0;break}F+=b,E=p,$=h,h=p=N.lastIndex;continue}if(P.lastIndex=h,P.test(e)){if(x=P.lastIndex-h,b=x*i,F+b>C&&(v=Math.min(v,h+Math.floor((C-F)/i))),F+b>s){w=!0;break}F+=b,E=p,$=h,h=p=P.lastIndex;continue}if(X.lastIndex=h,X.test(e)){if(F+d>C&&(v=Math.min(v,h)),F+d>s){w=!0;break}F+=d,E=p,$=h,h=p=X.lastIndex;continue}h+=1}return{width:w?C:F,index:w?v:y,truncated:w,ellipsed:w&&s>=l}},Ge={limit:1/0,ellipsis:"",ellipsisWidth:0},T=(e,t={})=>le(e,Ge,t).width,U="\x1B",ce="\x9B",Ke=39,Q="\x07",ue="[",ze="]",he="m",ee=`${ze}8;;`,me=new RegExp(`(?:\\${ue}(?<code>\\d+)m|\\${ee}(?<uri>.*)${Q})`,"y"),fe=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},de=e=>`${U}${ue}${e}${he}`,pe=e=>`${U}${ee}${e}${Q}`,te=(e,t,r)=>{const s=t[Symbol.iterator]();let o=!1,l=!1,n=e.at(-1),a=n===void 0?0:T(n),i=s.next(),c=s.next(),d=0;for(;!i.done;){const u=i.value,f=T(u);a+f<=r?e[e.length-1]+=u:(e.push(u),a=0),(u===U||u===ce)&&(o=!0,l=t.startsWith(ee,d+1)),o?l?u===Q&&(o=!1,l=!1):u===he&&(o=!1):(a+=f,a===r&&!c.done&&(e.push(""),a=0)),i=c,c=s.next(),d+=u.length}n=e.at(-1),!a&&n!==void 0&&n.length&&e.length>1&&(e[e.length-2]+=e.pop())},He=e=>{const t=e.split(" ");let r=t.length;for(;r&&!T(t[r-1]);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Je=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let s="",o,l;const n=e.split(" ");let a=[""],i=0;for(let u=0;u<n.length;u++){const f=n[u];if(r.trim!==!1){const p=a.at(-1)??"",h=p.trimStart();p.length!==h.length&&(a[a.length-1]=h,i=T(h))}u!==0&&(i>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),i=0),(i||r.trim===!1)&&(a[a.length-1]+=" ",i++));const g=T(f);if(r.hard&&g>t){const p=t-i,h=1+Math.floor((g-p-1)/t);Math.floor((g-1)/t)<h&&a.push(""),te(a,f,t),i=T(a.at(-1)??"");continue}if(i+g>t&&i&&g){if(r.wordWrap===!1&&i<t){te(a,f,t),i=T(a.at(-1)??"");continue}a.push(""),i=0}if(i+g>t&&r.wordWrap===!1){te(a,f,t),i=T(a.at(-1)??"");continue}a[a.length-1]+=f,i+=g}r.trim!==!1&&(a=a.map(u=>He(u)));const c=a.join(`
|
|
2
|
-
|
|
3
|
-
`){
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`),s=t.split(`
|
|
7
|
-
`),
|
|
8
|
-
`).
|
|
9
|
-
`)
|
|
10
|
-
`),
|
|
11
|
-
`)
|
|
12
|
-
`);this.output.write(
|
|
13
|
-
`).
|
|
14
|
-
`)
|
|
15
|
-
`);
|
|
16
|
-
`);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{styleText as c}from"node:util";import C,{stdin as Tt,stdout as rt}from"node:process";import Ct from"node:readline";import"node:tty";import R from"node:fs";import F from"node:path";import{fileURLToPath as Rt}from"node:url";const At=(()=>{const t=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return e=>{let r=0;for(t.lastIndex=0;t.test(e);)r+=1;return e.length-r}})(),Lt=t=>t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510,kt=t=>t===8987||t===9001||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12771||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=19903||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t>=131072&&t<=196605||t>=196608&&t<=262141,Ot=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Bt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,it=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,Mt=/\t{1,1000}/y,st=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),Nt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Pt=new RegExp("\\p{M}+","gu"),Dt={limit:1/0,ellipsis:""},nt=(t,e={},r={})=>{const i=e.limit??1/0,o=e.ellipsis??"",l=e?.ellipsisWidth??(o?nt(o,Dt,r).width:0),n=0,a=r.controlWidth??0,s=r.tabWidth??8,u=r.emojiWidth??2,m=2,h=r.regularWidth??1,d=r.wideWidth??m,p=[[Nt,h],[Ot,n],[Bt,a],[Mt,s],[st,u],[it,d]];let f=0,g=0,b=t.length,_=0,I=!1,O=b,L=Math.max(0,i-l),w=0,v=0,x=0,y=0;t:for(;;){if(v>w||g>=b&&g>f){const E=t.slice(w,v)||t.slice(f,g);_=0;for(const B of E.replaceAll(Pt,"")){const S=B.codePointAt(0)||0;if(Lt(S)?y=m:kt(S)?y=d:y=h,x+y>L&&(O=Math.min(O,Math.max(w,f)+_)),x+y>i){I=!0;break t}_+=B.length,x+=y}w=v=0}if(g>=b)break t;for(let E=0,B=p.length;E<B;E++){const[S,et]=p[E];if(S.lastIndex=g,S.test(t)){if(_=S===it?At(t.slice(g,S.lastIndex)):S===st?1:S.lastIndex-g,y=_*et,x+y>L&&(O=Math.min(O,g+Math.floor((L-x)/et))),x+y>i){I=!0;break t}x+=y,w=f,v=g,g=f=S.lastIndex;continue t}}g+=1}return{width:I?L:x,index:I?O:b,truncated:I,ellipsed:I&&i>=l}},jt={limit:1/0,ellipsis:"",ellipsisWidth:0},k=(t,e={})=>nt(t,jt,e).width,j="\x1B",at="\x9B",Wt=39,z="\x07",ot="[",Vt="]",lt="m",J=`${Vt}8;;`,ct=new RegExp(`(?:\\${ot}(?<code>\\d+)m|\\${J}(?<uri>.*)${z})`,"y"),ut=t=>{if(t>=30&&t<=37||t>=90&&t<=97)return 39;if(t>=40&&t<=47||t>=100&&t<=107)return 49;if(t===1||t===2)return 22;if(t===3)return 23;if(t===4)return 24;if(t===7)return 27;if(t===8)return 28;if(t===9)return 29;if(t===0)return 0},ht=t=>`${j}${ot}${t}${lt}`,mt=t=>`${j}${J}${t}${z}`,q=(t,e,r)=>{const i=e[Symbol.iterator]();let o=!1,l=!1,n=t.at(-1),a=n===void 0?0:k(n),s=i.next(),u=i.next(),m=0;for(;!s.done;){const h=s.value,d=k(h);a+d<=r?t[t.length-1]+=h:(t.push(h),a=0),(h===j||h===at)&&(o=!0,l=e.startsWith(J,m+1)),o?l?h===z&&(o=!1,l=!1):h===lt&&(o=!1):(a+=d,a===r&&!u.done&&(t.push(""),a=0)),s=u,u=i.next(),m+=h.length}n=t.at(-1),!a&&n!==void 0&&n.length&&t.length>1&&(t[t.length-2]+=t.pop())},Ut=t=>{const e=t.split(" ");let r=e.length;for(;r&&!k(e[r-1]);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Gt=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let i="",o,l;const n=t.split(" ");let a=[""],s=0;for(let h=0;h<n.length;h++){const d=n[h];if(r.trim!==!1){const f=a.at(-1)??"",g=f.trimStart();f.length!==g.length&&(a[a.length-1]=g,s=k(g))}h!==0&&(s>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),s=0),(s||r.trim===!1)&&(a[a.length-1]+=" ",s++));const p=k(d);if(r.hard&&p>e){const f=e-s,g=1+Math.floor((p-f-1)/e);Math.floor((p-1)/e)<g&&a.push(""),q(a,d,e),s=k(a.at(-1)??"");continue}if(s+p>e&&s&&p){if(r.wordWrap===!1&&s<e){q(a,d,e),s=k(a.at(-1)??"");continue}a.push(""),s=0}if(s+p>e&&r.wordWrap===!1){q(a,d,e),s=k(a.at(-1)??"");continue}a[a.length-1]+=d,s+=p}r.trim!==!1&&(a=a.map(h=>Ut(h)));const u=a.join(`
|
|
3
|
+
`);let m=!1;for(let h=0;h<u.length;h++){const d=u[h];if(i+=d,m)m=!1;else if(m=d>="\uD800"&&d<="\uDBFF",m)continue;if(d===j||d===at){ct.lastIndex=h+1;const f=ct.exec(u)?.groups;if(f?.code!==void 0){const g=Number.parseFloat(f.code);o=g===Wt?void 0:g}else f?.uri!==void 0&&(l=f.uri.length===0?void 0:f.uri)}if(u[h+1]===`
|
|
4
|
+
`){l&&(i+=mt(""));const p=o?ut(o):void 0;o&&p&&(i+=ht(p))}else d===`
|
|
5
|
+
`&&(o&&ut(o)&&(i+=ht(o)),l&&(i+=mt(l)))}return i},Kt=/\r?\n/;function W(t,e,r){return String(t).normalize().split(Kt).map(i=>Gt(i,e,r)).join(`
|
|
6
|
+
`)}function Ht(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Y,dt;function zt(){if(dt)return Y;dt=1;const t="\x1B",e=`${t}[`,r="\x07",i={to(n,a){return a?`${e}${a+1};${n+1}H`:`${e}${n+1}G`},move(n,a){let s="";return n<0?s+=`${e}${-n}D`:n>0&&(s+=`${e}${n}C`),a<0?s+=`${e}${-a}A`:a>0&&(s+=`${e}${a}B`),s},up:(n=1)=>`${e}${n}A`,down:(n=1)=>`${e}${n}B`,forward:(n=1)=>`${e}${n}C`,backward:(n=1)=>`${e}${n}D`,nextLine:(n=1)=>`${e}E`.repeat(n),prevLine:(n=1)=>`${e}F`.repeat(n),left:`${e}G`,hide:`${e}?25l`,show:`${e}?25h`,save:`${t}7`,restore:`${t}8`},o={up:(n=1)=>`${e}S`.repeat(n),down:(n=1)=>`${e}T`.repeat(n)},l={screen:`${e}2J`,up:(n=1)=>`${e}1J`.repeat(n),down:(n=1)=>`${e}J`.repeat(n),line:`${e}2K`,lineEnd:`${e}K`,lineStart:`${e}1K`,lines(n){let a="";for(let s=0;s<n;s++)a+=this.line+(s<n-1?i.up():"");return n&&(a+=i.left),a}};return Y={cursor:i,scroll:o,erase:l,beep:r},Y}var A=zt();function V(t,e,r){if(!r.some(n=>!n.disabled))return t;const i=t+e,o=Math.max(r.length-1,0),l=i<0?o:i>o?0:i;return r[l]?.disabled?V(l,e<0?-1:1,r):l}const Jt=["up","down","left","right","space","enter","cancel"],M={actions:new Set(Jt),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),withGuide:!0};function ft(t,e){if(typeof t=="string")return M.aliases.get(t)===e;for(const r of t)if(r!==void 0&&ft(r,e))return!0;return!1}function qt(t,e){if(t===e)return;const r=t.split(`
|
|
7
|
+
`),i=e.split(`
|
|
8
|
+
`),o=Math.max(r.length,i.length),l=[];for(let n=0;n<o;n++)r[n]!==i[n]&&l.push(n);return{lines:l,numLinesBefore:r.length,numLinesAfter:i.length,numLines:o}}globalThis.process.platform.startsWith("win");const X=Symbol("clack:cancel");function U(t){return t===X}function G(t,e){const r=t;r.isTTY&&r.setRawMode(e)}const pt=t=>"columns"in t&&typeof t.columns=="number"?t.columns:80,gt=t=>"rows"in t&&typeof t.rows=="number"?t.rows:20;function Z(t,e,r,i=r,o=r,l){const n=pt(t??rt);return W(e,n-r.length,{hard:!0,trim:!1}).split(`
|
|
9
|
+
`).map((a,s,u)=>{const m=a;return s===0?`${i}${m}`:s===u.length-1?`${o}${m}`:`${r}${m}`}).join(`
|
|
10
|
+
`)}function Yt(t,e){if("~standard"in t){const r=t["~standard"].validate(e);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");return r.issues?.at(0)?.message}return t(e)}class bt{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(e,r=!0){const{input:i=Tt,output:o=rt,render:l,signal:n,...a}=e;this.opts=a,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=l.bind(this),this._track=r,this._abortSignal=n,this.input=i,this.output=o}unsubscribe(){this._subscribers.clear()}setSubscriber(e,r){const i=this._subscribers.get(e)??[];i.push(r),this._subscribers.set(e,i)}on(e,r){this.setSubscriber(e,{cb:r})}once(e,r){this.setSubscriber(e,{cb:r,once:!0})}emit(e,...r){const i=this._subscribers.get(e)??[],o=[];for(const l of i)l.cb(...r),l.once&&o.push(()=>i.splice(i.indexOf(l),1));for(const l of o)l()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(X);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=Ct.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),G(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(A.cursor.show),this.output.off("resize",this.render),G(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(A.cursor.show),this.output.off("resize",this.render),G(this.input,!1),e(X)})})}_isActionKey(e,r){return e===" "}_shouldSubmit(e,r){return!0}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,r){this.userInput=e??"",this.emit("userInput",this.userInput),r&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(e,r){if(this._track&&r.name!=="return"&&(r.name&&this._isActionKey(e,r)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&M.aliases.has(r.name)&&this.emit("cursor",M.aliases.get(r.name)),M.actions.has(r.name)&&this.emit("cursor",r.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),this.emit("key",e,r),r?.name==="return"&&this._shouldSubmit(e,r)){if(this.opts.validate){const i=Yt(this.opts.validate,this.value);i&&(this.error=i instanceof Error?i.message:i,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}ft([e,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
11
|
+
`),G(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const e=W(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
12
|
+
`).length-1;this.output.write(A.cursor.move(-999,e*-1))}render(){const e=W(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(A.cursor.hide);else{const r=qt(this._prevFrame,e),i=gt(this.output);if(this.restoreCursor(),r){const o=Math.max(0,r.numLinesAfter-i),l=Math.max(0,r.numLinesBefore-i);let n=r.lines.find(a=>a>=o);if(n===void 0){this._prevFrame=e;return}if(r.lines.length===1){this.output.write(A.cursor.move(0,n-l)),this.output.write(A.erase.lines(1));const a=e.split(`
|
|
13
|
+
`);this.output.write(a[n]),this._prevFrame=e,this.output.write(A.cursor.move(0,a.length-n-1));return}else if(r.lines.length>1){if(o<l)n=o;else{const s=n-l;s>0&&this.output.write(A.cursor.move(0,s))}this.output.write(A.erase.down());const a=e.split(`
|
|
14
|
+
`).slice(n);this.output.write(a.join(`
|
|
15
|
+
`)),this._prevFrame=e;return}}this.output.write(A.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}}let Xt=class extends bt{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){const e=this._selectedValue;this.value=e===void 0?void 0:e.value}constructor(e){super(e,!1),this.options=e.options;const r=this.options.findIndex(({value:o})=>o===e.initialValue),i=r===-1?0:r;this.cursor=this.options[i]?.disabled?V(i,1,this.options):i,this.changeValue(),this.on("cursor",o=>{switch(o){case"left":case"up":this.cursor=V(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=V(this.cursor,1,this.options);break}this.changeValue()})}};class Zt extends bt{get userInputWithCursor(){if(this.state==="submit")return this.userInput;const e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;const r=e.slice(0,this.cursor),i=e.slice(this.cursor,this.cursor+1),o=e.slice(this.cursor+1);return`${r}${c("inverse",i)}${o}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=e.defaultValue),this.value===void 0&&(this.value="")})}}function Qt(){return C.platform!=="win32"?C.env.TERM!=="linux":!!C.env.CI||!!C.env.WT_SESSION||!!C.env.TERMINUS_SUBLIME||C.env.ConEmuTask==="{cmd::Cmder}"||C.env.TERM_PROGRAM==="Terminus-Sublime"||C.env.TERM_PROGRAM==="vscode"||C.env.TERM==="xterm-256color"||C.env.TERM==="alacritty"||C.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const te=Qt(),T=(t,e)=>te?t:e,ee=T("\u25C6","*"),re=T("\u25A0","x"),ie=T("\u25B2","x"),xt=T("\u25C7","o"),$=T("\u2502","|"),P=T("\u2514","\u2014"),se=T("\u25CF",">"),$t=T("\u25CB"," "),ne=T("\u25CF","\u2022"),ae=T("\u25C6","*"),oe=T("\u25B2","!"),le=T("\u25A0","x"),wt=t=>{switch(t){case"initial":case"active":return c("cyan",ee);case"cancel":return c("red",re);case"error":return c("yellow",ie);case"submit":return c("green",xt)}},ce=t=>{switch(t){case"initial":case"active":return c("cyan",$);case"cancel":return c("red",$);case"error":return c("yellow",$);case"submit":return c("green",$)}};function ue(t,e){const r=[`${e?`${c("cyan",$)} `:""}${t.join(" \u2022 ")}`];return e&&r.push(c("cyan",P)),r}const _t=(t,e,r,i,o,l=!1)=>{let n=e,a=0;if(l)for(let s=i-1;s>=r;s--){const u=t[s];if(u&&(n-=u.length),a++,n<=o)break}else for(let s=r;s<i;s++){const u=t[s];if(u&&(n-=u.length),a++,n<=o)break}return{lineCount:n,removals:a}},he=({cursor:t,options:e,style:r,output:i=process.stdout,maxItems:o=Number.POSITIVE_INFINITY,columnPadding:l=0,rowPadding:n=4})=>{const a=pt(i)-l,s=gt(i),u=c("dim","..."),m=Math.max(s-n,0),h=Math.max(Math.min(o,m),5);let d=0;t>=h-3&&(d=Math.max(Math.min(t-h+3,e.length-h),0));let p=h<e.length&&d>0,f=h<e.length&&d+h<e.length;const g=Math.min(d+h,e.length),b=[];let _=0;p&&_++,f&&_++;const I=d+(p?1:0),O=g-(f?1:0);for(let w=I;w<O;w++){const v=e[w],x=v?r(v,w===t):"",y=W(x,a,{hard:!0,trim:!1}).split(`
|
|
16
|
+
`);b.push(y),_+=y.length}if(_>m){let w=0,v=0,x=_;const y=t-I;let E=m;const B=()=>_t(b,x,0,y,E),S=()=>_t(b,x,y+1,b.length,E,!0);p?({lineCount:x,removals:w}=B(),x>E&&(f||(E-=1),{lineCount:x,removals:v}=S())):(f||(E-=1),{lineCount:x,removals:v}=S(),x>E&&(E-=1,{lineCount:x,removals:w}=B())),w>0&&(p=!0,b.splice(0,w)),v>0&&(f=!0,b.splice(b.length-v,v))}const L=[];p&&L.push(u);for(const w of b)for(const v of w)L.push(v);return f&&L.push(u),L};`${c("dim","\u2191/\u2193")}`,`${c("dim","Space:")}`,`${c("dim","Enter:")}`;const N={message:(t=[],{symbol:e=c("gray",$),secondarySymbol:r=c("gray",$),output:i=process.stdout,spacing:o=1,withGuide:l}={})=>{const n=[],a=l??M.withGuide,s=a?r:"",u=a?`${e} `:"",m=a?`${r} `:"";for(let d=0;d<o;d++)n.push(s);const h=Array.isArray(t)?t:t.split(`
|
|
17
|
+
`);if(h.length>0){const[d,...p]=h;d.length>0?n.push(`${u}${d}`):n.push(a?e:"");for(const f of p)f.length>0?n.push(`${m}${f}`):n.push(a?r:"")}i.write(`${n.join(`
|
|
17
18
|
`)}
|
|
18
|
-
`)},info:(e
|
|
19
|
+
`)},info:(t,e)=>{N.message(t,{...e,symbol:c("blue",ne)})},success:(t,e)=>{N.message(t,{...e,symbol:c("green",ae)})},step:(t,e)=>{N.message(t,{...e,symbol:c("green",xt)})},warn:(t,e)=>{N.message(t,{...e,symbol:c("yellow",oe)})},warning:(t,e)=>{N.warn(t,e)},error:(t,e)=>{N.message(t,{...e,symbol:c("red",le)})}},me=(t="",e)=>{const r=process.stdout,i=`${c("gray",P)} `;r.write(`${i}${c("red",t)}
|
|
19
20
|
|
|
20
|
-
`)},
|
|
21
|
-
${
|
|
21
|
+
`)},de=(t="",e)=>{const r=process.stdout,i=`${c("gray",$)}
|
|
22
|
+
${c("gray",P)} `;r.write(`${i}${t}
|
|
22
23
|
|
|
23
|
-
`)},
|
|
24
|
-
`)?
|
|
25
|
-
`).map(r=>
|
|
26
|
-
`):t
|
|
27
|
-
`:""}${
|
|
28
|
-
`;switch(this.state){case"submit":{const
|
|
29
|
-
${
|
|
30
|
-
`).length,
|
|
31
|
-
|
|
32
|
-
${
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
`)},fe=[`${c("dim","\u2191/\u2193")} to navigate`,`${c("dim","Enter:")} confirm`],K=(t,e)=>t.includes(`
|
|
25
|
+
`)?t.split(`
|
|
26
|
+
`).map(r=>e(r)).join(`
|
|
27
|
+
`):e(t),yt=t=>{const e=(i,o)=>{if(i===void 0)return"";const l=i.label??String(i.value);switch(o){case"disabled":return`${c("gray",$t)} ${K(l,n=>c("gray",n))}${i.hint?` ${c("dim",`(${i.hint??"disabled"})`)}`:""}`;case"selected":return`${K(l,n=>c("dim",n))}`;case"active":return`${c("green",se)} ${l}${i.hint?` ${c("dim",`(${i.hint})`)}`:""}`;case"cancelled":return`${K(l,n=>c(["strikethrough","dim"],n))}`;default:return`${c("dim",$t)} ${K(l,n=>c("dim",n))}`}},r=t.showInstructions??!0;return new Xt({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue,render(){const i=t.withGuide??M.withGuide,o=`${wt(this.state)} `,l=`${ce(this.state)} `,n=Z(t.output,t.message,l,o),a=`${i?`${c("gray",$)}
|
|
28
|
+
`:""}${n}
|
|
29
|
+
`;switch(this.state){case"submit":{const s=i?`${c("gray",$)} `:"",u=Z(t.output,e(this.options[this.cursor],"selected"),s);return`${a}${u}`}case"cancel":{const s=i?`${c("gray",$)} `:"",u=Z(t.output,e(this.options[this.cursor],"cancelled"),s);return`${a}${u}${i?`
|
|
30
|
+
${c("gray",$)}`:""}`}default:{const s=i?`${c("cyan",$)} `:"",u=a.split(`
|
|
31
|
+
`).length,m=r?ue(fe,i):i?[c("cyan",P)]:[],h=m.join(`
|
|
32
|
+
`),d=m.length+1;return`${a}${s}${he({output:t.output,cursor:this.cursor,options:this.options,maxItems:t.maxItems,columnPadding:s.length,rowPadding:u+d,style:(p,f)=>e(p,p.disabled?"disabled":f?"active":"inactive")}).join(`
|
|
33
|
+
${s}`)}
|
|
34
|
+
${h}
|
|
35
|
+
`}}}}).prompt()};`${c("gray",$)}`;const vt=t=>new Zt({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,output:t.output,signal:t.signal,input:t.input,render(){const e=t?.withGuide??M.withGuide,r=`${`${e?`${c("gray",$)}
|
|
36
|
+
`:""}${wt(this.state)} `}${t.message}
|
|
37
|
+
`,i=t.placeholder&&t.placeholder.length>0?c("inverse",t.placeholder[0])+c("dim",t.placeholder.slice(1)):c(["inverse","hidden"],"_"),o=this.userInput?this.userInputWithCursor:i,l=this.value??"";switch(this.state){case"error":{const n=this.error?` ${c("yellow",this.error)}`:"",a=e?`${c("yellow",$)} `:"",s=e?c("yellow",P):"";return`${r.trim()}
|
|
36
38
|
${a}${o}
|
|
37
|
-
${
|
|
38
|
-
`}case"submit":{const n=l?` ${
|
|
39
|
-
${a}`:""}`}default:{const n=
|
|
39
|
+
${s}${n}
|
|
40
|
+
`}case"submit":{const n=l?` ${c("dim",l)}`:"",a=e?c("gray",$):"";return`${r}${a}${n}`}case"cancel":{const n=l?` ${c(["strikethrough","dim"],l)}`:"",a=e?c("gray",$):"";return`${r}${a}${n}${l.trim()?`
|
|
41
|
+
${a}`:""}`}default:{const n=e?`${c("cyan",$)} `:"",a=e?c("cyan",P):"";return`${r}${n}${o}
|
|
40
42
|
${a}
|
|
41
|
-
`}}}}).prompt();function
|
|
42
|
-
`)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
yarn
|
|
47
|
-
|
|
48
|
-
${
|
|
49
|
-
${i} run dev`;break}Ft(h)}var q={exports:{}},Ce;function wt(){if(Ce)return q.exports;Ce=1;let e=process||{},t=e.argv||[],r=e.env||{},s=!(r.NO_COLOR||t.includes("--no-color"))&&(!!r.FORCE_COLOR||t.includes("--color")||e.platform==="win32"||(e.stdout||{}).isTTY&&r.TERM!=="dumb"||!!r.CI),o=(a,i,c=a)=>d=>{let u=""+d,f=u.indexOf(i,a.length);return~f?a+l(u,i,c,f)+i:a+u+i},l=(a,i,c,d)=>{let u="",f=0;do u+=a.substring(f,d)+c,f=d+i.length,d=a.indexOf(i,f);while(~d);return u+a.substring(f)},n=(a=s)=>{let i=a?o:()=>String;return{isColorSupported:a,reset:i("\x1B[0m","\x1B[0m"),bold:i("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:i("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:i("\x1B[3m","\x1B[23m"),underline:i("\x1B[4m","\x1B[24m"),inverse:i("\x1B[7m","\x1B[27m"),hidden:i("\x1B[8m","\x1B[28m"),strikethrough:i("\x1B[9m","\x1B[29m"),black:i("\x1B[30m","\x1B[39m"),red:i("\x1B[31m","\x1B[39m"),green:i("\x1B[32m","\x1B[39m"),yellow:i("\x1B[33m","\x1B[39m"),blue:i("\x1B[34m","\x1B[39m"),magenta:i("\x1B[35m","\x1B[39m"),cyan:i("\x1B[36m","\x1B[39m"),white:i("\x1B[37m","\x1B[39m"),gray:i("\x1B[90m","\x1B[39m"),bgBlack:i("\x1B[40m","\x1B[49m"),bgRed:i("\x1B[41m","\x1B[49m"),bgGreen:i("\x1B[42m","\x1B[49m"),bgYellow:i("\x1B[43m","\x1B[49m"),bgBlue:i("\x1B[44m","\x1B[49m"),bgMagenta:i("\x1B[45m","\x1B[49m"),bgCyan:i("\x1B[46m","\x1B[49m"),bgWhite:i("\x1B[47m","\x1B[49m"),blackBright:i("\x1B[90m","\x1B[39m"),redBright:i("\x1B[91m","\x1B[39m"),greenBright:i("\x1B[92m","\x1B[39m"),yellowBright:i("\x1B[93m","\x1B[39m"),blueBright:i("\x1B[94m","\x1B[39m"),magentaBright:i("\x1B[95m","\x1B[39m"),cyanBright:i("\x1B[96m","\x1B[39m"),whiteBright:i("\x1B[97m","\x1B[39m"),bgBlackBright:i("\x1B[100m","\x1B[49m"),bgRedBright:i("\x1B[101m","\x1B[49m"),bgGreenBright:i("\x1B[102m","\x1B[49m"),bgYellowBright:i("\x1B[103m","\x1B[49m"),bgBlueBright:i("\x1B[104m","\x1B[49m"),bgMagentaBright:i("\x1B[105m","\x1B[49m"),bgCyanBright:i("\x1B[106m","\x1B[49m"),bgWhiteBright:i("\x1B[107m","\x1B[49m")}};return q.exports=n(),q.exports.createColors=n,q.exports}var Be=wt();const vt=Ye(Be),{blue:_e,cyan:At}=vt,Ie=[{name:"vanilla",display:"Vanilla",description:"with playcanvas engine",color:Be.yellow,variants:[{name:"vanilla-ts",display:"TypeScript",color:_e}]},{name:"react",display:"React",description:"with @playcanvas/react",color:At,variants:[{name:"react-ts",display:"TypeScript",color:_e}]}],Ct=Ie.flatMap(e=>e.variants.map(t=>t.name));async function Bt({argTargetDir:e,defaultTargetDir:t,cancel:r}){let s=e?ae(String(e)):void 0;if(!s){const o=await ve({message:"Project name:",defaultValue:t,placeholder:t});z(o)&&r(),s=ae(o)}return s}async function _t({targetDir:e,argOverwrite:t,cancel:r}){if(B.existsSync(e)&&!gt(e)){const s=t?"yes":await ne({message:(e==="."?"Current directory":`Target directory "${e}"`)+" is not empty. Please choose how to proceed:",options:[{label:"Cancel operation",value:"no"},{label:"Remove existing files and continue",value:"yes"},{label:"Ignore files and continue",value:"ignore"}]});if(z(s))return r();switch(s){case"yes":bt(e);break;case"no":r();return}}}function De(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function Se(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}async function It({targetDir:e,cancel:t}){let r=_.basename(_.resolve(e));if(!De(r)){const s=await ve({message:"Package name:",defaultValue:Se(r),placeholder:Se(r),validate(o){if(!o||!De(o))return"Invalid package.json name"}});if(z(s))return t();r=s}return r}async function Dt({argTemplate:e,FRAMEWORKS:t,TEMPLATES:r,pkgInfo:s,getFullCustomCommand:o,cancel:l}){let n=e,a=!1;if(e&&!r.includes(e)&&(n=void 0,a=!0),!n){const i=await ne({message:a?`"${e}" isn't a valid template. Please choose from below: `:"Select a framework:",options:t.map(c=>{const d=c.color;return{label:d(c.display||c.name),value:c,hint:c.description}})});if(z(i))return l();await ne({message:"Select a variant:",options:i.variants.map(c=>{const d=c.color,u=c.customCommand?o(c.customCommand,s).replace(/ TARGET_DIR$/,""):void 0;return{label:d(c.display||c.name),value:c.name,hint:u}})}),n=i.variants[0].name}return n}const j=je(process.argv.slice(2),{alias:{h:"help",t:"template",d:"delete"},boolean:["help","overwrite"],string:["template"]}),St=process.cwd(),Tt=`Usage: npm create playcanvas@latest [OPTION]...
|
|
43
|
+
`}}}}).prompt();function Q(t){return t==null?[]:Array.isArray(t)?t:[t]}function pe(t,e,r,i){var o,l=t[e],n=~i.string.indexOf(e)?r==null||r===!0?"":String(r):typeof r=="boolean"?r:~i.boolean.indexOf(e)?r==="false"?!1:r==="true"||(t._.push((o=+r,o*0===0?o:r)),!!r):(o=+r,o*0===0?o:r);t[e]=l==null?n:Array.isArray(l)?l.concat(n):[l,n]}function ge(t,e){t=t||[],e=e||{};var r,i,o,l,n,a={_:[]},s=0,u=0,m=0,h=t.length;const d=e.alias!==void 0,p=e.unknown!==void 0,f=e.default!==void 0;if(e.alias=e.alias||{},e.string=Q(e.string),e.boolean=Q(e.boolean),d)for(r in e.alias)for(i=e.alias[r]=Q(e.alias[r]),s=0;s<i.length;s++)(e.alias[i[s]]=i.concat(r)).splice(s,1);for(s=e.boolean.length;s-- >0;)for(i=e.alias[e.boolean[s]]||[],u=i.length;u-- >0;)e.boolean.push(i[u]);for(s=e.string.length;s-- >0;)for(i=e.alias[e.string[s]]||[],u=i.length;u-- >0;)e.string.push(i[u]);if(f){for(r in e.default)if(l=typeof e.default[r],i=e.alias[r]=e.alias[r]||[],e[l]!==void 0)for(e[l].push(r),s=0;s<i.length;s++)e[l].push(i[s])}const g=p?Object.keys(e.alias):[];for(s=0;s<h;s++){if(o=t[s],o==="--"){a._=a._.concat(t.slice(++s));break}for(u=0;u<o.length&&o.charCodeAt(u)===45;u++);if(u===0)a._.push(o);else if(o.substring(u,u+3)==="no-"){if(l=o.substring(u+3),p&&!~g.indexOf(l))return e.unknown(o);a[l]=!1}else{for(m=u+1;m<o.length&&o.charCodeAt(m)!==61;m++);for(l=o.substring(u,m),n=o.substring(++m)||s+1===h||(""+t[s+1]).charCodeAt(0)===45||t[++s],i=u===2?[l]:l,m=0;m<i.length;m++){if(l=i[m],p&&!~g.indexOf(l))return e.unknown("-".repeat(u)+l);pe(a,l,m+1<i.length||n,e)}}}if(f)for(r in e.default)a[r]===void 0&&(a[r]=e.default[r]);if(d)for(r in a)for(i=e.alias[r]||[];i.length>0;)a[i.shift()]=a[r];return a}var H={exports:{}},Et;function be(){if(Et)return H.exports;Et=1;let t=process||{},e=t.argv||[],r=t.env||{},i=!(r.NO_COLOR||e.includes("--no-color"))&&(!!r.FORCE_COLOR||e.includes("--color")||t.platform==="win32"||(t.stdout||{}).isTTY&&r.TERM!=="dumb"||!!r.CI),o=(a,s,u=a)=>m=>{let h=""+m,d=h.indexOf(s,a.length);return~d?a+l(h,s,u,d)+s:a+h+s},l=(a,s,u,m)=>{let h="",d=0;do h+=a.substring(d,m)+u,d=m+s.length,m=a.indexOf(s,d);while(~m);return h+a.substring(d)},n=(a=i)=>{let s=a?o:()=>String;return{isColorSupported:a,reset:s("\x1B[0m","\x1B[0m"),bold:s("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:s("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:s("\x1B[3m","\x1B[23m"),underline:s("\x1B[4m","\x1B[24m"),inverse:s("\x1B[7m","\x1B[27m"),hidden:s("\x1B[8m","\x1B[28m"),strikethrough:s("\x1B[9m","\x1B[29m"),black:s("\x1B[30m","\x1B[39m"),red:s("\x1B[31m","\x1B[39m"),green:s("\x1B[32m","\x1B[39m"),yellow:s("\x1B[33m","\x1B[39m"),blue:s("\x1B[34m","\x1B[39m"),magenta:s("\x1B[35m","\x1B[39m"),cyan:s("\x1B[36m","\x1B[39m"),white:s("\x1B[37m","\x1B[39m"),gray:s("\x1B[90m","\x1B[39m"),bgBlack:s("\x1B[40m","\x1B[49m"),bgRed:s("\x1B[41m","\x1B[49m"),bgGreen:s("\x1B[42m","\x1B[49m"),bgYellow:s("\x1B[43m","\x1B[49m"),bgBlue:s("\x1B[44m","\x1B[49m"),bgMagenta:s("\x1B[45m","\x1B[49m"),bgCyan:s("\x1B[46m","\x1B[49m"),bgWhite:s("\x1B[47m","\x1B[49m"),blackBright:s("\x1B[90m","\x1B[39m"),redBright:s("\x1B[91m","\x1B[39m"),greenBright:s("\x1B[92m","\x1B[39m"),yellowBright:s("\x1B[93m","\x1B[39m"),blueBright:s("\x1B[94m","\x1B[39m"),magentaBright:s("\x1B[95m","\x1B[39m"),cyanBright:s("\x1B[96m","\x1B[39m"),whiteBright:s("\x1B[97m","\x1B[39m"),bgBlackBright:s("\x1B[100m","\x1B[49m"),bgRedBright:s("\x1B[101m","\x1B[49m"),bgGreenBright:s("\x1B[102m","\x1B[49m"),bgYellowBright:s("\x1B[103m","\x1B[49m"),bgBlueBright:s("\x1B[104m","\x1B[49m"),bgMagentaBright:s("\x1B[105m","\x1B[49m"),bgCyanBright:s("\x1B[106m","\x1B[49m"),bgWhiteBright:s("\x1B[107m","\x1B[49m")}};return H.exports=n(),H.exports.createColors=n,H.exports}var xe=be();const $e=Ht(xe),{cyan:we,yellow:_e}=$e,St=[{name:"vanilla-ts",display:"Vanilla",description:"with PlayCanvas Engine",color:_e},{name:"react-ts",display:"React",description:"with @playcanvas/react",color:we}],ye=async({argTemplate:t,cancel:e})=>{if(t&&St.some(i=>i.name===t))return t;const r=await yt({message:t?`"${t}" isn't a valid template. Please choose from below: `:"Select a template:",options:St.map(i=>({label:i.color(i.display),value:i.name,hint:i.description}))});return U(r)&&e(),r},It=t=>/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(t),Ft=t=>t.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-"),ve=async({targetDir:t,cancel:e})=>{let r=F.basename(F.resolve(t));if(!It(r)){const i=await vt({message:"Package name:",defaultValue:Ft(r),placeholder:Ft(r),validate:o=>{if(!o||!It(o))return"Invalid package.json name"}});if(U(i))return e();r=i}return r},tt=t=>t.trim().replace(/\/+$/g,""),Ee=t=>{const e=R.readdirSync(t);return e.length===0||e.length===1&&e[0]===".git"},Se=t=>{if(R.existsSync(t))for(const e of R.readdirSync(t))e!==".git"&&R.rmSync(F.resolve(t,e),{recursive:!0,force:!0})},Ie=async({argTargetDir:t,defaultTargetDir:e,cancel:r})=>{let i=t?tt(String(t)):void 0;if(!i){const o=await vt({message:"Project name:",defaultValue:e,placeholder:e});U(o)&&r(),i=tt(o)}return i},Fe=async({targetDir:t,argOverwrite:e,cancel:r})=>{if(R.existsSync(t)&&!Ee(t)){const i=e?"yes":await yt({message:(t==="."?"Current directory":`Target directory "${t}"`)+" is not empty. Please choose how to proceed:",options:[{label:"Cancel operation",value:"no"},{label:"Remove existing files and continue",value:"yes"},{label:"Ignore files and continue",value:"ignore"}]});if(U(i))return r();switch(i){case"yes":Se(t);break;case"no":r();return}}},Te=t=>{const{cwd:e,targetDir:r,template:i,packageName:o,renameFiles:l}=t,n=F.resolve(e,r);R.mkdirSync(n,{recursive:!0});const a=process.env.npm_config_user_agent?.split("/")[0]??"npm";N.step(`Creating project in ${n}...`);const s=Rt(import.meta.url),u=F.dirname(s),m=[F.resolve(u,"../templates",i),F.resolve(u,"../../templates",i)].find(b=>R.existsSync(b));if(!m)throw new Error(`Template directory not found for: ${i}`);const h=(b,_)=>{const I=F.join(n,l[b]??b);_!==void 0?R.writeFileSync(I,_):R.cpSync(F.join(m,b),I,{recursive:!0})},d=R.readdirSync(m);for(const b of d.filter(_=>_!=="package.json"))h(b);const p=JSON.parse(R.readFileSync(F.join(m,"package.json"),"utf-8"));p.name=o,h("package.json",JSON.stringify(p,null,4)+`
|
|
44
|
+
`);let f=`Project created. Now run:
|
|
45
|
+
`;const g=F.isAbsolute(r)?n:F.relative(e,n);switch(n!==e&&(f+=`
|
|
46
|
+
cd ${g.includes(" ")?`"${g}"`:g}`),a){case"yarn":f+=`
|
|
47
|
+
yarn`,f+=`
|
|
48
|
+
yarn dev`;break;default:f+=`
|
|
49
|
+
${a} install`,f+=`
|
|
50
|
+
${a} run dev`;break}de(f)},D=ge(process.argv.slice(2),{alias:{h:"help",t:"template"},boolean:["help","overwrite"],string:["template"]}),Ce=process.cwd(),Re=`Usage: npm create playcanvas@latest [OPTION]...
|
|
50
51
|
|
|
51
|
-
Create a new PlayCanvas project
|
|
52
|
+
Create a new PlayCanvas project with TypeScript.
|
|
52
53
|
With no arguments, start the CLI in interactive mode.
|
|
53
54
|
|
|
54
55
|
Options:
|
|
55
56
|
-t, --template NAME use a specific template
|
|
57
|
+
--overwrite remove existing files from a non-empty target directory
|
|
56
58
|
-h, --help show help
|
|
57
|
-
|
|
58
|
-
`,kt={_gitignore:".gitignore"},Mt="playcanvas-project";async function Rt(){const e=j._[0]?ae(String(j._[0])):void 0,t=j.template,r=j.overwrite;if(j.help){console.log(Tt);return}const s=Lt(process.env.npm_config_user_agent),o=()=>pt("Operation cancelled"),l=await Bt({argTargetDir:e,defaultTargetDir:Mt,cancel:o});await _t({targetDir:l,argOverwrite:r,cancel:o});const n=await It({targetDir:l,cancel:o}),a=await Dt({argTemplate:t,FRAMEWORKS:Ie,TEMPLATES:Ct,pkgInfo:s,getFullCustomCommand:Et,cancel:o});await yt({cwd:St,targetDir:l,template:a,packageName:n,renameFiles:kt,pkgInfo:s})}function Lt(e){if(!e)return;const t=e.split(" ")[0].split("/");return{name:t[0],version:t[1]}}Rt().catch(e=>{console.error(e)});
|
|
59
|
+
`,Ae={_gitignore:".gitignore"},Le="playcanvas-project",ke=async()=>{const t=D._[0]?tt(String(D._[0])):void 0,e=D.template,r=D.overwrite;if(D.help){console.log(Re);return}const i=()=>{me("Operation cancelled"),process.exit(0)},o=await Ie({argTargetDir:t,defaultTargetDir:Le,cancel:i});await Fe({targetDir:o,argOverwrite:r,cancel:i});const l=await ve({targetDir:o,cancel:i}),n=await ye({argTemplate:e,cancel:i});await Te({cwd:Ce,targetDir:o,template:n,packageName:l,renameFiles:Ae})};ke().catch(t=>{console.error(t),process.exitCode=1});
|
package/package.json
CHANGED
|
@@ -1,51 +1,55 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
2
|
+
"name": "create-playcanvas",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Scaffold a PlayCanvas project",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"playcanvas",
|
|
7
|
+
"create",
|
|
8
|
+
"scaffold",
|
|
9
|
+
"template",
|
|
10
|
+
"vite",
|
|
11
|
+
"react",
|
|
12
|
+
"typescript",
|
|
13
|
+
"webgl",
|
|
14
|
+
"webgpu",
|
|
15
|
+
"game",
|
|
16
|
+
"3d"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://github.com/playcanvas/create-playcanvas#readme",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/playcanvas/create-playcanvas.git"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": "PlayCanvas <support@playcanvas.com>",
|
|
25
|
+
"type": "module",
|
|
26
|
+
"bin": {
|
|
27
|
+
"create-playcanvas": "dist/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"templates",
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "unbuild",
|
|
35
|
+
"dev": "unbuild --stub",
|
|
36
|
+
"fmt": "prettier --check .",
|
|
37
|
+
"fmt:fix": "prettier --write .",
|
|
38
|
+
"lint": "eslint .",
|
|
39
|
+
"lint:fix": "eslint . --fix",
|
|
40
|
+
"typecheck": "tsc --noEmit"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@clack/prompts": "^1.7.0",
|
|
44
|
+
"@playcanvas/eslint-config": "3.0.0-beta.8",
|
|
45
|
+
"@types/node": "22.20.1",
|
|
46
|
+
"eslint": "^9.39.5",
|
|
47
|
+
"mri": "^1.2.0",
|
|
48
|
+
"picocolors": "^1.1.1",
|
|
49
|
+
"prettier": "^3.9.6",
|
|
50
|
+
"unbuild": "^3.6.1"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=22.23.2"
|
|
54
|
+
}
|
|
51
55
|
}
|
package/templates/index.ts
CHANGED
|
@@ -1,60 +1,18 @@
|
|
|
1
|
-
import colors
|
|
2
|
-
const { blue, cyan } = colors
|
|
1
|
+
import colors from 'picocolors';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* The framework display name is used to display the framework name in the CLI.
|
|
9
|
-
* The framework description is used to display the framework description in the CLI.
|
|
10
|
-
* The framework color is used to display the framework color in the CLI.
|
|
11
|
-
* The framework variants are used to display the framework variants in the CLI.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
export const FRAMEWORKS: Framework[] = [
|
|
15
|
-
{
|
|
16
|
-
name: 'vanilla',
|
|
17
|
-
display: 'Vanilla',
|
|
18
|
-
description: 'with playcanvas engine',
|
|
19
|
-
color: yellow,
|
|
20
|
-
variants: [
|
|
21
|
-
{
|
|
3
|
+
const { cyan, yellow } = colors;
|
|
4
|
+
|
|
5
|
+
export const TEMPLATES = [
|
|
6
|
+
{
|
|
22
7
|
name: 'vanilla-ts',
|
|
23
|
-
display: '
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
name: 'react',
|
|
30
|
-
display: 'React',
|
|
31
|
-
description: 'with @playcanvas/react',
|
|
32
|
-
color: cyan,
|
|
33
|
-
variants: [
|
|
34
|
-
{
|
|
8
|
+
display: 'Vanilla',
|
|
9
|
+
description: 'with PlayCanvas Engine',
|
|
10
|
+
color: yellow
|
|
11
|
+
},
|
|
12
|
+
{
|
|
35
13
|
name: 'react-ts',
|
|
36
|
-
display: '
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
]
|
|
42
|
-
|
|
43
|
-
export const TEMPLATES = FRAMEWORKS.flatMap((f) => f.variants.map((v) => v.name))
|
|
44
|
-
|
|
45
|
-
export type ColorFunc = (str: string | number) => string
|
|
46
|
-
|
|
47
|
-
export type FrameworkVariant = {
|
|
48
|
-
name: string
|
|
49
|
-
display: string
|
|
50
|
-
color: ColorFunc
|
|
51
|
-
customCommand?: string
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export type Framework = {
|
|
55
|
-
name: string
|
|
56
|
-
display: string
|
|
57
|
-
color: ColorFunc
|
|
58
|
-
description?: string
|
|
59
|
-
variants: FrameworkVariant[]
|
|
60
|
-
}
|
|
14
|
+
display: 'React',
|
|
15
|
+
description: 'with @playcanvas/react',
|
|
16
|
+
color: cyan
|
|
17
|
+
}
|
|
18
|
+
];
|