create-ton 0.5.0 → 0.7.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 +21 -0
- package/README.md +16 -1
- package/dist/cli.js +42 -32
- package/dist/template/README.md +0 -3
- package/dist/template/package.json +6 -5
- package/package.json +31 -31
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,27 @@ 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.7.0] - 2023-08-20
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Changed template ton-core dependency to ^0.51.0, ton to ~13.6.0, which fixes dependency tree problems
|
|
13
|
+
|
|
14
|
+
## [0.6.0] - 2023-08-08
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Added flags `--contractName` and `--type` to allow fully non-interactive runs
|
|
19
|
+
- Added scripts `start` and `build` to the template
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Updated blueprint to 0.12.0, test-utils to 0.3.0
|
|
24
|
+
|
|
25
|
+
### Removed
|
|
26
|
+
|
|
27
|
+
- Removed license from the template
|
|
28
|
+
|
|
8
29
|
## [0.5.0] - 2023-06-06
|
|
9
30
|
|
|
10
31
|
### Changed
|
package/README.md
CHANGED
|
@@ -2,4 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
This is an entry point script for the Blueprint development tool
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm create ton
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
(or using other package managers)
|
|
12
|
+
|
|
13
|
+
If you want to input data non-interactively (for example, in scripts), do:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm create ton -- project-dir --type first-contract-type --contractName FirstContractName
|
|
17
|
+
```
|
|
18
|
+
where `first-contract-type` can currently be one of `func-empty`, `func-counter`, `tact-empty`, `tact-counter`
|
|
19
|
+
|
|
20
|
+
For more details please go to https://github.com/ton-org/blueprint
|
package/dist/cli.js
CHANGED
|
@@ -8,52 +8,62 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
8
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
|
+
const arg_1 = __importDefault(require("arg"));
|
|
11
12
|
const chalk_1 = __importDefault(require("chalk"));
|
|
12
13
|
const FILES_WITH_NAME_TEMPLATE = ['package.json', 'README.md'];
|
|
13
14
|
const NAME_TEMPLATE = '{{name}}';
|
|
15
|
+
const VARIANT_CHOICES = [
|
|
16
|
+
{
|
|
17
|
+
name: 'An empty contract (FunC)',
|
|
18
|
+
value: 'func-empty',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'A simple counter contract (FunC)',
|
|
22
|
+
value: 'func-counter',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'An empty contract (TACT)',
|
|
26
|
+
value: 'tact-empty',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'A simple counter contract (TACT)',
|
|
30
|
+
value: 'tact-counter',
|
|
31
|
+
},
|
|
32
|
+
];
|
|
14
33
|
async function main() {
|
|
15
34
|
console.log();
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
:
|
|
35
|
+
const localArgs = (0, arg_1.default)({
|
|
36
|
+
'--type': String,
|
|
37
|
+
'--contractName': String,
|
|
38
|
+
});
|
|
39
|
+
const name = localArgs._[0] ||
|
|
40
|
+
(await inquirer_1.default.prompt({
|
|
19
41
|
name: 'name',
|
|
20
42
|
message: 'Project name',
|
|
21
43
|
})).name.trim();
|
|
22
44
|
if (name.length === 0)
|
|
23
45
|
throw new Error('Cannot initialize a project with an empty name');
|
|
24
|
-
const contractName =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
46
|
+
const contractName = localArgs['--contractName'] ||
|
|
47
|
+
(await inquirer_1.default.prompt({
|
|
48
|
+
name: 'contractName',
|
|
49
|
+
message: 'First created contract name (PascalCase)',
|
|
50
|
+
})).contractName.trim();
|
|
28
51
|
if (contractName.length === 0)
|
|
29
52
|
throw new Error(`Cannot create a contract with an empty name`);
|
|
30
53
|
if (contractName.toLowerCase() === 'contract' || !/^[A-Z][a-zA-Z0-9]*$/.test(contractName))
|
|
31
54
|
throw new Error(`Cannot create a contract with the name '${contractName}'`);
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
value: 'func-counter',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: 'An empty contract (TACT)',
|
|
48
|
-
value: 'tact-empty',
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'A simple counter contract (TACT)',
|
|
52
|
-
value: 'tact-counter',
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
]);
|
|
55
|
+
const argsVariant = VARIANT_CHOICES.map(e => e.value).indexOf(localArgs['--type'] || '') !== -1
|
|
56
|
+
? localArgs['--type']
|
|
57
|
+
: undefined;
|
|
58
|
+
const variant = argsVariant ||
|
|
59
|
+
(await inquirer_1.default.prompt([
|
|
60
|
+
{
|
|
61
|
+
name: 'variant',
|
|
62
|
+
message: 'Choose the project template',
|
|
63
|
+
type: 'list',
|
|
64
|
+
choices: VARIANT_CHOICES,
|
|
65
|
+
},
|
|
66
|
+
])).variant;
|
|
57
67
|
await fs_extra_1.default.mkdir(name);
|
|
58
68
|
const steps = 3;
|
|
59
69
|
console.log(`\n[1/${steps}] Copying files...`);
|
package/dist/template/README.md
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "{{name}}",
|
|
3
3
|
"version": "0.0.1",
|
|
4
|
-
"license": "MIT",
|
|
5
4
|
"scripts": {
|
|
5
|
+
"start": "blueprint run",
|
|
6
|
+
"build": "blueprint build",
|
|
6
7
|
"test": "jest"
|
|
7
8
|
},
|
|
8
9
|
"devDependencies": {
|
|
9
|
-
"@ton-community/blueprint": "^0.
|
|
10
|
+
"@ton-community/blueprint": "^0.12.0",
|
|
10
11
|
"@ton-community/sandbox": "^0.11.0",
|
|
11
|
-
"@ton-community/test-utils": "^0.
|
|
12
|
+
"@ton-community/test-utils": "^0.3.0",
|
|
12
13
|
"@types/jest": "^29.5.0",
|
|
13
14
|
"@types/node": "^20.2.5",
|
|
14
15
|
"jest": "^29.5.0",
|
|
15
16
|
"prettier": "^2.8.6",
|
|
16
|
-
"ton": "
|
|
17
|
-
"ton-core": "^0.
|
|
17
|
+
"ton": "~13.6.0",
|
|
18
|
+
"ton-core": "^0.51.0",
|
|
18
19
|
"ton-crypto": "^3.2.0",
|
|
19
20
|
"ts-jest": "^29.0.5",
|
|
20
21
|
"ts-node": "^10.9.1",
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
2
|
+
"name": "create-ton",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Tool to quickly create TON projects",
|
|
6
|
+
"author": "TonTech",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/ton-community/create-ton.git"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/**/*"
|
|
13
|
+
],
|
|
14
|
+
"bin": "./dist/cli.js",
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "rm -rf dist && tsc && cp -r template dist/template"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/fs-extra": "^11.0.1",
|
|
20
|
+
"@types/inquirer": "^8.2.6",
|
|
21
|
+
"@types/node": "^20.2.5",
|
|
22
|
+
"prettier": "^2.8.8",
|
|
23
|
+
"typescript": "^4.9.5"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"arg": "^5.0.2",
|
|
27
|
+
"chalk": "^4.1.0",
|
|
28
|
+
"fs-extra": "^11.1.1",
|
|
29
|
+
"inquirer": "^8.2.5"
|
|
30
|
+
},
|
|
31
|
+
"packageManager": "yarn@3.6.1"
|
|
32
|
+
}
|