Skip to content

Commit

Permalink
feat: changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cpreston321 committed Aug 24, 2023
1 parent 56ad313 commit de9f5b6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
28 changes: 28 additions & 0 deletions examples/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as p from '@clack/prompts'
import color from 'picocolors';

(async () => {
console.clear();

p.intro(`${color.bgCyan(color.black(' clack-examples '))}`);

// Choose example to run
const example = await p.select({
message: 'Choose an example:',
options: [
{ label: 'Basic', value: 'basic', hint: 'basic project setup' },
{ label: 'Changesets', value: 'changesets', hint: 'mimics the changesets cli' },
{ label: 'Spinner', value: 'spinner', hint: 'shows off the spinner functionality' },
{ label: 'Workflow', value: 'workflow' },
],
})

if (p.isCancel(example)) return

try {
// Run example
await import(`./${example}.ts`);
} catch (error) {
// Don't crash on error
}
})()
1 change: 1 addition & 0 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"picocolors": "^1.0.0"
},
"scripts": {
"start": "jiti ./index.ts",
"basic": "jiti ./basic.ts",
"spinner": "jiti ./spinner.ts",
"changesets": "jiti ./changesets.ts",
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
"private": true,
"type": "module",
"scripts": {
"dev": "pnpm --filter @clack/examples run start",
"stub": "pnpm -r run build --stub",
"build": "pnpm run build:core && pnpm run build:prompts",
"build:core": "pnpm --filter @clack/core run build",
"build:prompts": "pnpm --filter @clack/prompts run build",
"start": "pnpm --filter @example/basic run start",
"dev": "pnpm --filter @example/changesets run start",
"format": "pnpm run format:code",
"format:code": "prettier -w . --cache",
"format:imports": "organize-imports-cli ./packages/*/tsconfig.json",
Expand Down

0 comments on commit de9f5b6

Please sign in to comment.