create-ton 0.0.11 → 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,35 @@ 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
+
19
+ ## [0.1.0] - 2023-03-21
20
+
21
+ ### Added
22
+
23
+ - Added support for [TACT](https://github.com/tact-lang/tact), including TACT smart contract templates
24
+ - Added `.prettierignore` to template to ignore generated TACT files
25
+
26
+ ### Changed
27
+
28
+ - Updated template dependencies, including blueprint to 0.6.0, sandbox to 0.6.1, test-utils to 0.2.0
29
+ - Edited template's `README.md`
30
+ - Changed template's `.gitignore` to contain a newline at the end
31
+ - Updated dependencies
32
+
33
+ ### Removed
34
+
35
+ - Removed dubious `LICENSE` file from template
36
+
8
37
  ## [0.0.11] - 2023-03-02
9
38
 
10
39
  ### Changed
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({
@@ -32,12 +35,20 @@ async function main() {
32
35
  type: 'list',
33
36
  choices: [
34
37
  {
35
- name: 'An empty contract',
36
- value: 'empty',
38
+ name: 'An empty contract (FunC)',
39
+ value: 'func-empty',
37
40
  },
38
41
  {
39
- name: 'A simple counter contract',
40
- value: 'counter',
42
+ name: 'A simple counter contract (FunC)',
43
+ value: 'func-counter',
44
+ },
45
+ {
46
+ name: 'An empty contract (TACT)',
47
+ value: 'tact-empty',
48
+ },
49
+ {
50
+ name: 'A simple counter contract (TACT)',
51
+ value: 'tact-counter',
41
52
  },
42
53
  ],
43
54
  },
@@ -53,16 +64,37 @@ async function main() {
53
64
  }
54
65
  await fs_extra_1.default.writeFile(path_1.default.join(name, '.gitignore'), `node_modules
55
66
  temp
56
- build`);
67
+ build
68
+ `);
57
69
  await fs_extra_1.default.writeFile(path_1.default.join(name, PACKAGE_JSON), (await fs_extra_1.default.readFile(path_1.default.join(basePath, PACKAGE_JSON))).toString().replace('{{name}}', name));
58
70
  console.log(`[2/${steps}] Installing dependencies...\n`);
59
71
  const execOpts = {
60
72
  stdio: 'inherit',
61
73
  cwd: name,
62
74
  };
63
- (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
+ }
64
87
  console.log(`\n[3/${steps}] Creating your first contract...`);
65
- (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);
66
98
  try {
67
99
  (0, child_process_1.execSync)('git init', execOpts);
68
100
  }
@@ -0,0 +1 @@
1
+ build
@@ -1,9 +1,7 @@
1
- # TON project template (RFC)
1
+ # TON project
2
2
 
3
3
  Starter template for a new TON project - FunC contracts, unit tests, compilation and deployment scripts.
4
4
 
5
- > This repo is a work in progress and is subject to change
6
-
7
5
  ## Layout
8
6
 
9
7
  - `contracts` - contains the source code of all the smart contracts of the project and their dependencies.
@@ -11,18 +9,13 @@ Starter template for a new TON project - FunC contracts, unit tests, compilation
11
9
  - `tests` - tests for the contracts. Would typically use the wrappers.
12
10
  - `scripts` - contains scripts used by the project, mainly the deployment scripts.
13
11
 
14
- We ask the community to provide any comments on this layout, the wanted/required changes, or even suggestions for entirely different project structures and/or tool concepts.
15
-
16
- PRs are welcome!
17
-
18
12
  ## Repo contents / tech stack
19
13
  1. Compiling FunC - [https://github.com/ton-community/func-js](https://github.com/ton-community/func-js)
20
- 2. Testing TON smart contracts - [https://github.com/ton-community/sandbox/](https://github.com/ton-community/sandbox/)
21
- 3. Deployment of contracts is supported with [TON Connect 2](https://github.com/ton-connect/), [Tonhub wallet](https://tonhub.com/) or via a direct `ton://` deeplink
14
+ 2. Testing TON smart contracts - [https://github.com/ton-community/sandbox](https://github.com/ton-community/sandbox)
15
+ 3. Deployment of contracts is supported with [TON Connect 2](https://github.com/ton-connect/), [Tonhub wallet](https://tonhub.com/), using mnemonics, or via a direct `ton://` deeplink
22
16
 
23
17
  ## How to use
24
- * Clone this repo
25
- * Run `yarn install`
18
+ * Run `npm create ton@latest`
26
19
 
27
20
  ### Building a contract
28
21
  1. Interactively
@@ -41,6 +34,7 @@ PRs are welcome!
41
34
  1. With a TON Connect compatible wallet
42
35
  2. A `ton://` deep link / QR code
43
36
  3. Tonhub wallet
37
+ 4. Mnemonic
44
38
  5. Deploy the contract
45
39
  2. Non-interactively
46
40
  1. Run `yarn blueprint run <CONTRACT> --<NETWORK> --<DEPLOY_METHOD>`
@@ -6,18 +6,18 @@
6
6
  "test": "jest"
7
7
  },
8
8
  "devDependencies": {
9
- "@ton-community/blueprint": "^0.4.1",
10
- "@ton-community/sandbox": "^0.5.1",
11
- "@ton-community/test-utils": "^0.0.2",
12
- "@types/jest": "^29.2.6",
13
- "@types/node": "^18.11.18",
14
- "jest": "^29.3.1",
15
- "prettier": "^2.8.3",
9
+ "@ton-community/blueprint": "^0.6.1",
10
+ "@ton-community/sandbox": "^0.7.0",
11
+ "@ton-community/test-utils": "^0.2.0",
12
+ "@types/jest": "^29.5.0",
13
+ "@types/node": "^18.15.5",
14
+ "jest": "^29.5.0",
15
+ "prettier": "^2.8.6",
16
16
  "ton": "^13.4.1",
17
17
  "ton-core": "^0.48.0",
18
18
  "ton-crypto": "^3.2.0",
19
19
  "ts-jest": "^29.0.5",
20
20
  "ts-node": "^10.9.1",
21
- "typescript": "^4.9.4"
21
+ "typescript": "^4.9.5"
22
22
  }
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ton",
3
- "version": "0.0.11",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "description": "Tool to quickly create TON projects",
6
6
  "author": "TonTech",
@@ -19,14 +19,14 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/fs-extra": "^11.0.1",
22
- "@types/inquirer": "^8.2.5",
23
- "@types/node": "^18.11.18",
24
- "prettier": "^2.8.3",
22
+ "@types/inquirer": "^8.2.6",
23
+ "@types/node": "^18.15.5",
24
+ "prettier": "^2.8.6",
25
25
  "typescript": "^4.9.5"
26
26
  },
27
27
  "dependencies": {
28
28
  "chalk": "^4.1.0",
29
- "fs-extra": "^11.1.0",
29
+ "fs-extra": "^11.1.1",
30
30
  "inquirer": "^8.2.5"
31
31
  }
32
32
  }
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Tontech
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.