generator-bitloops 0.3.4 → 0.3.5
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 +1 -1
- package/setup/index.js +17 -32
package/package.json
CHANGED
package/setup/index.js
CHANGED
|
@@ -56,19 +56,20 @@ export default class extends Generator {
|
|
|
56
56
|
default: false,
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
+
this.option('git', {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
description: 'Commit changes to git',
|
|
62
|
+
default: false,
|
|
63
|
+
});
|
|
64
|
+
|
|
59
65
|
this.installNextJS = async function() {
|
|
60
66
|
// Clone Next.js template with Tailwind if specified, using the project name
|
|
61
|
-
const createNextAppCommand = ['-y', 'create-next-app@
|
|
67
|
+
const createNextAppCommand = ['-y', 'create-next-app@14.2.16'];
|
|
62
68
|
createNextAppCommand.push(toKebabCase(this.options.project)); // Use the project name for the directory
|
|
63
69
|
createNextAppCommand.push('--app');
|
|
64
70
|
createNextAppCommand.push('--empty');
|
|
65
71
|
createNextAppCommand.push('--src-dir');
|
|
66
|
-
|
|
67
|
-
// Disable TurboPack for Storybook compatibility given the Next.js downgrade that will follow
|
|
68
|
-
createNextAppCommand.push('--no-turbopack');
|
|
69
|
-
} else {
|
|
70
|
-
createNextAppCommand.push('--turbopack');
|
|
71
|
-
}
|
|
72
|
+
// createNextAppCommand.push('--turbopack'); when we go to Next.js 15
|
|
72
73
|
createNextAppCommand.push('--import-alias');
|
|
73
74
|
createNextAppCommand.push('@/*');
|
|
74
75
|
createNextAppCommand.push('--use-npm');
|
|
@@ -85,9 +86,9 @@ export default class extends Generator {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
this.log("Installing Next.js...");
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
await new Promise((resolve, error) => {exec(`npx ${createNextAppCommand.join(' ')} && cd ${toKebabCase(this.options.project)} && npm install ${
|
|
89
|
+
const patchPackages = '';//'next@14 react@18 react-dom@18';
|
|
90
|
+
const additionalPackages = `react-tooltip ${patchPackages}`;
|
|
91
|
+
await new Promise((resolve, error) => {exec(`npx ${createNextAppCommand.join(' ')} && cd ${toKebabCase(this.options.project)} && npm install ${additionalPackages}`).on('exit', (code) => {
|
|
91
92
|
this.destinationRoot(this.destinationPath(toKebabCase(this.options.project)));
|
|
92
93
|
resolve();
|
|
93
94
|
});});
|
|
@@ -98,8 +99,8 @@ export default class extends Generator {
|
|
|
98
99
|
if (this.options.storybook) {
|
|
99
100
|
this.log("Adding Storybook...");
|
|
100
101
|
this.spawnCommandSync('npx', ['-y', 'storybook@8.4', 'init', '--no-dev']);
|
|
101
|
-
// if (this.options.tailwind) {
|
|
102
|
-
// Tailwind CSS specific setup
|
|
102
|
+
// if (this.options.tailwind && this.options.storybook) {
|
|
103
|
+
// Tailwind CSS specific setup for older versions of Storybook
|
|
103
104
|
// this.spawnCommandSync('npx', ['storybook@latest', 'add', '@storybook/addon-styling-webpack']);
|
|
104
105
|
// }
|
|
105
106
|
}
|
|
@@ -114,24 +115,6 @@ export default class extends Generator {
|
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
this.patchFiles = async function() {
|
|
117
|
-
if (this.options.storybook) {
|
|
118
|
-
if (this.options.typescript) {
|
|
119
|
-
this.log('Replace Next.js\' TypeScript configuration file with JS...');
|
|
120
|
-
// Remove TypeScript configuration files given they require Next.js 15
|
|
121
|
-
try {
|
|
122
|
-
fs.unlinkSync(this.destinationPath('next.config.ts'));
|
|
123
|
-
this.log(`Deleted next.config.ts`);
|
|
124
|
-
} catch (err) {
|
|
125
|
-
console.error('Error deleting next.config.ts:', err);
|
|
126
|
-
}
|
|
127
|
-
this.fs.copyTpl(
|
|
128
|
-
this.templatePath('next.config.js'),
|
|
129
|
-
this.destinationPath('next.config.js'),
|
|
130
|
-
);
|
|
131
|
-
this.log(`Created next.config.js instead`);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
118
|
// Conditionally initialize Storybook
|
|
136
119
|
if (this.options.storybook) {
|
|
137
120
|
this.log("Making Storybook changes...");
|
|
@@ -158,7 +141,7 @@ export default class extends Generator {
|
|
|
158
141
|
}
|
|
159
142
|
|
|
160
143
|
if (this.options.cypress) {
|
|
161
|
-
this.log(
|
|
144
|
+
this.log('Adding Cypress config...');
|
|
162
145
|
this.fs.copyTpl(
|
|
163
146
|
this.templatePath('cypress.config.ts'),
|
|
164
147
|
this.destinationPath('cypress.config.ts'),
|
|
@@ -234,7 +217,9 @@ export default class extends Generator {
|
|
|
234
217
|
this.installCypress();
|
|
235
218
|
this.log('Patching files');
|
|
236
219
|
await this.patchFiles();
|
|
237
|
-
|
|
220
|
+
if (this.options.git) {
|
|
221
|
+
await this.commitChanges();
|
|
222
|
+
}
|
|
238
223
|
}
|
|
239
224
|
|
|
240
225
|
end() {
|