create-ton 0.7.0 → 0.9.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,22 @@ 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.9.0] - 2023-08-28
9
+
10
+ ### Removed
11
+
12
+ - Removed flag `--path`
13
+
14
+ ### Changed
15
+
16
+ - The project name (asked interactively or passed in CLI non-interactively) is now resolved as a path to get the full project path, and the basename (last segment) of that path is taken as the actual project name. For example, running `create-ton .` in a directory named `test-project` will create the project in that very directory (without creating any subdirectories) with the name `test-project`
17
+
18
+ ## [0.8.0] - 2023-08-28
19
+
20
+ ### Added
21
+
22
+ - Added flag `--path` to specify where the project should be initialized, defaults to the project name
23
+
8
24
  ## [0.7.0] - 2023-08-20
9
25
 
10
26
  ### Changed
package/dist/cli.js CHANGED
@@ -36,11 +36,13 @@ async function main() {
36
36
  '--type': String,
37
37
  '--contractName': String,
38
38
  });
39
- const name = localArgs._[0] ||
39
+ const desiredProjectName = localArgs._[0] ||
40
40
  (await inquirer_1.default.prompt({
41
41
  name: 'name',
42
42
  message: 'Project name',
43
43
  })).name.trim();
44
+ const projectPath = path_1.default.resolve(desiredProjectName);
45
+ const name = path_1.default.basename(projectPath);
44
46
  if (name.length === 0)
45
47
  throw new Error('Cannot initialize a project with an empty name');
46
48
  const contractName = localArgs['--contractName'] ||
@@ -64,26 +66,28 @@ async function main() {
64
66
  choices: VARIANT_CHOICES,
65
67
  },
66
68
  ])).variant;
67
- await fs_extra_1.default.mkdir(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 ${desiredProjectName}`));
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.9.0",
4
4
  "license": "MIT",
5
5
  "description": "Tool to quickly create TON projects",
6
6
  "author": "TonTech",