generator-bitloops 0.2.0 → 0.3.0

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The Bitloops Generator is used by the Bitloops Platform to setup your Bitloops projects.
4
4
 
5
- Nonetheless, you can use it independently to setup your next next.js project with TypeScript, Tailwind, Storybook and Cypress all ready to go!
5
+ Nonetheless, you can use it independently to setup your next Next.js project with TypeScript, Tailwind, Storybook and Cypress all ready to go!
6
6
 
7
7
  ## How to run it
8
8
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "generator-bitloops",
3
- "version": "0.2.0",
4
- "description": "Bitloops Yeoman generator",
3
+ "version": "0.3.0",
4
+ "description": "Next.js with TypeScript, Tailwind, Storybook and Cypress generator by Bitloops",
5
5
  "license": "MIT",
6
6
  "author": "Bitloops S.A.",
7
7
  "repository": {
@@ -15,7 +15,7 @@
15
15
  "files": [
16
16
  "app",
17
17
  "setup",
18
- "cli.js"
18
+ "cli.mjs"
19
19
  ],
20
20
  "keywords": [
21
21
  "bitloops",
package/setup/index.js CHANGED
@@ -85,7 +85,7 @@ export default class extends Generator {
85
85
  }
86
86
 
87
87
  this.log("Installing Next.js...");
88
- await new Promise((resolve, error) => {exec(`npx ${createNextAppCommand.join(' ')} && cd ${toKebabCase(this.options.project)} && npm install next@14 react@18 react-dom@18`).on('exit', (code) => {
88
+ await new Promise((resolve, error) => {exec(`npx ${createNextAppCommand.join(' ')} && cd ${toKebabCase(this.options.project)} && npm install next@14 react@18 react-dom@18 react-tooltip`).on('exit', (code) => {
89
89
  this.destinationRoot(this.destinationPath(toKebabCase(this.options.project)));
90
90
  resolve();
91
91
  });});
@@ -115,14 +115,17 @@ export default class extends Generator {
115
115
  if (this.options.typescript) {
116
116
  this.log('Replace Next.js\' TypeScript configuration file with JS...');
117
117
  // Remove TypeScript configuration files given they require Next.js 15
118
- fs.unlinkSync(this.destinationPath('next.config.ts'));
119
- console.log('Template Path:', this.templatePath('next.config.js'));
120
- console.log('Destination Path:', this.destinationPath('next.config.js'));
118
+ try {
119
+ fs.unlinkSync(this.destinationPath('next.config.ts'));
120
+ this.log(`Deleted next.config.ts`);
121
+ } catch (err) {
122
+ console.error('Error deleting next.config.ts:', err);
123
+ }
121
124
  this.fs.copyTpl(
122
125
  this.templatePath('next.config.js'),
123
126
  this.destinationPath('next.config.js'),
124
- );
125
- this.log(`Deleted next.config.ts and created next.config.js instead`);
127
+ );
128
+ this.log(`Created next.config.js instead`);
126
129
  }
127
130
  }
128
131
 
@@ -178,6 +181,12 @@ export default class extends Generator {
178
181
  this.templatePath('globals.css'),
179
182
  this.destinationPath('src/app/globals.css'),
180
183
  );
184
+
185
+ this.log('Adding Bitloops support components...');
186
+ this.fs.copyTpl(
187
+ this.templatePath('src.components.bitloops.Unsupported.tsx'),
188
+ this.destinationPath('src/components/bitloops/Unsupported.tsx'),
189
+ );
181
190
  }
182
191
  }
183
192
 
@@ -0,0 +1,39 @@
1
+ import { Tooltip } from 'react-tooltip';
2
+ import 'react-tooltip/dist/react-tooltip.css';
3
+
4
+ type UnsupportedType =
5
+ | 'VECTOR'
6
+ | 'STAR'
7
+ | 'ELLIPSE'
8
+ | 'LINE'
9
+ | 'REGULAR_POLYGON'
10
+ | 'SLICE'
11
+ | 'IMAGE';
12
+
13
+ export type UnsupportedElementProps = {
14
+ type: UnsupportedType;
15
+ elementClassName: string;
16
+ };
17
+ export function UnsupportedElement(props: UnsupportedElementProps) {
18
+ const { type, elementClassName } = props;
19
+ return (
20
+ <div
21
+ className={`${elementClassName} relative group border border-red-500 border-dashed`}
22
+ data-tooltip-id='tooltip'
23
+ data-tooltip-content={`Unsupported: ${type}`}
24
+ >
25
+ <Tooltip
26
+ id='tooltip'
27
+ place='top'
28
+ style={{
29
+ backgroundColor: 'black',
30
+ color: 'white',
31
+ padding: '8px',
32
+ borderRadius: '4px',
33
+ fontSize: '0.75rem',
34
+ whiteSpace: 'nowrap',
35
+ }}
36
+ />
37
+ </div>
38
+ );
39
+ }