create-playcanvas 0.2.6 → 0.4.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.
Files changed (103) hide show
  1. package/README.md +51 -47
  2. package/dist/index.mjs +49 -46
  3. package/package.json +54 -49
  4. package/templates/_shared/model-viewer/public/playcanvas-cube.glb +0 -0
  5. package/templates/engine/base/README.md +38 -0
  6. package/templates/engine/base/eslint.config.mjs +3 -0
  7. package/templates/engine/base/package.json +30 -0
  8. package/templates/engine/base/prettier.config.mjs +1 -0
  9. package/templates/engine/base/src/vite-env.d.ts +19 -0
  10. package/templates/engine/base/tsconfig.json +25 -0
  11. package/templates/engine/interactive-sphere/index.html +13 -0
  12. package/templates/engine/interactive-sphere/src/App.ts +180 -0
  13. package/templates/{vanilla-ts → engine/interactive-sphere}/src/main.ts +8 -8
  14. package/templates/engine/interactive-sphere/src/style.css +107 -0
  15. package/templates/engine/interactive-sphere/src/utils.ts +16 -0
  16. package/templates/engine/model-viewer/index.html +13 -0
  17. package/templates/engine/model-viewer/src/main.ts +81 -0
  18. package/templates/engine/model-viewer/src/style.css +8 -0
  19. package/templates/engine/spinning-cube/index.html +13 -0
  20. package/templates/engine/spinning-cube/src/main.ts +65 -0
  21. package/templates/engine/spinning-cube/src/style.css +8 -0
  22. package/templates/engine/splat-viewer/index.html +13 -0
  23. package/templates/engine/splat-viewer/src/main.ts +74 -0
  24. package/templates/engine/splat-viewer/src/style.css +8 -0
  25. package/templates/index.ts +47 -57
  26. package/templates/react/base/README.md +38 -0
  27. package/templates/react/base/eslint.config.mjs +14 -0
  28. package/templates/react/base/package.json +36 -0
  29. package/templates/react/base/prettier.config.mjs +1 -0
  30. package/templates/react/base/src/vite-env.d.ts +19 -0
  31. package/templates/react/base/tsconfig.json +26 -0
  32. package/templates/react/base/vite.config.ts +7 -0
  33. package/templates/react/interactive-sphere/index.html +13 -0
  34. package/templates/react/interactive-sphere/src/App.css +75 -0
  35. package/templates/react/interactive-sphere/src/App.tsx +43 -0
  36. package/templates/react/interactive-sphere/src/Scene.tsx +69 -0
  37. package/templates/react/interactive-sphere/src/index.css +51 -0
  38. package/templates/react/interactive-sphere/src/main.tsx +11 -0
  39. package/templates/react/model-viewer/index.html +13 -0
  40. package/templates/react/model-viewer/src/App.tsx +43 -0
  41. package/templates/react/model-viewer/src/index.css +9 -0
  42. package/templates/react/model-viewer/src/main.tsx +11 -0
  43. package/templates/react/spinning-cube/index.html +13 -0
  44. package/templates/react/spinning-cube/src/App.tsx +36 -0
  45. package/templates/react/spinning-cube/src/index.css +9 -0
  46. package/templates/react/spinning-cube/src/main.tsx +11 -0
  47. package/templates/react/splat-viewer/index.html +13 -0
  48. package/templates/react/splat-viewer/src/App.tsx +39 -0
  49. package/templates/react/splat-viewer/src/index.css +9 -0
  50. package/templates/react/splat-viewer/src/main.tsx +11 -0
  51. package/templates/web-components/base/README.md +66 -0
  52. package/templates/web-components/base/_gitignore +24 -0
  53. package/templates/web-components/base/eslint.config.mjs +3 -0
  54. package/templates/web-components/base/package.json +31 -0
  55. package/templates/web-components/base/prettier.config.mjs +1 -0
  56. package/templates/web-components/base/src/assets/playcanvas.png +0 -0
  57. package/templates/web-components/base/src/vite-env.d.ts +19 -0
  58. package/templates/web-components/base/tsconfig.json +25 -0
  59. package/templates/web-components/interactive-sphere/index.html +53 -0
  60. package/templates/web-components/interactive-sphere/src/assets/typescript.svg +1 -0
  61. package/templates/web-components/interactive-sphere/src/main.ts +76 -0
  62. package/templates/web-components/interactive-sphere/src/style.css +111 -0
  63. package/templates/web-components/model-viewer/index.html +34 -0
  64. package/templates/web-components/model-viewer/src/main.ts +26 -0
  65. package/templates/web-components/model-viewer/src/style.css +8 -0
  66. package/templates/web-components/spinning-cube/index.html +29 -0
  67. package/templates/web-components/spinning-cube/src/main.ts +20 -0
  68. package/templates/web-components/spinning-cube/src/style.css +8 -0
  69. package/templates/web-components/splat-viewer/index.html +31 -0
  70. package/templates/web-components/splat-viewer/src/main.ts +14 -0
  71. package/templates/web-components/splat-viewer/src/style.css +8 -0
  72. package/index.js +0 -3
  73. package/templates/react-ts/README.md +0 -82
  74. package/templates/react-ts/index.html +0 -13
  75. package/templates/react-ts/package.json +0 -29
  76. package/templates/react-ts/scripts/ensure-node-version.cjs +0 -12
  77. package/templates/react-ts/src/App.css +0 -87
  78. package/templates/react-ts/src/App.tsx +0 -46
  79. package/templates/react-ts/src/Scene.tsx +0 -70
  80. package/templates/react-ts/src/index.css +0 -73
  81. package/templates/react-ts/src/main.tsx +0 -10
  82. package/templates/react-ts/src/vite-env.d.ts +0 -1
  83. package/templates/react-ts/tsconfig.app.json +0 -27
  84. package/templates/react-ts/tsconfig.json +0 -7
  85. package/templates/react-ts/tsconfig.node.json +0 -25
  86. package/templates/react-ts/vite.config.ts +0 -7
  87. package/templates/vanilla-ts/README.md +0 -114
  88. package/templates/vanilla-ts/index.html +0 -13
  89. package/templates/vanilla-ts/package.json +0 -23
  90. package/templates/vanilla-ts/public/environment-map.png +0 -0
  91. package/templates/vanilla-ts/scripts/ensure-node-version.cjs +0 -12
  92. package/templates/vanilla-ts/src/App.ts +0 -182
  93. package/templates/vanilla-ts/src/style.css +0 -140
  94. package/templates/vanilla-ts/src/utils.ts +0 -16
  95. package/templates/vanilla-ts/src/vite-env.d.ts +0 -1
  96. package/templates/vanilla-ts/tsconfig.json +0 -25
  97. /package/templates/{react-ts → _shared/interactive-sphere}/public/environment-map.png +0 -0
  98. /package/templates/{react-ts → engine/base}/_gitignore +0 -0
  99. /package/templates/{react-ts → engine/base}/src/assets/playcanvas.png +0 -0
  100. /package/templates/{vanilla-ts → engine/interactive-sphere}/src/assets/typescript.svg +0 -0
  101. /package/templates/{vanilla-ts → react/base}/_gitignore +0 -0
  102. /package/templates/{vanilla-ts → react/base}/src/assets/playcanvas.png +0 -0
  103. /package/templates/{react-ts → react/interactive-sphere}/src/assets/react.svg +0 -0
package/README.md CHANGED
@@ -1,78 +1,82 @@
1
1
  # create-playcanvas
2
2
 
