create-make 0.6.1 → 0.7.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Zero <github.com/z-nerd>
3
+ Copyright (c) 2026 Zero Red<github.com/zero-red-dev>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.cjs CHANGED
@@ -1,18 +1,22 @@
1
1
  'use strict';
2
2
 
3
+ const yargs = require('yargs');
4
+ const helpers = require('yargs/helpers');
3
5
  const node_fs = require('node:fs');
4
6
  const node_child_process = require('node:child_process');
5
7
  const node_path = require('node:path');
6
8
  const inquirer = require('inquirer');
7
9
 
10
+ function asyncGeneratorStep$2(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$2(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);})}}function _ts_generator$2(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=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(_)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 getCli=/*#__PURE__*/function(){var _ref=_async_to_generator$2(function(){var yargsInstance,argv,projectName,template,otherTemplate;return _ts_generator$2(this,function(_state){switch(_state.label){case 0:yargsInstance=yargs(helpers.hideBin(process.argv)).scriptName("create-make").usage("Usage: $0 <projectName> [options]").example("$0 my-project","Create a new project").example("$0 my-project --template vite-vanilla-ts","Create a project with Vite web template").example("$0 my-project -t vite-node-ts","Create a project with Vite Node template").option("template",{alias:"t",type:"string",description:"Specify the template to use"}).option("other-template",{alias:"o",type:"string",description:"Specify the other template to use"}).version().alias("v","version").help().alias("h","help");return [4,yargsInstance.parseAsync()];case 1:argv=_state.sent();projectName=argv._[0];template=argv.template;otherTemplate=argv.otherTemplate;if((template||otherTemplate)&&!projectName){console.error("❌ Error: Project name is required");console.error("\uD83D\uDCD6 Usage: create-make <project-name>");console.error("\uD83D\uDCA1 Example: create-make my-project");process.exit(2);}return [2,{projectName:projectName,template:template,otherTemplate:otherTemplate}]}})});return function getCli(){return _ref.apply(this,arguments)}}();
11
+
8
12
  var OS_NAME=process.platform;var OS_APP_HOME=process.env.APPDATA||(OS_NAME=="darwin"?process.env.HOME+"/Library/Preferences":process.env.HOME+"/.local/share");var APP_PATH="".concat(OS_APP_HOME,"/create-make");var CONFIG_PATH="".concat(APP_PATH,"/config.json");var DEFAULT_CATEGORIES={TypeScript:{Vanilla:{repo:"https://github.com/z-starter/vite-vanilla-ts.git",args:[{str:"vite-vanilla-ts",value:"projectName"}]},Phaser:{repo:"https://github.com/z-starter/vite-phaser-ts.git",args:[{str:"vite-phaser-ts",value:"projectName"}]},"Vite Node":{repo:"https://github.com/z-starter/vite-node-ts.git",args:[{str:"vite-node-ts",value:"projectName"}]},"Rollup Node":{repo:"https://github.com/z-starter/rollup-node-ts.git",args:[{str:"rollup-node-ts",value:"projectName"}]},"Vite Monorepo":{repo:"https://github.com/z-starter/vite-monorepo-ts.git",args:[{str:"vite-monorepo-ts",value:"projectName"}]},"Rollup Monorepo":{repo:"https://github.com/z-starter/rollup-monorepo-ts.git",args:[{str:"rollup-monorepo-ts",value:"projectName"}]}}};var SCHEMA_PATH="".concat(APP_PATH,"/schema.json");var DEFAULT_SCHEMA={$schema:"https://json-schema.org/draft-07/schema",$id:"https://example.com/product.schema.json",title:"Create Make",description:"An advance CLI tools for creating new project from GitHub repository.",type:"object",properties:{categories:{type:"object",additionalProperties:{type:"object",additionalProperties:{type:"object",properties:{repo:{type:"string",default:"repoUrl"},args:{type:"array",items:{type:"object",properties:{str:{type:"string",default:"contentToReplace"},value:{type:"string",default:"projectName"}}}}}}}}}};
9
13
 
10
- 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]!==undefined?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]!==undefined?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"});}});};
14
+ 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"});}});};
11
15
 
12
16
  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})};
13
17
 
