-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b103e1
commit 4260e65
Showing
9 changed files
with
136 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
export const templateTypes: { name: string; value: string }[] = [ | ||
{ | ||
name: 'An empty contract (FunC)', | ||
value: 'func-empty', | ||
}, | ||
{ | ||
name: 'A simple counter contract (FunC)', | ||
value: 'func-counter', | ||
}, | ||
{ | ||
name: 'An empty contract (TACT)', | ||
value: 'tact-empty', | ||
}, | ||
{ | ||
name: 'A simple counter contract (TACT)', | ||
value: 'tact-counter', | ||
}, | ||
]; | ||
|
||
export const helpArgs = { '--help': Boolean }; | ||
export const helpMessages = { | ||
help: `Usage: blueprint help [command] | ||
Displays this message if no command is specified, or displays detailed help for the specified command. | ||
Blueprint is generally invoked as follows: blueprint [command] [command-args] [flags] | ||
List of available commands: | ||
- create | ||
- run | ||
- build | ||
- custom | ||
- help | ||
- test | ||
- verify | ||
- convert`, | ||
create: `Usage: blueprint create [contract name] [flags] | ||
Creates a new contract together with supporting files according to a template. | ||
Contract name must be specified in PascalCase and may only include characters a-z, A-Z, 0-9. If not specified on the command line, it will be asked interactively. | ||
Flags: | ||
--type <type> - specifies the template type to use when creating the contract. If not specified on the command line, it will be asked interactively. | ||
List of available types: | ||
${templateTypes.map((t) => `${t.value} - ${t.name}`).join('\n')}`, | ||
run: `Usage: blueprint run [script name] [flags] | ||
Runs a script from the scripts directory. | ||
Script name is matched (ignoring case) to a file in the scripts directory. If not specified on the command line, the available scripts will be presented interactively. | ||
Flags: | ||
--mainnet, --testnet - specifies the network to use when running the script. If not specified on the command line, it will be asked interactively. | ||
--custom [api-endpoint] - indicates that a custom API should be used when running the script, and the API URL optionally. (example: https://testnet.toncenter.com/api/v2/) | ||
--custom-version - specifies the API version to use with the custom API. Options: v2 (defualt), v4. | ||
--custom-key - specifies the API key to use with the custom API, can only be used with API v2. | ||
--custom-type - specifies the network type to be indicated to scripts. Options: custom (default), mainnet, testnet. | ||
--tonconnect, --tonhub, --deeplink, --mnemonic - specifies the deployer to use when running the script. If not specified on the command line, it will be asked interactively. | ||
--tonscan, --tonviewer, --toncx, --dton - specifies the network explorer to use when displaying links to the deployed contracts. Default: tonscan.`, | ||
build: `Usage: blueprint build [contract name] [flags] | ||
Builds the specified contract according to the respective .compile.ts file. If the contract is written in TACT, all TACT-generated files (wrapper class, etc) will be placed in the build/<contract name> folder. | ||
If contract name is not specified on the command line, the buildable contracts (that have the respective .compile.ts files under wrappers directory) will be presented interactively, unless --all flag is specified. | ||
Flags: | ||
--all - builds all buildable contracts instead of just one.`, | ||
set: `Usage: blueprint set <key> [value] | ||
Available keys: | ||
- func - overrides @ton-community/func-js-bin version, effectively setting the func version. The required version may be passed as the value, otherwise available versions will be displayed.`, | ||
test: `Usage: blueprint test | ||
Just runs \`npm test\`, which by default runs \`jest\`.`, | ||
verify: `Usage: blueprint verify [contract name] [flags] | ||
Builds a contract (similar to build command) and verifies it on https://verifier.ton.org. The contract must be already deployed on the network. If the contract's name is not specified on the command line, it will be asked interactively. | ||
Flags: | ||
--mainnet, --testnet - specifies the network to use when running the script. If not specified on the command line, it will be asked interactively. | ||
--custom [api-endpoint] - indicates that a custom API should be used when running the script, and the API URL optionally. (example: https://testnet.toncenter.com/api/v2/) Requires --custom-type to be specified. | ||
--custom-version - specifies the API version to use with the custom API. Options: v2 (defualt), v4. | ||
--custom-key - specifies the API key to use with the custom API, can only be used with API v2. | ||
--custom-type - specifies the network type to be indicated to scripts. Options: mainnet, testnet.`, | ||
convert: `Usage: blueprint convert [path to build script] | ||
Atempts to convert legacy bash build script to a blueprint compile wrapper.`, | ||
} satisfies { [name: string]: string }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
import { Runner } from './Runner'; | ||
import { execSync } from 'child_process'; | ||
import arg from 'arg'; | ||
import { helpArgs, helpMessages } from './constants'; | ||
|
||
export const test: Runner = async (args, ui) => { | ||
const localArgs = arg(helpArgs); | ||
if (localArgs['--help']) { | ||
ui.write(helpMessages['test']); | ||
return; | ||
} | ||
|
||
export const test: Runner = async () => { | ||
execSync('npm test', { stdio: 'inherit' }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters