create-ton 0.2.0 → 0.4.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,25 @@ 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.4.0] - 2023-05-04
9
+
10
+ ### Changed
11
+
12
+ - Updated template readme
13
+ - Updated template jest config to use TypeScript
14
+ - Updated dependencies: blueprint to 0.9.0, sandbox to 0.10.0
15
+
16
+ ## [0.3.0] - 2023-04-07
17
+
18
+ ### Changed
19
+
20
+ - Updated template dependencies: blueprint to 0.8.0, sandbox to 0.8.0, ton-core to 0.49.0
21
+ - Updated dependencies
22
+
23
+ ### Fixed
24
+
25
+ - Fixed duplicate contract type question when using pnpm
26
+
8
27
  ## [0.2.0] - 2023-03-27
9
28
 
10
29
  ### Added
package/dist/cli.js CHANGED
@@ -9,7 +9,8 @@ const path_1 = __importDefault(require("path"));
9
9
  const child_process_1 = require("child_process");
10
10
  const inquirer_1 = __importDefault(require("inquirer"));
11
11
  const chalk_1 = __importDefault(require("chalk"));
12
- const PACKAGE_JSON = 'package.json';
12
+ const FILES_WITH_NAME_TEMPLATE = ['package.json', 'README.md'];
13
+ const NAME_TEMPLATE = '{{name}}';
13
14
  async function main() {
14
15
  console.log();
15
16
  const name = process.argv.length > 2
@@ -58,7 +59,7 @@ async function main() {
58
59
  console.log(`\n[1/${steps}] Copying files...`);
59
60
  const basePath = path_1.default.join(__dirname, 'template');
60
61
  for (const file of await fs_extra_1.default.readdir(basePath)) {
61
- if (file === PACKAGE_JSON)
62
+ if (FILES_WITH_NAME_TEMPLATE.includes(file))
62
63
  continue;
63
64
  await fs_extra_1.default.copy(path_1.default.join(basePath, file), path_1.default.join(name, file));
64
65
  }
@@ -66,7 +67,9 @@ async function main() {
66
67
  temp
67
68
  build
68
69
  `);
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));
70
+ for (const file of FILES_WITH_NAME_TEMPLATE) {
71
+ 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));
72
+ }
70
73
  console.log(`[2/${steps}] Installing dependencies...\n`);
71
74
  const execOpts = {
72
75
  stdio: 'inherit',
@@ -94,7 +97,7 @@ build
94
97
  execCommand = 'pnpm';
95
98
  break;
96
99
  }
97
- (0, child_process_1.execSync)(`${execCommand} exec blueprint -- create ${contractName} --type ${variant}`, execOpts);
100
+ (0, child_process_1.execSync)(`${execCommand} exec blueprint${pkgManager === 'pnpm' ? '' : ' --'} create ${contractName} --type ${variant}`, execOpts);
98
101
  try {
99
102
  (0, child_process_1.execSync)('git init', execOpts);
100
103
  }
@@ -1,76 +1,29 @@
1
- # TON project
1
+ # {{name}}
2
2
 
3
- Starter template for a new TON project - FunC contracts, unit tests, compilation and deployment scripts.
3
+ ## Project structure
4
4
 
5
- ## Layout
6
-
7
- - `contracts` - contains the source code of all the smart contracts of the project and their dependencies.
8
- - `wrappers` - contains the wrapper classes (implementing `Contract` from ton-core) for the contracts, including any [de]serialization primitives and compilation functions.
9
- - `tests` - tests for the contracts. Would typically use the wrappers.
10
- - `scripts` - contains scripts used by the project, mainly the deployment scripts.
11
-
12
- ## Repo contents / tech stack
13
- 1. Compiling FunC - [https://github.com/ton-community/func-js](https://github.com/ton-community/func-js)
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
5
+ - `contracts` - source code of all the smart contracts of the project and their dependencies.
6
+ - `wrappers` - wrapper classes (implementing `Contract` from ton-core) for the contracts, including any [de]serialization primitives and compilation functions.
7
+ - `tests` - tests for the contracts.
8
+ - `scripts` - scripts used by the project, mainly the deployment scripts.
16
9
 
17
10
  ## How to use
18
- * Run `npm create ton@latest`
19
11
 
20
- ### Building a contract
21
- 1. Interactively
22
- 1. Run `yarn blueprint build`
23
- 2. Choose the contract you'd like to build
24
- 1. Non-interactively
25
- 1. Run `yarn blueprint build <CONTRACT>`
26
- 2. example: `yarn blueprint build pingpong`
12
+ ### Build
13
+
14
+ `npx blueprint build` or `yarn blueprint build`
27
15
 
28
- ### Deploying a contract
29
- 1. Interactively
30
- 1. Run `yarn blueprint run`
31
- 2. Choose the contract you'd like to deploy
32
- 3. Choose whether you're deploying on mainnet or testnet
33
- 4. Choose how to deploy:
34
- 1. With a TON Connect compatible wallet
35
- 2. A `ton://` deep link / QR code
36
- 3. Tonhub wallet
37
- 4. Mnemonic
38
- 5. Deploy the contract
39
- 2. Non-interactively
40
- 1. Run `yarn blueprint run <CONTRACT> --<NETWORK> --<DEPLOY_METHOD>`
41
- 2. example: `yarn blueprint run pingpong --mainnet --tonconnect`
16
+ ### Test
42
17
 
43
- ### Testing
44
- 1. Run `yarn test`
18
+ `npx blueprint test` or `yarn blueprint test`
45
19
 
46
- ## Adding your own contract
47
- 1. Run `yarn blueprint create <CONTRACT>`
48
- 2. example: `yarn blueprint create MyContract`
20
+ ### Deploy or run another script
49
21
 
50
- * Write code
51
- * FunC contracts are located in `contracts/*.fc`
52
- * Standalone root contracts are located in `contracts/*.fc`
53
- * Shared imports (when breaking code to multiple files) are in `contracts/imports/*.fc`
54
- * Tests in TypeScript are located in `test/*.spec.ts`
55
- * Wrapper classes for interacting with the contract are located in `wrappers/*.ts`
56
- * Any scripts (including deployers) are located in `scripts/*.ts`
22
+ `npx blueprint run` or `yarn blueprint run`
57
23
 
58
- * Build
59
- * Builder configs are located in `wrappers/*.compile.ts`
60
- * In the root repo dir, run in terminal `yarn blueprint build`
61
- * Compilation errors will appear on screen, if applicable
62
- * Resulting build artifacts include:
63
- * `build/*.compiled.json` - the binary code cell of the compiled contract (for deployment). Saved in a hex format within a json file to support webapp imports
24
+ ### Add a new contract
64
25
 
65
- * Test
66
- * In the root repo dir, run in terminal `yarn test`
67
- * Don't forget to build (or rebuild) before running tests
68
- * Tests are running inside Node.js by running TVM in web-assembly using [sandbox](https://github.com/ton-community/sandbox)
26
+ `npx blueprint create ContractName` or `yarn blueprint create ContractName`
69
27
 
70
- * Deploy
71
- * Run `yarn blueprint run <deployscript>`
72
- * Contracts will be rebuilt on each execution
73
- * Follow the on-screen instructions of the deploy script
74
-
75
28
  # License
76
29
  MIT
@@ -0,0 +1,8 @@
1
+ import type { Config } from 'jest';
2
+
3
+ const config: Config = {
4
+ preset: 'ts-jest',
5
+ testEnvironment: 'node',
6
+ };
7
+
8
+ export default config;
@@ -6,15 +6,15 @@
6
6
  "test": "jest"
7
7
  },
8
8
  "devDependencies": {
9
- "@ton-community/blueprint": "^0.6.1",
10
- "@ton-community/sandbox": "^0.7.0",
9
+ "@ton-community/blueprint": "^0.9.0",
10
+ "@ton-community/sandbox": "^0.10.0",
11
11
  "@ton-community/test-utils": "^0.2.0",
12
12
  "@types/jest": "^29.5.0",
13
13
  "@types/node": "^18.15.5",
14
14
  "jest": "^29.5.0",
15
15
  "prettier": "^2.8.6",
16
16
  "ton": "^13.4.1",
17
- "ton-core": "^0.48.0",
17
+ "ton-core": "^0.49.0",
18
18
  "ton-crypto": "^3.2.0",
19
19
  "ts-jest": "^29.0.5",
20
20
  "ts-node": "^10.9.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ton",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "license": "MIT",
5
5
  "description": "Tool to quickly create TON projects",
6
6
  "author": "TonTech",
@@ -20,8 +20,8 @@
20
20
  "devDependencies": {
21
21
  "@types/fs-extra": "^11.0.1",
22
22
  "@types/inquirer": "^8.2.6",
23
- "@types/node": "^18.15.5",
24
- "prettier": "^2.8.6",
23
+ "@types/node": "^18.15.11",
24
+ "prettier": "^2.8.7",
25
25
  "typescript": "^4.9.5"
26
26
  },
27
27
  "dependencies": {
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- preset: 'ts-jest',
3
- testEnvironment: 'node',
4
- };