14
- 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,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=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(_)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]:undefined,done:true}}}var projectPrompt=/*#__PURE__*/function(){var _ref=_async_to_generator$1(function(config){var defaultCategories,userDefineCategories,answers1,isUserDefineCategories,templates,answers2,repo,args;return _ts_generator$1(this,function(_state){switch(_state.label){case 0:defaultCategories=Object.keys(config.defaultCategories);userDefineCategories=Object.keys(config.categories);if(userDefineCategories.length>0)defaultCategories.push("Others");return [4,inquirer.prompt([{name:"projectName",message:"Project name:",type:"input",default:"my-project"},{name:"category",message:"Select a category:",choices:defaultCategories,type:"list"}])];case 1:answers1=_state.sent();isUserDefineCategories=answers1.category==="Others";if(!isUserDefineCategories)return [3,3];return [4,inquirer.prompt([{name:"category",message:"Select a category:",choices:userDefineCategories,type:"list"}])];case 2:answers1.category=_state.sent().category;_state.label=3;case 3:templates=isUserDefineCategories?Object.keys(config.categories[answers1.category]):Object.keys(config.defaultCategories[answers1.category]);return [4,inquirer.prompt([{name:"template",message:"Select a template:",choices:templates,type:"list"}])];case 4:answers2=_state.sent();repo=isUserDefineCategories?config.categories[answers1.category][answers2.template].repo:config.defaultCategories[answers1.category][answers2.template].repo;args=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:repo,args:args})]}})});return function projectPrompt(config){return _ref.apply(this,arguments)}}();
18
+ 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,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=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(_)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=/*#__PURE__*/function(){var _ref=_async_to_generator$1(function(cli,config){var dcArr,tStrArr,args,repo,ucArr,tStrArr1,args1,repo1,prompt1,defaultCategories,userDefineCategories,_answers1,answers1,_projectName,isUserDefineCategories,templates,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(args[0].str);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(args1[0].str);if(args1[0].str===cli.otherTemplate)return [2,{category:category1,template:template1,projectName:cli.projectName,args:args1,repo:repo1}]}}console.error('❌ Error: Template "'.concat(cli.otherTemplate,'" was not found.\n')+"Available templates:\n"+" • ".concat(tStrArr1.join("\n • "),"\n")+"Please select one of the templates above.");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=isUserDefineCategories?Object.keys(config.categories[answers1.category]):Object.keys(config.defaultCategories[answers1.category]);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]}})});return function projectPrompt(cli,config){return _ref.apply(this,arguments)}}();
15
19
 
16
- 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,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=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(_)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]:undefined,done:true}}}var boot=/*#__PURE__*/function(){var _ref=_async_to_generator(function(){var config,answer,PROJECT_PATH,PROJECT_GIT_PATH;return _ts_generator(this,function(_state){switch(_state.label){case 0:console.log();config=getConfig();return [4,projectPrompt(config)];case 1:answer=_state.sent();PROJECT_PATH="".concat(process.cwd(),"/").concat(answer.projectName);PROJECT_GIT_PATH="".concat(PROJECT_PATH,"/.git");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]}})});return function boot(){return _ref.apply(this,arguments)}}();
20
+ 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,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=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(_)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=/*#__PURE__*/function(){var _ref=_async_to_generator(function(){var cli,config,answer,PROJECT_PATH,PROJECT_GIT_PATH;return _ts_generator(this,function(_state){switch(_state.label){case 0:console.log();return [4,getCli()];case 1:cli=_state.sent();config=getConfig();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]}})});return function boot(){return _ref.apply(this,arguments)}}();
17
21
 
18
22
  module.exports = boot;
package/dist/index.js CHANGED
@@ -1,16 +1,20 @@
1
- import { rmSync, readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync, statSync } from 'node:fs';
1
+ import yargs from 'yargs';
2
+ import { hideBin } from 'yargs/helpers';
3
+ import { existsSync, rmSync, readFileSync, writeFileSync, readdirSync, statSync, mkdirSync } from 'node:fs';
2
4
  import { execSync } from 'node:child_process';
3
5
  import { join } from 'node:path';
4
6
  import inquirer from 'inquirer';
5
7
 
8
+ function asyncGeneratorStep$2(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$2(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);})}}function _ts_generator$2(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=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(_)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 getCli=/*#__PURE__*/function(){var _ref=_async_to_generator$2(function(){var yargsInstance,argv,projectName,template,otherTemplate;return _ts_generator$2(this,function(_state){switch(_state.label){case 0:yargsInstance=yargs(hideBin(process.argv)).scriptName("create-make").usage("Usage: $0 <projectName> [options]").example("$0 my-project","Create a new project").example("$0 my-project --template vite-vanilla-ts","Create a project with Vite web template").example("$0 my-project -t vite-node-ts","Create a project with Vite Node template").option("template",{alias:"t",type:"string",description:"Specify the template to use"}).option("other-template",{alias:"o",type:"string",description:"Specify the other template to use"}).version().alias("v","version").help().alias("h","help");return [4,yargsInstance.parseAsync()];case 1:argv=_state.sent();projectName=argv._[0];template=argv.template;otherTemplate=argv.otherTemplate;if((template||otherTemplate)&&!projectName){console.error("❌ Error: Project name is required");console.error("\uD83D\uDCD6 Usage: create-make <project-name>");console.error("\uD83D\uDCA1 Example: create-make my-project");process.exit(2);}return [2,{projectName:projectName,template:template,otherTemplate:otherTemplate}]}})});return function getCli(){return _ref.apply(this,arguments)}}();
9
+
6
10
  var OS_NAME=process.platform;var OS_APP_HOME=process.env.APPDATA||(OS_NAME=="darwin"?process.env.HOME+"/Library/Preferences":process.env.HOME+"/.local/share");var APP_PATH="".concat(OS_APP_HOME,"/create-make");var CONFIG_PATH="".concat(APP_PATH,"/config.json");var DEFAULT_CATEGORIES={TypeScript:{Vanilla:{repo:"https://github.com/z-starter/vite-vanilla-ts.git",args:[{str:"vite-vanilla-ts",value:"projectName"}]},Phaser:{repo:"https://github.com/z-starter/vite-phaser-ts.git",args:[{str:"vite-phaser-ts",value:"projectName"}]},"Vite Node":{repo:"https://github.com/z-starter/vite-node-ts.git",args:[{str:"vite-node-ts",value:"projectName"}]},"Rollup Node":{repo:"https://github.com/z-starter/rollup-node-ts.git",args:[{str:"rollup-node-ts",value:"projectName"}]},"Vite Monorepo":{repo:"https://github.com/z-starter/vite-monorepo-ts.git",args:[{str:"vite-monorepo-ts",value:"projectName"}]},"Rollup Monorepo":{repo:"https://github.com/z-starter/rollup-monorepo-ts.git",args:[{str:"rollup-monorepo-ts",value:"projectName"}]}}};var SCHEMA_PATH="".concat(APP_PATH,"/schema.json");var DEFAULT_SCHEMA={$schema:"https://json-schema.org/draft-07/schema",$id:"https://example.com/product.schema.json",title:"Create Make",description:"An advance CLI tools for creating new project from GitHub repository.",type:"object",properties:{categories:{type:"object",additionalProperties:{type:"object",additionalProperties:{type:"object",properties:{repo:{type:"string",default:"repoUrl"},args:{type:"array",items:{type:"object",properties:{str:{type:"string",default:"contentToReplace"},value:{type:"string",default:"projectName"}}}}}}}}}};
7
11
 
8
- 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]!==undefined?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]!==undefined?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"});}});};
12
+ 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"});}});};
9
13
 
10
14
  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})};
11
15
 
