Skip to content

Commit 60fcb33

Browse files
committed
Make playground package optional
1 parent 70f20f8 commit 60fcb33

File tree

8 files changed

+20
-4
lines changed

8 files changed

+20
-4
lines changed

src/index.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type Config = {
1818
githubUrl: string
1919
githubIssues: string
2020
githubRepository: string
21+
includePlayground: boolean
2122
}
2223

2324
async function init() {
@@ -26,10 +27,11 @@ async function init() {
2627
let result: {
2728
packageName?: string
2829
githubPath?: string
30+
includePlayground: boolean
2931
} = {}
3032

3133
try {
32-
result = await prompts(
34+
result = <any>await prompts(
3335
[
3436
{
3537
name: 'packageName',
@@ -41,6 +43,13 @@ async function init() {
4143
type: 'text',
4244
message: 'GitHub path, e.g. skirtles-code/test-project (optional)',
4345
initial: ''
46+
}, {
47+
name: 'includePlayground',
48+
type: 'toggle',
49+
message: 'Include playground application for development?',
50+
initial: true,
51+
active: 'Yes',
52+
inactive: 'No'
4453
}
4554
],
4655
{
@@ -102,11 +111,16 @@ async function init() {
102111
githubPath,
103112
githubUrl,
104113
githubIssues,
105-
githubRepository
114+
githubRepository,
115+
includePlayground: result.includePlayground
106116
}
107117

108118
copyTemplate('base', config)
109119

120+
if (config.includePlayground) {
121+
copyTemplate('playground', config)
122+
}
123+
110124
console.log('Project created')
111125
console.log('Note: pnpm must be used as the package manager')
112126
console.log()

src/template/base/package.json renamed to src/template/base/package.json.ejs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
"build": "pnpm run -r build",
77
"type-check": "pnpm run -r type-check",
88
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
9+
<%_ if (config.includePlayground) { _%>
910
"dev": "pnpm run --filter ./packages/playground -r dev",
11+
<%_ } _%>
1012
"docs:dev": "pnpm run --filter ./packages/docs -r dev",
11-
"test:unit": "pnpm run --filter ./packages/@projectName@ -r test:unit",
12-
"coverage": "pnpm run --filter ./packages/@projectName@ -r coverage",
13+
"test:unit": "pnpm run --filter ./packages/<%- config.shortUnscopedPackageName %> -r test:unit",
14+
"coverage": "pnpm run --filter ./packages/<%- config.shortUnscopedPackageName %> -r coverage",
1315
"preinstall": "node scripts/preinstall.js",
1416
"postinstall": "simple-git-hooks"
1517
},

0 commit comments

Comments
 (0)