From 869e2a6477eef6eb9b64d7470162ca3d7d66ba2a Mon Sep 17 00:00:00 2001 From: "Hong Jing (Jingles)" Date: Wed, 28 Aug 2024 15:18:19 +0800 Subject: [PATCH] debug build --- package.json | 2 +- scripts/mesh-cli/bin/create-mesh-app | 2 - scripts/mesh-cli/bin/meshjs | 2 + scripts/mesh-cli/package.json | 11 ++++-- scripts/mesh-cli/src/actions/create.ts | 9 +---- scripts/mesh-cli/src/index.ts | 51 ++++++++++++++------------ 6 files changed, 40 insertions(+), 37 deletions(-) delete mode 100755 scripts/mesh-cli/bin/create-mesh-app create mode 100755 scripts/mesh-cli/bin/meshjs diff --git a/package.json b/package.json index 0879c4a5..49efaaac 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@meshsdk/root", "private": true, "scripts": { - "build": "npm run build:mesh && npm run build:docs && npm run build:apps && npm run build:scripts", + "build": "turbo build --concurrency 15", "build:apps": "turbo run build:apps", "build:docs": "turbo run build:docs", "build:mesh": "turbo run build:mesh", diff --git a/scripts/mesh-cli/bin/create-mesh-app b/scripts/mesh-cli/bin/create-mesh-app deleted file mode 100755 index c6cf500c..00000000 --- a/scripts/mesh-cli/bin/create-mesh-app +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env node -require('../dist/create-mesh-app.cjs.js'); diff --git a/scripts/mesh-cli/bin/meshjs b/scripts/mesh-cli/bin/meshjs new file mode 100755 index 00000000..74b198d6 --- /dev/null +++ b/scripts/mesh-cli/bin/meshjs @@ -0,0 +1,2 @@ +#! /usr/bin/env node +require('../dist/index.js'); diff --git a/scripts/mesh-cli/package.json b/scripts/mesh-cli/package.json index d3100bad..123c3dc8 100644 --- a/scripts/mesh-cli/package.json +++ b/scripts/mesh-cli/package.json @@ -3,9 +3,11 @@ "description": "A quick and easy way to bootstrap your dApps on Cardano using Mesh.", "homepage": "https://meshjs.dev", "author": "MeshJS", - "version": "1.5.3", + "version": "1.5.4", "license": "Apache-2.0", - "main": "dist/meshjs.cjs.js", + "type": "module", + "main": "./dist/index.cjs", + "module": "./dist/index.js", "bin": { "meshjs": "./bin/meshjs" }, @@ -23,7 +25,9 @@ "npx" ], "scripts": { - "build:scripts": "preconstruct build", + "clean": "rm -rf .turbo && rm -rf dist && rm -rf node_modules", + "build:scripts": "tsup src/index.ts --format esm,cjs --dts", + "build:scripts:old": "preconstruct build", "start": "preconstruct watch" }, "dependencies": { @@ -37,6 +41,7 @@ "devDependencies": { "@preconstruct/cli": "2.8.4", "@types/figlet": "1.5.8", + "@types/got": "^9.6.12", "@types/prompts": "2.4.9", "@types/tar": "6.1.13" } diff --git a/scripts/mesh-cli/src/actions/create.ts b/scripts/mesh-cli/src/actions/create.ts index f8881da7..fe8d9c4f 100644 --- a/scripts/mesh-cli/src/actions/create.ts +++ b/scripts/mesh-cli/src/actions/create.ts @@ -12,13 +12,8 @@ export const create = async (name, options) => { const template = options.template ?? (await askUser('What template do you want to use?', [ - { title: 'NextJs starter template', value: 'mesh-nextjs' }, - // { title: 'Multi-Sig Minting', value: 'minting' }, - // { title: 'Stake-Pool Website', value: 'staking' }, - // { title: 'Cardano Sign-In', value: 'signin' }, - // { title: 'E-Commerce Store', value: 'ecommerce' }, - // { title: 'Marketplace', value: 'marketplace' }, - { title: 'Aiken template', value: 'mesh-aiken' }, + { title: "Aiken", value: "mesh-aiken" }, + { title: "NextJS", value: "mesh-nextjs" }, ])); console.log('\n'); diff --git a/scripts/mesh-cli/src/index.ts b/scripts/mesh-cli/src/index.ts index ec4f01e1..2fc44cc3 100644 --- a/scripts/mesh-cli/src/index.ts +++ b/scripts/mesh-cli/src/index.ts @@ -1,65 +1,68 @@ -import chalk from 'chalk'; -import figlet from 'figlet'; +import chalk from "chalk"; +import figlet from "figlet"; import { - createArgument, createCommand, - createOption, InvalidArgumentError, -} from 'commander'; -import { create } from './actions'; -import { logError, logSuccess } from './utils'; + createArgument, + createCommand, + createOption, + InvalidArgumentError, +} from "commander"; +import { create } from "./actions"; +import { logError, logSuccess } from "./utils"; const main = async () => { console.clear(); console.info( - chalk.blue( - figlet.textSync('!Create Mesh dApp', { - font: 'Speed', horizontalLayout: 'full', + chalk.blueBright( + figlet.textSync("MeshJS", { + font: "Larry 3D", + horizontalLayout: "full", }) ) ); - console.log('\n'); + console.log("\n"); const program = createCommand(); program - .name('create-mesh-app') + .name("meshjs") .description( - 'A quick and easy way to bootstrap your dApps on Cardano using Mesh.' + "A quick and easy way to bootstrap your dApps on Cardano using Mesh." ) - .version('1.0.0'); + .version("1.0.0"); program .addArgument( - createArgument('name', 'Set a name for your dApp.') + createArgument("name", "Set a name for your dApp.") .argParser((name) => { if (/^([A-Za-z\-\\_\d])+$/.test(name)) return name; throw new InvalidArgumentError( chalk.redBright( - '❗ Only letters, numbers, underscores and, hashes are allowed.', - ), + "❗ Only letters, numbers, underscores and, hashes are allowed." + ) ); }) .argRequired() ) .addOption( createOption( - '-t, --template ', + "-t, --template ", `The template to start your project from.` - ).choices(['starter', 'minting', 'staking', 'ecommerce', 'signin', 'marketplace']) + ).choices(["nextjs", "aiken"]) ) .addOption( createOption( - '-s, --stack ', + "-s, --stack ", `The tech stack you want to build on.` - ).choices(['next']) + ).choices(["next"]) ) .addOption( createOption( - '-l, --language ', + "-l, --language ", `The language you want to use.` - ).choices(['ts']) + ).choices(["ts"]) ) .action(create); @@ -68,7 +71,7 @@ const main = async () => { main() .then(() => { - logSuccess('✨✨ Welcome to Web 3.0! ✨✨'); + logSuccess("✨✨ Welcome to Web 3.0! ✨✨"); process.exit(0); }) .catch((error) => {