generator-bitloops 0.3.20 → 0.3.22
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/app/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export default class extends Generator {
|
|
|
11
11
|
this.option('tailwind'); // This method adds support for a `--tailwind` flag
|
|
12
12
|
this.option('storybook'); // This method adds support for a `--storybook` flag
|
|
13
13
|
this.option('cypress'); // This method adds support for a `--cypress` flag
|
|
14
|
+
this.option('primitives'); // This method adds support for a `--primitives` flag
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
message() {
|
package/package.json
CHANGED
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
|
|
@@ -103,6 +105,12 @@ export default class extends Generator {
|
|
|
103
105
|
default: false,
|
|
104
106
|
});
|
|
105
107
|
|
|
108
|
+
this.option('primitives', {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
description: 'Add primitives support',
|
|
111
|
+
default: false,
|
|
112
|
+
});
|
|
113
|
+
|
|
106
114
|
this.installNextJS = async function () {
|
|
107
115
|
// Clone Next.js template with Tailwind if specified, using the project name
|
|
108
116
|
const createNextAppCommand = ['-y', 'create-next-app@15.3.3'];
|
|
@@ -201,6 +209,36 @@ export default class extends Generator {
|
|
|
201
209
|
}
|
|
202
210
|
};
|
|
203
211
|
|
|
212
|
+
this.installPrimitives = function () {
|
|
213
|
+
// Conditionally add Primitives
|
|
214
|
+
if (this.options.primitives) {
|
|
215
|
+
this.log('Installing Primitives...');
|
|
216
|
+
|
|
217
|
+
const platformNextIndexPath = `${PLATFORM_NEXT_SRC_FOLDER}/index.ts`;
|
|
218
|
+
deleteFileIfExists(this.destinationPath(platformNextIndexPath));
|
|
219
|
+
this.fs.copyTpl(
|
|
220
|
+
this.templatePath(platformNextIndexPath),
|
|
221
|
+
this.destinationPath(platformNextIndexPath)
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
const platformNextImgPath = `${PLATFORM_NEXT_SRC_FOLDER}/Img.tsx`;
|
|
225
|
+
deleteFileIfExists(this.destinationPath(platformNextImgPath));
|
|
226
|
+
this.fs.copyTpl(
|
|
227
|
+
this.templatePath(platformNextImgPath),
|
|
228
|
+
this.destinationPath(platformNextImgPath)
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
const platformNextTypesPath = `${PLATFORM_NEXT_SRC_FOLDER}/types.ts`;
|
|
232
|
+
deleteFileIfExists(this.destinationPath(platformNextTypesPath));
|
|
233
|
+
this.fs.copyTpl(
|
|
234
|
+
this.templatePath(platformNextTypesPath),
|
|
235
|
+
this.destinationPath(platformNextTypesPath)
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
this.log('Primitives installed!');
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
|
|
204
242
|
this.patchFiles = async function () {
|
|
205
243
|
// Conditionally initialize Storybook
|
|
206
244
|
if (this.options.storybook) {
|
|
@@ -338,6 +376,7 @@ export default class extends Generator {
|
|
|
338
376
|
await this.installNextJS();
|
|
339
377
|
this.installStorybook();
|
|
340
378
|
this.installCypress();
|
|
379
|
+
this.installPrimitives();
|
|
341
380
|
await this.patchFiles();
|
|
342
381
|
if (this.options.git) {
|
|
343
382
|
await this.commitChanges();
|
|
@@ -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 };
|