Skip to content

Commit de9f5b6

Browse files
committed
feat: changes
1 parent 56ad313 commit de9f5b6

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

examples/index.ts

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import * as p from '@clack/prompts'
2+
import color from 'picocolors';
3+
4+
(async () => {
5+
console.clear();
6+
7+
p.intro(`${color.bgCyan(color.black(' clack-examples '))}`);
8+
9+
// Choose example to run
10+
const example = await p.select({
11+
message: 'Choose an example:',
12+
options: [
13+
{ label: 'Basic', value: 'basic', hint: 'basic project setup' },
14+
{ label: 'Changesets', value: 'changesets', hint: 'mimics the changesets cli' },
15+
{ label: 'Spinner', value: 'spinner', hint: 'shows off the spinner functionality' },
16+
{ label: 'Workflow', value: 'workflow' },
17+
],
18+
})
19+
20+
if (p.isCancel(example)) return
21+
22+
try {
23+
// Run example
24+
await import(`./${example}.ts`);
25+
} catch (error) {
26+
// Don't crash on error
27+
}
28+
})()

examples/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"picocolors": "^1.0.0"
1010
},
1111
"scripts": {
12+
"start": "jiti ./index.ts",
1213
"basic": "jiti ./basic.ts",
1314
"spinner": "jiti ./spinner.ts",
1415
"changesets": "jiti ./changesets.ts",

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6+
"dev": "pnpm --filter @clack/examples run start",
67
"stub": "pnpm -r run build --stub",
78
"build": "pnpm run build:core && pnpm run build:prompts",
89
"build:core": "pnpm --filter @clack/core run build",
910
"build:prompts": "pnpm --filter @clack/prompts run build",
10-
"start": "pnpm --filter @example/basic run start",
11-
"dev": "pnpm --filter @example/changesets run start",
1211
"format": "pnpm run format:code",
1312
"format:code": "prettier -w . --cache",
1413
"format:imports": "organize-imports-cli ./packages/*/tsconfig.json",

0 commit comments

Comments
 (0)