3
3
  [![NPM Version](https://img.shields.io/npm/v/create-playcanvas)](https://www.npmjs.com/package/create-playcanvas)
4
- [![CI](https://github.com/playcanvas/create-playcanvas/actions/workflows/ci.yml/badge.svg)](https://github.com/playcanvas/create-playcanvas/actions/workflows/ci.yml)
4
+ [![NPM Downloads](https://img.shields.io/npm/dw/create-playcanvas)](https://npmtrends.com/create-playcanvas)
5
+ [![License](https://img.shields.io/npm/l/create-playcanvas)](https://github.com/playcanvas/create-playcanvas/blob/main/LICENSE)
6
+ [![Discord](https://img.shields.io/badge/Discord-5865F2?style=flat&logo=discord&logoColor=white&color=black)](https://discord.gg/RSaMRzg)
7
+ [![Reddit](https://img.shields.io/badge/Reddit-FF4500?style=flat&logo=reddit&logoColor=white&color=black)](https://www.reddit.com/r/PlayCanvas)
8
+ [![X](https://img.shields.io/badge/X-000000?style=flat&logo=x&logoColor=white&color=black)](https://x.com/intent/follow?screen_name=playcanvas)
5
9
 
6
- Spin up a ready-to-code [PlayCanvas](https://playcanvas.com/) project in seconds.
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
- ```bash
9
- npm create playcanvas@latest
10
- ```
12
+ Scaffold a Vite-powered PlayCanvas project with TypeScript. Choose the PlayCanvas Engine directly, [`@playcanvas/react`](https://github.com/playcanvas/react) or [`@playcanvas/web-components`](https://github.com/playcanvas/web-components).
11
13
 
12
- Also works with other package managers:
14
+ ## Getting Started
13
15
 
14
16
  ```bash
15
- pnpm create playcanvas
17
+ # npm
18
+ npm create playcanvas@latest
19
+ # pnpm
20
+ pnpm create playcanvas@latest
21
+ # yarn
16
22
  yarn create playcanvas
17
- bun create playcanvas
23
+ # bun
24
+ bun x create-playcanvas@latest
18
25
  ```
19
26
 
20
- The CLI will prompt you for:
27
+ Then follow the prompts. Requires Node.js 22.23.2 or later.
21
28
 
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
29
+ ## Templates
26
30
 
27
- ## Non-interactive Usage
31
+ | Template | Description |
32
+ | ---------------- | -------------------------------------------- |
33
+ | `engine` | The PlayCanvas Engine API directly |
34
+ | `react` | `@playcanvas/react` components |
35
+ | `web-components` | `@playcanvas/web-components` custom elements |
28
36
 
29
- Skip the prompts when scripting or if you know what you want:
37
+ Every template is TypeScript, and includes Vite, ESLint, Prettier and a production build.
30
38
 
31
- ```bash
32
- npm create playcanvas@latest my-game -- -t react-ts --overwrite
33
- ```
39
+ ## Boilerplates
34
40
 
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 |
41
+ Each template offers a choice of starting scene. `spinning-cube` is the default.
40
42
 
41
- ## Templates
43
+ | Boilerplate | Description |
44
+ | -------------------- | ---------------------------------------------- |
45
+ | `spinning-cube` | A rotating cube and a light |
46
+ | `interactive-sphere` | Orbit controls, a grid and pointer picking |
47
+ | `model-viewer` | A glTF model, orbit controls, a procedural sky |
48
+ | `splat-viewer` | A Gaussian splat and orbit controls |
42
49
 
43
- | Template | Description |
44
- | ------------ | -------------------------------------- |
45
- | `vanilla-ts` | Vanilla TypeScript + PlayCanvas Engine |
46
- | `react-ts` | React + TypeScript + PlayCanvas React |
50
+ A template is a `base` directory of shared tooling plus one directory per boilerplate, which is copied over the top. Assets a boilerplate needs in every template live once in `templates/_shared/<boilerplate>` and are seeded in first.
47
51
 
48
- _To add your own template, drop a folder in `templates/<name>` and update `templates/index.js`._
52
+ ## CLI Options
49
53
 
50
- ## Development
51
-
52
- Clone the repo, then:
54
+ Pass a project name, template and boilerplate to skip the prompts:
53
55
 
54
56
  ```bash
55
- npm install
56
- npm run dev # stub build for local development
57
- node index.js # test the CLI locally
57
+ npm create playcanvas@latest my-game -- --template react --boilerplate spinning-cube
58
58
  ```
59
59
 
60
- Or use `npm link` to test as if installed globally:
60
+ | Option | Shorthand | Description |
61
+ | ---------------------- | --------- | ------------------------------------------------------- |
62
+ | `--template <name>` | `-t` | Use a template from the list above |
63
+ | `--boilerplate <name>` | `-b` | Use a boilerplate from the list above |
64
+ | `--overwrite` | | Remove existing files from a non-empty target directory |
65
+ | `--yes` | `-y` | Skip the prompts and take the defaults |
66
+ | `--help` | `-h` | Show command help |
61
67
 
62
- ```bash
63
- npm link
64
- create-playcanvas
65
- ```
68
+ `--yes` takes `playcanvas-project`, the `engine` template and the `spinning-cube` boilerplate for anything you don't pass. It never deletes files, so a non-empty target directory still needs `--overwrite`.
66
69
 
67
- ## Contributing
70
+ ## Development
68
71
 
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.
72
+ ```bash
73
+ npm install
74
+ npm run build
75
+ node dist/index.mjs
76
+ ```
70
77
 
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
78
+ Contributions are welcome. Please open an issue before proposing a new template or another substantial change.
75
79
 
76
80
  ## License
77
81
 
78
- MIT
82
+ [MIT](LICENSE)
package/dist/index.mjs CHANGED
@@ -1,58 +1,61 @@
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
- `);let d=!1;for(let u=0;u<c.length;u++){const f=c[u];if(s+=f,!d)d=f>="\uD800"&&f<="\uDBFF";else continue;if(f===U||f===ce){me.lastIndex=u+1;const p=me.exec(c)?.groups;if(p?.code!==void 0){const h=Number.parseFloat(p.code);o=h===Ke?void 0:h}else p?.uri!==void 0&&(l=p.uri.length===0?void 0:p.uri)}if(c[u+1]===`
3
- `){l&&(s+=pe(""));const g=o?fe(o):void 0;o&&g&&(s+=de(g))}else f===`
4
- `&&(o&&fe(o)&&(s+=de(o)),l&&(s+=pe(l)))}return s},qe=/\r?\n/;function G(e,t,r){return String(e).normalize().split(qe).map(s=>Je(s,t,r)).join(`
5
- `)}function Ye(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var re,Fe;function Ze(){if(Fe)return re;Fe=1;const e="\x1B",t=`${e}[`,r="\x07",s={to(n,a){return a?`${t}${a+1};${n+1}H`:`${t}${n+1}G`},move(n,a){let i="";return n<0?i+=`${t}${-n}D`:n>0&&(i+=`${t}${n}C`),a<0?i+=`${t}${-a}A`:a>0&&(i+=`${t}${a}B`),i},up:(n=1)=>`${t}${n}A`,down:(n=1)=>`${t}${n}B`,forward:(n=1)=>`${t}${n}C`,backward:(n=1)=>`${t}${n}D`,nextLine:(n=1)=>`${t}E`.repeat(n),prevLine:(n=1)=>`${t}F`.repeat(n),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${e}7`,restore:`${e}8`},o={up:(n=1)=>`${t}S`.repeat(n),down:(n=1)=>`${t}T`.repeat(n)},l={screen:`${t}2J`,up:(n=1)=>`${t}1J`.repeat(n),down:(n=1)=>`${t}J`.repeat(n),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(n){let a="";for(let i=0;i<n;i++)a+=this.line+(i<n-1?s.up():"");return n&&(a+=s.left),a}};return re={cursor:s,scroll:o,erase:l,beep:r},re}var S=Ze();function K(e,t,r){if(!r.some(n=>!n.disabled))return e;const s=e+t,o=Math.max(r.length-1,0),l=s<0?o:s>o?0:s;return r[l].disabled?K(l,t<0?-1:1,r):l}const Xe=["up","down","left","right","space","enter","cancel"],k={actions:new Set(Xe),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),withGuide:!0};function ge(e,t){if(typeof e=="string")return k.aliases.get(e)===t;for(const r of e)if(r!==void 0&&ge(r,t))return!0;return!1}function Qe(e,t){if(e===t)return;const r=e.split(`
1
+ #!/usr/bin/env node
2
+ import{styleText as c}from"node:util";import k,{stdin as Ce,stdout as ae}from"node:process";import Re from"node:readline";import"node:tty";import I from"node:fs";import _ from"node:path";import{fileURLToPath as Ae}from"node:url";const ke=(()=>{const e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let r=0;for(e.lastIndex=0;e.test(t);)r+=1;return t.length-r}})(),Be=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Le=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||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>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,Oe=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Me=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,oe=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,Ne=/\t{1,1000}/y,le=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"),Pe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,je=new RegExp("\\p{M}+","gu"),De={limit:1/0,ellipsis:""},ce=(e,t={},r={})=>{const s=t.limit??1/0,a=t.ellipsis??"",l=t?.ellipsisWidth??(a?ce(a,De,r).width:0),o=0,n=r.controlWidth??0,i=r.tabWidth??8,u=r.emojiWidth??2,m=2,h=r.regularWidth??1,d=r.wideWidth??m,f=[[Pe,h],[Oe,o],[Me,n],[Ne,i],[le,u],[oe,d]];let p=0,g=0,b=e.length,E=0,w=!1,C=b,R=Math.max(0,s-l),y=0,S=0,x=0,v=0;e:for(;;){if(S>y||g>=b&&g>p){const F=e.slice(y,S)||e.slice(p,g);E=0;for(const O of F.replaceAll(je,"")){const T=O.codePointAt(0)||0;if(Be(T)?v=m:Le(T)?v=d:v=h,x+v>R&&(C=Math.min(C,Math.max(y,p)+E)),x+v>s){w=!0;break e}E+=O.length,x+=v}y=S=0}if(g>=b)break e;for(let F=0,O=f.length;F<O;F++){const[T,ne]=f[F];if(T.lastIndex=g,T.test(e)){if(E=T===oe?ke(e.slice(g,T.lastIndex)):T===le?1:T.lastIndex-g,v=E*ne,x+v>R&&(C=Math.min(C,g+Math.floor((R-x)/ne))),x+v>s){w=!0;break e}x+=v,y=p,S=g,g=p=T.lastIndex;continue e}}g+=1}return{width:w?R:x,index:w?C:b,truncated:w,ellipsed:w&&s>=l}},We={limit:1/0,ellipsis:"",ellipsisWidth:0},L=(e,t={})=>ce(e,We,t).width,V="\x1B",ue="\x9B",Ve=39,Y="\x07",he="[",Ue="]",me="m",q=`${Ue}8;;`,de=new RegExp(`(?:\\${he}(?<code>\\d+)m|\\${q}(?<uri>.*)${Y})`,"y"),pe=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},fe=e=>`${V}${he}${e}${me}`,ge=e=>`${V}${q}${e}${Y}`,X=(e,t,r)=>{const s=t[Symbol.iterator]();let a=!1,l=!1,o=e.at(-1),n=o===void 0?0:L(o),i=s.next(),u=s.next(),m=0;for(;!i.done;){const h=i.value,d=L(h);n+d<=r?e[e.length-1]+=h:(e.push(h),n=0),(h===V||h===ue)&&(a=!0,l=t.startsWith(q,m+1)),a?l?h===Y&&(a=!1,l=!1):h===me&&(a=!1):(n+=d,n===r&&!u.done&&(e.push(""),n=0)),i=u,u=s.next(),m+=h.length}o=e.at(-1),!n&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ge=e=>{const t=e.split(" ");let r=t.length;for(;r&&!L(t[r-1]);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Ke=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let s="",a,l;const o=e.split(" ");let n=[""],i=0;for(let h=0;h<o.length;h++){const d=o[h];if(r.trim!==!1){const p=n.at(-1)??"",g=p.trimStart();p.length!==g.length&&(n[n.length-1]=g,i=L(g))}h!==0&&(i>=t&&(r.wordWrap===!1||r.trim===!1)&&(n.push(""),i=0),(i||r.trim===!1)&&(n[n.length-1]+=" ",i++));const f=L(d);if(r.hard&&f>t){const p=t-i,g=1+Math.floor((f-p-1)/t);Math.floor((f-1)/t)<g&&n.push(""),X(n,d,t),i=L(n.at(-1)??"");continue}if(i+f>t&&i&&f){if(r.wordWrap===!1&&i<t){X(n,d,t),i=L(n.at(-1)??"");continue}n.push(""),i=0}if(i+f>t&&r.wordWrap===!1){X(n,d,t),i=L(n.at(-1)??"");continue}n[n.length-1]+=d,i+=f}r.trim!==!1&&(n=n.map(h=>Ge(h)));const u=n.join(`
3
+ `);let m=!1;for(let h=0;h<u.length;h++){const d=u[h];if(s+=d,m)m=!1;else if(m=d>="\uD800"&&d<="\uDBFF",m)continue;if(d===V||d===ue){de.lastIndex=h+1;const p=de.exec(u)?.groups;if(p?.code!==void 0){const g=Number.parseFloat(p.code);a=g===Ve?void 0:g}else p?.uri!==void 0&&(l=p.uri.length===0?void 0:p.uri)}if(u[h+1]===`
4
+ `){l&&(s+=ge(""));const f=a?pe(a):void 0;a&&f&&(s+=fe(f))}else d===`
5
+ `&&(a&&pe(a)&&(s+=fe(a)),l&&(s+=ge(l)))}return s},He=/\r?\n/;function U(e,t,r){return String(e).normalize().split(He).map(s=>Ke(s,t,r)).join(`
6
+ `)}function ze(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z,be;function Je(){if(be)return Z;be=1;const e="\x1B",t=`${e}[`,r="\x07",s={to(o,n){return n?`${t}${n+1};${o+1}H`:`${t}${o+1}G`},move(o,n){let i="";return o<0?i+=`${t}${-o}D`:o>0&&(i+=`${t}${o}C`),n<0?i+=`${t}${-n}A`:n>0&&(i+=`${t}${n}B`),i},up:(o=1)=>`${t}${o}A`,down:(o=1)=>`${t}${o}B`,forward:(o=1)=>`${t}${o}C`,backward:(o=1)=>`${t}${o}D`,nextLine:(o=1)=>`${t}E`.repeat(o),prevLine:(o=1)=>`${t}F`.repeat(o),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${e}7`,restore:`${e}8`},a={up:(o=1)=>`${t}S`.repeat(o),down:(o=1)=>`${t}T`.repeat(o)},l={screen:`${t}2J`,up:(o=1)=>`${t}1J`.repeat(o),down:(o=1)=>`${t}J`.repeat(o),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(o){let n="";for(let i=0;i<o;i++)n+=this.line+(i<o-1?s.up():"");return o&&(n+=s.left),n}};return Z={cursor:s,scroll:a,erase:l,beep:r},Z}var B=Je();function G(e,t,r){if(!r.some(o=>!o.disabled))return e;const s=e+t,a=Math.max(r.length-1,0),l=s<0?a:s>a?0:s;return r[l]?.disabled?G(l,t<0?-1:1,r):l}const Ye=["up","down","left","right","space","enter","cancel"],M={actions:new Set(Ye),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),withGuide:!0};function xe(e,t){if(typeof e=="string")return M.aliases.get(e)===t;for(const r of e)if(r!==void 0&&xe(r,t))return!0;return!1}function qe(e,t){if(e===t)return;const r=e.split(`
6
7
  `),s=t.split(`
7
- `),o=Math.max(r.length,s.length),l=[];for(let n=0;n<o;n++)r[n]!==s[n]&&l.push(n);return{lines:l,numLinesBefore:r.length,numLinesAfter:s.length,numLines:o}}globalThis.process.platform.startsWith("win");const ie=Symbol("clack:cancel");function z(e){return e===ie}function H(e,t){const r=e;r.isTTY&&r.setRawMode(t)}const be=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,xe=e=>"rows"in e&&typeof e.rows=="number"?e.rows:20;function se(e,t,r,s=r){const o=be(e??oe);return G(t,o-r.length,{hard:!0,trim:!1}).split(`
8
- `).map((l,n)=>`${n===0?s:r}${l}`).join(`
9
- `)}let Ee=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(e,t=!0){const{input:r=Te,output:s=oe,render:o,signal:l,...n}=e;this.opts=n,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=o.bind(this),this._track=t,this._abortSignal=l,this.input=r,this.output=s}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){const r=this._subscribers.get(e)??[];r.push(t),this._subscribers.set(e,r)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){const r=this._subscribers.get(e)??[],s=[];for(const o of r)o.cb(...t),o.once&&s.push(()=>r.splice(r.indexOf(o),1));for(const o of s)o()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(ie);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=ke.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),H(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(S.cursor.show),this.output.off("resize",this.render),H(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(S.cursor.show),this.output.off("resize",this.render),H(this.input,!1),e(ie)})})}_isActionKey(e,t){return e===" "}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,t){this.userInput=e??"",this.emit("userInput",this.userInput),t&&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,t){if(this._track&&t.name!=="return"&&(t.name&&this._isActionKey(e,t)&&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"),t?.name&&(!this._track&&k.aliases.has(t.name)&&this.emit("cursor",k.aliases.get(t.name)),k.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),this.emit("key",e?.toLowerCase(),t),t?.name==="return"){if(this.opts.validate){const r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}ge([e,t?.name,t?.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(`
10
- `),H(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const e=G(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
11
- `).length-1;this.output.write(S.cursor.move(-999,e*-1))}render(){const e=G(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(S.cursor.hide);else{const t=Qe(this._prevFrame,e),r=xe(this.output);if(this.restoreCursor(),t){const s=Math.max(0,t.numLinesAfter-r),o=Math.max(0,t.numLinesBefore-r);let l=t.lines.find(n=>n>=s);if(l===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(S.cursor.move(0,l-o)),this.output.write(S.erase.lines(1));const n=e.split(`
12
- `);this.output.write(n[l]),this._prevFrame=e,this.output.write(S.cursor.move(0,n.length-l-1));return}else if(t.lines.length>1){if(s<o)l=s;else{const a=l-o;a>0&&this.output.write(S.cursor.move(0,a))}this.output.write(S.erase.down());const n=e.split(`
13
- `).slice(l);this.output.write(n.join(`
14
- `)),this._prevFrame=e;return}}this.output.write(S.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};class et extends Ee{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(t){super(t,!1),this.options=t.options;const r=this.options.findIndex(({value:o})=>o===t.initialValue),s=r===-1?0:r;this.cursor=this.options[s].disabled?K(s,1,this.options):s,this.changeValue(),this.on("cursor",o=>{switch(o){case"left":case"up":this.cursor=K(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=K(this.cursor,1,this.options);break}this.changeValue()})}}class tt extends Ee{get userInputWithCursor(){if(this.state==="submit")return this.userInput;const t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;const r=t.slice(0,this.cursor),[s,...o]=t.slice(this.cursor);return`${r}${m("inverse",s)}${o.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}}function rt(){return D.platform!=="win32"?D.env.TERM!=="linux":!!D.env.CI||!!D.env.WT_SESSION||!!D.env.TERMINUS_SUBLIME||D.env.ConEmuTask==="{cmd::Cmder}"||D.env.TERM_PROGRAM==="Terminus-Sublime"||D.env.TERM_PROGRAM==="vscode"||D.env.TERM==="xterm-256color"||D.env.TERM==="alacritty"||D.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const it=rt(),I=(e,t)=>it?e:t,st=I("\u25C6","*"),nt=I("\u25A0","x"),at=I("\u25B2","x"),$e=I("\u25C7","o"),A=I("\u2502","|"),O=I("\u2514","\u2014"),ot=I("\u25CF",">"),ye=I("\u25CB"," "),lt=I("\u25CF","\u2022"),ct=I("\u25C6","*"),ut=I("\u25B2","!"),ht=I("\u25A0","x"),we=e=>{switch(e){case"initial":case"active":return m("cyan",st);case"cancel":return m("red",nt);case"error":return m("yellow",at);case"submit":return m("green",$e)}},mt=e=>{switch(e){case"initial":case"active":return m("cyan",A);case"cancel":return m("red",A);case"error":return m("yellow",A);case"submit":return m("green",A)}},ft=(e,t,r,s,o)=>{let l=t,n=0;for(let a=r;a<s;a++){const i=e[a];if(l=l-i.length,n++,l<=o)break}return{lineCount:l,removals:n}},dt=({cursor:e,options:t,style:r,output:s=process.stdout,maxItems:o=Number.POSITIVE_INFINITY,columnPadding:l=0,rowPadding:n=4})=>{const a=be(s)-l,i=xe(s),c=m("dim","..."),d=Math.max(i-n,0),u=Math.max(Math.min(o,d),5);let f=0;e>=u-3&&(f=Math.max(Math.min(e-u+3,t.length-u),0));let g=u<t.length&&f>0,p=u<t.length&&f+u<t.length;const h=Math.min(f+u,t.length),y=[];let x=0;g&&x++,p&&x++;const w=f+(g?1:0),v=h-(p?1:0);for(let E=w;E<v;E++){const $=G(r(t[E],E===e),a,{hard:!0,trim:!1}).split(`
15
- `);y.push($),x+=$.length}if(x>d){let E=0,$=0,F=x;const b=e-w,R=(W,L)=>ft(y,F,W,L,d);g?({lineCount:F,removals:E}=R(0,b),F>d&&({lineCount:F,removals:$}=R(b+1,y.length))):({lineCount:F,removals:$}=R(b+1,y.length),F>d&&({lineCount:F,removals:E}=R(0,b))),E>0&&(g=!0,y.splice(0,E)),$>0&&(p=!0,y.splice(y.length-$,$))}const C=[];g&&C.push(c);for(const E of y)for(const $ of E)C.push($);return p&&C.push(c),C},M={message:(e=[],{symbol:t=m("gray",A),secondarySymbol:r=m("gray",A),output:s=process.stdout,spacing:o=1,withGuide:l}={})=>{const n=[],a=l??k.withGuide,i=a?r:"",c=a?`${t} `:"",d=a?`${r} `:"";for(let f=0;f<o;f++)n.push(i);const u=Array.isArray(e)?e:e.split(`
16
- `);if(u.length>0){const[f,...g]=u;f.length>0?n.push(`${c}${f}`):n.push(a?t:"");for(const p of g)p.length>0?n.push(`${d}${p}`):n.push(a?r:"")}s.write(`${n.join(`
8
+ `),a=Math.max(r.length,s.length),l=[];for(let o=0;o<a;o++)r[o]!==s[o]&&l.push(o);return{lines:l,numLinesBefore:r.length,numLinesAfter:s.length,numLines:a}}globalThis.process.platform.startsWith("win");const Q=Symbol("clack:cancel");function D(e){return e===Q}function K(e,t){const r=e;r.isTTY&&r.setRawMode(t)}const $e=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,ye=e=>"rows"in e&&typeof e.rows=="number"?e.rows:20;function ee(e,t,r,s=r,a=r,l){const o=$e(e??ae);return U(t,o-r.length,{hard:!0,trim:!1}).split(`
9
+ `).map((n,i,u)=>{const m=n;return i===0?`${s}${m}`:i===u.length-1?`${a}${m}`:`${r}${m}`}).join(`
10
+ `)}function Xe(e,t){if("~standard"in e){const r=e["~standard"].validate(t);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 e(t)}class we{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(t,r=!0){const{input:s=Ce,output:a=ae,render:l,signal:o,...n}=t;this.opts=n,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=o,this.input=s,this.output=a}unsubscribe(){this._subscribers.clear()}setSubscriber(t,r){const s=this._subscribers.get(t)??[];s.push(r),this._subscribers.set(t,s)}on(t,r){this.setSubscriber(t,{cb:r})}once(t,r){this.setSubscriber(t,{cb:r,once:!0})}emit(t,...r){const s=this._subscribers.get(t)??[],a=[];for(const l of s)l.cb(...r),l.once&&a.push(()=>s.splice(s.indexOf(l),1));for(const l of a)l()}prompt(){return new Promise(t=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(Q);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=Re.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),K(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(B.cursor.show),this.output.off("resize",this.render),K(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(B.cursor.show),this.output.off("resize",this.render),K(this.input,!1),t(Q)})})}_isActionKey(t,r){return t===" "}_shouldSubmit(t,r){return!0}_setValue(t){this.value=t,this.emit("value",this.value)}_setUserInput(t,r){this.userInput=t??"",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(t,r){if(this._track&&r.name!=="return"&&(r.name&&this._isActionKey(t,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)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),this.emit("key",t,r),r?.name==="return"&&this._shouldSubmit(t,r)){if(this.opts.validate){const s=Xe(this.opts.validate,this.value);s&&(this.error=s instanceof Error?s.message:s,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}xe([t,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
+ `),K(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=U(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
12
+ `).length-1;this.output.write(B.cursor.move(-999,t*-1))}render(){const t=U(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(B.cursor.hide);else{const r=qe(this._prevFrame,t),s=ye(this.output);if(this.restoreCursor(),r){const a=Math.max(0,r.numLinesAfter-s),l=Math.max(0,r.numLinesBefore-s);let o=r.lines.find(n=>n>=a);if(o===void 0){this._prevFrame=t;return}if(r.lines.length===1){this.output.write(B.cursor.move(0,o-l)),this.output.write(B.erase.lines(1));const n=t.split(`
13
+ `);this.output.write(n[o]),this._prevFrame=t,this.output.write(B.cursor.move(0,n.length-o-1));return}else if(r.lines.length>1){if(a<l)o=a;else{const i=o-l;i>0&&this.output.write(B.cursor.move(0,i))}this.output.write(B.erase.down());const n=t.split(`
14
+ `).slice(o);this.output.write(n.join(`
15
+ `)),this._prevFrame=t;return}}this.output.write(B.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}let Ze=class extends we{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){const t=this._selectedValue;this.value=t===void 0?void 0:t.value}constructor(t){super(t,!1),this.options=t.options;const r=this.options.findIndex(({value:a})=>a===t.initialValue),s=r===-1?0:r;this.cursor=this.options[s]?.disabled?G(s,1,this.options):s,this.changeValue(),this.on("cursor",a=>{switch(a){case"left":case"up":this.cursor=G(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=G(this.cursor,1,this.options);break}this.changeValue()})}},Qe=class extends we{get userInputWithCursor(){if(this.state==="submit")return this.userInput;const t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;const r=t.slice(0,this.cursor),s=t.slice(this.cursor,this.cursor+1),a=t.slice(this.cursor+1);return`${r}${c("inverse",s)}${a}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}};function et(){return k.platform!=="win32"?k.env.TERM!=="linux":!!k.env.CI||!!k.env.WT_SESSION||!!k.env.TERMINUS_SUBLIME||k.env.ConEmuTask==="{cmd::Cmder}"||k.env.TERM_PROGRAM==="Terminus-Sublime"||k.env.TERM_PROGRAM==="vscode"||k.env.TERM==="xterm-256color"||k.env.TERM==="alacritty"||k.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const tt=et(),A=(e,t)=>tt?e:t,rt=A("\u25C6","*"),it=A("\u25A0","x"),st=A("\u25B2","x"),ve=A("\u25C7","o"),$=A("\u2502","|"),j=A("\u2514","\u2014"),nt=A("\u25CF",">"),_e=A("\u25CB"," "),at=A("\u25CF","\u2022"),ot=A("\u25C6","*"),lt=A("\u25B2","!"),ct=A("\u25A0","x"),Ee=e=>{switch(e){case"initial":case"active":return c("cyan",rt);case"cancel":return c("red",it);case"error":return c("yellow",st);case"submit":return c("green",ve)}},ut=e=>{switch(e){case"initial":case"active":return c("cyan",$);case"cancel":return c("red",$);case"error":return c("yellow",$);case"submit":return c("green",$)}};function ht(e,t){const r=[`${t?`${c("cyan",$)} `:""}${e.join(" \u2022 ")}`];return t&&r.push(c("cyan",j)),r}const Se=(e,t,r,s,a,l=!1)=>{let o=t,n=0;if(l)for(let i=s-1;i>=r;i--){const u=e[i];if(u&&(o-=u.length),n++,o<=a)break}else for(let i=r;i<s;i++){const u=e[i];if(u&&(o-=u.length),n++,o<=a)break}return{lineCount:o,removals:n}},mt=({cursor:e,options:t,style:r,output:s=process.stdout,maxItems:a=Number.POSITIVE_INFINITY,columnPadding:l=0,rowPadding:o=4})=>{const n=$e(s)-l,i=ye(s),u=c("dim","..."),m=Math.max(i-o,0),h=Math.max(Math.min(a,m),5);let d=0;e>=h-3&&(d=Math.max(Math.min(e-h+3,t.length-h),0));let f=h<t.length&&d>0,p=h<t.length&&d+h<t.length;const g=Math.min(d+h,t.length),b=[];let E=0;f&&E++,p&&E++;const w=d+(f?1:0),C=g-(p?1:0);for(let y=w;y<C;y++){const S=t[y],x=S?r(S,y===e):"",v=U(x,n,{hard:!0,trim:!1}).split(`
16
+ `);b.push(v),E+=v.length}if(E>m){let y=0,S=0,x=E;const v=e-w;let F=m;const O=()=>Se(b,x,0,v,F),T=()=>Se(b,x,v+1,b.length,F,!0);f?({lineCount:x,removals:y}=O(),x>F&&(p||(F-=1),{lineCount:x,removals:S}=T())):(p||(F-=1),{lineCount:x,removals:S}=T(),x>F&&(F-=1,{lineCount:x,removals:y}=O())),y>0&&(f=!0,b.splice(0,y)),S>0&&(p=!0,b.splice(b.length-S,S))}const R=[];f&&R.push(u);for(const y of b)for(const S of y)R.push(S);return p&&R.push(u),R};`${c("dim","\u2191/\u2193")}`,`${c("dim","Space:")}`,`${c("dim","Enter:")}`;const N={message:(e=[],{symbol:t=c("gray",$),secondarySymbol:r=c("gray",$),output:s=process.stdout,spacing:a=1,withGuide:l}={})=>{const o=[],n=l??M.withGuide,i=n?r:"",u=n?`${t} `:"",m=n?`${r} `:"";for(let d=0;d<a;d++)o.push(i);const h=Array.isArray(e)?e:e.split(`
17
+ `);if(h.length>0){const[d,...f]=h;d.length>0?o.push(`${u}${d}`):o.push(n?t:"");for(const p of f)p.length>0?o.push(`${m}${p}`):o.push(n?r:"")}s.write(`${o.join(`
17
18
  `)}
18
- `)},info:(e,t)=>{M.message(e,{...t,symbol:m("blue",lt)})},success:(e,t)=>{M.message(e,{...t,symbol:m("green",ct)})},step:(e,t)=>{M.message(e,{...t,symbol:m("green",$e)})},warn:(e,t)=>{M.message(e,{...t,symbol:m("yellow",ut)})},warning:(e,t)=>{M.warn(e,t)},error:(e,t)=>{M.message(e,{...t,symbol:m("red",ht)})}},pt=(e="",t)=>{const r=process.stdout,s=`${m("gray",O)} `;r.write(`${s}${m("red",e)}
19
+ `)},info:(e,t)=>{N.message(e,{...t,symbol:c("blue",at)})},success:(e,t)=>{N.message(e,{...t,symbol:c("green",ot)})},step:(e,t)=>{N.message(e,{...t,symbol:c("green",ve)})},warn:(e,t)=>{N.message(e,{...t,symbol:c("yellow",lt)})},warning:(e,t)=>{N.warn(e,t)},error:(e,t)=>{N.message(e,{...t,symbol:c("red",ct)})}},dt=(e="",t)=>{const r=process.stdout,s=`${c("gray",j)} `;r.write(`${s}${c("red",e)}
19
20
 
20
- `)},Ft=(e="",t)=>{const r=process.stdout,s=`${m("gray",A)}
21
- ${m("gray",O)} `;r.write(`${s}${e}
21
+ `)},pt=(e="",t)=>{const r=process.stdout,s=`${c("gray",$)}
22
+ ${c("gray",j)} `;r.write(`${s}${e}
22
23
 
23
- `)},J=(e,t)=>e.includes(`
24
+ `)},ft=[`${c("dim","\u2191/\u2193")} to navigate`,`${c("dim","Enter:")} confirm`],H=(e,t)=>e.includes(`
24
25
  `)?e.split(`
25
26
  `).map(r=>t(r)).join(`
26
- `):t(e),ne=e=>{const t=(r,s)=>{const o=r.label??String(r.value);switch(s){case"disabled":return`${m("gray",ye)} ${J(o,l=>m("gray",l))}${r.hint?` ${m("dim",`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${J(o,l=>m("dim",l))}`;case"active":return`${m("green",ot)} ${o}${r.hint?` ${m("dim",`(${r.hint})`)}`:""}`;case"cancelled":return`${J(o,l=>m(["strikethrough","dim"],l))}`;default:return`${m("dim",ye)} ${J(o,l=>m("dim",l))}`}};return new et({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){const r=e.withGuide??k.withGuide,s=`${we(this.state)} `,o=`${mt(this.state)} `,l=se(e.output,e.message,o,s),n=`${r?`${m("gray",A)}
27
- `:""}${l}
28
- `;switch(this.state){case"submit":{const a=r?`${m("gray",A)} `:"",i=se(e.output,t(this.options[this.cursor],"selected"),a);return`${n}${i}`}case"cancel":{const a=r?`${m("gray",A)} `:"",i=se(e.output,t(this.options[this.cursor],"cancelled"),a);return`${n}${i}${r?`
29
- ${m("gray",A)}`:""}`}default:{const a=r?`${m("cyan",A)} `:"",i=r?m("cyan",O):"",c=n.split(`
30
- `).length,d=r?2:1;return`${n}${a}${dt({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:a.length,rowPadding:c+d,style:(u,f)=>t(u,u.disabled?"disabled":f?"active":"inactive")}).join(`
31
- ${a}`)}
32
- ${i}
33
- `}}}}).prompt()};`${m("gray",A)}`;const ve=e=>new tt({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){const t=e?.withGuide??k.withGuide,r=`${`${t?`${m("gray",A)}
34
- `:""}${we(this.state)} `}${e.message}
35
- `,s=e.placeholder?m("inverse",e.placeholder[0])+m("dim",e.placeholder.slice(1)):m(["inverse","hidden"],"_"),o=this.userInput?this.userInputWithCursor:s,l=this.value??"";switch(this.state){case"error":{const n=this.error?` ${m("yellow",this.error)}`:"",a=t?`${m("yellow",A)} `:"",i=t?m("yellow",O):"";return`${r.trim()}
36
- ${a}${o}
37
- ${i}${n}
38
- `}case"submit":{const n=l?` ${m("dim",l)}`:"",a=t?m("gray",A):"";return`${r}${a}${n}`}case"cancel":{const n=l?` ${m(["strikethrough","dim"],l)}`:"",a=t?m("gray",A):"";return`${r}${a}${n}${l.trim()?`
39
- ${a}`:""}`}default:{const n=t?`${m("cyan",A)} `:"",a=t?m("cyan",O):"";return`${r}${n}${o}
40
- ${a}
41
- `}}}}).prompt();function ae(e){return e.trim().replace(/\/+$/g,"")}function gt(e){const t=B.readdirSync(e);return t.length===0||t.length===1&&t[0]===".git"}function bt(e){if(B.existsSync(e))for(const t of B.readdirSync(e))t!==".git"&&B.rmSync(_.resolve(e,t),{recursive:!0,force:!0})}function Ae(e,t){B.statSync(e).isDirectory()?xt(e,t):B.copyFileSync(e,t)}function xt(e,t){B.mkdirSync(t,{recursive:!0});for(const r of B.readdirSync(e)){const s=_.resolve(e,r),o=_.resolve(t,r);Ae(s,o)}}function Et(e,t){const r=t?t.name:"npm",s=r==="yarn"&&t?.version.startsWith("1.");return e.replace(/^npm create /,()=>r==="bun"?"bun x create-":`${r} create `).replace("@latest",()=>s?"":"@latest").replace(/^npm exec/,()=>r==="pnpm"?"pnpm dlx":r==="yarn"&&!s?"yarn dlx":r==="bun"?"bun x":"npm exec")}async function $t(e,t,r="VITE_"){const s=Object.entries(e).map(([l,n])=>`${r}${l.toUpperCase()}=${JSON.stringify(n)}`).join(`
42
- `),o=Le.join(t,".env");await Re.writeFile(o,s,"utf8")}async function yt(e){const{cwd:t,targetDir:r,template:s,packageName:o,renameFiles:l,pkgInfo:n}=e,a=_.join(t,r);B.mkdirSync(a,{recursive:!0}),await $t({},a);const i=n?n.name:"npm";M.step(`Creating project in ${a}...`);const c=Me(import.meta.url),d=_.dirname(c),u=[_.resolve(d,"../templates",s),_.resolve(d,"../../templates",s)].find(x=>B.existsSync(x));if(!u)throw new Error(`Template directory not found for: ${s}`);const f=(x,w)=>{const v=_.join(a,l[x]??x);w?B.writeFileSync(v,w):Ae(_.join(u,x),v)},g=B.readdirSync(u);for(const x of g.filter(w=>w!=="package.json"))f(x);const p=JSON.parse(B.readFileSync(_.join(u,"package.json"),"utf-8"));p.name=o,f("package.json",JSON.stringify(p,null,2)+`
43
- `);let h="";const y=_.relative(t,a);switch(h+=`Project created. Now run:
44
- `,a!==t&&(h+=`
45
- cd ${y.includes(" ")?`"${y}"`:y}`),i){case"yarn":h+=`
46
- yarn`,h+=`
47
- yarn dev`;break;default:h+=`
48
- ${i} install`,h+=`
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]...
27
+ `):t(e),te=e=>{const t=(s,a)=>{if(s===void 0)return"";const l=s.label??String(s.value);switch(a){case"disabled":return`${c("gray",_e)} ${H(l,o=>c("gray",o))}${s.hint?` ${c("dim",`(${s.hint??"disabled"})`)}`:""}`;case"selected":return`${H(l,o=>c("dim",o))}`;case"active":return`${c("green",nt)} ${l}${s.hint?` ${c("dim",`(${s.hint})`)}`:""}`;case"cancelled":return`${H(l,o=>c(["strikethrough","dim"],o))}`;default:return`${c("dim",_e)} ${H(l,o=>c("dim",o))}`}},r=e.showInstructions??!0;return new Ze({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){const s=e.withGuide??M.withGuide,a=`${Ee(this.state)} `,l=`${ut(this.state)} `,o=ee(e.output,e.message,l,a),n=`${s?`${c("gray",$)}
28
+ `:""}${o}
29
+ `;switch(this.state){case"submit":{const i=s?`${c("gray",$)} `:"",u=ee(e.output,t(this.options[this.cursor],"selected"),i);return`${n}${u}`}case"cancel":{const i=s?`${c("gray",$)} `:"",u=ee(e.output,t(this.options[this.cursor],"cancelled"),i);return`${n}${u}${s?`
30
+ ${c("gray",$)}`:""}`}default:{const i=s?`${c("cyan",$)} `:"",u=n.split(`
31
+ `).length,m=r?ht(ft,s):s?[c("cyan",j)]:[],h=m.join(`
32
+ `),d=m.length+1;return`${n}${i}${mt({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:i.length,rowPadding:u+d,style:(f,p)=>t(f,f.disabled?"disabled":p?"active":"inactive")}).join(`
33
+ ${i}`)}
34
+ ${h}
35
+ `}}}}).prompt()};`${c("gray",$)}`;const Ie=e=>new Qe({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){const t=e?.withGuide??M.withGuide,r=`${`${t?`${c("gray",$)}
36
+ `:""}${Ee(this.state)} `}${e.message}
37
+ `,s=e.placeholder&&e.placeholder.length>0?c("inverse",e.placeholder[0])+c("dim",e.placeholder.slice(1)):c(["inverse","hidden"],"_"),a=this.userInput?this.userInputWithCursor:s,l=this.value??"";switch(this.state){case"error":{const o=this.error?` ${c("yellow",this.error)}`:"",n=t?`${c("yellow",$)} `:"",i=t?c("yellow",j):"";return`${r.trim()}
38
+ ${n}${a}
39
+ ${i}${o}
40
+ `}case"submit":{const o=l?` ${c("dim",l)}`:"",n=t?c("gray",$):"";return`${r}${n}${o}`}case"cancel":{const o=l?` ${c(["strikethrough","dim"],l)}`:"",n=t?c("gray",$):"";return`${r}${n}${o}${l.trim()?`
41
+ ${n}`:""}`}default:{const o=t?`${c("cyan",$)} `:"",n=t?c("cyan",j):"";return`${r}${o}${a}
42
+ ${n}
43
+ `}}}}).prompt();function re(e){return e==null?[]:Array.isArray(e)?e:[e]}function gt(e,t,r,s){var a,l=e[t],o=~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((a=+r,a*0===0?a:r)),!!r):(a=+r,a*0===0?a:r);e[t]=l==null?o:Array.isArray(l)?l.concat(o):[l,o]}function bt(e,t){e=e||[],t=t||{};var r,s,a,l,o,n={_:[]},i=0,u=0,m=0,h=e.length;const d=t.alias!==void 0,f=t.unknown!==void 0,p=t.default!==void 0;if(t.alias=t.alias||{},t.string=re(t.string),t.boolean=re(t.boolean),d)for(r in t.alias)for(s=t.alias[r]=re(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]]||[],u=s.length;u-- >0;)t.boolean.push(s[u]);for(i=t.string.length;i-- >0;)for(s=t.alias[t.string[i]]||[],u=s.length;u-- >0;)t.string.push(s[u]);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 g=f?Object.keys(t.alias):[];for(i=0;i<h;i++){if(a=e[i],a==="--"){n._=n._.concat(e.slice(++i));break}for(u=0;u<a.length&&a.charCodeAt(u)===45;u++);if(u===0)n._.push(a);else if(a.substring(u,u+3)==="no-"){if(l=a.substring(u+3),f&&!~g.indexOf(l))return t.unknown(a);n[l]=!1}else{for(m=u+1;m<a.length&&a.charCodeAt(m)!==61;m++);for(l=a.substring(u,m),o=a.substring(++m)||i+1===h||(""+e[i+1]).charCodeAt(0)===45||e[++i],s=u===2?[l]:l,m=0;m<s.length;m++){if(l=s[m],f&&!~g.indexOf(l))return t.unknown("-".repeat(u)+l);gt(n,l,m+1<s.length||o,t)}}}if(p)for(r in t.default)n[r]===void 0&&(n[r]=t.default[r]);if(d)for(r in n)for(s=t.alias[r]||[];s.length>0;)n[s.shift()]=n[r];return n}var z={exports:{}},Fe;function xt(){if(Fe)return z.exports;Fe=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),a=(n,i,u=n)=>m=>{let h=""+m,d=h.indexOf(i,n.length);return~d?n+l(h,i,u,d)+i:n+h+i},l=(n,i,u,m)=>{let h="",d=0;do h+=n.substring(d,m)+u,d=m+i.length,m=n.indexOf(i,d);while(~m);return h+n.substring(d)},o=(n=s)=>{let i=n?a:()=>String;return{isColorSupported:n,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 z.exports=o(),z.exports.createColors=o,z.exports}var $t=xt();const yt=ze($t),{cyan:wt,magenta:vt,yellow:_t}=yt,J=[{name:"engine",display:"Engine",description:"with the PlayCanvas Engine API directly",color:_t},{name:"react",display:"React",description:"with @playcanvas/react",color:wt},{name:"web-components",display:"Web Components",description:"with @playcanvas/web-components",color:vt}],W=[{name:"spinning-cube",display:"Spinning Cube",description:"a rotating cube and a light"},{name:"interactive-sphere",display:"Interactive Sphere",description:"orbit controls, a grid and pointer picking"},{name:"model-viewer",display:"Model Viewer",description:"a glTF model, orbit controls and a procedural sky"},{name:"splat-viewer",display:"Splat Viewer",description:"a Gaussian splat and orbit controls"}],Et=async({argBoilerplate:e,yes:t,cancel:r})=>{if(e&&W.some(a=>a.name===e))return e;if(!process.stdout.isTTY||t){if(!e)return W[0].name;throw new Error(`Unknown boilerplate: ${e}. Choose from: ${W.map(a=>a.name).join(", ")}`)}const s=await te({message:e?`"${e}" isn't a valid boilerplate. Please choose from below: `:"Select a boilerplate:",initialValue:W[0].name,options:W.map(a=>({label:a.display,value:a.name,hint:a.description}))});return D(s)&&r(),s},St=async({argTemplate:e,yes:t,cancel:r})=>{if(e&&J.some(a=>a.name===e))return e;if(e&&(!process.stdout.isTTY||t))throw new Error(`Unknown template: ${e}. Choose from: ${J.map(a=>a.name).join(", ")}`);if(t)return J[0].name;const s=await te({message:e?`"${e}" isn't a valid template. Please choose from below: `:"Select a template:",options:J.map(a=>({label:a.color(a.display),value:a.name,hint:a.description}))});return D(s)&&r(),s},Te=e=>/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e),ie=e=>e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-"),It=async({targetDir:e,yes:t,cancel:r})=>{let s=_.basename(_.resolve(e));if(!Te(s)){if(t)return ie(s);const a=await Ie({message:"Package name:",defaultValue:ie(s),placeholder:ie(s),validate:l=>{if(!l||!Te(l))return"Invalid package.json name"}});if(D(a))return r();s=a}return s},se=e=>e.trim().replace(/\/+$/g,""),Ft=e=>{const t=I.readdirSync(e);return t.length===0||t.length===1&&t[0]===".git"},Tt=e=>{if(I.existsSync(e))for(const t of I.readdirSync(e))t!==".git"&&I.rmSync(_.resolve(e,t),{recursive:!0,force:!0})},Ct=async({argTargetDir:e,defaultTargetDir:t,yes:r,cancel:s})=>{let a=e?se(String(e)):void 0;if(!a&&r)return t;if(!a){const l=await Ie({message:"Project name:",defaultValue:t,placeholder:t});D(l)&&s(),a=se(l)}return a},Rt=async({targetDir:e,argOverwrite:t,yes:r,cancel:s})=>{if(I.existsSync(e)&&!Ft(e)){if(r&&!t)throw new Error(`Target directory "${e}" is not empty. Pass --overwrite to remove its contents.`);const a=t?"yes":await te({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(D(a))return s();switch(a){case"yes":Tt(e);break;case"no":s();return}}},At=e=>{const{cwd:t,targetDir:r,template:s,boilerplate:a,packageName:l,renameFiles:o}=e,n=_.resolve(t,r);I.mkdirSync(n,{recursive:!0});const i=process.env.npm_config_user_agent?.split("/")[0]??"npm";N.step(`Creating project in ${n}...`);const u=Ae(import.meta.url),m=_.dirname(u),h=[_.resolve(m,"../templates"),_.resolve(m,"../../templates")].find(w=>I.existsSync(_.join(w,s)));if(!h)throw new Error(`Template directory not found for: ${s}`);const d=_.join(h,s),f=_.join(h,"_shared",a);I.existsSync(f)&&I.cpSync(f,n,{recursive:!0});for(const w of["base",a]){const C=_.join(d,w);if(!I.existsSync(C))throw new Error(`Boilerplate directory not found: ${s}/${w}`);I.cpSync(C,n,{recursive:!0})}for(const[w,C]of Object.entries(o)){const R=_.join(n,w);I.existsSync(R)&&I.renameSync(R,_.join(n,C))}const p=_.join(n,"package.json"),g=JSON.parse(I.readFileSync(p,"utf-8"));g.name=l,I.writeFileSync(p,JSON.stringify(g,null,4)+`
44
+ `);let b=`Project created. Now run:
45
+ `;const E=_.isAbsolute(r)?n:_.relative(t,n);switch(n!==t&&(b+=`
46
+ cd ${E.includes(" ")?`"${E}"`:E}`),i){case"yarn":b+=`
47
+ yarn`,b+=`
48
+ yarn dev`;break;default:b+=`
49
+ ${i} install`,b+=`
50
+ ${i} run dev`;break}pt(b)},P=bt(process.argv.slice(2),{alias:{h:"help",t:"template",b:"boilerplate",y:"yes"},boolean:["help","overwrite","yes"],string:["template","boilerplate"]}),kt=process.cwd(),Bt=`Usage: npm create playcanvas@latest [OPTION]...
50
51
 
51
- Create a new PlayCanvas project in JavaScript or TypeScript.
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
+ -b, --boilerplate NAME use a specific boilerplate
58
+ --overwrite remove existing files from a non-empty target directory
59
+ -y, --yes skip the prompts and take the defaults
56
60
  -h, --help show help
57
- -d, --delete delete the project directory if it exists
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)});
61
+ `,Lt={_gitignore:".gitignore"},Ot="playcanvas-project",Mt=async()=>{const e=P._[0]?se(String(P._[0])):void 0,t=P.template,r=P.boilerplate,s=P.overwrite,a=P.yes;if(P.help){console.log(Bt);return}const l=()=>{dt("Operation cancelled"),process.exit(0)},o=await Ct({argTargetDir:e,defaultTargetDir:Ot,yes:a,cancel:l});await Rt({targetDir:o,argOverwrite:s,yes:a,cancel:l});const n=await It({targetDir:o,yes:a,cancel:l}),i=await St({argTemplate:t,yes:a,cancel:l}),u=await Et({argBoilerplate:r,yes:a,cancel:l});At({cwd:kt,targetDir:o,template:i,boilerplate:u,packageName:n,renameFiles:Lt})};Mt().catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});
package/package.json CHANGED
@@ -1,51 +1,56 @@
1
1
  {
2
- "name": "create-playcanvas",
3
- "version": "0.2.6",
4
- "author": "PlayCanvas <support@playcanvas.com>",
5
- "homepage": "https://github.com/playcanvas/create-playcanvas#readme",
6
- "description": "Scaffold a PlayCanvas project",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/playcanvas/create-playcanvas.git"
10
- },
11
- "keywords": [
12
- "playcanvas",
13
- "create",
14
- "scaffold",
15
- "template",
16
- "vite",
17
- "react",
18
- "typescript",
19
- "webgl",
20
- "webgpu",
21
- "game",
22
- "3d"
23
- ],
24
- "type": "module",
25
- "bin": {
26
- "create-playcanvas": "index.js"
27
- },
28
- "files": [
29
- "index.js",
30
- "templates",
31
- "dist"
32
- ],
33
- "scripts": {
34
- "dev": "unbuild --stub",
35
- "build": "unbuild",
36
- "typecheck": "tsc --noEmit",
37
- "prepublishOnly": "npm run build"
38
- },
39
- "license": "MIT",
40
- "devDependencies": {
41
- "@clack/prompts": "^1.2.0",
42
- "@types/node": "^25.6.0",
43
- "cross-spawn": "^7.0.6",
44
- "mri": "^1.2.0",
45
- "picocolors": "^1.1.1",
46
- "unbuild": "^3.6.1"
47
- },
48
- "engines": {
49
- "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
50
- }
2
+ "name": "create-playcanvas",
3
+ "version": "0.4.0",
4
+ "description": "Scaffold a PlayCanvas project",
5
+ "keywords": [
6
+ "playcanvas",
7
+ "create",
8
+ "scaffold",
9
+ "template",
10
+ "vite",
11
+ "react",
12
+ "web-components",
13
+ "typescript",
14
+ "webgl",
15
+ "webgpu",
16
+ "game",
17
+ "3d"
18
+ ],
19
+ "homepage": "https://github.com/playcanvas/create-playcanvas#readme",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/playcanvas/create-playcanvas.git"
23
+ },
24
+ "license": "MIT",
25
+ "author": "PlayCanvas <support@playcanvas.com>",
26
+ "type": "module",
27
+ "bin": {
28
+ "create-playcanvas": "dist/index.mjs"
29
+ },
30
+ "files": [
31
+ "templates",
32
+ "dist"
33
+ ],
34
+ "scripts": {
35
+ "build": "unbuild",
36
+ "dev": "unbuild --stub",
37
+ "fmt": "prettier --check .",
38
+ "fmt:fix": "prettier --write .",
39
+ "lint": "eslint .",
40
+ "lint:fix": "eslint . --fix",
41
+ "typecheck": "tsc --noEmit"
42
+ },
43
+ "devDependencies": {
44
+ "@clack/prompts": "^1.7.0",
45
+ "@playcanvas/eslint-config": "3.0.0-beta.8",
46
+ "@types/node": "22.20.1",
47
+ "eslint": "^9.39.5",
48
+ "mri": "^1.2.0",
49
+ "picocolors": "^1.1.1",
50
+ "prettier": "^3.9.6",
51
+ "unbuild": "^3.6.1"
52
+ },
53
+ "engines": {
54
+ "node": ">=22.23.2"
55
+ }
51
56
  }
@@ -0,0 +1,38 @@
1
+ # PlayCanvas Engine + TypeScript Starter
2
+
3
+ A Vite-powered PlayCanvas Engine project with TypeScript, hot module replacement, ESLint and Prettier.
4
+
5
+ ## Prerequisites
6
+
7
+ Node.js 22.23.2 or later.
8
+
9
+ ## Getting started
10
+
11
+ ```bash
12
+ npm create playcanvas@latest playcanvas-project -- --template engine
13
+ cd playcanvas-project
14
+ npm install
15
+ npm run dev
16
+ ```
17
+
18
+ Open <http://localhost:5173>. Edit the files under `src/` and save to see the scene update.
19
+
20
+ ## Scripts
21
+
22
+ | Command | Description |
23
+ | ------------------- | --------------------------------- |
24
+ | `npm run dev` | Start the Vite development server |
25
+ | `npm run build` | Build for production |
26
+ | `npm run start` | Preview the production build |
27
+ | `npm run lint` | Run ESLint |
28
+ | `npm run fmt` | Check formatting |
29
+ | `npm run typecheck` | Run TypeScript checks |
30
+
31
+ Run `npm run build` to generate a deployable static site in `dist/`.
32
+
33
+ ## Further reading
34
+
35
+ - [PlayCanvas Engine manual](https://developer.playcanvas.com/user-manual/engine/)
36
+ - [PlayCanvas examples](https://playcanvas.github.io/)
37
+ - [Vite documentation](https://vite.dev/)
38
+ - [TypeScript documentation](https://www.typescriptlang.org/docs/)
@@ -0,0 +1,3 @@
1
+ import typescriptConfig from '@playcanvas/eslint-config/typescript';
2
+
3
+ export default typescriptConfig;
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "playcanvas-project",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "description": "A PlayCanvas TypeScript project",
6
+ "type": "module",
7
+ "scripts": {
8
+ "build": "vite build",
9
+ "dev": "vite",
10
+ "fmt": "prettier --check .",
11
+ "fmt:fix": "prettier --write .",
12
+ "lint": "eslint .",
13
+ "lint:fix": "eslint . --fix",
14
+ "start": "vite preview",
15
+ "typecheck": "tsc --noEmit"
16
+ },
17
+ "dependencies": {
18
+ "playcanvas": "^2.21.3"
19
+ },
20
+ "devDependencies": {
21
+ "@playcanvas/eslint-config": "3.0.0-beta.8",
22
+ "eslint": "^9.39.5",
23
+ "prettier": "^3.9.6",
24
+ "typescript": "~6.0.3",
25
+ "vite": "^8.2.0"
26
+ },
27
+ "engines": {
28
+ "node": ">=22.23.2"
29
+ }
30
+ }
@@ -0,0 +1 @@
1
+ export { default } from '@playcanvas/eslint-config/prettier';