generator-bitloops 0.3.22 → 0.3.23

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 +30 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-bitloops",
3
- "version": "0.3.22",
3
+ "version": "0.3.23",
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
@@ -291,6 +291,36 @@ export default class extends Generator {
291
291
  this.destinationPath('src/app/globals.css')
292
292
  );
293
293
 
294
+ if (this.options.typescript) {
295
+ this.log('Updating tsconfig.json paths...');
296
+ const tsconfigPath = this.destinationPath('tsconfig.json');
297
+ if (this.fs.exists(tsconfigPath)) {
298
+ const tsconfigContent = this.fs.read(tsconfigPath);
299
+ const tsconfig = JSON.parse(tsconfigContent);
300
+
301
+ // Initialize compilerOptions if it doesn't exist
302
+ if (!tsconfig.compilerOptions) {
303
+ tsconfig.compilerOptions = {};
304
+ }
305
+
306
+ // Initialize paths if it doesn't exist
307
+ if (!tsconfig.compilerOptions.paths) {
308
+ tsconfig.compilerOptions.paths = {};
309
+ }
310
+
311
+ // Add or merge the path aliases
312
+ tsconfig.compilerOptions.paths = {
313
+ ...tsconfig.compilerOptions.paths,
314
+ "@/primitives": ["./platform-next/src"],
315
+ "@/assets": ["./src/assets"]
316
+ };
317
+
318
+ deleteFileIfExists(tsconfigPath);
319
+ this.fs.write(tsconfigPath, JSON.stringify(tsconfig, null, 2) + '\n');
320
+ this.log('tsconfig.json paths updated!');
321
+ }
322
+ }
323
+
294
324
  if (this.options.bitloops) {
295
325
  this.log('Adding Bitloops support components...');
296
326
  const unsupportedPath =