create-kitql
Advanced tools
Comparing version 0.0.2 to 0.0.3
31
bin.js
@@ -10,6 +10,2 @@ #!/usr/bin/env node | ||
// the first argument is the name of the project | ||
let projectDir = process.argv[2] | ||
let projectName = projectDir | ||
const { version } = JSON.parse(fs.readFileSync(new URL('package.json', import.meta.url), 'utf-8')) | ||
@@ -21,12 +17,15 @@ // eslint-disable-next-line no-console | ||
const templatesDir = sourcePath(`./templates`) | ||
const options = fs.readdirSync(templatesDir).map(templateDir => { | ||
// in .meta.json you can find: | ||
/** @type {{label?: string, hint?: string, apiUrl?: string}} */ | ||
let data = {} | ||
const metaPath = path.join(templatesDir, templateDir, '.meta.json') | ||
if (fs.existsSync(metaPath)) { | ||
data = JSON.parse(readFileSync(metaPath, 'utf-8')) | ||
} | ||
return { ...data, value: templateDir } | ||
}) | ||
const options = fs | ||
.readdirSync(templatesDir) | ||
.map(templateDir => { | ||
// in .meta.json you can find: | ||
/** @type {{label?: string, hint?: string, order?: number}} */ | ||
let data = {} | ||
const metaPath = path.join(templatesDir, templateDir, '.meta.json') | ||
if (fs.existsSync(metaPath)) { | ||
data = JSON.parse(readFileSync(metaPath, 'utf-8')) | ||
} | ||
return { ...data, value: templateDir } | ||
}) | ||
.sort((a, b) => ((a.order ?? 0) > (b.order ?? 0) ? 1 : -1)) | ||
@@ -52,2 +51,5 @@ program.argument('[project_name]', 'optional project name') | ||
let projectDir = program.args[0] | ||
let projectName = projectDir | ||
p.intro(`${green(`⚡️`)} Welcome to KitQL world!`) | ||
@@ -107,3 +109,2 @@ | ||
message: 'Which template do you want to use?', | ||
initialValue: 'kit-routes', | ||
options, | ||
@@ -110,0 +111,0 @@ }) |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"license": "MIT", | ||
@@ -12,0 +12,0 @@ "type": "module", |
@@ -12,6 +12,6 @@ # ⚡ create kitql | ||
```bash | ||
npm create kitql@latest demo-kitql | ||
npm create kitql@latest | ||
# or with a template option | ||
npm create kitql@latest demo-kitql --template kit-routes | ||
# or with a name & template selected to go even faster | ||
npm create kitql@latest demo-kitql --template kitql-remult | ||
``` | ||
@@ -18,0 +18,0 @@ |
@@ -33,6 +33,6 @@ { | ||
"vite": "^4.4.2", | ||
"vite-plugin-kit-routes": "^0.1.0-next.5", | ||
"vitest": "^0.32.2" | ||
"vite-plugin-kit-routes": "^0.1.1", | ||
"vitest": "^0.34.0" | ||
}, | ||
"type": "module" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
335446
55
9033