create-apppaaaul 2.0.4 â 2.0.6
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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -144,7 +144,7 @@ async function main() {
|
|
|
144
144
|
console.log("\n\u2728 Project created \u2728");
|
|
145
145
|
if (project.name !== ".") {
|
|
146
146
|
try {
|
|
147
|
-
await
|
|
147
|
+
await execAsync(`cd ${project.name}`);
|
|
148
148
|
console.log(`
|
|
149
149
|
${import_picocolors2.default.green(`cd`)} ${project.name}`);
|
|
150
150
|
} catch (error) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../node_modules/.pnpm/tsup@8.4.0_typescript@5.8.2_yaml@2.4.5/node_modules/tsup/assets/cjs_shims.js","../index.ts","../helpers/install.ts"],"sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () =>\n typeof document === 'undefined'\n ? new URL(`file:${__filename}`).href\n : (document.currentScript && document.currentScript.src) ||\n new URL('main.js', document.baseURI).href\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","#!/usr/bin/env node\n\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { cp, readFile, writeFile } from \"node:fs/promises\";\nimport { exec } from \"child_process\";\nimport { promisify } from \"util\";\n\nimport { cyan, green, red } from \"picocolors\";\nimport { glob } from \"glob\";\nimport color from \"picocolors\";\nimport prompts from \"prompts\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\n\nimport { install } from \"./helpers/install\";\nconst execAsync = promisify(exec);\n\n// Define the templates available\nconst TEMPLATES = [\n {\n title: \"Nextjs ts with db setup Landing with prisma\",\n value: \"nextjs-ts-landing-prisma\",\n },\n {\n title: \"Nextjs ts with db setup Landing with drizzle\",\n value: \"nextjs-ts-landing-drizzle\",\n },\n {\n title: 'Nextjs ts clean',\n value: 'nextjs-ts-clean'\n }\n];\n\n// Specify CLI arguments\nconst args = yargs(hideBin(process.argv)).options({\n name: {\n alias: \"n\",\n type: \"string\",\n description: \"Name of the project\",\n },\n template: {\n alias: \"t\",\n type: \"string\",\n description: \"Template to use\",\n },\n});\n\n// Override arguments passed on the CLI\nprompts.override(args.argv);\n\nasync function main() {\n // Get the initial values for the prompts\n const {\n _: [initialName, initialProject],\n } = await args.argv;\n\n // Create the project prompt\n const project = await prompts(\n [\n {\n type: \"text\",\n name: \"name\",\n message: \"What is the name of your project?\",\n initial: initialName || \"apppaaaul-project\",\n validate: (value) => {\n if (value !== \".\" && value.match(/[^a-zA-Z0-9-_]+/g)) {\n return \"Project name can only contain letters, numbers, dashes, underscores, or be '.' for the current directory\";\n }\n\n return true;\n },\n },\n {\n type: \"select\",\n name: \"template\",\n message: `Which template would you like to use?`,\n initial: initialProject || 0,\n choices: TEMPLATES,\n },\n ],\n {\n onCancel: () => {\n console.log(\"\\nBye đ\\n\");\n\n process.exit(0);\n },\n },\n );\n\n // Get the template folder for the selected template\n const template = path.join(\n path.dirname(fileURLToPath(import.meta.url)),\n \"templates\",\n project.template,\n );\n\n // Get the destination folder for the project\n const destination = project.name === \".\" ? process.cwd() : path.join(process.cwd(), project.name);\n\n // Copy files from the template folder to the current directory\n await cp(path.join(template, \"project\"), destination, { recursive: true });\n\n // Get all files from the destination folder\n const files = await glob(`**/*`, { nodir: true, cwd: destination, absolute: true });\n\n // Read each file and replace the tokens\n for await (const file of files) {\n const data = await readFile(file, \"utf8\");\n const draft = data.replace(/{{name}}/g, project.name);\n\n await writeFile(file, draft, \"utf8\");\n }\n\n // Log outro message\n console.log(\"\\n⨠Project created â¨\");\n\n // Run commands if a new directory was created\n if (project.name !== \".\") {\n try {\n await
|
|
1
|
+
{"version":3,"sources":["../node_modules/.pnpm/tsup@8.4.0_typescript@5.8.2_yaml@2.4.5/node_modules/tsup/assets/cjs_shims.js","../index.ts","../helpers/install.ts"],"sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () =>\n typeof document === 'undefined'\n ? new URL(`file:${__filename}`).href\n : (document.currentScript && document.currentScript.src) ||\n new URL('main.js', document.baseURI).href\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","#!/usr/bin/env node\n\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { cp, readFile, writeFile } from \"node:fs/promises\";\nimport { exec } from \"child_process\";\nimport { promisify } from \"util\";\n\nimport { cyan, green, red } from \"picocolors\";\nimport { glob } from \"glob\";\nimport color from \"picocolors\";\nimport prompts from \"prompts\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\n\nimport { install } from \"./helpers/install\";\nconst execAsync = promisify(exec);\n\n// Define the templates available\nconst TEMPLATES = [\n {\n title: \"Nextjs ts with db setup Landing with prisma\",\n value: \"nextjs-ts-landing-prisma\",\n },\n {\n title: \"Nextjs ts with db setup Landing with drizzle\",\n value: \"nextjs-ts-landing-drizzle\",\n },\n {\n title: 'Nextjs ts clean',\n value: 'nextjs-ts-clean'\n }\n];\n\n// Specify CLI arguments\nconst args = yargs(hideBin(process.argv)).options({\n name: {\n alias: \"n\",\n type: \"string\",\n description: \"Name of the project\",\n },\n template: {\n alias: \"t\",\n type: \"string\",\n description: \"Template to use\",\n },\n});\n\n// Override arguments passed on the CLI\nprompts.override(args.argv);\n\nasync function main() {\n // Get the initial values for the prompts\n const {\n _: [initialName, initialProject],\n } = await args.argv;\n\n // Create the project prompt\n const project = await prompts(\n [\n {\n type: \"text\",\n name: \"name\",\n message: \"What is the name of your project?\",\n initial: initialName || \"apppaaaul-project\",\n validate: (value) => {\n if (value !== \".\" && value.match(/[^a-zA-Z0-9-_]+/g)) {\n return \"Project name can only contain letters, numbers, dashes, underscores, or be '.' for the current directory\";\n }\n\n return true;\n },\n },\n {\n type: \"select\",\n name: \"template\",\n message: `Which template would you like to use?`,\n initial: initialProject || 0,\n choices: TEMPLATES,\n },\n ],\n {\n onCancel: () => {\n console.log(\"\\nBye đ\\n\");\n\n process.exit(0);\n },\n },\n );\n\n // Get the template folder for the selected template\n const template = path.join(\n path.dirname(fileURLToPath(import.meta.url)),\n \"templates\",\n project.template,\n );\n\n // Get the destination folder for the project\n const destination = project.name === \".\" ? process.cwd() : path.join(process.cwd(), project.name);\n\n // Copy files from the template folder to the current directory\n await cp(path.join(template, \"project\"), destination, { recursive: true });\n\n // Get all files from the destination folder\n const files = await glob(`**/*`, { nodir: true, cwd: destination, absolute: true });\n\n // Read each file and replace the tokens\n for await (const file of files) {\n const data = await readFile(file, \"utf8\");\n const draft = data.replace(/{{name}}/g, project.name);\n\n await writeFile(file, draft, \"utf8\");\n }\n\n // Log outro message\n console.log(\"\\n⨠Project created â¨\");\n\n // Run commands if a new directory was created\n if (project.name !== \".\") {\n try {\n await execAsync(`cd ${project.name}`);\n console.log(`\\n${color.green(`cd`)} ${project.name}`);\n } catch (error) {\n console.error(`Error executing commands: ${error}`);\n }\n }\n try {\n await execAsync(\"cursor .\");\n console.log(\"Installing packages. This might take a couple of minutes.\");\n console.log();\n await install();\n console.log();\n console.log(`${green(\"Success!\")} App installed successfully.`);\n console.log(cyan(\"Initializing the development server...\"));\n //TODO: Add docker-compose up, docker create db, pnpm run db:push\n await execAsync(\"pnpm dev\");\n } catch (error) {\n console.error(`Error executing commands: ${error}`);\n }\n}\n\n// Run the main function\nmain().catch(console.error);\n","import spawn from \"cross-spawn\";\nimport { yellow } from \"picocolors\";\n\nexport async function install(): Promise<void> {\n const packageManager = \"pnpm\";\n const args: string[] = [\"install\"];\n\n return new Promise((resolve, reject) => {\n /**\n * Spawn the installation process.\n */\n const child = spawn(packageManager, args, {\n stdio: \"inherit\",\n env: {\n ...process.env,\n ADBLOCK: \"1\",\n // we set NODE_ENV to development as pnpm skips dev\n // dependencies when production\n NODE_ENV: \"development\",\n DISABLE_OPENCOLLECTIVE: \"1\",\n },\n });\n\n child.on(\"close\", (code) => {\n if (code !== 0) {\n reject({ command: `${packageManager} ${args.join(\" \")}` });\n\n return;\n }\n resolve();\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,OAClD,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEpC,IAAM,gBAAgC,iCAAiB;;;ACT9D,uBAAiB;AACjB,sBAA8B;AAC9B,sBAAwC;AACxC,2BAAqB;AACrB,kBAA0B;AAE1B,wBAAiC;AACjC,kBAAqB;AACrB,IAAAA,qBAAkB;AAClB,qBAAoB;AACpB,mBAAkB;AAClB,qBAAwB;;;ACbxB,yBAAkB;AAGlB,eAAsB,UAAyB;AAC7C,QAAM,iBAAiB;AACvB,QAAMC,QAAiB,CAAC,SAAS;AAEjC,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AAItC,UAAM,YAAQ,mBAAAC,SAAM,gBAAgBD,OAAM;AAAA,MACxC,OAAO;AAAA,MACP,KAAK;AAAA,QACH,GAAG,QAAQ;AAAA,QACX,SAAS;AAAA;AAAA;AAAA,QAGT,UAAU;AAAA,QACV,wBAAwB;AAAA,MAC1B;AAAA,IACF,CAAC;AAED,UAAM,GAAG,SAAS,CAAC,SAAS;AAC1B,UAAI,SAAS,GAAG;AACd,eAAO,EAAE,SAAS,GAAG,cAAc,IAAIA,MAAK,KAAK,GAAG,CAAC,GAAG,CAAC;AAEzD;AAAA,MACF;AACA,cAAQ;AAAA,IACV,CAAC;AAAA,EACH,CAAC;AACH;;;ADhBA,IAAM,gBAAY,uBAAU,yBAAI;AAG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|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Create projects as paaauldev would",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"bin": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"build": "tsup",
|
|
31
31
|
"start": "node dist/index.js",
|
|
32
32
|
"dev": "tsup --watch",
|
|
33
|
-
"bump": "pnpm run build && pnpm version patch && git tag latest --force && git push origin main --tags --force &&
|
|
33
|
+
"bump": "pnpm run build && pnpm version patch && git tag latest --force && git push origin main --tags --force && npm publish --tag latest --force"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^20.17.27",
|