@majordigital/create-acorn 1.5.5 → 1.5.7
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 +6 -6
- package/bin/create-acorn.mjs +14 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @majordigital/create-acorn
|
|
2
2
|
|
|
3
|
-
**Create Acorn** is Major Digital's production-ready
|
|
3
|
+
**Create Acorn** is Major Digital's production-ready starter CLI for building headless CMS websites with Next.js 15 and the Acorn component system.
|
|
4
4
|
|
|
5
5
|
It eliminates the repetitive setup that comes with every new project — framework configuration, CMS integration, linting, commit conventions, and a full UI component library — so your team can skip straight to building.
|
|
6
6
|
|
|
@@ -10,9 +10,9 @@ It eliminates the repetitive setup that comes with every new project — framewo
|
|
|
10
10
|
npx @majordigital/create-acorn@latest
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
> **Note:** Always use `npx` to run the CLI. Do not use `npm install` — this is a
|
|
13
|
+
> **Note:** Always use `npx` to run the CLI. Do not use `npm install` — this is a starter tool, not a library dependency.
|
|
14
14
|
|
|
15
|
-
The CLI prompts you for a project name, creates the directory, then walks you through selecting a headless CMS —
|
|
15
|
+
The CLI prompts you for a project name, creates the directory, then walks you through selecting a headless CMS — generating a complete, opinionated project in seconds.
|
|
16
16
|
|
|
17
17
|
```
|
|
18
18
|
? What is the name of your project? (my-acorn-app)
|
|
@@ -59,8 +59,8 @@ src/
|
|
|
59
59
|
| CMS | Status | Setup |
|
|
60
60
|
|-----|--------|-------|
|
|
61
61
|
| **Prismic** | Full integration | Slice Machine init, repository connection, slicemachine script |
|
|
62
|
-
| **Storyblok** |
|
|
63
|
-
| **DatoCMS** |
|
|
62
|
+
| **Storyblok** | Full integration | Environment template, component generation support |
|
|
63
|
+
| **DatoCMS** | Full integration | Environment template, API token configuration |
|
|
64
64
|
|
|
65
65
|
## Non-Interactive Usage
|
|
66
66
|
|
|
@@ -74,7 +74,7 @@ npx @majordigital/create-acorn@latest --name my-project --cms dato
|
|
|
74
74
|
|
|
75
75
|
## Generated Project Files
|
|
76
76
|
|
|
77
|
-
Beyond the component library, every
|
|
77
|
+
Beyond the component library, every project includes:
|
|
78
78
|
|
|
79
79
|
| File | Purpose |
|
|
80
80
|
|------|---------|
|
package/bin/create-acorn.mjs
CHANGED
|
@@ -70,7 +70,7 @@ function parseFlag(name) {
|
|
|
70
70
|
|
|
71
71
|
function runCommand(cmd, args, options = {}) {
|
|
72
72
|
return new Promise((resolve, reject) => {
|
|
73
|
-
const child = spawn(cmd, args, { stdio: 'inherit',
|
|
73
|
+
const child = spawn(cmd, args, { stdio: 'inherit', ...options });
|
|
74
74
|
child.on('close', (code) => {
|
|
75
75
|
if (code === 0) resolve();
|
|
76
76
|
else reject(new Error(`${cmd} ${args.join(' ')} exited with code ${code}`));
|
|
@@ -79,8 +79,8 @@ function runCommand(cmd, args, options = {}) {
|
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
async function
|
|
83
|
-
console.log('
|
|
82
|
+
async function setupNextApp() {
|
|
83
|
+
console.log('Setting up Next.js 15 project...');
|
|
84
84
|
console.log('');
|
|
85
85
|
await runCommand('npx', [
|
|
86
86
|
'create-next-app@latest',
|
|
@@ -96,7 +96,7 @@ async function scaffoldNextApp() {
|
|
|
96
96
|
'--yes'
|
|
97
97
|
]);
|
|
98
98
|
console.log('');
|
|
99
|
-
console.log('Next.js project
|
|
99
|
+
console.log('Next.js project created successfully.');
|
|
100
100
|
console.log('');
|
|
101
101
|
|
|
102
102
|
// Add .npmrc with legacy-peer-deps so all npm installs (including Slice Machine) work with React 19
|
|
@@ -107,7 +107,7 @@ async function scaffoldNextApp() {
|
|
|
107
107
|
try { rmSync(join(process.cwd(), 'next.config.ts')); } catch {}
|
|
108
108
|
try { rmSync(join(process.cwd(), 'next.config.js')); } catch {}
|
|
109
109
|
|
|
110
|
-
// Copy Acorn template files (src/, public/, config files) over the Next.js
|
|
110
|
+
// Copy Acorn template files (src/, public/, config files) over the Next.js starter
|
|
111
111
|
console.log('Copying Acorn boilerplate...');
|
|
112
112
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
113
113
|
const templateDir = join(__dirname, '..', 'template');
|
|
@@ -343,7 +343,7 @@ async function setupDato() {
|
|
|
343
343
|
console.log(' https://www.datocms.com/dashboard');
|
|
344
344
|
console.log('');
|
|
345
345
|
console.log('Once your project is ready, provide the Full-access API token below');
|
|
346
|
-
console.log('and we will automatically
|
|
346
|
+
console.log('and we will automatically create all models (Page, Hero, Button, Layout, etc.).');
|
|
347
347
|
console.log('');
|
|
348
348
|
console.log('Token location: Settings > API Tokens > Full-access API token');
|
|
349
349
|
console.log('Make sure "Access the Content Management API" is enabled and the role is Admin.');
|
|
@@ -368,11 +368,11 @@ async function setupDato() {
|
|
|
368
368
|
|
|
369
369
|
if (apiToken) {
|
|
370
370
|
console.log('');
|
|
371
|
-
console.log('
|
|
371
|
+
console.log('Creating DatoCMS models...');
|
|
372
372
|
console.log('');
|
|
373
373
|
|
|
374
374
|
try {
|
|
375
|
-
await
|
|
375
|
+
await createDatoModels(apiToken);
|
|
376
376
|
console.log('');
|
|
377
377
|
console.log('DatoCMS models created successfully!');
|
|
378
378
|
console.log('');
|
|
@@ -405,7 +405,7 @@ NEXT_DATOCMS_ENVIRONMENT=draft
|
|
|
405
405
|
}
|
|
406
406
|
} catch (err) {
|
|
407
407
|
console.log('');
|
|
408
|
-
console.log('Warning: Could not
|
|
408
|
+
console.log('Warning: Could not create DatoCMS models automatically.');
|
|
409
409
|
console.log(` Error: ${err.message}`);
|
|
410
410
|
console.log('');
|
|
411
411
|
console.log('You can create models manually in the DatoCMS dashboard.');
|
|
@@ -415,7 +415,7 @@ NEXT_DATOCMS_ENVIRONMENT=draft
|
|
|
415
415
|
}
|
|
416
416
|
} else {
|
|
417
417
|
console.log('');
|
|
418
|
-
console.log('Skipping model
|
|
418
|
+
console.log('Skipping model creation — you can set up models manually later.');
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
// Update next.config.ts — replace Prismic image patterns with DatoCMS
|
|
@@ -547,10 +547,10 @@ NEXT_DATOCMS_ENVIRONMENT=draft
|
|
|
547
547
|
}
|
|
548
548
|
|
|
549
549
|
/**
|
|
550
|
-
*
|
|
551
|
-
*
|
|
550
|
+
* Create default DatoCMS models using the Management API.
|
|
551
|
+
* Models match the GraphQL queries in the dato-api layer.
|
|
552
552
|
*/
|
|
553
|
-
async function
|
|
553
|
+
async function createDatoModels(apiToken) {
|
|
554
554
|
const { buildClient } = await import('@datocms/cma-client-node');
|
|
555
555
|
const client = buildClient({ apiToken });
|
|
556
556
|
|
|
@@ -1089,7 +1089,7 @@ async function main() {
|
|
|
1089
1089
|
console.log(`Created directory: ${projectDir}`);
|
|
1090
1090
|
console.log('');
|
|
1091
1091
|
|
|
1092
|
-
await
|
|
1092
|
+
await setupNextApp();
|
|
1093
1093
|
|
|
1094
1094
|
// Generate .env.example and README before CMS setup (CMS setup may block if user starts Slice Machine)
|
|
1095
1095
|
const envExamples = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@majordigital/create-acorn",
|
|
3
|
-
"version": "1.5.
|
|
4
|
-
"description": "Interactive
|
|
3
|
+
"version": "1.5.7",
|
|
4
|
+
"description": "Interactive starter CLI for Acorn with Storyblok/Prismic/DatoCMS, TypeScript, and Tailwind.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-acorn": "bin/create-acorn.mjs",
|
|
7
7
|
"major-acorn": "bin/create-acorn.mjs"
|