generator-bitloops 0.3.25 → 0.3.27

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 (2) hide show
  1. package/package.json +1 -1
  2. package/setup/index.js +33 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-bitloops",
3
- "version": "0.3.25",
3
+ "version": "0.3.27",
4
4
  "description": "Next.js with TypeScript, Tailwind, Storybook and Cypress generator by Bitloops",
5
5
  "license": "MIT",
6
6
  "author": "Bitloops S.A.",
package/setup/index.js CHANGED
@@ -118,6 +118,12 @@ export default class extends Generator {
118
118
  default: false,
119
119
  });
120
120
 
121
+ this.option('baseUi', {
122
+ type: Boolean,
123
+ description: 'Add Base UI React components (@base-ui/react)',
124
+ default: false,
125
+ });
126
+
121
127
  this.installNextJS = async function () {
122
128
  // Clone Next.js template with Tailwind if specified, using the project name
123
129
  const createNextAppCommand = ['-y', 'create-next-app@latest'];
@@ -128,7 +134,7 @@ export default class extends Generator {
128
134
  createNextAppCommand.push('--src-dir');
129
135
  createNextAppCommand.push('--import-alias');
130
136
  createNextAppCommand.push('@/*');
131
- createNextAppCommand.push('--use-npm');
137
+ createNextAppCommand.push('--use-pnpm');
132
138
  createNextAppCommand.push('--eslint');
133
139
 
134
140
  if (this.options.typescript) {
@@ -148,7 +154,7 @@ export default class extends Generator {
148
154
  exec(
149
155
  `npx ${createNextAppCommand.join(' ')} && cd ${toKebabCase(
150
156
  this.options.project,
151
- )} && npm install ${additionalPackages}`,
157
+ )} && pnpm add ${additionalPackages}`,
152
158
  ).on('exit', (code) => {
153
159
  this.destinationRoot(
154
160
  this.destinationPath(toKebabCase(this.options.project)),
@@ -207,8 +213,8 @@ export default class extends Generator {
207
213
  this.log('Storybook installed!');
208
214
  // Verifies the correct nextjs-vite framework is used
209
215
  spawnSync(
210
- 'npm',
211
- ['install', '--save-dev', '@storybook/nextjs-vite@^10'],
216
+ 'pnpm',
217
+ ['add', '-D', '@storybook/nextjs-vite@^10'],
212
218
  { stdio: 'inherit', cwd: this.destinationRoot() },
213
219
  );
214
220
  this.log('@storybook/nextjs-vite installed!');
@@ -219,17 +225,17 @@ export default class extends Generator {
219
225
  // Conditionally add Cypress
220
226
  if (this.options.cypress) {
221
227
  this.log('Installing Cypress...');
222
- spawnSync('npm', ['install', '--save-dev', 'cypress'], {
228
+ spawnSync('pnpm', ['add', '-D', 'cypress'], {
223
229
  stdio: 'inherit',
224
230
  cwd: this.destinationRoot(),
225
231
  });
226
232
  this.log('Cypress installed!');
227
233
  if (this.options.bitloops) {
228
234
  spawnSync(
229
- 'npm',
235
+ 'pnpm',
230
236
  [
231
- 'install',
232
- '--save-dev',
237
+ 'add',
238
+ '-D',
233
239
  'mochawesome',
234
240
  'mochawesome-merge',
235
241
  'mochawesome-report-generator',
@@ -245,14 +251,27 @@ export default class extends Generator {
245
251
  if (this.options.i18n) {
246
252
  this.log('Installing i18n packages...');
247
253
  spawnSync(
248
- 'npm',
249
- ['install', 'i18next', 'i18next-icu', 'react-i18next'],
254
+ 'pnpm',
255
+ ['add', 'i18next', 'i18next-icu', 'react-i18next'],
250
256
  { stdio: 'inherit', cwd: this.destinationRoot() },
251
257
  );
252
258
  this.log('i18n packages installed!');
253
259
  }
254
260
  };
255
261
 
262
+ this.installBaseUi = function () {
263
+ // Conditionally add Base UI
264
+ if (this.options.baseUi) {
265
+ this.log('Installing Base UI...');
266
+ spawnSync(
267
+ 'pnpm',
268
+ ['add', '@base-ui/react@^1.1.0'],
269
+ { stdio: 'inherit', cwd: this.destinationRoot() },
270
+ );
271
+ this.log('Base UI installed!');
272
+ }
273
+ };
274
+
256
275
  this.installPrimitives = function () {
257
276
  // Conditionally add Primitives
258
277
  if (this.options.primitives) {
@@ -376,7 +395,7 @@ export default class extends Generator {
376
395
  const path = 'cypress/helpers/index.ts';
377
396
  this.fs.copyTpl(this.templatePath(path), this.destinationPath(path));
378
397
  }
379
- spawnSync('npm', ['install', '--save-dev', 'react-aria-components'], {
398
+ spawnSync('pnpm', ['add', '-D', 'react-aria-components'], {
380
399
  stdio: 'inherit',
381
400
  cwd: this.destinationRoot(),
382
401
  });
@@ -429,6 +448,7 @@ export default class extends Generator {
429
448
  await this.installNextJS();
430
449
  this.installCypress();
431
450
  this.installI18n();
451
+ this.installBaseUi();
432
452
  this.installPrimitives();
433
453
  this.installStorybook();
434
454
  await this.patchFiles();
@@ -445,9 +465,9 @@ export default class extends Generator {
445
465
  );
446
466
  this.log('');
447
467
  this.log('Use the following commands to start:');
448
- this.log('- `npm run dev` to start the Next.js app.');
468
+ this.log('- `pnpm dev` to start the Next.js app.');
449
469
  if (this.options.storybook)
450
- this.log('- `npm run storybook` to start Storybook.');
470
+ this.log('- `pnpm storybook` to start Storybook.');
451
471
  if (this.options.cypress)
452
472
  this.log('- `npx cypress open --e2e --browser chrome` to open Cypress.');
453
473
  if (this.options.cypress)