create-make 0.8.0 → 0.8.1

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.cjs CHANGED
@@ -107,13 +107,13 @@ function _ts_generator$2(thisArg, body) {
107
107
  return { value: op[0] ? op[1] : void 0, done: true };
108
108
  }
109
109
  }
110
- var getCli = function() {
110
+ var getCli = function getCli2() {
111
111
  return _async_to_generator$2(function() {
112
112
  var version, yargsInstance, argv, projectName, template, otherTemplate;
113
113
  return _ts_generator$2(this, function(_state) {
114
114
  switch (_state.label) {
115
115
  case 0:
116
- version = "0.8.0";
116
+ version = "0.8.1";
117
117
  yargsInstance = yargs(helpers.hideBin(process.argv)).scriptName("create-make").usage("Usage: $0 [projectName] [options]").epilogue("\n\u{1F4E6} Create projects in seconds with built-in or custom templates!\n\nQuick Start:\n \u2022 Interactive mode: $0 (Guided setup)\n \u2022 Built-in template: $0 my-app -t vite-vanilla-ts (Skip prompts)\n \u2022 Custom template: $0 my-project -o express-api (Use custom config)\n\n\u{1F4A1} Tips:\n \u2022 When using --template or --other-template, projectName is required\n \u2022 Omit projectName to be prompted for it\n \u2022 Add custom templates via config file at ".concat(CONFIG_PATH, "\n\nFor more information, visit: https://github.com/z-npm/create-make\n")).example("$0", "Start interactive mode - guided project setup").example("$0 my-project", "Set project name, then choose template interactively").example("$0 my-app --template vite-vanilla-ts", "Create Vite web project (skips prompts)").example("$0 my-api -t vite-node-ts", "Create Vite Node project (alias, skips prompts)").example("$0 my-project --other-template my-backend", "Use custom template from config").example("$0 my-site -o react-starter", "Use custom template (alias)").option("template", { alias: "t", type: "string", describe: "Use built-in template (skips category/template selection)", requiresArg: true, conflicts: "other-template" }).option("other-template", { alias: "o", type: "string", describe: "Use custom template from config (skips to custom template selection)", requiresArg: true, conflicts: "template" }).option("help", { alias: "h", type: "boolean", describe: "Show help information" }).check(function(argv2) {
118
118
  if ((argv2.template || argv2["other-template"]) && !argv2._[0]) {
119
119
  throw new Error("Project name is required when using --template or --other-template");
@@ -138,12 +138,12 @@ var getCli = function() {
138
138
  })();
139
139
  };
140
140
 
141
- function _array_like_to_array(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_without_holes(arr){if(Array.isArray(arr))return _array_like_to_array(arr)}function _iterable_to_array(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _to_consumable_array(arr){return _array_without_holes(arr)||_iterable_to_array(arr)||_unsupported_iterable_to_array(arr)||_non_iterable_spread()}function _unsupported_iterable_to_array(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}var mkdir=function(path){return node_fs.mkdirSync(path,{recursive:true})};var rmRF=function(path){return node_fs.rmSync(path,{recursive:true,force:true})};var pathExists=function(path){return node_fs.existsSync(path)};var readFile=function(path){return node_fs.readFileSync(path,{encoding:"utf8"})};var writeFile=function(path,data){return node_fs.writeFileSync(path,data,{encoding:"utf8"})};var cmd=function(command){var path=arguments.length>1&&arguments[1]!==void 0?arguments[1]:process.cwd();return node_child_process.execSync(command,{stdio:[0,1,2],cwd:path})};var gitClone=function(repo,projectName){return cmd("git clone --depth=1 ".concat(repo," ").concat(projectName))};var findFile=function(dir,fileName){var exclude=arguments.length>2&&arguments[2]!==void 0?arguments[2]:["node_modules",".git"];var finds=[];node_fs.readdirSync(dir).forEach(function(file){var filePath=node_path.join(dir,file);if(!exclude.includes(filePath)){var fileStat=node_fs.statSync(filePath);if(fileStat.isDirectory())finds=_to_consumable_array(finds).concat(_to_consumable_array(findFile(filePath,fileName)));else finds.push(filePath);}});return finds};var filesChangeContent=function(path,oldContent,newContent){findFile(path,true).map(function(item){var content=node_fs.readFileSync(item,{encoding:"utf-8"});if(new RegExp("\\b"+oldContent+"\\b").test(content)){node_fs.writeFileSync(item,content.replaceAll(oldContent,newContent),{encoding:"utf-8"});}});};
141
+ function _array_like_to_array(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_without_holes(arr){if(Array.isArray(arr))return _array_like_to_array(arr)}function _iterable_to_array(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _to_consumable_array(arr){return _array_without_holes(arr)||_iterable_to_array(arr)||_unsupported_iterable_to_array(arr)||_non_iterable_spread()}function _unsupported_iterable_to_array(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}var mkdir=function mkdir(path){return node_fs.mkdirSync(path,{recursive:true})};var rmRF=function rmRF(path){return node_fs.rmSync(path,{recursive:true,force:true})};var pathExists=function pathExists(path){return node_fs.existsSync(path)};var readFile=function readFile(path){return node_fs.readFileSync(path,{encoding:"utf8"})};var writeFile=function writeFile(path,data){return node_fs.writeFileSync(path,data,{encoding:"utf8"})};var cmd=function cmd(command){var path=arguments.length>1&&arguments[1]!==void 0?arguments[1]:process.cwd();return node_child_process.execSync(command,{stdio:[0,1,2],cwd:path})};var gitClone=function gitClone(repo,projectName){return cmd("git clone --depth=1 ".concat(repo," ").concat(projectName))};var findFile=function findFile1(dir,fileName){var exclude=arguments.length>2&&arguments[2]!==void 0?arguments[2]:["node_modules",".git"];var finds=[];node_fs.readdirSync(dir).forEach(function(file){var filePath=node_path.join(dir,file);if(!exclude.includes(filePath)){var fileStat=node_fs.statSync(filePath);if(fileStat.isDirectory())finds=_to_consumable_array(finds).concat(_to_consumable_array(findFile(filePath,fileName)));else finds.push(filePath);}});return finds};var filesChangeContent=function filesChangeContent(path,oldContent,newContent){findFile(path,true).map(function(item){var content=node_fs.readFileSync(item,{encoding:"utf-8"});if(new RegExp("\\b"+oldContent+"\\b").test(content)){node_fs.writeFileSync(item,content.replaceAll(oldContent,newContent),{encoding:"utf-8"});}});};
142
142
 
143
- function _define_property$1(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else {obj[key]=value;}return obj}function _object_spread$1(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}));}ownKeys.forEach(function(key){_define_property$1(target,key,source[key]);});}return target}function ownKeys$1(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);keys.push.apply(keys,symbols);}return keys}function _object_spread_props$1(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else {ownKeys$1(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target}var getConfig=function(){var needInit=false;var config={$schema:"./schema.json",categories:{}};if(pathExists(CONFIG_PATH))config=JSON.parse(readFile(CONFIG_PATH));else needInit=true;if(needInit){mkdir(APP_PATH);writeFile(SCHEMA_PATH,JSON.stringify(DEFAULT_SCHEMA,null,2));writeFile(CONFIG_PATH,JSON.stringify(config,null,2));}return _object_spread_props$1(_object_spread$1({},config),{needInit:needInit,defaultCategories:DEFAULT_CATEGORIES})};
143
+ function _define_property$1(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else {obj[key]=value;}return obj}function _object_spread$1(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}));}ownKeys.forEach(function(key){_define_property$1(target,key,source[key]);});}return target}function ownKeys$1(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);keys.push.apply(keys,symbols);}return keys}function _object_spread_props$1(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else {ownKeys$1(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target}var getConfig=function getConfig(){var needInit=false;var config={$schema:"./schema.json",categories:{}};if(pathExists(CONFIG_PATH))config=JSON.parse(readFile(CONFIG_PATH));else needInit=true;if(needInit){mkdir(APP_PATH);writeFile(SCHEMA_PATH,JSON.stringify(DEFAULT_SCHEMA,null,2));writeFile(CONFIG_PATH,JSON.stringify(config,null,2));}return _object_spread_props$1(_object_spread$1({},config),{needInit:needInit,defaultCategories:DEFAULT_CATEGORIES})};
144
144
 
145
- function asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _async_to_generator$1(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);})}}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else {obj[key]=value;}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}));}ownKeys.forEach(function(key){_define_property(target,key,source[key]);});}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);keys.push.apply(keys,symbols);}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else {ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target}function _ts_generator$1(thisArg,body){var f,y,t,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},g=Object.create((typeof Iterator==="function"?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),typeof Symbol==="function"&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return {value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}if(op[0]&5)throw op[1];return {value:op[0]?op[1]:void 0,done:true}}}var projectPrompt=function(cli,config){return _async_to_generator$1(function(){var dcArr,tStrArr,args,repo,ucArr,tStrArr1,args1,repo1,eMsg,prompt1,defaultCategories,userDefineCategories,_answers1,_projectName,answers1,isUserDefineCategories,templates,tobj,tobj1,answers2,repo2,args2,error;return _ts_generator$1(this,function(_state){switch(_state.label){case 0:if(cli.projectName&&cli.template){dcArr=config.defaultCategories;tStrArr=[];for(var category in dcArr){for(var template in dcArr[category]){args=dcArr[category][template].args;repo=dcArr[category][template].repo;tStrArr.push(template);if(args[0].str===cli.template)return [2,{category:category,template:template,projectName:cli.projectName,args:args,repo:repo}]}}console.error('❌ Error: Template "'.concat(cli.template,'" was not found.\n')+"Available templates:\n"+" • ".concat(tStrArr.join("\n • "),"\n")+"Please select one of the templates above.");process.exit(2);}if(cli.projectName&&cli.otherTemplate){ucArr=config.categories;tStrArr1=[];for(var category1 in ucArr){for(var template1 in ucArr[category1]){args1=ucArr[category1][template1].args;repo1=ucArr[category1][template1].repo;tStrArr1.push(template1);if(args1[0].str===cli.otherTemplate)return [2,{category:category1,template:template1,projectName:cli.projectName,args:args1,repo:repo1}]}}eMsg=tStrArr1.length>0?"Available templates:\n"+" • ".concat(tStrArr1.join("\n • "),"\n")+"Please select one of the templates above.":"\nNo custom templates are currently configured.\n"+"Please check your configuration at:\n ".concat(CONFIG_PATH,"\n\n")+"To add templates, edit the configuration file and add template definitions.";console.error('❌ Error: Template "'.concat(cli.otherTemplate,'" was not found.\n').concat(eMsg));process.exit(2);}prompt1=[];defaultCategories=Object.keys(config.defaultCategories);userDefineCategories=Object.keys(config.categories);if(userDefineCategories.length>0)defaultCategories.push("Others");if(!cli.projectName)prompt1.push({type:"input",name:"projectName",message:"Project name:",default:"my-project"});prompt1.push({type:"select",name:"category",message:"Select a category:",choices:defaultCategories});_state.label=1;case 1:_state.trys.push([1,6,,7]);return [4,inquirer.prompt(prompt1)];case 2:answers1=_state.sent();(_projectName=(_answers1=answers1).projectName)!==null&&_projectName!==void 0?_projectName:_answers1.projectName=cli.projectName;isUserDefineCategories=answers1.category==="Others";if(!isUserDefineCategories)return [3,4];return [4,inquirer.prompt([{type:"select",name:"category",message:"Select a category:",choices:userDefineCategories}])];case 3:answers1.category=_state.sent().category;_state.label=4;case 4:templates=[];if(isUserDefineCategories)for(var key in config.categories[answers1.category]){tobj=config.categories[answers1.category][key];if(tobj.name)templates.push({name:"".concat(tobj.name,"(").concat(key,")"),value:key});else templates.push({name:key,value:key});}else for(var key1 in config.defaultCategories[answers1.category]){tobj1=config.defaultCategories[answers1.category][key1];if(tobj1.name)templates.push({name:"".concat(tobj1.name,"(").concat(key1,")"),value:key1});else templates.push({name:key1,value:key1});}return [4,inquirer.prompt([{type:"select",name:"template",message:"Select a template:",choices:templates}])];case 5:answers2=_state.sent();repo2=isUserDefineCategories?config.categories[answers1.category][answers2.template].repo:config.defaultCategories[answers1.category][answers2.template].repo;args2=isUserDefineCategories?config.categories[answers1.category][answers2.template].args:config.defaultCategories[answers1.category][answers2.template].args;return [2,_object_spread_props(_object_spread({},answers1,answers2),{repo:repo2,args:args2})];case 6:error=_state.sent();if(error.name==="ExitPromptError"){console.log("\nProcess interrupted. Exiting gracefully.");process.exit(0);}else {throw error}return [3,7];case 7:return [2]}})})()};
145
+ function asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _async_to_generator$1(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);})}}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else {obj[key]=value;}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}));}ownKeys.forEach(function(key){_define_property(target,key,source[key]);});}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);keys.push.apply(keys,symbols);}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else {ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target}function _ts_generator$1(thisArg,body){var f,y,t,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},g=Object.create((typeof Iterator==="function"?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),typeof Symbol==="function"&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return {value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}if(op[0]&5)throw op[1];return {value:op[0]?op[1]:void 0,done:true}}}var projectPrompt=function projectPrompt(cli,config){return _async_to_generator$1(function(){var dcArr,tStrArr,args,repo,ucArr,tStrArr1,args1,repo1,eMsg,prompt1,defaultCategories,userDefineCategories,_answers1,_projectName,answers1,isUserDefineCategories,templates,tobj,tobj1,answers2,repo2,args2,error;return _ts_generator$1(this,function(_state){switch(_state.label){case 0:if(cli.projectName&&cli.template){dcArr=config.defaultCategories;tStrArr=[];for(var category in dcArr){for(var template in dcArr[category]){args=dcArr[category][template].args;repo=dcArr[category][template].repo;tStrArr.push(template);if(args[0].str===cli.template)return [2,{category:category,template:template,projectName:cli.projectName,args:args,repo:repo}]}}console.error('❌ Error: Template "'.concat(cli.template,'" was not found.\n')+"Available templates:\n"+" • ".concat(tStrArr.join("\n • "),"\n")+"Please select one of the templates above.");process.exit(2);}if(cli.projectName&&cli.otherTemplate){ucArr=config.categories;tStrArr1=[];for(var category1 in ucArr){for(var template1 in ucArr[category1]){args1=ucArr[category1][template1].args;repo1=ucArr[category1][template1].repo;tStrArr1.push(template1);if(args1[0].str===cli.otherTemplate)return [2,{category:category1,template:template1,projectName:cli.projectName,args:args1,repo:repo1}]}}eMsg=tStrArr1.length>0?"Available templates:\n"+" • ".concat(tStrArr1.join("\n • "),"\n")+"Please select one of the templates above.":"\nNo custom templates are currently configured.\n"+"Please check your configuration at:\n ".concat(CONFIG_PATH,"\n\n")+"To add templates, edit the configuration file and add template definitions.";console.error('❌ Error: Template "'.concat(cli.otherTemplate,'" was not found.\n').concat(eMsg));process.exit(2);}prompt1=[];defaultCategories=Object.keys(config.defaultCategories);userDefineCategories=Object.keys(config.categories);if(userDefineCategories.length>0)defaultCategories.push("Others");if(!cli.projectName)prompt1.push({type:"input",name:"projectName",message:"Project name:",default:"my-project"});prompt1.push({type:"select",name:"category",message:"Select a category:",choices:defaultCategories});_state.label=1;case 1:_state.trys.push([1,6,,7]);return [4,inquirer.prompt(prompt1)];case 2:answers1=_state.sent();(_projectName=(_answers1=answers1).projectName)!==null&&_projectName!==void 0?_projectName:_answers1.projectName=cli.projectName;isUserDefineCategories=answers1.category==="Others";if(!isUserDefineCategories)return [3,4];return [4,inquirer.prompt([{type:"select",name:"category",message:"Select a category:",choices:userDefineCategories}])];case 3:answers1.category=_state.sent().category;_state.label=4;case 4:templates=[];if(isUserDefineCategories)for(var key in config.categories[answers1.category]){tobj=config.categories[answers1.category][key];if(tobj.name)templates.push({name:"".concat(tobj.name,"(").concat(key,")"),value:key});else templates.push({name:key,value:key});}else for(var key1 in config.defaultCategories[answers1.category]){tobj1=config.defaultCategories[answers1.category][key1];if(tobj1.name)templates.push({name:"".concat(tobj1.name,"(").concat(key1,")"),value:key1});else templates.push({name:key1,value:key1});}return [4,inquirer.prompt([{type:"select",name:"template",message:"Select a template:",choices:templates}])];case 5:answers2=_state.sent();repo2=isUserDefineCategories?config.categories[answers1.category][answers2.template].repo:config.defaultCategories[answers1.category][answers2.template].repo;args2=isUserDefineCategories?config.categories[answers1.category][answers2.template].args:config.defaultCategories[answers1.category][answers2.template].args;return [2,_object_spread_props(_object_spread({},answers1,answers2),{repo:repo2,args:args2})];case 6:error=_state.sent();if(error.name==="ExitPromptError"){console.log("\nProcess interrupted. Exiting gracefully.");process.exit(0);}else {throw error}return [3,7];case 7:return [2]}})})()};
146
146
 
