create-ton-project
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -11,2 +11,3 @@ #!/usr/bin/env node | ||
const readline_1 = __importDefault(require("readline")); | ||
const inquirer_1 = __importDefault(require("inquirer")); | ||
const PACKAGE_JSON = 'package.json'; | ||
@@ -23,17 +24,66 @@ function question(q) { | ||
async function main() { | ||
const defaultName = path_1.default.basename(process.cwd()); | ||
let name = (await question(`Project name? (${defaultName}) `)).trim(); | ||
const { name, variant } = await inquirer_1.default.prompt([ | ||
{ | ||
name: 'name', | ||
message: 'Project name', | ||
}, | ||
{ | ||
name: 'variant', | ||
message: 'Choose the project template', | ||
type: 'list', | ||
choices: [ | ||
{ | ||
name: 'An empty contract', | ||
value: 'empty', | ||
}, | ||
{ | ||
name: 'A simple counter contract', | ||
value: 'counter', | ||
}, | ||
] | ||
} | ||
]); | ||
if (name.length === 0) | ||
name = defaultName; | ||
throw new Error('Cannot initialize a project with an empty name'); | ||
await fs_extra_1.default.mkdir(name); | ||
const steps = 2; | ||
console.log(`[1/${steps}] Copying files...`); | ||
const basePath = path_1.default.join(__dirname, 'template'); | ||
for (const file of await fs_extra_1.default.readdir(basePath)) { | ||
if (file === PACKAGE_JSON) | ||
if (file === PACKAGE_JSON || file === 'variants') | ||
continue; | ||
await fs_extra_1.default.copy(path_1.default.join(basePath, file), file); | ||
await fs_extra_1.default.copy(path_1.default.join(basePath, file), path_1.default.join(name, file)); | ||
} | ||
await fs_extra_1.default.writeFile(PACKAGE_JSON, (await fs_extra_1.default.readFile(path_1.default.join(basePath, PACKAGE_JSON))).toString().replace('{{name}}', name)); | ||
const variantPath = path_1.default.join(basePath, 'variants', variant); | ||
for (const file of await fs_extra_1.default.readdir(variantPath)) { | ||
await fs_extra_1.default.copy(path_1.default.join(variantPath, file), path_1.default.join(name, file)); | ||
} | ||
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)); | ||
console.log(`[2/${steps}] Installing dependencies...`); | ||
(0, child_process_1.execSync)('npm i', { | ||
stdio: 'inherit', | ||
cwd: name, | ||
}); | ||
(0, child_process_1.execSync)('git init', { | ||
stdio: 'inherit', | ||
cwd: name, | ||
}); | ||
console.log('\nInitialized git repository.\n'); | ||
console.log(`Success! | ||
Now you can run the following to run the default tests: | ||
cd ${name} | ||
npm run test | ||
You can also run the following commands in your project's directory: | ||
npx blueprint create MyContract | ||
creates all the necessary files for a new contract | ||
npx blueprint build | ||
asks you to choose a contract and builds it | ||
npx blueprint run | ||
asks you to choose a script and runs it | ||
`); | ||
} | ||
main().catch(console.error); |
@@ -9,3 +9,3 @@ { | ||
"devDependencies": { | ||
"@ton-community/blueprint": "^0.0.1-alpha.3", | ||
"@ton-community/blueprint": "^0.0.1", | ||
"@ton-community/sandbox": "^0.2.0", | ||
@@ -12,0 +12,0 @@ "@ton-community/test-utils": "^0.0.2", |
{ | ||
"name": "create-ton-project", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"license": "MIT", | ||
@@ -21,9 +21,11 @@ "description": "Tool to quickly create TON projects", | ||
"devDependencies": { | ||
"@types/fs-extra": "^11.0.1", | ||
"@types/node": "^18.11.18", | ||
"typescript": "^4.9.5", | ||
"@types/fs-extra": "^11.0.1" | ||
"@types/inquirer": "^8.0.0" | ||
}, | ||
"dependencies": { | ||
"fs-extra": "^11.1.0" | ||
"fs-extra": "^11.1.0", | ||
"inquirer": "^8.0.0" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
92177
21
298
2
4
2
+ Addedinquirer@^8.0.0
+ Addedansi-escapes@4.3.2(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbl@4.1.0(transitive)
+ Addedbuffer@5.7.1(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedchardet@0.7.0(transitive)
+ Addedcli-cursor@3.1.0(transitive)
+ Addedcli-spinners@2.9.2(transitive)
+ Addedcli-width@3.0.0(transitive)
+ Addedclone@1.0.4(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addeddefaults@1.0.4(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedexternal-editor@3.1.0(transitive)
+ Addedfigures@3.2.0(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedinquirer@8.2.6(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedis-interactive@1.0.0(transitive)
+ Addedis-unicode-supported@0.1.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedlog-symbols@4.1.0(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addedmute-stream@0.0.8(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedora@5.4.1(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedrestore-cursor@3.1.0(transitive)
+ Addedrun-async@2.4.1(transitive)
+ Addedrxjs@7.8.1(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedtmp@0.0.33(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addedtype-fest@0.21.3(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwcwidth@1.0.1(transitive)
+ Addedwrap-ansi@6.2.0(transitive)