12
- 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,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=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(_)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]:undefined,done:true}}}var projectPrompt=/*#__PURE__*/function(){var _ref=_async_to_generator$1(function(config){var defaultCategories,userDefineCategories,answers1,isUserDefineCategories,templates,answers2,repo,args;return _ts_generator$1(this,function(_state){switch(_state.label){case 0:defaultCategories=Object.keys(config.defaultCategories);userDefineCategories=Object.keys(config.categories);if(userDefineCategories.length>0)defaultCategories.push("Others");return [4,inquirer.prompt([{name:"projectName",message:"Project name:",type:"input",default:"my-project"},{name:"category",message:"Select a category:",choices:defaultCategories,type:"list"}])];case 1:answers1=_state.sent();isUserDefineCategories=answers1.category==="Others";if(!isUserDefineCategories)return [3,3];return [4,inquirer.prompt([{name:"category",message:"Select a category:",choices:userDefineCategories,type:"list"}])];case 2:answers1.category=_state.sent().category;_state.label=3;case 3:templates=isUserDefineCategories?Object.keys(config.categories[answers1.category]):Object.keys(config.defaultCategories[answers1.category]);return [4,inquirer.prompt([{name:"template",message:"Select a template:",choices:templates,type:"list"}])];case 4:answers2=_state.sent();repo=isUserDefineCategories?config.categories[answers1.category][answers2.template].repo:config.defaultCategories[answers1.category][answers2.template].repo;args=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:repo,args:args})]}})});return function projectPrompt(config){return _ref.apply(this,arguments)}}();
16
+ 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,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=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(_)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=/*#__PURE__*/function(){var _ref=_async_to_generator$1(function(cli,config){var dcArr,tStrArr,args,repo,ucArr,tStrArr1,args1,repo1,prompt1,defaultCategories,userDefineCategories,_answers1,answers1,_projectName,isUserDefineCategories,templates,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(args[0].str);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(args1[0].str);if(args1[0].str===cli.otherTemplate)return [2,{category:category1,template:template1,projectName:cli.projectName,args:args1,repo:repo1}]}}console.error('❌ Error: Template "'.concat(cli.otherTemplate,'" was not found.\n')+"Available templates:\n"+" • ".concat(tStrArr1.join("\n • "),"\n")+"Please select one of the templates above.");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=isUserDefineCategories?Object.keys(config.categories[answers1.category]):Object.keys(config.defaultCategories[answers1.category]);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]}})});return function projectPrompt(cli,config){return _ref.apply(this,arguments)}}();
13
17
 
14
- 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,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=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(_)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]:undefined,done:true}}}var boot=/*#__PURE__*/function(){var _ref=_async_to_generator(function(){var config,answer,PROJECT_PATH,PROJECT_GIT_PATH;return _ts_generator(this,function(_state){switch(_state.label){case 0:console.log();config=getConfig();return [4,projectPrompt(config)];case 1:answer=_state.sent();PROJECT_PATH="".concat(process.cwd(),"/").concat(answer.projectName);PROJECT_GIT_PATH="".concat(PROJECT_PATH,"/.git");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]}})});return function boot(){return _ref.apply(this,arguments)}}();
18
+ 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,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=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(_)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=/*#__PURE__*/function(){var _ref=_async_to_generator(function(){var cli,config,answer,PROJECT_PATH,PROJECT_GIT_PATH;return _ts_generator(this,function(_state){switch(_state.label){case 0:console.log();return [4,getCli()];case 1:cli=_state.sent();config=getConfig();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]}})});return function boot(){return _ref.apply(this,arguments)}}();
15
19
 
16
20
  export { boot as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-make",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "An advance CLI tools for creating new project from GitHub repository.",
5
5
  "type": "module",
6
6
  "main": "bin.js",
@@ -10,7 +10,7 @@
10
10
  "url": "git+https://github.com/z-npm/create-make.git"
11
11
  },
12
12
  "author": {
13
- "name": "Zero <github.com/z-nerd>"
13
+ "name": "Zero <github.com/zero-red-dev>"
14
14
  },
15
15
  "license": "MIT",
16
16
  "keywords": [
@@ -35,15 +35,17 @@
35
35
  "local": "yarn build && yarn unlink && yarn link && yarn create make"
36
36
  },
37
37
  "devDependencies": {
38
- "@types/inquirer": "^9.0.7",
39
- "@types/node": "^22.10.7",
40
- "@z-code/vite-plugin-swc": "^0.5.0",
41
- "rollup-plugin-node-externals": "^8.0.0",
42
- "typescript": "^5.7.3",
43
- "vite": "^6.0.9"
38
+ "@types/inquirer": "^9.0.9",
39
+ "@types/node": "^24.10.1",
40
+ "@types/yargs": "^17.0.35",
41
+ "@z-code/vite-plugin-swc": "^0.5.2",
42
+ "rollup-plugin-node-externals": "^8.1.2",
43
+ "typescript": "^5.9.3",
44
+ "vite": "^7.2.6"
44
45
  },
45
46
  "dependencies": {
46
- "inquirer": "^12.3.2"
47
+ "inquirer": "^13.0.2",
48
+ "yargs": "^18.0.0"
47
49
  },
48
- "packageManager": "yarn@4.6.0"
50
+ "packageManager": "yarn@4.12.0"
49
51
  }