@majordigital/create-acorn 1.3.1 → 1.3.3
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/bin/create-acorn.mjs +27 -40
- package/package.json +1 -1
package/bin/create-acorn.mjs
CHANGED
|
@@ -281,53 +281,40 @@ async function setupStoryblok(projectName) {
|
|
|
281
281
|
cpSync(join(storyblokSrcDir, 'ui', 'FallbackComponent.tsx'), join(targetUiDir, 'FallbackComponent.tsx'));
|
|
282
282
|
console.log('Copied FallbackComponent (ui/FallbackComponent.tsx).');
|
|
283
283
|
|
|
284
|
-
//
|
|
285
|
-
const componentsDir = join(process.cwd(), 'src', 'components');
|
|
286
|
-
mkdirSync(componentsDir, { recursive: true });
|
|
287
|
-
writeFileSync(join(componentsDir, 'StoryblokProvider.tsx'), `'use client';
|
|
288
|
-
|
|
289
|
-
import { getStoryblokApi } from '@/lib/storyblok';
|
|
290
|
-
import type { PropsWithChildren } from 'react';
|
|
291
|
-
|
|
292
|
-
export default function StoryblokProvider({ children }: PropsWithChildren) {
|
|
293
|
-
getStoryblokApi();
|
|
294
|
-
return children;
|
|
295
|
-
}
|
|
296
|
-
`);
|
|
297
|
-
console.log('Created StoryblokProvider component.');
|
|
298
|
-
|
|
299
|
-
// Update layout.tsx to wrap with StoryblokProvider
|
|
300
|
-
const layoutPath = join(process.cwd(), 'src', 'app', 'layout.tsx');
|
|
301
|
-
try {
|
|
302
|
-
let layout = readFileSync(layoutPath, 'utf-8');
|
|
303
|
-
layout = layout.replace(
|
|
304
|
-
"import '@/styles/globals.css';",
|
|
305
|
-
"import '@/styles/globals.css';\n\nimport StoryblokProvider from '@/components/StoryblokProvider';"
|
|
306
|
-
);
|
|
307
|
-
layout = layout.replace(
|
|
308
|
-
'<html lang="en"',
|
|
309
|
-
'<StoryblokProvider>\n\t\t<html lang="en"'
|
|
310
|
-
);
|
|
311
|
-
layout = layout.replace(
|
|
312
|
-
'</html>',
|
|
313
|
-
'</html>\n\t\t</StoryblokProvider>'
|
|
314
|
-
);
|
|
315
|
-
writeFileSync(layoutPath, layout);
|
|
316
|
-
console.log('Updated layout.tsx with StoryblokProvider.');
|
|
317
|
-
} catch {
|
|
318
|
-
console.log('Warning: Could not update layout.tsx with StoryblokProvider.');
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// Add generate-types script to package.json
|
|
284
|
+
// Update package.json scripts for Storyblok
|
|
322
285
|
const pkgPath = join(process.cwd(), 'package.json');
|
|
323
286
|
try {
|
|
324
287
|
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
325
288
|
if (!pkg.scripts) pkg.scripts = {};
|
|
289
|
+
pkg.scripts.dev = 'next dev --turbo --experimental-https';
|
|
290
|
+
pkg.scripts['build:snapshot'] = 'node src/scripts/generate-snapshot-entry.js';
|
|
291
|
+
pkg.scripts.build = 'npm run build:snapshot && next build';
|
|
292
|
+
pkg.scripts['build-stats'] = 'cross-env ANALYZE=true npm run build';
|
|
293
|
+
pkg.scripts.start = 'next start';
|
|
294
|
+
pkg.scripts.preview = 'next build && next start';
|
|
295
|
+
pkg.scripts.prepare = 'lefthook install || true';
|
|
296
|
+
pkg.scripts.check = 'biome lint . --skip suspicious/noConsole && biome format .';
|
|
297
|
+
pkg.scripts.fix = 'biome lint . --write --skip suspicious/noConsole && biome format . --write';
|
|
298
|
+
pkg.scripts['check:prod'] = 'biome check .';
|
|
299
|
+
pkg.scripts['fix:prod'] = 'biome check . --write';
|
|
326
300
|
pkg.scripts['generate-types'] = `storyblok components pull --space ${spaceId} && storyblok types generate --type-suffix Storyblok --space ${spaceId}`;
|
|
301
|
+
pkg.scripts.storybook = 'storybook dev -p 6006';
|
|
302
|
+
pkg.scripts['build-storybook'] = 'storybook build';
|
|
327
303
|
writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
328
|
-
console.log('
|
|
304
|
+
console.log('Updated package.json scripts for Storyblok.');
|
|
305
|
+
} catch {
|
|
306
|
+
console.log('Warning: Could not update package.json scripts.');
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Update .env.example with the space ID
|
|
310
|
+
const envExamplePath = join(process.cwd(), '.env.example');
|
|
311
|
+
try {
|
|
312
|
+
let envContent = readFileSync(envExamplePath, 'utf-8');
|
|
313
|
+
envContent = envContent.replace('STORYBLOK_SPACE_ID=', `STORYBLOK_SPACE_ID=${spaceId}`);
|
|
314
|
+
writeFileSync(envExamplePath, envContent);
|
|
315
|
+
console.log('Updated .env.example with Space ID.');
|
|
329
316
|
} catch {
|
|
330
|
-
console.log('Warning: Could not update
|
|
317
|
+
console.log('Warning: Could not update .env.example with Space ID.');
|
|
331
318
|
}
|
|
332
319
|
|
|
333
320
|
console.log('');
|
package/package.json
CHANGED