create-apppaaaul 2.0.24 → 2.0.25

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 CHANGED
@@ -134,27 +134,19 @@ async function main() {
134
134
  try {
135
135
  const aditionalsPath = import_node_path.default.join(template, "aditionals");
136
136
  await (0, import_promises.access)(aditionalsPath);
137
- const aditionalsFiles = await (0, import_glob.glob)(`**/*`, {
138
- cwd: aditionalsPath,
139
- absolute: true,
140
- dot: true,
141
- nodir: true
142
- });
143
- for (const file of aditionalsFiles) {
144
- const relativePath = import_node_path.default.relative(aditionalsPath, file);
145
- const destPath = import_node_path.default.join(destination, relativePath);
146
- const destDir = import_node_path.default.dirname(destPath);
147
- try {
148
- await execAsync(`mkdir -p "${destDir}"`);
149
- } catch {
150
- await execAsync(`if not exist "${destDir}" mkdir "${destDir}"`);
151
- }
152
- await (0, import_promises.cp)(file, destPath);
153
- }
154
- console.log(`${import_picocolors2.default.green("\u2713")} Copied additional files (${aditionalsFiles.length} files)`);
137
+ await (0, import_promises.cp)(aditionalsPath, destination, { recursive: true });
138
+ console.log(`${import_picocolors2.default.green("\u2713")} Copied additional files`);
155
139
  } catch (error) {
156
140
  console.log(`${import_picocolors2.default.yellow("\u26A0")} Additional files folder not found in template, skipping...`);
157
141
  }
142
+ const aditionalsFiles = await (0, import_glob.glob)(`**/*`, { nodir: true, cwd: destination, absolute: true });
143
+ for await (const file of aditionalsFiles) {
144
+ const basename = import_node_path.default.basename(file);
145
+ if (basename.startsWith("%%")) {
146
+ const newPath = import_node_path.default.join(import_node_path.default.dirname(file), basename.slice(2));
147
+ await (0, import_promises.rename)(file, newPath);
148
+ }
149
+ }
158
150
  const files = await (0, import_glob.glob)(`**/*`, { nodir: true, cwd: destination, absolute: true });
159
151
  for await (const file of files) {
160
152
  const data = await (0, import_promises.readFile)(file, "utf8");
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\r\n\r\nimport path from \"node:path\";\r\nimport { fileURLToPath } from \"node:url\";\r\nimport { cp, readFile, writeFile, access, rename } from \"node:fs/promises\";\r\nimport { exec } from \"child_process\";\r\nimport { promisify } from \"util\";\r\n\r\nimport { cyan, green, red, yellow } from \"picocolors\";\r\nimport { glob } from \"glob\";\r\nimport color from \"picocolors\";\r\nimport prompts from \"prompts\";\r\nimport yargs from \"yargs\";\r\nimport { hideBin } from \"yargs/helpers\";\r\n\r\nimport { install } from \"./helpers/install\";\r\nconst execAsync = promisify(exec);\r\n\r\n// Define the templates available\r\nconst TEMPLATES = [\r\n {\r\n title: \"Nextjs ts with db setup Landing with prisma\",\r\n value: \"nextjs-ts-landing-prisma\",\r\n },\r\n {\r\n title: 'Nextjs ts clean',\r\n value: 'nextjs-ts-clean'\r\n }\r\n];\r\n\r\n// Specify CLI arguments\r\nconst args = yargs(hideBin(process.argv)).options({\r\n name: {\r\n alias: \"n\",\r\n type: \"string\",\r\n description: \"Name of the project\",\r\n },\r\n template: {\r\n alias: \"t\",\r\n type: \"string\",\r\n description: \"Template to use\",\r\n },\r\n});\r\n\r\n// Override arguments passed on the CLI\r\nprompts.override(args.argv);\r\n\r\nasync function main() {\r\n // Get the initial values for the prompts\r\n const {\r\n _: [initialName, initialProject],\r\n } = await args.argv;\r\n\r\n // Create the project prompt\r\n const project = await prompts(\r\n [\r\n {\r\n type: \"text\",\r\n name: \"name\",\r\n message: \"What is the name of your project?\",\r\n initial: initialName || \"apppaaaul-project\",\r\n validate: (value) => {\r\n if (value !== \".\" && value.match(/[^a-zA-Z0-9-_]+/g)) {\r\n return \"Project name can only contain letters, numbers, dashes, underscores, or be '.' for the current directory\";\r\n }\r\n\r\n return true;\r\n },\r\n },\r\n {\r\n type: \"select\",\r\n name: \"template\",\r\n message: `Which template would you like to use?`,\r\n initial: initialProject || 0,\r\n choices: TEMPLATES,\r\n },\r\n ],\r\n {\r\n onCancel: () => {\r\n console.log(\"\\nBye šŸ‘‹\\n\");\r\n\r\n process.exit(0);\r\n },\r\n },\r\n );\r\n\r\n // Get the template folder for the selected template\r\n const template = path.join(\r\n path.dirname(fileURLToPath(import.meta.url)),\r\n \"templates\",\r\n project.template,\r\n );\r\n\r\n // Get the destination folder for the project\r\n const destination = project.name === \".\" ? process.cwd() : path.join(process.cwd(), project.name);\r\n\r\n // Copy files from the template folder to the current directory\r\n await cp(path.join(template, \"project\"), destination, { recursive: true });\r\n\r\n // Copy additional files from aditionals folder within the template\r\n try {\r\n const aditionalsPath = path.join(template, \"aditionals\");\r\n await access(aditionalsPath);\r\n \r\n // Get all files including dotfiles using glob with dot option\r\n const aditionalsFiles = await glob(`**/*`, { \r\n cwd: aditionalsPath, \r\n absolute: true,\r\n dot: true,\r\n nodir: true\r\n });\r\n \r\n // Copy each file individually\r\n for (const file of aditionalsFiles) {\r\n const relativePath = path.relative(aditionalsPath, file);\r\n const destPath = path.join(destination, relativePath);\r\n \r\n // Ensure destination directory exists\r\n const destDir = path.dirname(destPath);\r\n try {\r\n await execAsync(`mkdir -p \"${destDir}\"`);\r\n } catch {\r\n // Windows fallback\r\n await execAsync(`if not exist \"${destDir}\" mkdir \"${destDir}\"`);\r\n }\r\n \r\n // Copy the file\r\n await cp(file, destPath);\r\n }\r\n \r\n console.log(`${color.green(\"āœ“\")} Copied additional files (${aditionalsFiles.length} files)`);\r\n } catch (error) {\r\n console.log(`${color.yellow(\"⚠\")} Additional files folder not found in template, skipping...`);\r\n }\r\n\r\n // Get all files from the destination folder\r\n const files = await glob(`**/*`, { nodir: true, cwd: destination, absolute: true });\r\n\r\n // Read each file and replace the tokens\r\n for await (const file of files) {\r\n const data = await readFile(file, \"utf8\");\r\n const draft = data.replace(/{{name}}/g, project.name);\r\n\r\n await writeFile(file, draft, \"utf8\");\r\n }\r\n\r\n // Log outro message\r\n console.log(\"\\n✨ Project created ✨\");\r\n\r\n // Run commands if a new directory was created\r\n if (project.name !== \".\") {\r\n try {\r\n await execAsync(`cd ${project.name}`);\r\n console.log(`\\n${color.green(`cd`)} ${project.name}`);\r\n \r\n // Check if git is initialized\r\n try {\r\n await execAsync(\"git status\", { cwd: destination });\r\n console.log(`${color.green(\"āœ“\")} Git repository detected`);\r\n \r\n // Create dev branch if git is initialized\r\n await execAsync(\"git checkout -b dev\", { cwd: destination });\r\n console.log(`${color.green(\"āœ“\")} Created dev branch`);\r\n \r\n // Try to push to origin if remote exists\r\n try {\r\n await execAsync(\"git push -u origin dev\", { cwd: destination });\r\n console.log(`${color.green(\"āœ“\")} Pushed dev branch to origin`);\r\n } catch (pushError) {\r\n console.log(`${color.yellow(\"⚠\")} Could not push to origin (remote may not be configured)`);\r\n }\r\n } catch (gitError) {\r\n console.log(`${color.yellow(\"⚠\")} Git not initialized in this directory`);\r\n }\r\n } catch (error) {\r\n console.error(`Error executing commands: ${error}`);\r\n }\r\n }\r\n try {\r\n await execAsync(\"cursor .\");\r\n console.log(\"Installing packages. This might take a couple of minutes.\");\r\n console.log();\r\n await install();\r\n console.log();\r\n console.log(`${green(\"Success!\")} App installed successfully.`);\r\n console.log(cyan(\"Initializing the development server...\"));\r\n await execAsync(\"pnpm dev\");\r\n } catch (error) {\r\n console.error(`Error executing commands: ${error}`);\r\n }\r\n}\r\n\r\n// Run the main function\r\nmain().catch(console.error);\r\n","import spawn from \"cross-spawn\";\r\nimport { yellow } from \"picocolors\";\r\n\r\nexport async function install(): Promise<void> {\r\n const packageManager = \"pnpm\";\r\n const args: string[] = [\"install\"];\r\n\r\n return new Promise((resolve, reject) => {\r\n /**\r\n * Spawn the installation process.\r\n */\r\n const child = spawn(packageManager, args, {\r\n stdio: \"inherit\",\r\n env: {\r\n ...process.env,\r\n ADBLOCK: \"1\",\r\n // we set NODE_ENV to development as pnpm skips dev\r\n // dependencies when production\r\n NODE_ENV: \"development\",\r\n DISABLE_OPENCOLLECTIVE: \"1\",\r\n },\r\n });\r\n\r\n child.on(\"close\", (code) => {\r\n if (code !== 0) {\r\n reject({ command: `${packageManager} ${args.join(\" \")}` });\r\n\r\n return;\r\n }\r\n resolve();\r\n });\r\n });\r\n}\r\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,sBAAwD;AACxD,2BAAqB;AACrB,kBAA0B;AAE1B,wBAAyC;AACzC,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,G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AAM,6BAA6B,KAAK,EAAE;AAAA,EACpD;AACF;AAGA,KAAK,EAAE,MAAM,QAAQ,KAAK;","names":["import_picocolors","args","spawn","yargs","prompts","path","color"]}
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\r\n\r\nimport path from \"node:path\";\r\nimport { fileURLToPath } from \"node:url\";\r\nimport { cp, readFile, writeFile, access, rename } from \"node:fs/promises\";\r\nimport { exec } from \"child_process\";\r\nimport { promisify } from \"util\";\r\n\r\nimport { cyan, green, red, yellow } from \"picocolors\";\r\nimport { glob } from \"glob\";\r\nimport color from \"picocolors\";\r\nimport prompts from \"prompts\";\r\nimport yargs from \"yargs\";\r\nimport { hideBin } from \"yargs/helpers\";\r\n\r\nimport { install } from \"./helpers/install\";\r\nconst execAsync = promisify(exec);\r\n\r\n// Define the templates available\r\nconst TEMPLATES = [\r\n {\r\n title: \"Nextjs ts with db setup Landing with prisma\",\r\n value: \"nextjs-ts-landing-prisma\",\r\n },\r\n {\r\n title: 'Nextjs ts clean',\r\n value: 'nextjs-ts-clean'\r\n }\r\n];\r\n\r\n// Specify CLI arguments\r\nconst args = yargs(hideBin(process.argv)).options({\r\n name: {\r\n alias: \"n\",\r\n type: \"string\",\r\n description: \"Name of the project\",\r\n },\r\n template: {\r\n alias: \"t\",\r\n type: \"string\",\r\n description: \"Template to use\",\r\n },\r\n});\r\n\r\n// Override arguments passed on the CLI\r\nprompts.override(args.argv);\r\n\r\nasync function main() {\r\n // Get the initial values for the prompts\r\n const {\r\n _: [initialName, initialProject],\r\n } = await args.argv;\r\n\r\n // Create the project prompt\r\n const project = await prompts(\r\n [\r\n {\r\n type: \"text\",\r\n name: \"name\",\r\n message: \"What is the name of your project?\",\r\n initial: initialName || \"apppaaaul-project\",\r\n validate: (value) => {\r\n if (value !== \".\" && value.match(/[^a-zA-Z0-9-_]+/g)) {\r\n return \"Project name can only contain letters, numbers, dashes, underscores, or be '.' for the current directory\";\r\n }\r\n\r\n return true;\r\n },\r\n },\r\n {\r\n type: \"select\",\r\n name: \"template\",\r\n message: `Which template would you like to use?`,\r\n initial: initialProject || 0,\r\n choices: TEMPLATES,\r\n },\r\n ],\r\n {\r\n onCancel: () => {\r\n console.log(\"\\nBye šŸ‘‹\\n\");\r\n\r\n process.exit(0);\r\n },\r\n },\r\n );\r\n\r\n // Get the template folder for the selected template\r\n const template = path.join(\r\n path.dirname(fileURLToPath(import.meta.url)),\r\n \"templates\",\r\n project.template,\r\n );\r\n\r\n // Get the destination folder for the project\r\n const destination = project.name === \".\" ? process.cwd() : path.join(process.cwd(), project.name);\r\n\r\n // Copy files from the template folder to the current directory\r\n await cp(path.join(template, \"project\"), destination, { recursive: true });\r\n\r\n // Copy additional files from aditionals folder within the template\r\n try {\r\n const aditionalsPath = path.join(template, \"aditionals\");\r\n await access(aditionalsPath);\r\n \r\n // Use cp with recursive to copy all files including dotfiles\r\n await cp(aditionalsPath, destination, { recursive: true });\r\n \r\n console.log(`${color.green(\"āœ“\")} Copied additional files`);\r\n } catch (error) {\r\n console.log(`${color.yellow(\"⚠\")} Additional files folder not found in template, skipping...`);\r\n }\r\n\r\n // Get all files from the destination folder\r\n const aditionalsFiles = await glob(`**/*`, {nodir: true, cwd: destination, absolute: true});\r\n\r\n // Rename files with %% prefix\r\n for await (const file of aditionalsFiles) {\r\n const basename = path.basename(file);\r\n\r\n if (basename.startsWith(\"%%\")) {\r\n const newPath = path.join(path.dirname(file), basename.slice(2));\r\n await rename(file, newPath);\r\n }\r\n }\r\n\r\n // Get all files from the destination folder\r\n const files = await glob(`**/*`, { nodir: true, cwd: destination, absolute: true });\r\n\r\n // Read each file and replace the tokens\r\n for await (const file of files) {\r\n const data = await readFile(file, \"utf8\");\r\n const draft = data.replace(/{{name}}/g, project.name);\r\n\r\n await writeFile(file, draft, \"utf8\");\r\n }\r\n\r\n // Log outro message\r\n console.log(\"\\n✨ Project created ✨\");\r\n\r\n // Run commands if a new directory was created\r\n if (project.name !== \".\") {\r\n try {\r\n await execAsync(`cd ${project.name}`);\r\n console.log(`\\n${color.green(`cd`)} ${project.name}`);\r\n \r\n // Check if git is initialized\r\n try {\r\n await execAsync(\"git status\", { cwd: destination });\r\n console.log(`${color.green(\"āœ“\")} Git repository detected`);\r\n \r\n // Create dev branch if git is initialized\r\n await execAsync(\"git checkout -b dev\", { cwd: destination });\r\n console.log(`${color.green(\"āœ“\")} Created dev branch`);\r\n \r\n // Try to push to origin if remote exists\r\n try {\r\n await execAsync(\"git push -u origin dev\", { cwd: destination });\r\n console.log(`${color.green(\"āœ“\")} Pushed dev branch to origin`);\r\n } catch (pushError) {\r\n console.log(`${color.yellow(\"⚠\")} Could not push to origin (remote may not be configured)`);\r\n }\r\n } catch (gitError) {\r\n console.log(`${color.yellow(\"⚠\")} Git not initialized in this directory`);\r\n }\r\n } catch (error) {\r\n console.error(`Error executing commands: ${error}`);\r\n }\r\n }\r\n try {\r\n await execAsync(\"cursor .\");\r\n console.log(\"Installing packages. This might take a couple of minutes.\");\r\n console.log();\r\n await install();\r\n console.log();\r\n console.log(`${green(\"Success!\")} App installed successfully.`);\r\n console.log(cyan(\"Initializing the development server...\"));\r\n await execAsync(\"pnpm dev\");\r\n } catch (error) {\r\n console.error(`Error executing commands: ${error}`);\r\n }\r\n}\r\n\r\n// Run the main function\r\nmain().catch(console.error);\r\n","import spawn from \"cross-spawn\";\r\nimport { yellow } from \"picocolors\";\r\n\r\nexport async function install(): Promise<void> {\r\n const packageManager = \"pnpm\";\r\n const args: string[] = [\"install\"];\r\n\r\n return new Promise((resolve, reject) => {\r\n /**\r\n * Spawn the installation process.\r\n */\r\n const child = spawn(packageManager, args, {\r\n stdio: \"inherit\",\r\n env: {\r\n ...process.env,\r\n ADBLOCK: \"1\",\r\n // we set NODE_ENV to development as pnpm skips dev\r\n // dependencies when production\r\n NODE_ENV: \"development\",\r\n DISABLE_OPENCOLLECTIVE: \"1\",\r\n },\r\n });\r\n\r\n child.on(\"close\", (code) => {\r\n if (code !== 0) {\r\n reject({ command: `${packageManager} ${args.join(\" \")}` });\r\n\r\n return;\r\n }\r\n resolve();\r\n });\r\n });\r\n}\r\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,sBAAwD;AACxD,2BAAqB;AACrB,kBAA0B;AAE1B,wBAAyC;AACzC,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,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,KAAK;","names":["import_picocolors","args","spawn","yargs","prompts","path","color"]}
@@ -0,0 +1,46 @@
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+
3
+ # dependencies
4
+ /node_modules
5
+ /.pnp
6
+ .pnp.js
7
+
8
+ # testing
9
+ /coverage
10
+
11
+ # next.js
12
+ /.next/
13
+ /out/
14
+
15
+ # production
16
+ /build
17
+
18
+ # misc
19
+ .DS_Store
20
+ *.pem
21
+
22
+ # debug
23
+ npm-debug.log*
24
+ yarn-debug.log*
25
+ yarn-error.log*
26
+
27
+ # local env files
28
+ .env*.local
29
+ .env
30
+
31
+ # vercel
32
+ .vercel
33
+
34
+ # typescript
35
+ *.tsbuildinfo
36
+ next-env.d.ts
37
+
38
+ # docker
39
+ docker-compose.yml
40
+
41
+ # prisma
42
+ prisma/generated/*
43
+
44
+ # pnpm
45
+ pnpm-lock.yaml
46
+ pnpm-*
@@ -0,0 +1,46 @@
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+
3
+ # dependencies
4
+ /node_modules
5
+ /.pnp
6
+ .pnp.js
7
+
8
+ # testing
9
+ /coverage
10
+
11
+ # next.js
12
+ /.next/
13
+ /out/
14
+
15
+ # production
16
+ /build
17
+
18
+ # misc
19
+ .DS_Store
20
+ *.pem
21
+
22
+ # debug
23
+ npm-debug.log*
24
+ yarn-debug.log*
25
+ yarn-error.log*
26
+
27
+ # local env files
28
+ .env*.local
29
+ .env
30
+
31
+ # vercel
32
+ .vercel
33
+
34
+ # typescript
35
+ *.tsbuildinfo
36
+ next-env.d.ts
37
+
38
+ # docker
39
+ docker-compose.yml
40
+
41
+ # prisma
42
+ prisma/generated/*
43
+
44
+ # pnpm
45
+ pnpm-lock.yaml
46
+ pnpm-*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-apppaaaul",
3
- "version": "2.0.24",
3
+ "version": "2.0.25",
4
4
  "description": "Create projects as paaauldev would",
5
5
  "main": "index.mjs",
6
6
  "bin": {