@lemonadecms/create 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +16 -0
  3. package/bin/create-lemonade.mjs +8 -6
  4. package/dist/catalog.json +193 -25
  5. package/dist/templates/angular/locks/npm-lock.json.template +2 -2
  6. package/dist/templates/angular/locks/pnpm-lock.yaml.template +14 -11
  7. package/dist/templates/angular/locks/yarn.lock.template +4899 -0
  8. package/dist/templates/angular/package.json +8 -1
  9. package/dist/templates/angular/vendor/README.md +32 -0
  10. package/dist/templates/angular/vendor/picomatch-4.0.7-lemonade-sec51.1.tgz +0 -0
  11. package/dist/templates/angular/vendor/picomatch-4.0.7.patch +59 -0
  12. package/dist/templates/angular/vendor/provenance.json +29 -0
  13. package/dist/templates/astro/locks/npm-lock.json.template +4 -4
  14. package/dist/templates/astro/locks/pnpm-lock.yaml.template +22 -15
  15. package/dist/templates/astro/locks/yarn.lock.template +4085 -0
  16. package/dist/templates/astro/package.json +10 -1
  17. package/dist/templates/astro/vendor/README.md +32 -0
  18. package/dist/templates/astro/vendor/picomatch-2.3.2-lemonade-sec51.1.tgz +0 -0
  19. package/dist/templates/astro/vendor/picomatch-2.3.2.patch +59 -0
  20. package/dist/templates/astro/vendor/picomatch-4.0.7-lemonade-sec51.1.tgz +0 -0
  21. package/dist/templates/astro/vendor/picomatch-4.0.7.patch +59 -0
  22. package/dist/templates/astro/vendor/provenance.json +43 -0
  23. package/dist/templates/next/locks/yarn.lock.template +775 -0
  24. package/dist/templates/nuxt/locks/npm-lock.json.template +6 -6
  25. package/dist/templates/nuxt/locks/pnpm-lock.yaml.template +33 -28
  26. package/dist/templates/nuxt/locks/yarn.lock.template +6915 -0
  27. package/dist/templates/nuxt/package.json +13 -1
  28. package/dist/templates/nuxt/vendor/README.md +32 -0
  29. package/dist/templates/nuxt/vendor/picomatch-2.3.2-lemonade-sec51.1.tgz +0 -0
  30. package/dist/templates/nuxt/vendor/picomatch-2.3.2.patch +59 -0
  31. package/dist/templates/nuxt/vendor/picomatch-4.0.7-lemonade-sec51.1.tgz +0 -0
  32. package/dist/templates/nuxt/vendor/picomatch-4.0.7.patch +59 -0
  33. package/dist/templates/nuxt/vendor/provenance.json +43 -0
  34. package/dist/templates/shared/GETTING_STARTED.md +3 -3
  35. package/dist/templates/shared/gitignore.template +3 -0
  36. package/dist/templates/shared/yarnrc.yml.template +2 -0
  37. package/package.json +1 -1
  38. package/src/arguments.mjs +23 -3
  39. package/src/catalog.mjs +35 -3
  40. package/src/prompts.mjs +7 -4
@@ -43,12 +43,24 @@
43
43
  "sharp"
44
44
  ],
45
45
  "overrides": {
46
- "readdir-glob>minimatch": "11.0.5"
46
+ "readdir-glob>minimatch": "11.0.5",
47
+ "picomatch@2.3.2": "file:vendor/picomatch-2.3.2-lemonade-sec51.1.tgz",
48
+ "picomatch@4.0.7": "file:vendor/picomatch-4.0.7-lemonade-sec51.1.tgz"
47
49
  }
48
50
  },
49
51
  "overrides": {
50
52
  "readdir-glob": {
51
53
  "minimatch": "11.0.5"
52
54
  }
55
+ },
56
+ "resolutions": {
57
+ "readdir-glob/minimatch": "11.0.5",
58
+ "picomatch@npm:^2.0.4": "file:./vendor/picomatch-2.3.2-lemonade-sec51.1.tgz",
59
+ "picomatch@npm:^2.3.1": "file:./vendor/picomatch-2.3.2-lemonade-sec51.1.tgz",
60
+ "picomatch@npm:^4.0.2": "file:./vendor/picomatch-4.0.7-lemonade-sec51.1.tgz",
61
+ "picomatch@npm:^4.0.3": "file:./vendor/picomatch-4.0.7-lemonade-sec51.1.tgz",
62
+ "picomatch@npm:^4.0.4": "file:./vendor/picomatch-4.0.7-lemonade-sec51.1.tgz",
63
+ "picomatch@npm:^4.0.5": "file:./vendor/picomatch-4.0.7-lemonade-sec51.1.tgz",
64
+ "picomatch@npm:^4.0.7": "file:./vendor/picomatch-4.0.7-lemonade-sec51.1.tgz"
53
65
  }