147
- function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);})}}function _ts_generator(thisArg,body){var f,y,t,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},g=Object.create((typeof Iterator==="function"?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),typeof Symbol==="function"&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return {value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}if(op[0]&5)throw op[1];return {value:op[0]?op[1]:void 0,done:true}}}var boot=function(){return _async_to_generator(function(){var config,cli,answer,PROJECT_PATH,PROJECT_GIT_PATH;return _ts_generator(this,function(_state){switch(_state.label){case 0:console.log();config=getConfig();return [4,getCli()];case 1:cli=_state.sent();return [4,projectPrompt(cli,config)];case 2:answer=_state.sent();PROJECT_PATH="".concat(process.cwd(),"/").concat(answer.projectName);PROJECT_GIT_PATH="".concat(PROJECT_PATH,"/.git");if(pathExists(PROJECT_PATH)){console.error('❌ Error: Cannot create project "'.concat(answer.projectName,'".\n')+"A directory with this name already exists.\n"+"Please choose a different name or delete the existing folder.");process.exit(1);}gitClone(answer.repo,answer.projectName);rmRF(PROJECT_GIT_PATH);answer.args.forEach(function(item){var value=item.value==="projectName"?answer.projectName:item.value;filesChangeContent(PROJECT_PATH,item.str,value);});return [2]}})})()};
147
+ function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);})}}function _ts_generator(thisArg,body){var f,y,t,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},g=Object.create((typeof Iterator==="function"?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),typeof Symbol==="function"&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return {value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}if(op[0]&5)throw op[1];return {value:op[0]?op[1]:void 0,done:true}}}var boot=function boot(){return _async_to_generator(function(){var config,cli,answer,PROJECT_PATH,PROJECT_GIT_PATH;return _ts_generator(this,function(_state){switch(_state.label){case 0:console.log();config=getConfig();return [4,getCli()];case 1:cli=_state.sent();return [4,projectPrompt(cli,config)];case 2:answer=_state.sent();PROJECT_PATH="".concat(process.cwd(),"/").concat(answer.projectName);PROJECT_GIT_PATH="".concat(PROJECT_PATH,"/.git");if(pathExists(PROJECT_PATH)){console.error('❌ Error: Cannot create project "'.concat(answer.projectName,'".\n')+"A directory with this name already exists.\n"+"Please choose a different name or delete the existing folder.");process.exit(1);}gitClone(answer.repo,answer.projectName);rmRF(PROJECT_GIT_PATH);answer.args.forEach(function(item){var value=item.value==="projectName"?answer.projectName:item.value;filesChangeContent(PROJECT_PATH,item.str,value);});return [2]}})})()};
148
148
 
