From 923ae32173457635cd2b70d853c8ee2f7db1911b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Che=C5=82miniak?= Date: Tue, 29 Oct 2024 13:50:42 +0100 Subject: [PATCH] feat: add bundled create-stapler-app package --- .changeset/new-eggs-cheat.md | 7 ++ .changeset/pre.json | 4 +- packages/cli/CHANGELOG.md | 8 +++ packages/cli/index.ts | 84 +++++++++++++----------- packages/cli/package.json | 4 +- packages/core/CHANGELOG.md | 6 ++ packages/core/package.json | 2 +- packages/create-stapler-app/CHANGELOG.md | 7 ++ packages/create-stapler-app/index.ts | 3 + packages/create-stapler-app/package.json | 12 ++++ pnpm-lock.yaml | 9 +++ 11 files changed, 102 insertions(+), 44 deletions(-) create mode 100644 .changeset/new-eggs-cheat.md create mode 100644 packages/create-stapler-app/CHANGELOG.md create mode 100644 packages/create-stapler-app/index.ts create mode 100644 packages/create-stapler-app/package.json diff --git a/.changeset/new-eggs-cheat.md b/.changeset/new-eggs-cheat.md new file mode 100644 index 0000000..4c0f7d6 --- /dev/null +++ b/.changeset/new-eggs-cheat.md @@ -0,0 +1,7 @@ +--- +'@tonik/create-stapler-app': minor +'@tonik/create-stapler-app-cli': patch +'@tonik/create-stapler-app-core': patch +--- + +Added separate bundled create-stapler-app package diff --git a/.changeset/pre.json b/.changeset/pre.json index ed30b2a..8be8790 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -3,10 +3,12 @@ "tag": "alpha", "initialVersions": { "@tonik/create-stapler-app": "0.1.0", - "@tonik/create-stapler-app-core": "0.1.0" + "@tonik/create-stapler-app-core": "0.1.0", + "@tonik/create-stapler-app-cli": "0.2.0-alpha.1" }, "changesets": [ "light-walls-obey", + "new-eggs-cheat", "witty-months-give" ] } diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index cd45d56..64aeabb 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,13 @@ # @tonik/create-stapler-app +## 0.2.0-alpha.2 + +### Patch Changes + +- Added separate bundled create-stapler-app package +- Updated dependencies + - @tonik/create-stapler-app-core@0.2.0-alpha.2 + ## 0.2.0-alpha.1 ### Minor Changes diff --git a/packages/cli/index.ts b/packages/cli/index.ts index a0424ad..da36cd7 100644 --- a/packages/cli/index.ts +++ b/packages/cli/index.ts @@ -5,7 +5,8 @@ import gradient from 'gradient-string'; import inquirer from 'inquirer'; import { createProject } from '@tonik/create-stapler-app-core'; -const asciiArt = ` +const cli = () => { + const asciiArt = ` .&&&% &&&& .&&&% &&&& .&&&&&&&&* (&&&&&&&&&&* (&&&.&&&&&&&&&& *&&&# &&&& #&&&&, @@ -17,50 +18,53 @@ const asciiArt = ` .&&&% (&&&&&&&&&%* (&&&/ %&&&, *&&&# &&&& .&&&&, `; -const displayHeader = () => { - const metalGradient = gradient([ - { color: '#3C3C3C', pos: 0 }, - { color: '#FFFFFF', pos: 0.5 }, - { color: '#BDBDBD', pos: 0.75 }, - { color: '#3C3C3C', pos: 1 }, - ]); + const displayHeader = () => { + const metalGradient = gradient([ + { color: '#3C3C3C', pos: 0 }, + { color: '#FFFFFF', pos: 0.5 }, + { color: '#BDBDBD', pos: 0.75 }, + { color: '#3C3C3C', pos: 1 }, + ]); - console.log(metalGradient(asciiArt)); - console.log(chalk.bold('\n🖇️ Welcome to Stapler!\n')); -}; + console.log(metalGradient(asciiArt)); + console.log(chalk.bold('\n🖇️ Welcome to Stapler!\n')); + }; -const program = new Command(); + const program = new Command(); -program - .name('create-stapler-app') - .description('CLI to bootstrap a new tonik-infused app') - .version('0.1.0') - .hook('preAction', () => { - displayHeader(); - }); + program + .name('create-stapler-app') + .description('CLI to bootstrap a new tonik-infused app') + .version('0.1.0') + .hook('preAction', () => { + displayHeader(); + }); -const createAction = async () => { - const answers = await inquirer.prompt([ - { - type: 'input', - name: 'name', - message: 'What is your project named?', - default: 'my-stapled-app', - }, - { - type: 'confirm', - name: 'usePayload', - message: 'Would you like to add Payload to your app?', - default: true, - }, - ]); + const createAction = async () => { + const answers = await inquirer.prompt([ + { + type: 'input', + name: 'name', + message: 'What is your project named?', + default: 'my-stapled-app', + }, + { + type: 'confirm', + name: 'usePayload', + message: 'Would you like to add Payload to your app?', + default: true, + }, + ]); - await createProject(answers); -}; + await createProject(answers); + }; -program.command('create').description('Create a new tonik-infused app').action(createAction); + program.command('create').description('Create a new tonik-infused app').action(createAction); -// Set "create" as the default command -program.action(createAction); + // Set "create" as the default command + program.action(createAction); + + program.parse(); +}; -program.parse(); +export default cli; diff --git a/packages/cli/package.json b/packages/cli/package.json index f19bc72..5e2c0ae 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { - "name": "@tonik/create-stapler-app", - "version": "0.2.0-alpha.1", + "name": "@tonik/create-stapler-app-cli", + "version": "0.2.0-alpha.2", "main": "./dist/index.mjs", "types": "./dist/index.d.ts", "bin": { diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 5f21df8..5f5ce11 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,11 @@ # @tonik/create-stapler-app-core +## 0.2.0-alpha.2 + +### Patch Changes + +- Added separate bundled create-stapler-app package + ## 0.2.0-alpha.1 ### Minor Changes diff --git a/packages/core/package.json b/packages/core/package.json index 5dad76e..f5f7261 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@tonik/create-stapler-app-core", - "version": "0.2.0-alpha.1", + "version": "0.2.0-alpha.2", "main": "dist/index.js", "types": "dist/index.d.ts", "private": true, diff --git a/packages/create-stapler-app/CHANGELOG.md b/packages/create-stapler-app/CHANGELOG.md new file mode 100644 index 0000000..2289bf7 --- /dev/null +++ b/packages/create-stapler-app/CHANGELOG.md @@ -0,0 +1,7 @@ +# @tonik/create-stapler-app + +## 0.1.0-alpha.4 + +### Minor Changes + +- Added separate bundled create-stapler-app package diff --git a/packages/create-stapler-app/index.ts b/packages/create-stapler-app/index.ts new file mode 100644 index 0000000..7cb6146 --- /dev/null +++ b/packages/create-stapler-app/index.ts @@ -0,0 +1,3 @@ +import cli from '@tonik/create-stapler-app-cli'; + +cli(); diff --git a/packages/create-stapler-app/package.json b/packages/create-stapler-app/package.json new file mode 100644 index 0000000..a7cac1b --- /dev/null +++ b/packages/create-stapler-app/package.json @@ -0,0 +1,12 @@ +{ + "name": "@tonik/create-stapler-app", + "version": "0.1.0-alpha.4", + "main": "index.ts", + "bin": { + "create-stapler-app": "cli/index.mjs" + }, + "devDependencies": { + "@tonik/create-stapler-app-core": "workspace:*", + "@tonik/create-stapler-app-cli": "workspace:*" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7867927..d9a2e2a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -144,6 +144,15 @@ importers: specifier: ^5.6.2 version: 5.6.3 + packages/create-stapler-app: + devDependencies: + '@tonik/create-stapler-app-cli': + specifier: workspace:* + version: link:../cli + '@tonik/create-stapler-app-core': + specifier: workspace:* + version: link:../core + packages: '@babel/code-frame@7.24.7':