create-ton 0.7.0 → 0.8.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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.8.0] - 2023-08-28
9
+
10
+ ### Added
11
+
12
+ - Added flag `--path` to specify where the project should be initialized, defaults to the project name
13
+
8
14
  ## [0.7.0] - 2023-08-20
9
15
 
10
16
  ### Changed
package/dist/cli.js CHANGED
@@ -35,6 +35,7 @@ async function main() {
35
35
  const localArgs = (0, arg_1.default)({
36
36
  '--type': String,
37
37
  '--contractName': String,
38
+ '--path': String,
38
39
  });
39
40
  const name = localArgs._[0] ||
40
41
  (await inquirer_1.default.prompt({
@@ -64,26 +65,29 @@ async function main() {
64
65
  choices: VARIANT_CHOICES,
65
66
  },
66
67
  ])).variant;
67
- await fs_extra_1.default.mkdir(name);
68
+ const projectPath = localArgs['--path'] || name;
69
+ await fs_extra_1.default.mkdir(projectPath, {
70
+ recursive: true,
71
+ });
68
72
  const steps = 3;
69
73
  console.log(`\n[1/${steps}] Copying files...`);
70
74
  const basePath = path_1.default.join(__dirname, 'template');
71
75
  for (const file of await fs_extra_1.default.readdir(basePath)) {
72
76
  if (FILES_WITH_NAME_TEMPLATE.includes(file))
73
77
  continue;
74
- await fs_extra_1.default.copy(path_1.default.join(basePath, file), path_1.default.join(name, file));
78
+ await fs_extra_1.default.copy(path_1.default.join(basePath, file), path_1.default.join(projectPath, file));
75
79
  }
76
- await fs_extra_1.default.writeFile(path_1.default.join(name, '.gitignore'), `node_modules
80
+ await fs_extra_1.default.writeFile(path_1.default.join(projectPath, '.gitignore'), `node_modules
77
81
  temp
78
82
  build
79
83
  `);
80
84
  for (const file of FILES_WITH_NAME_TEMPLATE) {
81
- await fs_extra_1.default.writeFile(path_1.default.join(name, file), (await fs_extra_1.default.readFile(path_1.default.join(basePath, file))).toString().replace(NAME_TEMPLATE, name));
85
+ await fs_extra_1.default.writeFile(path_1.default.join(projectPath, file), (await fs_extra_1.default.readFile(path_1.default.join(basePath, file))).toString().replace(NAME_TEMPLATE, name));
82
86
  }
83
87
  console.log(`[2/${steps}] Installing dependencies...\n`);
84
88
  const execOpts = {
85
89
  stdio: 'inherit',
86
- cwd: name,
90
+ cwd: projectPath,
87
91
  };
88
92
  const pkgManager = (process.env.npm_config_user_agent ?? 'npm/').split(' ')[0].split('/')[0];
89
93
  switch (pkgManager) {
@@ -125,7 +129,7 @@ build
125
129
  console.log(``);
126
130
  console.log(`Your new project is ready, available commands:`);
127
131
  console.log(``);
128
- console.log(chalk_1.default.greenBright(` > `) + chalk_1.default.cyanBright(`cd ${name}`));
132
+ console.log(chalk_1.default.greenBright(` > `) + chalk_1.default.cyanBright(`cd ${projectPath}`));
129
133
  console.log(` change directory to your new project`);
130
134
  console.log(``);
131
135
  console.log(chalk_1.default.greenBright(` > `) + chalk_1.default.cyanBright(`npx blueprint build`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ton",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "license": "MIT",
5
5
  "description": "Tool to quickly create TON projects",
6
6
  "author": "TonTech",