create-nextblock 0.2.69 → 0.2.71
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
CHANGED
package/scripts/sync-template.js
CHANGED
|
@@ -11,7 +11,11 @@ const PROJECT_ROOT = resolve(__dirname, '..');
|
|
|
11
11
|
const SOURCE_DIR = resolve(PROJECT_ROOT, '../nextblock');
|
|
12
12
|
const TARGET_DIR = resolve(PROJECT_ROOT, 'templates/nextblock-template');
|
|
13
13
|
const REPO_ROOT = resolve(PROJECT_ROOT, '..', '..');
|
|
14
|
-
const
|
|
14
|
+
const ROOT_PACKAGE_JSON = resolve(REPO_ROOT, 'package.json');
|
|
15
|
+
const UI_GLOBALS_SOURCE = resolve(
|
|
16
|
+
PROJECT_ROOT,
|
|
17
|
+
'../../libs/ui/src/styles/globals.css',
|
|
18
|
+
);
|
|
15
19
|
const UI_PROXY_MODULES = [
|
|
16
20
|
'avatar',
|
|
17
21
|
'badge',
|
|
@@ -47,7 +51,6 @@ const IGNORED_SEGMENTS = new Set([
|
|
|
47
51
|
'backups',
|
|
48
52
|
]);
|
|
49
53
|
|
|
50
|
-
|
|
51
54
|
async function ensureTemplateSync() {
|
|
52
55
|
const sourceExists = await fs.pathExists(SOURCE_DIR);
|
|
53
56
|
if (!sourceExists) {
|
|
@@ -88,6 +91,9 @@ async function ensureTemplateSync() {
|
|
|
88
91
|
await sanitizeUiImports();
|
|
89
92
|
await ensureUiProxies();
|
|
90
93
|
await removeBackups();
|
|
94
|
+
await ensureUiProxies();
|
|
95
|
+
await removeBackups();
|
|
96
|
+
await syncPackageVersions();
|
|
91
97
|
await removeTemplateProjectJson();
|
|
92
98
|
|
|
93
99
|
console.log(chalk.green('Template sync complete.'));
|
|
@@ -195,7 +201,8 @@ async function ensureClientTranslations() {
|
|
|
195
201
|
.replace(legacyImportRegex, wrapperImportStatement);
|
|
196
202
|
} else if (!content.includes(wrapperImportStatement)) {
|
|
197
203
|
const lines = content.split(/\r?\n/);
|
|
198
|
-
const insertIndex =
|
|
204
|
+
const insertIndex =
|
|
205
|
+
lines.findIndex((line) => line.startsWith('import')) + 1;
|
|
199
206
|
if (insertIndex > 0) {
|
|
200
207
|
lines.splice(insertIndex, 0, wrapperImportStatement);
|
|
201
208
|
content = lines.join('\n');
|
|
@@ -213,7 +220,10 @@ async function ensureClientTranslations() {
|
|
|
213
220
|
}
|
|
214
221
|
|
|
215
222
|
async function sanitizeBlockEditorImports() {
|
|
216
|
-
const blockEditorPath = resolve(
|
|
223
|
+
const blockEditorPath = resolve(
|
|
224
|
+
TARGET_DIR,
|
|
225
|
+
'app/cms/blocks/components/BlockEditorArea.tsx',
|
|
226
|
+
);
|
|
217
227
|
if (!(await fs.pathExists(blockEditorPath))) {
|
|
218
228
|
return;
|
|
219
229
|
}
|
|
@@ -249,7 +259,10 @@ async function sanitizeUiImports() {
|
|
|
249
259
|
|
|
250
260
|
for (const filePath of filesToProcess) {
|
|
251
261
|
const original = await fs.readFile(filePath, 'utf8');
|
|
252
|
-
const replaced = original.replace(
|
|
262
|
+
const replaced = original.replace(
|
|
263
|
+
/@nextblock-cms\/ui\/(?!styles\/)[A-Za-z0-9/_-]+/g,
|
|
264
|
+
'@nextblock-cms/ui',
|
|
265
|
+
);
|
|
253
266
|
|
|
254
267
|
if (replaced !== original) {
|
|
255
268
|
await fs.writeFile(filePath, replaced);
|
|
@@ -296,11 +309,7 @@ async function removeBackups() {
|
|
|
296
309
|
];
|
|
297
310
|
|
|
298
311
|
await Promise.all(
|
|
299
|
-
targets.map((dir) =>
|
|
300
|
-
fs
|
|
301
|
-
.remove(dir)
|
|
302
|
-
.catch(() => undefined),
|
|
303
|
-
),
|
|
312
|
+
targets.map((dir) => fs.remove(dir).catch(() => undefined)),
|
|
304
313
|
);
|
|
305
314
|
}
|
|
306
315
|
|
|
@@ -309,8 +318,87 @@ async function removeTemplateProjectJson() {
|
|
|
309
318
|
await fs.remove(projectJsonPath).catch(() => undefined);
|
|
310
319
|
}
|
|
311
320
|
|
|
321
|
+
async function syncPackageVersions() {
|
|
322
|
+
const targetPackageJsonPath = resolve(TARGET_DIR, 'package.json');
|
|
323
|
+
if (!(await fs.pathExists(targetPackageJsonPath))) return;
|
|
324
|
+
if (!(await fs.pathExists(ROOT_PACKAGE_JSON))) return;
|
|
325
|
+
|
|
326
|
+
const rootPkg = await fs.readJson(ROOT_PACKAGE_JSON);
|
|
327
|
+
const targetPkg = await fs.readJson(targetPackageJsonPath);
|
|
328
|
+
|
|
329
|
+
const keysToSync = [
|
|
330
|
+
'next',
|
|
331
|
+
'react',
|
|
332
|
+
'react-dom',
|
|
333
|
+
'next-themes',
|
|
334
|
+
'tailwindcss',
|
|
335
|
+
'postcss',
|
|
336
|
+
'autoprefixer',
|
|
337
|
+
'typescript',
|
|
338
|
+
'eslint',
|
|
339
|
+
'eslint-config-next',
|
|
340
|
+
'@tailwindcss/postcss',
|
|
341
|
+
];
|
|
342
|
+
|
|
343
|
+
let modified = false;
|
|
344
|
+
|
|
345
|
+
// Helper to find version in root (dev or regular dependencies)
|
|
346
|
+
const getRootVersion = (key) => {
|
|
347
|
+
return (
|
|
348
|
+
(rootPkg.dependencies && rootPkg.dependencies[key]) ||
|
|
349
|
+
(rootPkg.devDependencies && rootPkg.devDependencies[key])
|
|
350
|
+
);
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
keysToSync.forEach((key) => {
|
|
354
|
+
const rootVersion = getRootVersion(key);
|
|
355
|
+
if (!rootVersion) return;
|
|
356
|
+
|
|
357
|
+
// Update in dependencies
|
|
358
|
+
if (targetPkg.dependencies && targetPkg.dependencies[key]) {
|
|
359
|
+
if (targetPkg.dependencies[key] !== rootVersion) {
|
|
360
|
+
targetPkg.dependencies[key] = rootVersion;
|
|
361
|
+
modified = true;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
// Update in devDependencies
|
|
365
|
+
else if (targetPkg.devDependencies && targetPkg.devDependencies[key]) {
|
|
366
|
+
if (targetPkg.devDependencies[key] !== rootVersion) {
|
|
367
|
+
targetPkg.devDependencies[key] = rootVersion;
|
|
368
|
+
modified = true;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
// If missing but needed (like next-themes), add it to dependencies
|
|
372
|
+
else if (key === 'next-themes' && !targetPkg.dependencies[key]) {
|
|
373
|
+
targetPkg.dependencies[key] = rootVersion;
|
|
374
|
+
modified = true;
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
// Ensure @tailwindcss/postcss is in devDependencies if tailwind matches v4
|
|
379
|
+
const tailwindVersion = getRootVersion('tailwindcss');
|
|
380
|
+
if (
|
|
381
|
+
(tailwindVersion && tailwindVersion.startsWith('^4')) ||
|
|
382
|
+
(tailwindVersion && tailwindVersion.startsWith('4'))
|
|
383
|
+
) {
|
|
384
|
+
const postcssPluginVersion = getRootVersion('@tailwindcss/postcss');
|
|
385
|
+
if (postcssPluginVersion) {
|
|
386
|
+
targetPkg.devDependencies = targetPkg.devDependencies || {};
|
|
387
|
+
targetPkg.devDependencies['@tailwindcss/postcss'] = postcssPluginVersion;
|
|
388
|
+
modified = true;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (modified) {
|
|
393
|
+
console.log(chalk.green('Synced dependencies with root package.json'));
|
|
394
|
+
await fs.writeJson(targetPackageJsonPath, targetPkg, { spaces: 2 });
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
312
398
|
ensureTemplateSync().catch((error) => {
|
|
313
|
-
console.error(
|
|
399
|
+
console.error(
|
|
400
|
+
chalk.red(error instanceof Error ? error.message : String(error)),
|
|
401
|
+
);
|
|
314
402
|
process.exit(1);
|
|
315
403
|
});
|
|
316
404
|
|
|
@@ -322,7 +410,11 @@ async function emptyDirWithRetry(dir, retries = 5, delay = 1000) {
|
|
|
322
410
|
} catch (err) {
|
|
323
411
|
if (i === retries - 1) throw err;
|
|
324
412
|
if (err.code === 'EBUSY' || err.code === 'EPERM') {
|
|
325
|
-
console.log(
|
|
413
|
+
console.log(
|
|
414
|
+
chalk.yellow(
|
|
415
|
+
`Locked file encountered. Retrying in ${delay}ms... (${i + 1}/${retries})`,
|
|
416
|
+
),
|
|
417
|
+
);
|
|
326
418
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
327
419
|
} else {
|
|
328
420
|
throw err;
|
|
@@ -1,55 +1,58 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nextblock-cms/template",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "next dev",
|
|
7
|
-
"build": "next build",
|
|
8
|
-
"start": "next start",
|
|
9
|
-
"lint": "next lint",
|
|
10
|
-
"deploy:supabase": "node tools/deploy-supabase.js"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@aws-sdk/client-s3": "^3.920.0",
|
|
14
|
-
"@aws-sdk/s3-request-presigner": "^3.920.0",
|
|
15
|
-
"@dnd-kit/core": "^6.3.1",
|
|
16
|
-
"@dnd-kit/sortable": "^10.0.0",
|
|
17
|
-
"@dnd-kit/utilities": "^3.2.2",
|
|
18
|
-
"@supabase/ssr": "^0.6.1",
|
|
19
|
-
"@supabase/supabase-js": "^2.47.2",
|
|
20
|
-
"@tiptap/react": "^3.3.0",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"react
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"@nextblock-cms/
|
|
40
|
-
"@nextblock-cms/
|
|
41
|
-
"@nextblock-cms/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"@types/
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@nextblock-cms/template",
|
|
3
|
+
"version": "0.2.48",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start",
|
|
9
|
+
"lint": "next lint",
|
|
10
|
+
"deploy:supabase": "node tools/deploy-supabase.js"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@aws-sdk/client-s3": "^3.920.0",
|
|
14
|
+
"@aws-sdk/s3-request-presigner": "^3.920.0",
|
|
15
|
+
"@dnd-kit/core": "^6.3.1",
|
|
16
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
17
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
18
|
+
"@supabase/ssr": "^0.6.1",
|
|
19
|
+
"@supabase/supabase-js": "^2.47.2",
|
|
20
|
+
"@tiptap/react": "^3.3.0",
|
|
21
|
+
"critters": "^0.0.25",
|
|
22
|
+
"date-fns": "^3.6.0",
|
|
23
|
+
"dotenv": "^16.5.0",
|
|
24
|
+
"fast-json-patch": "^3.1.1",
|
|
25
|
+
"html-react-parser": "^5.2.6",
|
|
26
|
+
"js-cookie": "^3.0.5",
|
|
27
|
+
"lodash.debounce": "^4.0.8",
|
|
28
|
+
"lucide-react": "^0.534.0",
|
|
29
|
+
"next": "16.0.10",
|
|
30
|
+
"next-themes": "^0.4.6",
|
|
31
|
+
"nodemailer": "^7.0.4",
|
|
32
|
+
"plaiceholder": "^3.0.0",
|
|
33
|
+
"react": "^19.2.0",
|
|
34
|
+
"react-dom": "^19.2.0",
|
|
35
|
+
"react-hot-toast": "^2.4.1",
|
|
36
|
+
"sharp": "^0.34.2",
|
|
37
|
+
"uuid": "^10.0.0",
|
|
38
|
+
"zod": "^3.25.76",
|
|
39
|
+
"@nextblock-cms/ui": "workspace:*",
|
|
40
|
+
"@nextblock-cms/utils": "workspace:*",
|
|
41
|
+
"@nextblock-cms/db": "workspace:*",
|
|
42
|
+
"@nextblock-cms/editor": "workspace:*",
|
|
43
|
+
"@nextblock-cms/sdk": "workspace:*"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "22.10.2",
|
|
47
|
+
"@types/react": "^19.2.2",
|
|
48
|
+
"@types/react-dom": "^19.2.2",
|
|
49
|
+
"@tailwindcss/postcss": "^4.1.16",
|
|
50
|
+
"autoprefixer": "^10.4.21",
|
|
51
|
+
"eslint": "^9.38.0",
|
|
52
|
+
"eslint-config-next": "^16.0.6",
|
|
53
|
+
"postcss": "^8.5.6",
|
|
54
|
+
"tailwindcss": "^4.1.16",
|
|
55
|
+
"typescript": "^5.9.3",
|
|
56
|
+
"typescript-eslint": "^8.46.2"
|
|
57
|
+
}
|
|
58
|
+
}
|