@pixpilot/scaffoldfy 0.46.0 → 0.47.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/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/package.json +3 -3
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const e=require(`./configurations-p7mObBX2.cjs`);require(`./initial-config-CESipc-c.cjs`),require(`./tasks-Bu7OY2dL.cjs`);const t=require(`./validate-scaffoldfy-json-DOjEpTxr.cjs`);require(`./scaffoldfy-config-validator-BvNnGMO1.cjs`);const n=require(`./src-CQtJwNYw.cjs`);let r=require(`node:fs`);r=e.I(r);let i=require(`node:path`);i=e.I(i);let a=require(`node:process`);a=e.I(a);let o=require(`commander`);o=e.I(o);const s=1,c=new o.Command,
|
|
2
|
+
const e=require(`./configurations-p7mObBX2.cjs`);require(`./initial-config-CESipc-c.cjs`),require(`./tasks-Bu7OY2dL.cjs`);const t=require(`./validate-scaffoldfy-json-DOjEpTxr.cjs`);require(`./scaffoldfy-config-validator-BvNnGMO1.cjs`);const n=require(`./src-CQtJwNYw.cjs`);let r=require(`node:fs`);r=e.I(r);let i=require(`node:path`);i=e.I(i);let a=require(`node:process`);a=e.I(a);let o=require(`commander`);o=e.I(o);const s=1;let c=0;const l={};function u(e=`Loading`){let t=[`|`,`/`,`-`,`\\`,`.`,`..`,`...`],n=0;c++;let r=c;return process.stdout.write(`${e} `),l[r]=setInterval(()=>{process.stdout.write(`\r${e} ${t[n%t.length]} `),n++},120),r}function d(e){l[e]&&(clearInterval(l[e]),delete l[e],process.stdout.write(`\r`),process.stdout.write(`${` `.repeat(30)}\r`))}const f=new o.Command,p=i.default.join(__dirname,`..`,`package.json`);let m=`0.0.0`;try{m=JSON.parse(r.default.readFileSync(p,`utf-8`)).version??`0.0.0`}catch{}f.name(`scaffoldfy`).description(`Automate project setup and configuration with customizable tasks`).version(m),f.option(`--dry-run`,`Run in dry mode without making any changes`).option(`--force`,`Force execution even if checks fail`).option(`--config <path>`,`Path to task configuration file (JSON or TypeScript)`,`./scaffoldfy.json`).option(`--no-validate`,`Skip schema validation of task configuration (validation is enabled by default)`).option(`--debug`,`Enable debug logging for verbose output`).action(async o=>{o.debug===!0&&e.O(!0);try{let s=[],c,l,f,p,m;if(o.config!=null&&o.config!==``){let n=i.default.resolve(a.default.cwd(),o.config);if(r.default.existsSync(n))if(m=n,n.endsWith(`.ts`)||n.endsWith(`.mts`)){e.D(`Loading tasks from TypeScript file: ${o.config}`,`info`);try{let t=await import(n);s=t.default??t.tasks??[],(!Array.isArray(s)||s.length===0)&&(e.D(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),e.D(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(t){e.D(`Failed to load TypeScript config file: ${o.config}`,`error`),t instanceof Error&&e.D(` Error: ${t.message}`,`error`),a.default.exit(1)}}else try{if(o.validate!==!1){e.w(`Validating task configuration against schema...`);let i=r.default.readFileSync(n,`utf-8`);t.r(JSON.parse(i),{silent:!1}).valid||(e.D(``,`error`),e.D(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),a.default.exit(1)),e.D(`Configuration validated`,`success`)}let i=u(`Loading config`),m;try{m=await e.n(n,{sequential:!0})}finally{d(i)}if(m.configs!=null&&m.configs.length>0){let{runConfigurationSequentially:e}=await Promise.resolve().then(()=>require(`./run-configuration-sequentially-C0qg6_dB.cjs`)),{createInitialConfig:t}=await Promise.resolve().then(()=>require(`./initial-config-CbzFPdT_.cjs`));await e(m.configs,{dryRun:o.dryRun??!1,force:o.force??!1,configFilePath:n},t()),a.default.exit(0)}s=m.tasks,c=m.variables,l=m.prompts,f=m.enabled,p=m.transformers,Array.isArray(s)||(e.D(`❌ Invalid config file format`,`error`),e.D(`Expected JSON with { "tasks": [...] } structure`,`info`),a.default.exit(1))}catch(t){e.D(`Failed to load JSON config file: ${o.config}`,`error`),t instanceof Error&&e.D(` Error: ${t.message}`,`error`),a.default.exit(1)}else e.D(`Config file not found: ${o.config}`,`warn`)}let h=l!=null&&l.length>0||c!=null&&c.length>0;s.length===0&&!h&&(e.D(`❌ No tasks defined`,`error`),e.D(`Please provide tasks using one of these methods:`,`info`),e.D(` 1. Create a template-tasks.json file in the current directory`,`info`),e.D(` 2. Create a template-tasks.ts file in the current directory`,`info`),e.D(` 3. Use --config option to specify a different config file`,`info`),e.D(`Example JSON structure:`,`info`),console.log(JSON.stringify({tasks:[{id:`update-package`,name:`Update package.json`,description:`Update package.json with repository information`,required:!0,enabled:!0,type:`update-json`,prompts:[{id:`projectName`,type:`input`,message:`What is your project name?`,default:`my-project`,required:!0},{id:`includeTests`,type:`confirm`,message:`Include test files?`,default:!0}],config:{file:`package.json`,updates:{name:`{{projectName}}`,author:`{{author}}`}}}]},null,2)),a.default.exit(1)),s.length===0?e.D(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):e.D(`Loaded ${s.length} task(s)`,`success`),await n.t(s,{dryRun:o.dryRun,force:o.force,configFilePath:m,variables:c,prompts:l,configEnabled:f,transformers:p})}catch(t){if(e.D(`❌ CLI execution failed`,`error`),t instanceof Error){e.D(`Error: ${t.message}`,`error`);let n=a.default.env.DEBUG;n!=null&&n!==``&&console.error(t.stack)}else console.error(t);a.default.exit(1)}}),f.parse(a.default.argv);
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{D as e,O as t,n,w as r}from"./configurations-BkbRfqFu.js";import"./initial-config-Dt0jw4Vs.js";import"./tasks-B_F96F0B.js";import{r as i}from"./validate-scaffoldfy-json-CnxkydtB.js";import"./scaffoldfy-config-validator-D1iJBnRE.js";import{t as a}from"./src-Cm9BoA-P.js";import o from"node:path";import{fileURLToPath as s}from"node:url";import c from"node:fs";import l from"node:process";import{Command as u}from"commander";const d=()=>s(import.meta.url),f=(()=>o.dirname(d()))(),p=new u,
|
|
2
|
+
import{D as e,O as t,n,w as r}from"./configurations-BkbRfqFu.js";import"./initial-config-Dt0jw4Vs.js";import"./tasks-B_F96F0B.js";import{r as i}from"./validate-scaffoldfy-json-CnxkydtB.js";import"./scaffoldfy-config-validator-D1iJBnRE.js";import{t as a}from"./src-Cm9BoA-P.js";import o from"node:path";import{fileURLToPath as s}from"node:url";import c from"node:fs";import l from"node:process";import{Command as u}from"commander";const d=()=>s(import.meta.url),f=(()=>o.dirname(d()))();let p=0;const m={};function h(e=`Loading`){let t=[`|`,`/`,`-`,`\\`,`.`,`..`,`...`],n=0;p++;let r=p;return process.stdout.write(`${e} `),m[r]=setInterval(()=>{process.stdout.write(`\r${e} ${t[n%t.length]} `),n++},120),r}function g(e){m[e]&&(clearInterval(m[e]),delete m[e],process.stdout.write(`\r`),process.stdout.write(`${` `.repeat(30)}\r`))}const _=new u,v=o.join(f,`..`,`package.json`);let y=`0.0.0`;try{y=JSON.parse(c.readFileSync(v,`utf-8`)).version??`0.0.0`}catch{}_.name(`scaffoldfy`).description(`Automate project setup and configuration with customizable tasks`).version(y),_.option(`--dry-run`,`Run in dry mode without making any changes`).option(`--force`,`Force execution even if checks fail`).option(`--config <path>`,`Path to task configuration file (JSON or TypeScript)`,`./scaffoldfy.json`).option(`--no-validate`,`Skip schema validation of task configuration (validation is enabled by default)`).option(`--debug`,`Enable debug logging for verbose output`).action(async s=>{s.debug===!0&&t(!0);try{let t=[],u,d,f,p,m;if(s.config!=null&&s.config!==``){let a=o.resolve(l.cwd(),s.config);if(c.existsSync(a))if(m=a,a.endsWith(`.ts`)||a.endsWith(`.mts`)){e(`Loading tasks from TypeScript file: ${s.config}`,`info`);try{let n=await import(a);t=n.default??n.tasks??[],(!Array.isArray(t)||t.length===0)&&(e(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),e(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(t){e(`Failed to load TypeScript config file: ${s.config}`,`error`),t instanceof Error&&e(` Error: ${t.message}`,`error`),l.exit(1)}}else try{if(s.validate!==!1){r(`Validating task configuration against schema...`);let t=c.readFileSync(a,`utf-8`);i(JSON.parse(t),{silent:!1}).valid||(e(``,`error`),e(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),l.exit(1)),e(`Configuration validated`,`success`)}let o=h(`Loading config`),m;try{m=await n(a,{sequential:!0})}finally{g(o)}if(m.configs!=null&&m.configs.length>0){let{runConfigurationSequentially:e}=await import(`./run-configuration-sequentially-MGVooWf1.js`),{createInitialConfig:t}=await import(`./initial-config-V9mm6hls.js`);await e(m.configs,{dryRun:s.dryRun??!1,force:s.force??!1,configFilePath:a},t()),l.exit(0)}t=m.tasks,u=m.variables,d=m.prompts,f=m.enabled,p=m.transformers,Array.isArray(t)||(e(`❌ Invalid config file format`,`error`),e(`Expected JSON with { "tasks": [...] } structure`,`info`),l.exit(1))}catch(t){e(`Failed to load JSON config file: ${s.config}`,`error`),t instanceof Error&&e(` Error: ${t.message}`,`error`),l.exit(1)}else e(`Config file not found: ${s.config}`,`warn`)}let _=d!=null&&d.length>0||u!=null&&u.length>0;t.length===0&&!_&&(e(`❌ No tasks defined`,`error`),e(`Please provide tasks using one of these methods:`,`info`),e(` 1. Create a template-tasks.json file in the current directory`,`info`),e(` 2. Create a template-tasks.ts file in the current directory`,`info`),e(` 3. Use --config option to specify a different config file`,`info`),e(`Example JSON structure:`,`info`),console.log(JSON.stringify({tasks:[{id:`update-package`,name:`Update package.json`,description:`Update package.json with repository information`,required:!0,enabled:!0,type:`update-json`,prompts:[{id:`projectName`,type:`input`,message:`What is your project name?`,default:`my-project`,required:!0},{id:`includeTests`,type:`confirm`,message:`Include test files?`,default:!0}],config:{file:`package.json`,updates:{name:`{{projectName}}`,author:`{{author}}`}}}]},null,2)),l.exit(1)),t.length===0?e(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):e(`Loaded ${t.length} task(s)`,`success`),await a(t,{dryRun:s.dryRun,force:s.force,configFilePath:m,variables:u,prompts:d,configEnabled:f,transformers:p})}catch(t){if(e(`❌ CLI execution failed`,`error`),t instanceof Error){e(`Error: ${t.message}`,`error`);let n=l.env.DEBUG;n!=null&&n!==``&&console.error(t.stack)}else console.error(t);l.exit(1)}}),_.parse(l.argv);export{};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixpilot/scaffoldfy",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.47.0",
|
|
5
5
|
"author": "PixPilot <m.doaie@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"tsdown": "^0.15.10",
|
|
50
50
|
"typescript": "^5.9.3",
|
|
51
51
|
"@internal/eslint-config": "0.3.0",
|
|
52
|
+
"@internal/prettier-config": "0.0.1",
|
|
52
53
|
"@internal/tsconfig": "0.1.0",
|
|
53
|
-
"@internal/tsdown-config": "0.1.0",
|
|
54
54
|
"@internal/vitest-config": "0.1.0",
|
|
55
|
-
"@internal/
|
|
55
|
+
"@internal/tsdown-config": "0.1.0"
|
|
56
56
|
},
|
|
57
57
|
"prettier": "@internal/prettier-config",
|
|
58
58
|
"scripts": {
|