Skip to content

Commit

Permalink
Merge pull request #108 from sCrypt-Inc/add_helper_msg
Browse files Browse the repository at this point in the history
add helper msg
  • Loading branch information
zhfnjust authored Mar 25, 2024
2 parents 0fe8196 + f28d035 commit 79c5e1d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 43 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scrypt-cli",
"version": "0.1.71",
"version": "0.1.72",
"description": "CLI tool for creating and managing sCrypt projects.",
"bin": {
"scrypt": "./src/bin/index.js",
Expand Down Expand Up @@ -37,7 +37,7 @@
"json5": "^2.2.2",
"lodash": "^4.17.21",
"ora": "^5.4.1",
"scrypt-ts-transpiler": "^1.2.18",
"scrypt-ts-transpiler": "^1.2.20",
"scryptlib": "^2.1.41",
"semver": "^7.3.8",
"shelljs": "^0.8.5",
Expand Down
8 changes: 7 additions & 1 deletion src/lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,13 @@ async function init({ force }) {
exit(-1)
}

const tsVersion = majorVersion(Object.assign({}, packageJSON?.dependencies, packageJSON?.devDependencies)["typescript"])
const tsStr = Object.assign({}, packageJSON?.dependencies, packageJSON?.devDependencies)["typescript"];
if(!tsStr) {
console.log(red('Not typescript found'));
exit(-1)
}

const tsVersion = majorVersion(tsStr)
configTSconfig({
isVue3ViteProject,
isReactProject,
Expand Down
4 changes: 4 additions & 0 deletions templates/counter/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import * as dotenv from 'dotenv'
// Load the .env file
dotenv.config()

if(!process.env.PRIVATE_KEY) {
throw new Error("No \"PRIVATE_KEY\" found in .env, Please run \"npm run genprivkey\" to generate a private key")
}

// Read the private key from the .env file.
// The default private key inside the .env file is meant to be used for the Bitcoin testnet.
// See https://scrypt.io/docs/bitcoin-basics/bsv/#private-keys
Expand Down
4 changes: 4 additions & 0 deletions templates/demo-contract/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import * as dotenv from 'dotenv'
// Load the .env file
dotenv.config()

if(!process.env.PRIVATE_KEY) {
throw new Error("No \"PRIVATE_KEY\" found in .env, Please run \"npm run genprivkey\" to generate a private key")
}

// Read the private key from the .env file.
// The default private key inside the .env file is meant to be used for the Bitcoin testnet.
// See https://scrypt.io/docs/bitcoin-basics/bsv/#private-keys
Expand Down
63 changes: 32 additions & 31 deletions tests/test-all-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ if [ $TRAVIS_OS_NAME = linux ] ; then

echo "testing Vue 3.x bundled with Vite"
rm -rf dapp-vue3-vite
../tests/helper-scripts/create-vue3-vite-app.exp
npm create vue@latest dapp-vue3-vite -- --ts --jsx --router --pinia --vitest --eslint
cd dapp-vue3-vite
git init
git add .
Expand All @@ -177,26 +177,27 @@ if [ $TRAVIS_OS_NAME = linux ] ; then
npm run build
cd ..

echo "testing Vue 2.x bundled with Vite"
rm -rf dapp-vue2-vite
../tests/helper-scripts/create-vue2-vite-app.exp
cd dapp-vue2-vite
git init
git add .
git commit -am "Initial commit"
npm i
npm i -D ../../
npx scrypt-cli init --force
npx scrypt-cli compile
cp ../../tests/replaced-files/vue2-vite-main.ts src/main.ts
cat src/main.ts
npm run build
cd ..
# echo "testing Vue 2.x bundled with Vite"
# rm -rf dapp-vue2-vite
# ../tests/helper-scripts/create-vue2-vite-app.exp
# cd dapp-vue2-vite
# git init
# git add .
# git commit -am "Initial commit"
# npm i
# npm i -D ../../
# npx scrypt-cli init --force
# npx scrypt-cli compile
# cp ../../tests/replaced-files/vue2-vite-main.ts src/main.ts
# cat src/main.ts
# npm run build
# cd ..

echo "testing Vue 3.x bundled with Webpack"
rm -rf dapp-vue3-webpack ~/.vuerc
echo "{ \"useTaobaoRegistry\": true }" > ~/.vuerc
../tests/helper-scripts/create-vue3-webpack-app.exp
#npx @vue/cli create dapp-vue3-webpack -p default --inlinePreset '{"useConfigFiles": true,"plugins": {"@vue/cli-plugin-typescript": {"classComponent": false},"@vue/cli-plugin-unit-jest": {}},"vueVersion": "3"}'
cd dapp-vue3-webpack
git init
git add .
Expand All @@ -210,21 +211,21 @@ if [ $TRAVIS_OS_NAME = linux ] ; then
npm run build
cd ..

rm -rf dapp-vue2-webpack ~/.vuerc
echo "{ \"useTaobaoRegistry\": true }" > ~/.vuerc
../tests/helper-scripts/create-vue2-webpack-app.exp
cd dapp-vue2-webpack
git init
git add .
git commit -am "Initial commit"
npm i
npm i -D ../../
npx scrypt-cli init --force
npx scrypt-cli compile
cp ../../tests/replaced-files/vue2-webpack-main.ts src/main.ts
cat src/main.ts
npm run build
cd ..
# rm -rf dapp-vue2-webpack ~/.vuerc
# echo "{ \"useTaobaoRegistry\": true }" > ~/.vuerc
# ../tests/helper-scripts/create-vue2-webpack-app.exp
# cd dapp-vue2-webpack
# git init
# git add .
# git commit -am "Initial commit"
# npm i
# npm i -D ../../
# npx scrypt-cli init --force
# npx scrypt-cli compile
# cp ../../tests/replaced-files/vue2-webpack-main.ts src/main.ts
# cat src/main.ts
# npm run build
# cd ..
fi

ls -la
Expand Down

0 comments on commit 79c5e1d

Please sign in to comment.