149
149
  module.exports = boot;
package/dist/index.js CHANGED
@@ -105,13 +105,13 @@ function _ts_generator$2(thisArg, body) {
105
105
  return { value: op[0] ? op[1] : void 0, done: true };
106
106
  }
107
107
  }
108
- var getCli = function() {
108
+ var getCli = function getCli2() {
109
109
  return _async_to_generator$2(function() {
110
110
  var version, yargsInstance, argv, projectName, template, otherTemplate;
111
111
  return _ts_generator$2(this, function(_state) {
112
112
  switch (_state.label) {
113
113
  case 0:
114
- version = "0.8.0";
114
+ version = "0.8.1";
115
115
  yargsInstance = yargs(hideBin(process.argv)).scriptName("create-make").usage("Usage: $0 [projectName] [options]").epilogue("\n\u{1F4E6} Create projects in seconds with built-in or custom templates!\n\nQuick Start:\n \u2022 Interactive mode: $0 (Guided setup)\n \u2022 Built-in template: $0 my-app -t vite-vanilla-ts (Skip prompts)\n \u2022 Custom template: $0 my-project -o express-api (Use custom config)\n\n\u{1F4A1} Tips:\n \u2022 When using --template or --other-template, projectName is required\n \u2022 Omit projectName to be prompted for it\n \u2022 Add custom templates via config file at ".concat(CONFIG_PATH, "\n\nFor more information, visit: https://github.com/z-npm/create-make\n")).example("$0", "Start interactive mode - guided project setup").example("$0 my-project", "Set project name, then choose template interactively").example("$0 my-app --template vite-vanilla-ts", "Create Vite web project (skips prompts)").example("$0 my-api -t vite-node-ts", "Create Vite Node project (alias, skips prompts)").example("$0 my-project --other-template my-backend", "Use custom template from config").example("$0 my-site -o react-starter", "Use custom template (alias)").option("template", { alias: "t", type: "string", describe: "Use built-in template (skips category/template selection)", requiresArg: true, conflicts: "other-template" }).option("other-template", { alias: "o", type: "string", describe: "Use custom template from config (skips to custom template selection)", requiresArg: true, conflicts: "template" }).option("help", { alias: "h", type: "boolean", describe: "Show help information" }).check(function(argv2) {
116
116
  if ((argv2.template || argv2["other-template"]) && !argv2._[0]) {
117
117
  throw new Error("Project name is required when using --template or --other-template");
@@ -136,12 +136,12 @@ var getCli = function() {
136
136
  })();
137
137
  };
138
138
 
139
- function _array_like_to_array(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_without_holes(arr){if(Array.isArray(arr))return _array_like_to_array(arr)}function _iterable_to_array(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _to_consumable_array(arr){return _array_without_holes(arr)||_iterable_to_array(arr)||_unsupported_iterable_to_array(arr)||_non_iterable_spread()}function _unsupported_iterable_to_array(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}var mkdir=function(path){return mkdirSync(path,{recursive:true})};var rmRF=function(path){return rmSync(path,{recursive:true,force:true})};var pathExists=function(path){return existsSync(path)};var readFile=function(path){return readFileSync(path,{encoding:"utf8"})};var writeFile=function(path,data){return writeFileSync(path,data,{encoding:"utf8"})};var cmd=function(command){var path=arguments.length>1&&arguments[1]!==void 0?arguments[1]:process.cwd();return execSync(command,{stdio:[0,1,2],cwd:path})};var gitClone=function(repo,projectName){return cmd("git clone --depth=1 ".concat(repo," ").concat(projectName))};var findFile=function(dir,fileName){var exclude=arguments.length>2&&arguments[2]!==void 0?arguments[2]:["node_modules",".git"];var finds=[];readdirSync(dir).forEach(function(file){var filePath=join(dir,file);if(!exclude.includes(filePath)){var fileStat=statSync(filePath);if(fileStat.isDirectory())finds=_to_consumable_array(finds).concat(_to_consumable_array(findFile(filePath,fileName)));else finds.push(filePath);}});return finds};var filesChangeContent=function(path,oldContent,newContent){findFile(path,true).map(function(item){var content=readFileSync(item,{encoding:"utf-8"});if(new RegExp("\\b"+oldContent+"\\b").test(content)){writeFileSync(item,content.replaceAll(oldContent,newContent),{encoding:"utf-8"});}});};
139
+ function _array_like_to_array(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_without_holes(arr){if(Array.isArray(arr))return _array_like_to_array(arr)}function _iterable_to_array(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _to_consumable_array(arr){return _array_without_holes(arr)||_iterable_to_array(arr)||_unsupported_iterable_to_array(arr)||_non_iterable_spread()}function _unsupported_iterable_to_array(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}var mkdir=function mkdir(path){return mkdirSync(path,{recursive:true})};var rmRF=function rmRF(path){return rmSync(path,{recursive:true,force:true})};var pathExists=function pathExists(path){return existsSync(path)};var readFile=function readFile(path){return readFileSync(path,{encoding:"utf8"})};var writeFile=function writeFile(path,data){return writeFileSync(path,data,{encoding:"utf8"})};var cmd=function cmd(command){var path=arguments.length>1&&arguments[1]!==void 0?arguments[1]:process.cwd();return execSync(command,{stdio:[0,1,2],cwd:path})};var gitClone=function gitClone(repo,projectName){return cmd("git clone --depth=1 ".concat(repo," ").concat(projectName))};var findFile=function findFile1(dir,fileName){var exclude=arguments.length>2&&arguments[2]!==void 0?arguments[2]:["node_modules",".git"];var finds=[];readdirSync(dir).forEach(function(file){var filePath=join(dir,file);if(!exclude.includes(filePath)){var fileStat=statSync(filePath);if(fileStat.isDirectory())finds=_to_consumable_array(finds).concat(_to_consumable_array(findFile(filePath,fileName)));else finds.push(filePath);}});return finds};var filesChangeContent=function filesChangeContent(path,oldContent,newContent){findFile(path,true).map(function(item){var content=readFileSync(item,{encoding:"utf-8"});if(new RegExp("\\b"+oldContent+"\\b").test(content)){writeFileSync(item,content.replaceAll(oldContent,newContent),{encoding:"utf-8"});}});};
140
140
 
141
- function _define_property$1(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else {obj[key]=value;}return obj}function _object_spread$1(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}));}ownKeys.forEach(function(key){_define_property$1(target,key,source[key]);});}return target}function ownKeys$1(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);keys.push.apply(keys,symbols);}return keys}function _object_spread_props$1(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else {ownKeys$1(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target}var getConfig=function(){var needInit=false;var config={$schema:"./schema.json",categories:{}};if(pathExists(CONFIG_PATH))config=JSON.parse(readFile(CONFIG_PATH));else needInit=true;if(needInit){mkdir(APP_PATH);writeFile(SCHEMA_PATH,JSON.stringify(DEFAULT_SCHEMA,null,2));writeFile(CONFIG_PATH,JSON.stringify(config,null,2));}return _object_spread_props$1(_object_spread$1({},config),{needInit:needInit,defaultCategories:DEFAULT_CATEGORIES})};
141
+ function _define_property$1(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else {obj[key]=value;}return obj}function _object_spread$1(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}));}ownKeys.forEach(function(key){_define_property$1(target,key,source[key]);});}return target}function ownKeys$1(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);keys.push.apply(keys,symbols);}return keys}function _object_spread_props$1(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else {ownKeys$1(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target}var getConfig=function getConfig(){var needInit=false;var config={$schema:"./schema.json",categories:{}};if(pathExists(CONFIG_PATH))config=JSON.parse(readFile(CONFIG_PATH));else needInit=true;if(needInit){mkdir(APP_PATH);writeFile(SCHEMA_PATH,JSON.stringify(DEFAULT_SCHEMA,null,2));writeFile(CONFIG_PATH,JSON.stringify(config,null,2));}return _object_spread_props$1(_object_spread$1({},config),{needInit:needInit,defaultCategories:DEFAULT_CATEGORIES})};
142
142
 
143
- function asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _async_to_generator$1(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);})}}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else {obj[key]=value;}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}));}ownKeys.forEach(function(key){_define_property(target,key,source[key]);});}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);keys.push.apply(keys,symbols);}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else {ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target}function _ts_generator$1(thisArg,body){var f,y,t,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},g=Object.create((typeof Iterator==="function"?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),typeof Symbol==="function"&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return {value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}if(op[0]&5)throw op[1];return {value:op[0]?op[1]:void 0,done:true}}}var projectPrompt=function(cli,config){return _async_to_generator$1(function(){var dcArr,tStrArr,args,repo,ucArr,tStrArr1,args1,repo1,eMsg,prompt1,defaultCategories,userDefineCategories,_answers1,_projectName,answers1,isUserDefineCategories,templates,tobj,tobj1,answers2,repo2,args2,error;return _ts_generator$1(this,function(_state){switch(_state.label){case 0:if(cli.projectName&&cli.template){dcArr=config.defaultCategories;tStrArr=[];for(var category in dcArr){for(var template in dcArr[category]){args=dcArr[category][template].args;repo=dcArr[category][template].repo;tStrArr.push(template);if(args[0].str===cli.template)return [2,{category:category,template:template,projectName:cli.projectName,args:args,repo:repo}]}}console.error('❌ Error: Template "'.concat(cli.template,'" was not found.\n')+"Available templates:\n"+" • ".concat(tStrArr.join("\n • "),"\n")+"Please select one of the templates above.");process.exit(2);}if(cli.projectName&&cli.otherTemplate){ucArr=config.categories;tStrArr1=[];for(var category1 in ucArr){for(var template1 in ucArr[category1]){args1=ucArr[category1][template1].args;repo1=ucArr[category1][template1].repo;tStrArr1.push(template1);if(args1[0].str===cli.otherTemplate)return [2,{category:category1,template:template1,projectName:cli.projectName,args:args1,repo:repo1}]}}eMsg=tStrArr1.length>0?"Available templates:\n"+" • ".concat(tStrArr1.join("\n • "),"\n")+"Please select one of the templates above.":"\nNo custom templates are currently configured.\n"+"Please check your configuration at:\n ".concat(CONFIG_PATH,"\n\n")+"To add templates, edit the configuration file and add template definitions.";console.error('❌ Error: Template "'.concat(cli.otherTemplate,'" was not found.\n').concat(eMsg));process.exit(2);}prompt1=[];defaultCategories=Object.keys(config.defaultCategories);userDefineCategories=Object.keys(config.categories);if(userDefineCategories.length>0)defaultCategories.push("Others");if(!cli.projectName)prompt1.push({type:"input",name:"projectName",message:"Project name:",default:"my-project"});prompt1.push({type:"select",name:"category",message:"Select a category:",choices:defaultCategories});_state.label=1;case 1:_state.trys.push([1,6,,7]);return [4,inquirer.prompt(prompt1)];case 2:answers1=_state.sent();(_projectName=(_answers1=answers1).projectName)!==null&&_projectName!==void 0?_projectName:_answers1.projectName=cli.projectName;isUserDefineCategories=answers1.category==="Others";if(!isUserDefineCategories)return [3,4];return [4,inquirer.prompt([{type:"select",name:"category",message:"Select a category:",choices:userDefineCategories}])];case 3:answers1.category=_state.sent().category;_state.label=4;case 4:templates=[];if(isUserDefineCategories)for(var key in config.categories[answers1.category]){tobj=config.categories[answers1.category][key];if(tobj.name)templates.push({name:"".concat(tobj.name,"(").concat(key,")"),value:key});else templates.push({name:key,value:key});}else for(var key1 in config.defaultCategories[answers1.category]){tobj1=config.defaultCategories[answers1.category][key1];if(tobj1.name)templates.push({name:"".concat(tobj1.name,"(").concat(key1,")"),value:key1});else templates.push({name:key1,value:key1});}return [4,inquirer.prompt([{type:"select",name:"template",message:"Select a template:",choices:templates}])];case 5:answers2=_state.sent();repo2=isUserDefineCategories?config.categories[answers1.category][answers2.template].repo:config.defaultCategories[answers1.category][answers2.template].repo;args2=isUserDefineCategories?config.categories[answers1.category][answers2.template].args:config.defaultCategories[answers1.category][answers2.template].args;return [2,_object_spread_props(_object_spread({},answers1,answers2),{repo:repo2,args:args2})];case 6:error=_state.sent();if(error.name==="ExitPromptError"){console.log("\nProcess interrupted. Exiting gracefully.");process.exit(0);}else {throw error}return [3,7];case 7:return [2]}})})()};
143
+ function asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _async_to_generator$1(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);})}}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else {obj[key]=value;}return obj}function _object_spread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}));}ownKeys.forEach(function(key){_define_property(target,key,source[key]);});}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);keys.push.apply(keys,symbols);}return keys}function _object_spread_props(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else {ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target}function _ts_generator$1(thisArg,body){var f,y,t,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},g=Object.create((typeof Iterator==="function"?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),typeof Symbol==="function"&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return {value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}if(op[0]&5)throw op[1];return {value:op[0]?op[1]:void 0,done:true}}}var projectPrompt=function projectPrompt(cli,config){return _async_to_generator$1(function(){var dcArr,tStrArr,args,repo,ucArr,tStrArr1,args1,repo1,eMsg,prompt1,defaultCategories,userDefineCategories,_answers1,_projectName,answers1,isUserDefineCategories,templates,tobj,tobj1,answers2,repo2,args2,error;return _ts_generator$1(this,function(_state){switch(_state.label){case 0:if(cli.projectName&&cli.template){dcArr=config.defaultCategories;tStrArr=[];for(var category in dcArr){for(var template in dcArr[category]){args=dcArr[category][template].args;repo=dcArr[category][template].repo;tStrArr.push(template);if(args[0].str===cli.template)return [2,{category:category,template:template,projectName:cli.projectName,args:args,repo:repo}]}}console.error('❌ Error: Template "'.concat(cli.template,'" was not found.\n')+"Available templates:\n"+" • ".concat(tStrArr.join("\n • "),"\n")+"Please select one of the templates above.");process.exit(2);}if(cli.projectName&&cli.otherTemplate){ucArr=config.categories;tStrArr1=[];for(var category1 in ucArr){for(var template1 in ucArr[category1]){args1=ucArr[category1][template1].args;repo1=ucArr[category1][template1].repo;tStrArr1.push(template1);if(args1[0].str===cli.otherTemplate)return [2,{category:category1,template:template1,projectName:cli.projectName,args:args1,repo:repo1}]}}eMsg=tStrArr1.length>0?"Available templates:\n"+" • ".concat(tStrArr1.join("\n • "),"\n")+"Please select one of the templates above.":"\nNo custom templates are currently configured.\n"+"Please check your configuration at:\n ".concat(CONFIG_PATH,"\n\n")+"To add templates, edit the configuration file and add template definitions.";console.error('❌ Error: Template "'.concat(cli.otherTemplate,'" was not found.\n').concat(eMsg));process.exit(2);}prompt1=[];defaultCategories=Object.keys(config.defaultCategories);userDefineCategories=Object.keys(config.categories);if(userDefineCategories.length>0)defaultCategories.push("Others");if(!cli.projectName)prompt1.push({type:"input",name:"projectName",message:"Project name:",default:"my-project"});prompt1.push({type:"select",name:"category",message:"Select a category:",choices:defaultCategories});_state.label=1;case 1:_state.trys.push([1,6,,7]);return [4,inquirer.prompt(prompt1)];case 2:answers1=_state.sent();(_projectName=(_answers1=answers1).projectName)!==null&&_projectName!==void 0?_projectName:_answers1.projectName=cli.projectName;isUserDefineCategories=answers1.category==="Others";if(!isUserDefineCategories)return [3,4];return [4,inquirer.prompt([{type:"select",name:"category",message:"Select a category:",choices:userDefineCategories}])];case 3:answers1.category=_state.sent().category;_state.label=4;case 4:templates=[];if(isUserDefineCategories)for(var key in config.categories[answers1.category]){tobj=config.categories[answers1.category][key];if(tobj.name)templates.push({name:"".concat(tobj.name,"(").concat(key,")"),value:key});else templates.push({name:key,value:key});}else for(var key1 in config.defaultCategories[answers1.category]){tobj1=config.defaultCategories[answers1.category][key1];if(tobj1.name)templates.push({name:"".concat(tobj1.name,"(").concat(key1,")"),value:key1});else templates.push({name:key1,value:key1});}return [4,inquirer.prompt([{type:"select",name:"template",message:"Select a template:",choices:templates}])];case 5:answers2=_state.sent();repo2=isUserDefineCategories?config.categories[answers1.category][answers2.template].repo:config.defaultCategories[answers1.category][answers2.template].repo;args2=isUserDefineCategories?config.categories[answers1.category][answers2.template].args:config.defaultCategories[answers1.category][answers2.template].args;return [2,_object_spread_props(_object_spread({},answers1,answers2),{repo:repo2,args:args2})];case 6:error=_state.sent();if(error.name==="ExitPromptError"){console.log("\nProcess interrupted. Exiting gracefully.");process.exit(0);}else {throw error}return [3,7];case 7:return [2]}})})()};
144
144
 
145
- function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);})}}function _ts_generator(thisArg,body){var f,y,t,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},g=Object.create((typeof Iterator==="function"?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),typeof Symbol==="function"&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return {value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}if(op[0]&5)throw op[1];return {value:op[0]?op[1]:void 0,done:true}}}var boot=function(){return _async_to_generator(function(){var config,cli,answer,PROJECT_PATH,PROJECT_GIT_PATH;return _ts_generator(this,function(_state){switch(_state.label){case 0:console.log();config=getConfig();return [4,getCli()];case 1:cli=_state.sent();return [4,projectPrompt(cli,config)];case 2:answer=_state.sent();PROJECT_PATH="".concat(process.cwd(),"/").concat(answer.projectName);PROJECT_GIT_PATH="".concat(PROJECT_PATH,"/.git");if(pathExists(PROJECT_PATH)){console.error('❌ Error: Cannot create project "'.concat(answer.projectName,'".\n')+"A directory with this name already exists.\n"+"Please choose a different name or delete the existing folder.");process.exit(1);}gitClone(answer.repo,answer.projectName);rmRF(PROJECT_GIT_PATH);answer.args.forEach(function(item){var value=item.value==="projectName"?answer.projectName:item.value;filesChangeContent(PROJECT_PATH,item.str,value);});return [2]}})})()};
145
+ function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);})}}function _ts_generator(thisArg,body){var f,y,t,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},g=Object.create((typeof Iterator==="function"?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),typeof Symbol==="function"&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return {value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}if(op[0]&5)throw op[1];return {value:op[0]?op[1]:void 0,done:true}}}var boot=function boot(){return _async_to_generator(function(){var config,cli,answer,PROJECT_PATH,PROJECT_GIT_PATH;return _ts_generator(this,function(_state){switch(_state.label){case 0:console.log();config=getConfig();return [4,getCli()];case 1:cli=_state.sent();return [4,projectPrompt(cli,config)];case 2:answer=_state.sent();PROJECT_PATH="".concat(process.cwd(),"/").concat(answer.projectName);PROJECT_GIT_PATH="".concat(PROJECT_PATH,"/.git");if(pathExists(PROJECT_PATH)){console.error('❌ Error: Cannot create project "'.concat(answer.projectName,'".\n')+"A directory with this name already exists.\n"+"Please choose a different name or delete the existing folder.");process.exit(1);}gitClone(answer.repo,answer.projectName);rmRF(PROJECT_GIT_PATH);answer.args.forEach(function(item){var value=item.value==="projectName"?answer.projectName:item.value;filesChangeContent(PROJECT_PATH,item.str,value);});return [2]}})})()};
146
146
 
147
147
  export { boot as default };
package/dist/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.8.0"
2
+ "version": "0.8.1"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-make",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "An advanced CLI tool for creating projects from GitHub repositories or custom templates with lightning-fast setup.",
5
5
  "homepage": "https://github.com/z-npm/create-make#readme",
6
6
  "docs": "https://github.com/z-npm/create-make#readme",
@@ -62,16 +62,16 @@
62
62
  "local": "yarn build && yarn unlink && yarn link && yarn create make"
63
63
  },
64
64
  "devDependencies": {
65
+ "@o.z/vite-plugin-swc": "^0.6.1",
65
66
  "@types/inquirer": "^9.0.9",
66
- "@types/node": "^25.0.9",
67
+ "@types/node": "^25.2.3",
67
68
  "@types/yargs": "^17.0.35",
68
- "@z-code/vite-plugin-swc": "^0.5.5",
69
69
  "rollup-plugin-node-externals": "^8.1.2",
70
70
  "typescript": "^5.9.3",
71
71
  "vite": "^7.3.1"
72
72
  },
73
73
  "dependencies": {
74
- "inquirer": "^13.2.0",
74
+ "inquirer": "^13.2.4",
75
75
  "yargs": "^18.0.0"
76
76
  },
77
77
  "engines": {