create-rstack 1.7.2 → 1.7.3

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.d.ts CHANGED
@@ -4,6 +4,7 @@ export declare type Argv = {
4
4
  template?: string;
5
5
  override?: boolean;
6
6
  tools?: string | string[];
7
+ packageName?: string;
7
8
  'package-name'?: string;
8
9
  };
9
10
 
package/dist/index.js CHANGED
@@ -1573,16 +1573,16 @@ function isEmptyDir(path) {
1573
1573
  }
1574
1574
  function logHelpMessage(name, templates) {
1575
1575
  src_logger.log(`
1576
- Usage: create-${name} [options]
1576
+ Usage: create-${name} [dir] [options]
1577
1577
 
1578
1578
  Options:
1579
1579
 
1580
- -h, --help display help for command
1581
- -d, --dir create project in specified directory
1582
- -t, --template specify the template to use
1583
- --tools select additional tools (biome, eslint, prettier)
1584
- --override override files in target directory
1585
- --package-name specify the package name
1580
+ -h, --help display help for command
1581
+ -d, --dir <dir> create project in specified directory
1582
+ -t, --template <tpl> specify the template to use
1583
+ --tools <tool> select additional tools (biome, eslint, prettier)
1584
+ --override override files in target directory
1585
+ --packageName <name> specify the package name
1586
1586
 
1587
1587
  Templates:
1588
1588
 
@@ -1619,7 +1619,7 @@ function upperFirst(str) {
1619
1619
  }
1620
1620
  const readJSON = async (path)=>JSON.parse(await node_fs.promises.readFile(path, 'utf-8'));
1621
1621
  const readPackageJson = async (filePath)=>readJSON(node_path.join(filePath, 'package.json'));
1622
- async function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, version, noteInformation }) {
1622
+ const parseArgv = ()=>{
1623
1623
  const argv = minimist_default()(process.argv.slice(2), {
1624
1624
  alias: {
1625
1625
  h: 'help',
@@ -1627,8 +1627,14 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
1627
1627
  t: 'template'
1628
1628
  }
1629
1629
  });
1630
+ if (!argv.dir && argv._[0]) argv.dir = argv._[0];
1631
+ if (argv['package-name']) argv.packageName = argv['package-name'];
1632
+ return argv;
1633
+ };
1634
+ async function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, version, noteInformation }) {
1630
1635
  console.log('');
1631
1636
  src_logger.greet(`◆ Create ${upperFirst(name)} Project`);
1637
+ const argv = parseArgv();
1632
1638
  if (argv.help) return void logHelpMessage(name, templates);
1633
1639
  const cwd = process.cwd();
1634
1640
  const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);
@@ -1644,7 +1650,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
1644
1650
  }));
1645
1651
  const formatted = formatProjectName(projectName);
1646
1652
  const { targetDir } = formatted;
1647
- const packageName = argv['package-name'] || formatted.packageName;
1653
+ const packageName = argv.packageName || formatted.packageName;
1648
1654
  const distFolder = node_path.isAbsolute(targetDir) ? targetDir : node_path.join(cwd, targetDir);
1649
1655
  if (!argv.override && node_fs.existsSync(distFolder) && !isEmptyDir(distFolder)) {
1650
1656
  const option = checkCancel(await ve({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rstack",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "Create a new Rstack project",
5
5
  "repository": {
6
6
  "type": "git",