create-xeikit-app 1.0.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/LICENCE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 xeikit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # 🎉 create-xeikit-app
2
+
3
+ [![npm version][npm-version-src]][npm-version-href]
4
+
5
+ ## ✨ Usage
6
+
7
+ You can use [these templates](https://github.com/xeikit/starter/tree/templates/templates) to create a new project by running the following command:
8
+
9
+ ```bash
10
+ npx create-xeikit-app
11
+ ```
12
+
13
+ This will prompt you to select a template and then create a new project using that template.
14
+
15
+ ## 📄 License
16
+
17
+ [MIT](./LICENSE) License © 2025–Present [XeicuLy](https://github.com/XeicuLy)
18
+
19
+ <!-- Badges -->
20
+
21
+ [npm-version-src]: https://img.shields.io/npm/v/create-xeikit-app?style=flat&colorA=080f12&colorB=1fa669
22
+ [npm-version-href]: https://npmjs.com/package/create-xeikit-app
package/bin/cli.mjs ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { runMain } from '../dist/index.mjs';
4
+
5
+ runMain();
package/dist/index.cjs ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";const citty=require("citty"),e=require("consola"),utils=require("consola/utils"),pathe=require("pathe"),stdEnv=require("std-env"),node_fs=require("node:fs"),tinyexec=require("tinyexec"),nypm=require("nypm"),giget=require("giget");function _interopDefaultCompat(t){return t&&typeof t=="object"&&"default"in t?t.default:t}const e__default=_interopDefaultCompat(e),name="create-xeikit-app",version="1.0.0",description="CLI tool for scaffolding projects with xeikit/starter templates.",handleError=t=>{e__default.error(t.toString()),process.exit(1)},verifyDirectoryDoesNotExist=t=>{node_fs.existsSync(t)&&(e__default.error(`The directory ${utils.colors.cyan(pathe.relative(process.cwd(),t)||t)} already exists. Please choose a different directory.`),process.exit(1))},resolvePath=(t,n)=>pathe.resolve(t,n),initializeGitIfRequested=async(t,n)=>{if(t===void 0?await e__default.prompt("Initialize git repository?",{type:"confirm",cancel:"reject"}).catch(()=>process.exit(1)):t){e__default.info(`Initializing git repository...
2
+ `);try{await tinyexec.x("git",["init",n],{throwOnError:!0,nodeOptions:{stdio:"inherit"}})}catch(i){e__default.warn(`Failed to initialize git repository: ${i}`)}}},DEFAULT_REGISTRY="https://raw.githubusercontent.com/xeikit/starter/templates/templates",DEFAULT_TEMPLATE_NAME="nuxt3",PACKAGE_MANAGERS={npm:void 0,yarn:void 0,pnpm:void 0,bun:void 0,deno:void 0},PACKAGE_MANAGER_OPTIONS=Object.keys(PACKAGE_MANAGERS),TEMPLATE_OPTIONS=[{label:"Nuxt3",value:"nuxt3"}],detectCurrentPackageManager=()=>{const t=process.env.npm_config_user_agent;if(!t)return;const[n]=t.split("/");return PACKAGE_MANAGER_OPTIONS.includes(n)?n:void 0},selectPackageManager=async t=>{const n=detectCurrentPackageManager();if(t&&PACKAGE_MANAGER_OPTIONS.includes(t))return t;const i=PACKAGE_MANAGER_OPTIONS.map(r=>({label:r,value:r,hint:n===r?"current":void 0}));return e__default.prompt("Which package manager would you like to use?",{type:"select",options:i,initial:n,cancel:"reject"}).catch(()=>process.exit(1))},confirmDependenciesInstallation=async t=>{const n=await e__default.prompt("Do you want to install dependencies?",{type:"confirm",initial:t,cancel:"reject"}).catch(()=>process.exit(1));return typeof n!="boolean"&&(e__default.error("Please specify whether to install dependencies."),process.exit(1)),n},installDependenciesIfRequested=async(t,n,i)=>{if(t===!1){e__default.info("Skipping dependency installation.");return}e__default.start("Installing dependencies...");try{await nypm.installDependencies({cwd:n,packageManager:{name:i,command:i}}),e__default.success("Installation completed.")}catch(r){handleError(r)}},selectTemplate=async t=>{if(t)return t;const n=await e__default.prompt("Choose a template",{type:"select",options:TEMPLATE_OPTIONS,cancel:"reject"}).catch(()=>process.exit(1));return typeof n!="string"&&(e__default.error("Please specify a template name."),process.exit(1)),n||DEFAULT_TEMPLATE_NAME},downloadTemplateAndHandleErrors=async(t,n)=>{try{return await giget.downloadTemplate(t,{dir:n,registry:DEFAULT_REGISTRY})}catch(i){return handleError(i)}},getProjectDirectory=async t=>t!==""?t:e__default.prompt("Where would you like to create your project?",{placeholder:"./my-project",type:"text",default:"./my-project",cancel:"reject"}).catch(()=>process.exit(1)),mainCommand=citty.defineCommand({meta:{name,version,description},args:{cwd:{type:"string",description:"Specify the working directory",valueHint:"directory",default:"."},dir:{type:"positional",description:"Project directory",default:""},template:{type:"string",alias:"t",description:"Template name"},install:{type:"boolean",description:"Install dependencies"},gitInit:{type:"boolean",description:"Initialize git repository"},packageManager:{type:"string",description:"Package manager choice (npm, pnpm, yarn, bun, deno)"}},run:async({args:t})=>{stdEnv.hasTTY&&process.stdout.write(`Loading...
3
+ `),e__default.info(utils.colors.bold("\u{1F389} Hello xeikit app!"));const n=await getProjectDirectory(t.dir),i=resolvePath(t.cwd,""),r=resolvePath(i,n);e__default.info(`Creating a new project in ${utils.colors.cyan(pathe.relative(i,r)||r)}.`),verifyDirectoryDoesNotExist(r);const s=await selectTemplate(t.template),o=await downloadTemplateAndHandleErrors(s,r),a=await selectPackageManager(t.packageManager),c=await confirmDependenciesInstallation(t.install);await installDependenciesIfRequested(c,o.dir,a),await initializeGitIfRequested(t.gitInit,o.dir),e__default.log(`
4
+ \u{1F389} Starter project has been created with the \`${o.source}\` template.`),e__default.log(`
5
+ \u{1F680} Next steps:
6
+ `),e__default.log(`cd ${utils.colors.cyan(n)}`),c||e__default.log(`${utils.colors.cyan(a)} install`),e__default.log(`${utils.colors.cyan(a)} run dev`),e__default.log(`
7
+ \u{1F3AE} Happy coding! ${utils.colors.dim("(Press Ctrl+C to stop the dev server)")}`)}}),runMain=()=>citty.runMain(mainCommand);exports.runMain=runMain;
@@ -0,0 +1,3 @@
1
+ declare const runMain: () => Promise<void>;
2
+
3
+ export { runMain };
@@ -0,0 +1,3 @@
1
+ declare const runMain: () => Promise<void>;
2
+
3
+ export { runMain };
@@ -0,0 +1,3 @@
1
+ declare const runMain: () => Promise<void>;
2
+
3
+ export { runMain };
package/dist/index.mjs ADDED
@@ -0,0 +1,7 @@
1
+ import{defineCommand as u,runMain as g}from"citty";import i from"consola";import{colors as o}from"consola/utils";import{resolve as f,relative as l}from"pathe";import{hasTTY as h}from"std-env";import{existsSync as w}from"node:fs";import{x}from"tinyexec";import{installDependencies as v}from"nypm";import{downloadTemplate as E}from"giget";const k="create-xeikit-app",P="1.0.0",T="CLI tool for scaffolding projects with xeikit/starter templates.",d=e=>{i.error(e.toString()),process.exit(1)},A=e=>{w(e)&&(i.error(`The directory ${o.cyan(l(process.cwd(),e)||e)} already exists. Please choose a different directory.`),process.exit(1))},m=(e,t)=>f(e,t),I=async(e,t)=>{if(e===void 0?await i.prompt("Initialize git repository?",{type:"confirm",cancel:"reject"}).catch(()=>process.exit(1)):e){i.info(`Initializing git repository...
2
+ `);try{await x("git",["init",t],{throwOnError:!0,nodeOptions:{stdio:"inherit"}})}catch(r){i.warn(`Failed to initialize git repository: ${r}`)}}},j="https://raw.githubusercontent.com/xeikit/starter/templates/templates",M="nuxt3",b={npm:void 0,yarn:void 0,pnpm:void 0,bun:void 0,deno:void 0},s=Object.keys(b),C=[{label:"Nuxt3",value:"nuxt3"}],_=()=>{const e=process.env.npm_config_user_agent;if(!e)return;const[t]=e.split("/");return s.includes(t)?t:void 0},D=async e=>{const t=_();if(e&&s.includes(e))return e;const r=s.map(n=>({label:n,value:n,hint:t===n?"current":void 0}));return i.prompt("Which package manager would you like to use?",{type:"select",options:r,initial:t,cancel:"reject"}).catch(()=>process.exit(1))},S=async e=>{const t=await i.prompt("Do you want to install dependencies?",{type:"confirm",initial:e,cancel:"reject"}).catch(()=>process.exit(1));return typeof t!="boolean"&&(i.error("Please specify whether to install dependencies."),process.exit(1)),t},N=async(e,t,r)=>{if(e===!1){i.info("Skipping dependency installation.");return}i.start("Installing dependencies...");try{await v({cwd:t,packageManager:{name:r,command:r}}),i.success("Installation completed.")}catch(n){d(n)}},F=async e=>{if(e)return e;const t=await i.prompt("Choose a template",{type:"select",options:C,cancel:"reject"}).catch(()=>process.exit(1));return typeof t!="string"&&(i.error("Please specify a template name."),process.exit(1)),t||M},O=async(e,t)=>{try{return await E(e,{dir:t,registry:j})}catch(r){return d(r)}},G=async e=>e!==""?e:i.prompt("Where would you like to create your project?",{placeholder:"./my-project",type:"text",default:"./my-project",cancel:"reject"}).catch(()=>process.exit(1)),L=u({meta:{name:k,version:P,description:T},args:{cwd:{type:"string",description:"Specify the working directory",valueHint:"directory",default:"."},dir:{type:"positional",description:"Project directory",default:""},template:{type:"string",alias:"t",description:"Template name"},install:{type:"boolean",description:"Install dependencies"},gitInit:{type:"boolean",description:"Initialize git repository"},packageManager:{type:"string",description:"Package manager choice (npm, pnpm, yarn, bun, deno)"}},run:async({args:e})=>{h&&process.stdout.write(`Loading...
3
+ `),i.info(o.bold("\u{1F389} Hello xeikit app!"));const t=await G(e.dir),r=m(e.cwd,""),n=m(r,t);i.info(`Creating a new project in ${o.cyan(l(r,n)||n)}.`),A(n);const y=await F(e.template),a=await O(y,n),c=await D(e.packageManager),p=await S(e.install);await N(p,a.dir,c),await I(e.gitInit,a.dir),i.log(`
4
+ \u{1F389} Starter project has been created with the \`${a.source}\` template.`),i.log(`
5
+ \u{1F680} Next steps:
6
+ `),i.log(`cd ${o.cyan(t)}`),p||i.log(`${o.cyan(c)} install`),i.log(`${o.cyan(c)} run dev`),i.log(`
7
+ \u{1F3AE} Happy coding! ${o.dim("(Press Ctrl+C to stop the dev server)")}`)}}),R=()=>g(L);export{R as runMain};
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "create-xeikit-app",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "author": "XeicuLy",
6
+ "description": "CLI tool for scaffolding projects with xeikit/starter templates.",
7
+ "keywords": [
8
+ "cli",
9
+ "xeikit"
10
+ ],
11
+ "license": "MIT",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/xeikit/create-xeikit-app.git"
15
+ },
16
+ "exports": {
17
+ ".": {
18
+ "import": {
19
+ "types": "./dist/index.d.mts",
20
+ "default": "./dist/index.mjs"
21
+ },
22
+ "require": {
23
+ "types": "./dist/index.d.cts",
24
+ "default": "./dist/index.cjs"
25
+ }
26
+ }
27
+ },
28
+ "main": "./dist/index.mjs",
29
+ "module": "./dist/index.mjs",
30
+ "types": "./dist/index.d.ts",
31
+ "files": [
32
+ "bin",
33
+ "dist"
34
+ ],
35
+ "bin": {
36
+ "create-xeikit-app": "./bin/cli.mjs"
37
+ },
38
+ "dependencies": {
39
+ "citty": "0.1.6",
40
+ "consola": "3.4.2",
41
+ "giget": "2.0.0",
42
+ "nypm": "0.6.0",
43
+ "pathe": "2.0.3",
44
+ "pkg-types": "2.1.0",
45
+ "std-env": "3.9.0",
46
+ "tinyexec": "1.0.1"
47
+ },
48
+ "devDependencies": {
49
+ "@biomejs/biome": "1.9.4",
50
+ "@types/node": "22.15.18",
51
+ "changelogen": "0.6.1",
52
+ "husky": "9.1.7",
53
+ "jiti": "2.4.2",
54
+ "lint-staged": "16.0.0",
55
+ "prettier": "3.5.3",
56
+ "typescript": "5.8.3",
57
+ "unbuild": "3.5.0"
58
+ },
59
+ "lint-staged": {
60
+ "**/*.{css,js,ts,cjs,mjs,cts,mts,jsx,tsx,json,jsonc}": [
61
+ "biome check --write --no-errors-on-unmatched"
62
+ ],
63
+ "**/*.{md,html,yaml,yml}": [
64
+ "prettier --write"
65
+ ]
66
+ },
67
+ "volta": {
68
+ "node": "22.15.1",
69
+ "pnpm": "10.11.0"
70
+ },
71
+ "scripts": {
72
+ "build": "unbuild",
73
+ "dev": "unbuild --stub",
74
+ "command": "jiti bin/cli.mjs",
75
+ "release": "pnpm lint:fix && pnpm build && changelogen --release --push",
76
+ "biome": "biome check .",
77
+ "biome:fix": "biome check --write .",
78
+ "biome:ci": "biome ci .",
79
+ "prettier": "prettier --check .",
80
+ "prettier:fix": "prettier --write .",
81
+ "prettier:ci": "prettier --check --log-level warn .",
82
+ "typecheck": "tsc --noEmit",
83
+ "lint": "pnpm biome && pnpm prettier && pnpm typecheck",
84
+ "lint:fix": "pnpm biome:fix && pnpm prettier:fix && pnpm typecheck"
85
+ }
86
+ }