create-ton 0.1.0 → 0.2.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,17 @@ 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.2.0] - 2023-03-27
9
+
10
+ ### Added
11
+
12
+ - Added the ability to pass project name as a command line argument
13
+
14
+ ### Changed
15
+
16
+ - Dependencies of newly created projects are now installed using the package manager that is used to invoke create-ton
17
+ - Updated template dependencies' versions: blueprint to 0.6.1, sandbox to 0.7.0
18
+
8
19
  ## [0.1.0] - 2023-03-21
9
20
 
10
21
  ### Added
package/dist/cli.js CHANGED
@@ -11,10 +11,13 @@ const inquirer_1 = __importDefault(require("inquirer"));
11
11
  const chalk_1 = __importDefault(require("chalk"));
12
12
  const PACKAGE_JSON = 'package.json';
13
13
  async function main() {
14
- const name = (await inquirer_1.default.prompt({
15
- name: 'name',
16
- message: 'Project name',
17
- })).name.trim();
14
+ console.log();
15
+ const name = process.argv.length > 2
16
+ ? process.argv[2]
17
+ : (await inquirer_1.default.prompt({
18
+ name: 'name',
19
+ message: 'Project name',
20
+ })).name.trim();
18
21
  if (name.length === 0)
19
22
  throw new Error('Cannot initialize a project with an empty name');
20
23
  const contractName = (await inquirer_1.default.prompt({
@@ -69,9 +72,29 @@ build
69
72
  stdio: 'inherit',
70
73
  cwd: name,
71
74
  };
72
- (0, child_process_1.execSync)('npm i', execOpts);
75
+ const pkgManager = (process.env.npm_config_user_agent ?? 'npm/').split(' ')[0].split('/')[0];
76
+ switch (pkgManager) {
77
+ case 'yarn':
78
+ (0, child_process_1.execSync)('yarn', execOpts);
79
+ break;
80
+ case 'pnpm':
81
+ (0, child_process_1.execSync)('pnpm install', execOpts);
82
+ break;
83
+ default:
84
+ (0, child_process_1.execSync)('npm install', execOpts);
85
+ break;
86
+ }
73
87
  console.log(`\n[3/${steps}] Creating your first contract...`);
74
- (0, child_process_1.execSync)(`npx blueprint create ${contractName} --type ${variant}`, execOpts);
88
+ let execCommand = 'npm';
89
+ switch (pkgManager) {
90
+ case 'yarn':
91
+ execCommand = 'yarn';
92
+ break;
93
+ case 'pnpm':
94
+ execCommand = 'pnpm';
95
+ break;
96
+ }
97
+ (0, child_process_1.execSync)(`${execCommand} exec blueprint -- create ${contractName} --type ${variant}`, execOpts);
75
98
  try {
76
99
  (0, child_process_1.execSync)('git init', execOpts);
77
100
  }
@@ -6,8 +6,8 @@
6
6
  "test": "jest"
7
7
  },
8
8
  "devDependencies": {
9
- "@ton-community/blueprint": "^0.6.0",
10
- "@ton-community/sandbox": "^0.6.1",
9
+ "@ton-community/blueprint": "^0.6.1",
10
+ "@ton-community/sandbox": "^0.7.0",
11
11
  "@ton-community/test-utils": "^0.2.0",
12
12
  "@types/jest": "^29.5.0",
13
13
  "@types/node": "^18.15.5",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ton",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "description": "Tool to quickly create TON projects",
6
6
  "author": "TonTech",