54
66
  }
@@ -0,0 +1,32 @@
1
+ # Local picomatch security backports
2
+
3
+ These archives contain Lemonade's SEC-51 parser backports for
4
+ [GHSA-fc5q-39xc-vjpf](https://github.com/advisories/GHSA-fc5q-39xc-vjpf), not an
5
+ upstream patched release. Each retains the original package name/version and MIT
6
+ license. No install hook modifies node_modules. Keep this directory with the app.
7
+
8
+ Use the supplied frozen lock (`npm ci` or `pnpm install --frozen-lockfile`). npm
9
+ locks bind each transitive occurrence directly to its local archive/integrity;
10
+ pnpm additionally uses exact-version local overrides. Updating dependencies or
11
+ regenerating locks requires reviewing all picomatch resolutions. Ordinary npm
12
+ audit tools still identify the original upstream versions as affected.
13
+
14
+ Simple single-branch repeated wildcard patterns retain matching behavior without
15
+ nested unbounded quantifiers. Unsafe complex wildcard/capture patterns use
16
+ picomatch's existing literal fallback; their former complex/capture semantics
17
+ are intentionally unavailable. Quoted/escaped stars and ordinary globs retain
18
+ their behavior. The existing explicit `maxExtglobRecursion: false` disables safety;
19
+ never use it with untrusted patterns.
20
+
21
+ `provenance.json` records original npm SRI/SHA-256, parser/patch/output hashes and
22
+ inspected upstream PR heads. The original archives are obtainable from npm's
23
+ `picomatch` registry record for that exact version. Verify their SRI before
24
+ applying the included single-file patches to `package/lib/parse.js`. Every other
25
+ file, including package metadata and license, remains byte-identical. The
26
+ repository's `scripts/security/picomatch_backports.py` rebuilds canonical tar/gzip
27
+ outputs with sorted names, fixed modes, zero timestamps and no links.
28
+
29
+ Upstream PRs 237 and 246 were open and unmerged when inspected. Replace these
30
+ local backports only with a reviewed upstream fix qualified against this app's
31
+ actual framework and both package managers. Regenerate and review locks together;
32
+ do not silently remove the patch or rename its version to bypass an advisory.
@@ -0,0 +1,59 @@
1
+ --- a/lib/parse.js
2
+ +++ b/lib/parse.js
3
+ @@ -280,6 +280,33 @@
4
+ return depth;
5
+ };
6
+
7
+ +// Lemonade SEC-51 backport: preserve simple repeated-star languages without
8
+ +// nesting unbounded quantifiers. Other bare-star shapes use the existing risky
9
+ +// extglob literal fallback. Quoted/escaped/class stars are not wildcard stars.
10
+ +const analyzeSingleStarBranch = (branch, options) => {
11
+ + let quoted = false;
12
+ + let escaped = false;
13
+ + let bracket = false;
14
+ + let wildcard = false;
15
+ +
16
+ + for (let i = 0; i < branch.length; i++) {
17
+ + const ch = branch[i];
18
+ + if (escaped) { escaped = false; continue; }
19
+ + if (ch === '\\') { escaped = true; continue; }
20
+ + if (ch === '"' && !bracket) { quoted = !quoted; continue; }
21
+ + if (quoted) continue;
22
+ + if (ch === '[') { bracket = true; continue; }
23
+ + if (ch === ']' && bracket) { bracket = false; continue; }
24
+ + if (!bracket && ch === '*' && branch[i + 1] !== '(') wildcard = true;
25
+ + }
26
+ +
27
+ + if (!wildcard) return null;
28
+ + if (options.capture === true || branch.includes('**') || /[\\/"?()[\]{}|!+@]/.test(branch)) {
29
+ + return { risky: true };
30
+ + }
31
+ + return { risky: false, collapse: true };
32
+ +};
33
+ +
34
+ const analyzeRepeatedExtglob = (body, options) => {
35
+ if (options.maxExtglobRecursion === false) {
36
+ return { risky: false };
37
+ @@ -311,6 +338,11 @@
38
+ if (repeatedExtglobRecursion(branch) > max) {
39
+ return { risky: true };
40
+ }
41
+ + }
42
+ +
43
+ + if (branches.length === 1) {
44
+ + const single = analyzeSingleStarBranch(branches[0], options);
45
+ + if (single) return single;
46
+ }
47
+
48
+ return { risky: false };
49
+ @@ -536,6 +568,10 @@
50
+ return;
51
+ }
52
+
53
+ + if (analysis.collapse === true && (token.type === 'plus' || token.type === 'star')) {
54
+ + token.close = token.type === 'plus' ? ')' : ')?';
55
+ + }
56
+ +
57
+ let output = token.close + (opts.capture ? ')' : '');
58
+ let rest;
59
+
@@ -0,0 +1,59 @@
1
+ --- a/lib/parse.js
2
+ +++ b/lib/parse.js
3
+ @@ -284,6 +284,33 @@
4
+ return depth;
5
+ };
6
+
7
+ +// Lemonade SEC-51 backport: preserve simple repeated-star languages without
8
+ +// nesting unbounded quantifiers. Other bare-star shapes use the existing risky
9
+ +// extglob literal fallback. Quoted/escaped/class stars are not wildcard stars.
10
+ +const analyzeSingleStarBranch = (branch, options) => {
11
+ + let quoted = false;
12
+ + let escaped = false;
13
+ + let bracket = false;
14
+ + let wildcard = false;
15
+ +
16
+ + for (let i = 0; i < branch.length; i++) {
17
+ + const ch = branch[i];
18
+ + if (escaped) { escaped = false; continue; }
19
+ + if (ch === '\\') { escaped = true; continue; }
20
+ + if (ch === '"' && !bracket) { quoted = !quoted; continue; }
21
+ + if (quoted) continue;
22
+ + if (ch === '[') { bracket = true; continue; }
23
+ + if (ch === ']' && bracket) { bracket = false; continue; }
24
+ + if (!bracket && ch === '*' && branch[i + 1] !== '(') wildcard = true;
25
+ + }
26
+ +
27
+ + if (!wildcard) return null;
28
+ + if (options.capture === true || branch.includes('**') || /[\\/"?()[\]{}|!+@]/.test(branch)) {
29
+ + return { risky: true };
30
+ + }
31
+ + return { risky: false, collapse: true };
32
+ +};
33
+ +
34
+ const analyzeRepeatedExtglob = (body, options) => {
35
+ if (options.maxExtglobRecursion === false) {
36
+ return { risky: false };
37
+ @@ -341,6 +368,11 @@
38
+ return combinable
39
+ ? { risky: true, safeOutput: buildCharClassStar([...new Set(safeChars)]) }
40
+ : { risky: true };
41
+ + }
42
+ +
43
+ + if (branches.length === 1) {
44
+ + const single = analyzeSingleStarBranch(branches[0], options);
45
+ + if (single) return single;
46
+ }
47
+
48
+ return { risky: false };
49
+ @@ -565,6 +597,10 @@
50
+ return;
51
+ }
52
+
53
+ + if (analysis.collapse === true && (token.type === 'plus' || token.type === 'star')) {
54
+ + token.close = token.type === 'plus' ? ')' : ')?';
55
+ + }
56
+ +
57
+ let output = token.close + (opts.capture ? ')' : '');
58
+ let rest;
59
+
@@ -0,0 +1,43 @@
1
+ {
2
+ "advisory": "GHSA-fc5q-39xc-vjpf",
3
+ "upstream_fixes": [
4
+ {
5
+ "url": "https://github.com/micromatch/picomatch/pull/237",
6
+ "head": "1bf0d04563cb9ce568cf36efc5f6b7187d9911d5"
7
+ },
8
+ {
9
+ "url": "https://github.com/micromatch/picomatch/pull/246",
10
+ "head": "f03bec2c02e46f063fbfdc161aae1d0f854b2565"
11
+ }
12
+ ],
13
+ "packages": [
14
+ {
15
+ "name": "picomatch",
16
+ "version": "2.3.2",
17
+ "upstream": "upstream/picomatch-2.3.2.tgz",
18
+ "upstream_sha256": "4c843ba015bec815ac52116162559ab7b4b4efbd3b86f7fcf38f3d770decace6",
19
+ "upstream_integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
20
+ "patch": "patches/picomatch-2.3.2.patch",
21
+ "patch_sha256": "1d0762b3d2d7baa6917dee9f17bbe70eb41f66b37b2fbd7ae52dcd833cdd7f86",
22
+ "original_parser_sha256": "3a91656f440069aa8f8e15c9d695b9f6b2209df1eab2be8127c72cbcca45ff5f",
23
+ "patched_parser_sha256": "9b01b55a8c3de44f8f73d910ae1c56f5d1dd6c2eba19c7f61a62a337ab785816",
24
+ "archive": "archives/picomatch-2.3.2-lemonade-sec51.1.tgz",
25
+ "archive_sha256": "a1bba26d10270d5f1bd36062400aaaebeb4473e3507b61aaba4fb932cb54daa5",
26
+ "archive_integrity": "sha512-7zQO4hSvfvH7CcUPXD8tFo7X0Yh3gUgifS8by7hrbggrQO4yYoCkkY3BopG7HcxQ51dKtrk2a8h5KyBe8SyxKw=="
27
+ },
28
+ {
29
+ "name": "picomatch",
30
+ "version": "4.0.7",
31
+ "upstream": "upstream/picomatch-4.0.7.tgz",
32
+ "upstream_sha256": "697b463be3cdbd9ffc8f4194fd5019a69ddf95875fb703d78b2b115cc9e740a8",
33
+ "upstream_integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
34
+ "patch": "patches/picomatch-4.0.7.patch",
35
+ "patch_sha256": "ed1fe75757af96f132a2adb63d12376994e1d9582e8c6e7dd9741ecae9ddf9bc",
36
+ "original_parser_sha256": "4e1e05447668aa1e94366c5516a2bcd8f5fff800cc92b1d0cd7d77703b8618c4",
37
+ "patched_parser_sha256": "01c40acfda6f7c40a32dd4e6671cbec1c70e22f980cda8b22ea64d948a323c0c",
38
+ "archive": "archives/picomatch-4.0.7-lemonade-sec51.1.tgz",
39
+ "archive_sha256": "a0af57ad2de1444dbb70588db2444e906a47a5bd77c5150905cbfd6de02d636c",
40
+ "archive_integrity": "sha512-jkjudKn+93rODxiTonD3ehUEbHrHtSWpYcdZglbGGSbbc/Aqjz6j3R/1m0uuQJQXqFY/WZTtv9F+ZSM3ZCSrdA=="
41
+ }
42
+ ]
43
+ }
@@ -2,13 +2,13 @@
2
2
 
3
3
  This is your standalone application. The initializer ran no installation, Git or CMS operations.
4
4
 
5
- 1. Install dependencies before adding private configuration: `npm ci --ignore-scripts` or `pnpm install --frozen-lockfile`. pnpm only approves the explicitly listed esbuild/sharp/watcher build scripts.
5
+ 1. Install dependencies before adding private configuration. Use the command printed by the initializer for your lockfile: `npm ci --ignore-scripts`, `pnpm install --frozen-lockfile`, or `yarn install --immutable`. pnpm only approves the explicitly listed esbuild/sharp/watcher build scripts. The Yarn template uses `node_modules` with dependency build scripts disabled.
6
6
  2. Sign in at https://app.lemonadecms.com and choose the intended workspace and environment.
7
7
  3. Under Content types, choose Start with a template → Articles and authors, or review/import model-template.json. Imports create new types only; conflicting keys require a different workspace or a compatible existing model. Nothing is overwritten.
8
8
  4. In that environment's API access, issue a published read application token scoped to article and author, your language and media. Configure only that model scope: the currently pinned SDK schema CLI cannot negotiate unrelated JSON-field models.
9
9
  5. Create your ignored .env from .env.example and set the workspace UUID, exact environment key/UUID, locale, public token and SITE_URL (the local website origin). Never paste secrets into command arguments.
10
- 6. Run `npm run cms:check` (or pnpm run cms:check), then `npm run cms:types`. A verified empty collection is valid; create an author and article in Studio and publish the author before the article. Publication is always explicit.
11
- 7. Run `npm run dev`. Articles use UUID URLs; the preset's slug is plain text, not a uniqueness guarantee.
10
+ 6. Run `cms:check` and then `cms:types` using your manager, for example `yarn run cms:check` and `yarn run cms:types`. A verified empty collection is valid; create an author and article in Studio and publish the author before the article. Publication is always explicit.
11
+ 7. Run the `dev` script with the same manager. Articles use UUID URLs; the preset's slug is plain text, not a uniqueness guarantee.
12
12
 
13
13
  The SDK calls the hosted API. It has no custom URL/environment option; the credential selects the environment. Check again after changing credentials. SSR pages are uncached so the next request can show a new publication. Do not turn on static generation/CDN caching for expiring media links without designing an invalidation strategy.
14
14
 
@@ -9,5 +9,8 @@ dist/
9
9
  .next/
10
10
  .angular/
11
11
  .astro/
12
+ .yarn/install-state.gz
13
+ .yarn/unplugged/
14
+ .yarn/cache/
12
15
  *.tsbuildinfo
13
16
  *.log
@@ -0,0 +1,2 @@
1
+ nodeLinker: node-modules
2
+ enableScripts: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemonadecms/create",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "Create a standalone Lemonade CMS application with Astro, Nuxt, Next.js or Angular",
6
6
  "license": "MIT",
package/src/arguments.mjs CHANGED
@@ -1,10 +1,27 @@
1
1
  import { CreateError } from './errors.mjs';
2
2
  export const frameworks = ['astro', 'nuxt', 'next', 'angular'];
3
+ export const packageManagers = {
4
+ npm: {
5
+ version: '11.6.2',
6
+ install: ['ci', '--ignore-scripts'],
7
+ lockfile: 'package-lock.json',
8
+ },
9
+ pnpm: {
10
+ version: '10.34.5',
11
+ install: ['install', '--frozen-lockfile'],
12
+ lockfile: 'pnpm-lock.yaml',
13
+ },
14
+ yarn: {
15
+ version: '4.18.1',
16
+ install: ['install', '--immutable'],
17
+ lockfile: 'yarn.lock',
18
+ },
19
+ };
3
20
  export const HELP = `Create a Lemonade CMS blog
4
21
 
5
22
  create-lemonade <new-directory> --framework astro|nuxt|next|angular
6
23
  --template blog Versioned blog template (default blog)
7
- --package-manager npm|pnpm Select the frozen lockfile (default npm)
24
+ --package-manager npm|pnpm|yarn Select the frozen lockfile (default npm)
8
25
  --json Noninteractive, machine-readable result
9
26
  --help, --version
10
27
 
@@ -49,7 +66,10 @@ export function parseArguments(args) {
49
66
  }
50
67
  if (result.framework && !frameworks.includes(result.framework))
51
68
  throw new CreateError(2, 'Choose astro, nuxt, next or angular.');
52
- if (result.template !== 'blog' || !['npm', 'pnpm'].includes(result.packageManager))
53
- throw new CreateError(2, 'Choose the blog template and npm or pnpm.');
69
+ if (
70
+ result.template !== 'blog' ||
71
+ !Object.hasOwn(packageManagers, result.packageManager)
72
+ )
73
+ throw new CreateError(2, 'Choose the blog template and npm, pnpm, or Yarn.');
54
74
  return result;
55
75
  }
package/src/catalog.mjs CHANGED
@@ -3,7 +3,35 @@ import { resolve, relative, isAbsolute } from 'node:path';
3
3
  import { createHash } from 'node:crypto';
4
4
  import { safeRelative } from './paths.mjs';
5
5
  import { invariant } from './errors.mjs';
6
+ import { packageManagers } from './arguments.mjs';
6
7
  export const hash = (bytes) => createHash('sha256').update(bytes).digest('hex');
8
+
9
+ function renameYarnWorkspace(body, templateName, name) {
10
+ if (templateName === name) return body;
11
+ const current = `${templateName}@workspace:.`;
12
+ const next = `${name}@workspace:.`;
13
+ const blocks = body.toString('utf8').trimEnd().split('\n\n');
14
+ const currentKey = `${JSON.stringify(current)}:`;
15
+ const workspace = blocks.findIndex((entry) => entry.startsWith(currentKey + '\n'));
16
+ invariant(workspace >= 2, 'Yarn starter lockfile is missing its root workspace.');
17
+ const [entry] = blocks.splice(workspace, 1);
18
+ const nextKey = `${JSON.stringify(next)}:`;
19
+ const position = blocks.findIndex(
20
+ (block, index) => index >= 2 && block.split('\n', 1)[0] > nextKey,
21
+ );
22
+ // Yarn serializes entries in key order, and file archives bind to the root locator.
23
+ blocks.splice(
24
+ position < 0 ? blocks.length : position,
25
+ 0,
26
+ entry.replaceAll(current, next),
27
+ );
28
+ return Buffer.from(
29
+ blocks
30
+ .join('\n\n')
31
+ .replaceAll(encodeURIComponent(current), encodeURIComponent(next)) + '\n',
32
+ 'utf8',
33
+ );
34
+ }
7
35
  async function bundledDirectory(path) {
8
36
  const stat = await lstat(path);
9
37
  invariant(
@@ -70,7 +98,7 @@ export async function loadCatalog(root) {
70
98
  );
71
99
  invariant(
72
100
  ['shared', 'astro', 'nuxt', 'next', 'angular'].includes(file.framework) &&
73
- /^(both|npm|pnpm)$/.test(file.manager),
101
+ (file.manager === 'both' || Object.hasOwn(packageManagers, file.manager)),
74
102
  'Invalid catalog scope.',
75
103
  );
76
104
  invariant(
@@ -117,11 +145,15 @@ export async function selectedFiles(root, catalog, framework, manager, name) {
117
145
  if (['package.json', 'package-lock.json'].includes(item.target)) {
118
146
  const json = JSON.parse(body.toString('utf8'));
119
147
  json.name = name;
120
- if (item.target === 'package.json')
121
- json.packageManager = `${manager}@${manager === 'npm' ? '11.6.2' : '10.34.5'}`;
148
+ if (item.target === 'package.json') {
149
+ json.packageManager = `${manager}@${packageManagers[manager].version}`;
150
+ if (manager !== 'yarn') delete json.resolutions;
151
+ }
122
152
  if (json.packages?.['']) json.packages[''].name = name;
123
153
  body = Buffer.from(JSON.stringify(json, null, 2) + '\n');
124
154
  }
155
+ if (item.target === 'yarn.lock')
156
+ body = renameYarnWorkspace(body, 'lemonade-blog', name);
125
157
  result.push({ path: item.target, body });
126
158
  }
127
159
  invariant(
package/src/prompts.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createInterface } from 'node:readline';
2
2
  import { CreateError } from './errors.mjs';
3
3
  import { destination } from './paths.mjs';
4
+ import { packageManagers } from './arguments.mjs';
4
5
  export async function choose(options, { input, output, signal }) {
5
6
  if (signal?.aborted) throw new CreateError(130, 'Creation cancelled.');
6
7
  const rl = createInterface({ input, output, terminal: true });
@@ -43,10 +44,12 @@ export async function choose(options, { input, output, signal }) {
43
44
  throw new CreateError(2, 'Choose a framework from 1 to 4.');
44
45
  }
45
46
  if (!options.managerProvided) {
46
- const answer = await question('Package manager: 1 npm, 2 pnpm [1]: ');
47
- options.packageManager =
48
- answer === '2' ? 'pnpm' : !answer || answer === '1' ? 'npm' : null;
49
- if (!options.packageManager) throw new CreateError(2, 'Choose npm or pnpm.');
47
+ const answer = await question('Package manager: 1 npm, 2 pnpm, 3 Yarn [1]: ');
48
+ options.packageManager = /^[1-3]$/.test(answer || '1')
49
+ ? Object.keys(packageManagers)[Number(answer || '1') - 1]
50
+ : null;
51
+ if (!options.packageManager)
52
+ throw new CreateError(2, 'Choose npm, pnpm, or Yarn.');
50
53
  }
51
54
  const target = await destination(options.directory, options.cwd);
52
55
  check();