Skip to content

Commit

Permalink
feat: add bundled create-stapler-app package
Browse files Browse the repository at this point in the history
  • Loading branch information
maneike committed Oct 29, 2024
1 parent e151f9d commit 923ae32
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 44 deletions.
7 changes: 7 additions & 0 deletions .changeset/new-eggs-cheat.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
8 changes: 8 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
84 changes: 44 additions & 40 deletions packages/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `
.&&&% &&&&
.&&&% &&&&
.&&&&&&&&* (&&&&&&&&&&* (&&&.&&&&&&&&&& *&&&# &&&& #&&&&,
Expand All @@ -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;
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
6 changes: 6 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
7 changes: 7 additions & 0 deletions packages/create-stapler-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @tonik/create-stapler-app

## 0.1.0-alpha.4

### Minor Changes

- Added separate bundled create-stapler-app package
3 changes: 3 additions & 0 deletions packages/create-stapler-app/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import cli from '@tonik/create-stapler-app-cli';

cli();
12 changes: 12 additions & 0 deletions packages/create-stapler-app/package.json
Original file line number Diff line number Diff line change
@@ -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:*"
}
}
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 923ae32

Please sign in to comment.