generator-bitloops 0.3.20 → 0.3.21

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-bitloops",
3
- "version": "0.3.20",
3
+ "version": "0.3.21",
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
@@ -10,6 +10,8 @@ const __filename = fileURLToPath(import.meta.url);
10
10
  const __dirname = path.dirname(__filename);
11
11
 
12
12
  const DOT = '.';
13
+ const PLATFORM_NEXT_FOLDER = 'platform-next';
14
+ const PLATFORM_NEXT_SRC_FOLDER = `${PLATFORM_NEXT_FOLDER}/src`;
13
15
 
14
16
  function isKebabCase(str) {
15
17
  // Check if the string is empty
@@ -253,6 +255,27 @@ export default class extends Generator {
253
255
  this.destinationPath('src/app/globals.css')
254
256
  );
255
257
 
258
+ const platformNextIndexPath = `${PLATFORM_NEXT_SRC_FOLDER}/index.ts`;
259
+ deleteFileIfExists(this.destinationPath(platformNextIndexPath));
260
+ this.fs.copyTpl(
261
+ this.templatePath(platformNextIndexPath),
262
+ this.destinationPath(platformNextIndexPath)
263
+ );
264
+
265
+ const platformNextImgPath = `${PLATFORM_NEXT_SRC_FOLDER}/Img.tsx`;
266
+ deleteFileIfExists(this.destinationPath(platformNextImgPath));
267
+ this.fs.copyTpl(
268
+ this.templatePath(platformNextImgPath),
269
+ this.destinationPath(platformNextImgPath)
270
+ );
271
+
272
+ const platformNextTypesPath = `${PLATFORM_NEXT_SRC_FOLDER}/types.ts`;
273
+ deleteFileIfExists(this.destinationPath(platformNextTypesPath));
274
+ this.fs.copyTpl(
275
+ this.templatePath(platformNextTypesPath),
276
+ this.destinationPath(platformNextTypesPath)
277
+ );
278
+
256
279
  if (this.options.bitloops) {
257
280
  this.log('Adding Bitloops support components...');
258
281
  const unsupportedPath =
@@ -0,0 +1,7 @@
1
+ 'use client';
2
+ import NextImage from 'next/image';
3
+ import type { ImgProps } from './types';
4
+ export function Img(props: ImgProps) {
5
+ const { responsive, ...rest } = props;
6
+ return <NextImage {...rest} />;
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './Img';
@@ -0,0 +1,28 @@
1
+ export type ImgProps = {
2
+ src: string; alt: string;
3
+ width?: number; height?: number; fill?: boolean;
4
+ sizes?: string; priority?: boolean; quality?: number;
5
+ className?: string; style?: React.CSSProperties;
6
+ loading?: 'eager'|'lazy'; decoding?: 'auto'|'sync'|'async';
7
+ responsive?: { sources: Array<{ media: string; srcSet: string }> }; // optional <picture>
8
+ };
9
+
10
+ export type LinkProps = {
11
+ href: string; children: React.ReactNode;
12
+ prefetch?: boolean; replace?: boolean; scroll?: boolean;
13
+ target?: React.HTMLAttributeAnchorTarget; rel?: string;
14
+ className?: string; style?: React.CSSProperties; 'aria-label'?: string;
15
+ };
16
+
17
+ export type MetaProps = {
18
+ title?: string;
19
+ description?: string;
20
+ lang?: string;
21
+ openGraph?: { title?: string; description?: string; image?: string; url?: string; type?: string };
22
+ twitter?: { card?: string; title?: string; description?: string; image?: string };
23
+ icons?: { icon?: string; apple?: string };
24
+ };
25
+
26
+ export type FontSpec =
27
+ | { kind: 'next'; fonts: Array<{ variable: string; loader: () => any }> } // Next native loaders
28
+ | { kind: 'css'; hrefs: string[]; className?: string };