create-nextjs-cms 0.5.62 → 0.5.66

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.
Files changed (75) hide show
  1. package/dist/index.js +50 -198
  2. package/dist/lib/cms-setup.d.ts +6 -0
  3. package/dist/lib/cms-setup.d.ts.map +1 -0
  4. package/dist/lib/cms-setup.js +30 -0
  5. package/dist/lib/exec-utils.d.ts +28 -0
  6. package/dist/lib/exec-utils.d.ts.map +1 -0
  7. package/dist/lib/exec-utils.js +61 -0
  8. package/dist/lib/global-package.d.ts +10 -0
  9. package/dist/lib/global-package.d.ts.map +1 -0
  10. package/dist/lib/global-package.js +158 -0
  11. package/dist/lib/install-deps.d.ts +4 -0
  12. package/dist/lib/install-deps.d.ts.map +1 -0
  13. package/dist/lib/install-deps.js +114 -0
  14. package/dist/lib/logger.d.ts +8 -0
  15. package/dist/lib/logger.d.ts.map +1 -0
  16. package/dist/lib/logger.js +18 -0
  17. package/dist/lib/section-creators.d.ts +13 -0
  18. package/dist/lib/section-creators.d.ts.map +1 -0
  19. package/dist/lib/section-creators.js +201 -0
  20. package/dist/lib/utils.js +1 -1
  21. package/package.json +6 -4
  22. package/templates/default/components/form/helpers/_section-hot-reload.js +3 -3
  23. package/templates/default/lib/postinstall.js +1 -1
  24. package/templates/default/package.json +1 -1
  25. package/templates/default/.uploads/.photos/categories/000e56fada378de1a84a4 +0 -0
  26. package/templates/default/.uploads/.photos/categories/121e7d13ee3b5fa03795b +0 -0
  27. package/templates/default/.uploads/.photos/categories/17a55c5a53eb62293c69e +0 -0
  28. package/templates/default/.uploads/.photos/categories/4c86ad8c1f51f1e3a953b +0 -0
  29. package/templates/default/.uploads/.photos/categories/4d360813741a45744327c +0 -0
  30. package/templates/default/.uploads/.photos/categories/5238fefaa3cbebf388178 +0 -0
  31. package/templates/default/.uploads/.photos/categories/541d7cf8c69895bcb15cd +0 -0
  32. package/templates/default/.uploads/.photos/categories/57a2f689a910a378247ea +0 -0
  33. package/templates/default/.uploads/.photos/categories/6de4bdb341a3e1f70ddc3 +0 -0
  34. package/templates/default/.uploads/.photos/categories/6f52739eaa686441a28f4 +0 -0
  35. package/templates/default/.uploads/.photos/categories/8a21b9fa8ecd88f460a15 +0 -0
  36. package/templates/default/.uploads/.photos/categories/91948abcb073c9445fdec +0 -0
  37. package/templates/default/.uploads/.photos/categories/9ae700d1abfd6b85780e8 +0 -0
  38. package/templates/default/.uploads/.photos/categories/9edee86e932985fc589b5 +0 -0
  39. package/templates/default/.uploads/.photos/categories/a520e77b082f35b575dba +0 -0
  40. package/templates/default/.uploads/.photos/categories/b19c449029330f0a74b20 +0 -0
  41. package/templates/default/.uploads/.photos/categories/b9802010f68afd4edb0e8 +0 -0
  42. package/templates/default/.uploads/.photos/categories/c1d7c3b986739bf496730 +0 -0
  43. package/templates/default/.uploads/.photos/categories/c25dc38567384513ffe93 +0 -0
  44. package/templates/default/.uploads/.photos/categories/cbe3874a3d13afba388df +0 -0
  45. package/templates/default/.uploads/.photos/categories/d450fdeb04f0d070442d6 +0 -0
  46. package/templates/default/.uploads/.photos/categories/f80bf3a4515680ead5a5c +0 -0
  47. package/templates/default/.uploads/.photos/categories/f8639c2d5b0d24cb76fb1 +0 -0
  48. package/templates/default/.uploads/.photos/categories/f8d997149d10aab046e40 +0 -0
  49. package/templates/default/.uploads/.photos/categories/fa2c55690ff96e33a16fe +0 -0
  50. package/templates/default/.uploads/.photos/featured_slider/d00be4edb4c38ca34b5a5 +0 -0
  51. package/templates/default/.uploads/.thumbs/categories/000e56fada378de1a84a4 +0 -0
  52. package/templates/default/.uploads/.thumbs/categories/121e7d13ee3b5fa03795b +0 -0
  53. package/templates/default/.uploads/.thumbs/categories/17a55c5a53eb62293c69e +0 -0
  54. package/templates/default/.uploads/.thumbs/categories/4c86ad8c1f51f1e3a953b +0 -0
  55. package/templates/default/.uploads/.thumbs/categories/4d360813741a45744327c +0 -0
  56. package/templates/default/.uploads/.thumbs/categories/5238fefaa3cbebf388178 +0 -0
  57. package/templates/default/.uploads/.thumbs/categories/541d7cf8c69895bcb15cd +0 -0
  58. package/templates/default/.uploads/.thumbs/categories/57a2f689a910a378247ea +0 -0
  59. package/templates/default/.uploads/.thumbs/categories/6de4bdb341a3e1f70ddc3 +0 -0
  60. package/templates/default/.uploads/.thumbs/categories/6f52739eaa686441a28f4 +0 -0
  61. package/templates/default/.uploads/.thumbs/categories/8a21b9fa8ecd88f460a15 +0 -0
  62. package/templates/default/.uploads/.thumbs/categories/91948abcb073c9445fdec +0 -0
  63. package/templates/default/.uploads/.thumbs/categories/9ae700d1abfd6b85780e8 +0 -0
  64. package/templates/default/.uploads/.thumbs/categories/9edee86e932985fc589b5 +0 -0
  65. package/templates/default/.uploads/.thumbs/categories/a520e77b082f35b575dba +0 -0
  66. package/templates/default/.uploads/.thumbs/categories/b19c449029330f0a74b20 +0 -0
  67. package/templates/default/.uploads/.thumbs/categories/b9802010f68afd4edb0e8 +0 -0
  68. package/templates/default/.uploads/.thumbs/categories/c1d7c3b986739bf496730 +0 -0
  69. package/templates/default/.uploads/.thumbs/categories/c25dc38567384513ffe93 +0 -0
  70. package/templates/default/.uploads/.thumbs/categories/cbe3874a3d13afba388df +0 -0
  71. package/templates/default/.uploads/.thumbs/categories/d450fdeb04f0d070442d6 +0 -0
  72. package/templates/default/.uploads/.thumbs/categories/f80bf3a4515680ead5a5c +0 -0
  73. package/templates/default/.uploads/.thumbs/categories/f8639c2d5b0d24cb76fb1 +0 -0
  74. package/templates/default/.uploads/.thumbs/categories/f8d997149d10aab046e40 +0 -0
  75. package/templates/default/.uploads/.thumbs/categories/fa2c55690ff96e33a16fe +0 -0
@@ -0,0 +1,114 @@
1
+ import chalk from 'chalk';
2
+ import ora from 'ora';
3
+ import { log } from '@clack/prompts';
4
+ import { logger } from './logger.js';
5
+ import { detectPackageManager } from './utils.js';
6
+ import { execWithSpinner, execWithoutSpinner } from './exec-utils.js';
7
+ const runInstallCommand = async (pkgManager, projectDir) => {
8
+ switch (pkgManager) {
9
+ // When using npm, inherit both stdout and stderr so that the progress bar is shown
10
+ case 'npm':
11
+ await execWithoutSpinner(pkgManager, ['install'], {
12
+ cwd: projectDir,
13
+ stdout: 'inherit',
14
+ stderr: 'inherit',
15
+ });
16
+ return null;
17
+ // When using yarn or pnpm, use the stdout stream and ora spinner to show the progress
18
+ case 'pnpm':
19
+ return execWithSpinner({
20
+ command: pkgManager,
21
+ args: ['install'],
22
+ cwd: projectDir,
23
+ spinnerText: `Running ${pkgManager} install...`,
24
+ stderr: 'pipe', // Capture stderr to detect path length errors
25
+ onDataHandle: (spinner) => (data) => {
26
+ const text = data.toString();
27
+ if (text.includes('Progress')) {
28
+ spinner.text = text.includes('|') ? (text.split(' | ')[1] ?? '') : text;
29
+ }
30
+ },
31
+ checkExitCode: true, // Check exit code to catch errors
32
+ });
33
+ case 'yarn':
34
+ return execWithSpinner({
35
+ command: pkgManager,
36
+ args: ['install'],
37
+ cwd: projectDir,
38
+ spinnerText: `Running ${pkgManager} install...`,
39
+ onDataHandle: (spinner) => (data) => {
40
+ spinner.text = data.toString();
41
+ },
42
+ });
43
+ // When using bun, the stdout stream is ignored and the spinner is shown
44
+ case 'bun':
45
+ return execWithSpinner({
46
+ command: pkgManager,
47
+ args: ['install'],
48
+ cwd: projectDir,
49
+ spinnerText: `Running ${pkgManager} install...`,
50
+ stdout: 'ignore',
51
+ });
52
+ }
53
+ };
54
+ export const installDependencies = async ({ projectDir }) => {
55
+ log.info(chalk.cyan('Installing dependencies...'));
56
+ const pkgManager = detectPackageManager();
57
+ try {
58
+ const installSpinner = await runInstallCommand(pkgManager, projectDir);
59
+ // If the spinner was used to show the progress, use succeed method on it
60
+ // If not, create a new spinner for success message
61
+ if (installSpinner) {
62
+ installSpinner.stop();
63
+ // log.message(chalk.green('Successfully installed dependencies!'))
64
+ }
65
+ else {
66
+ // log.message(chalk.green('Successfully installed dependencies!'))
67
+ }
68
+ }
69
+ catch (error) {
70
+ const errorMessage = error instanceof Error ? error.message : String(error);
71
+ const stderrMessage = error.stderr ?? '';
72
+ const fullErrorText = `${errorMessage} ${stderrMessage}`.toUpperCase();
73
+ // Handle pnpm path length issue on Windows
74
+ if (pkgManager === 'pnpm' && fullErrorText.includes('PNPM_VIRTUAL_STORE_DIR_MAX_LENGTH_DIFF')) {
75
+ log.warn('⚠️ pnpm encountered a path length issue. Attempting to fix...');
76
+ // Run pnpm install -g to recreate global node_modules (non-interactive)
77
+ try {
78
+ const fixSpinner = ora('Fixing pnpm global store...').start();
79
+ await execWithoutSpinner('pnpm', ['install', '-g', '--yes'], {
80
+ stdout: 'ignore',
81
+ stderr: 'ignore',
82
+ reject: false, // Don't fail if this doesn't work
83
+ env: {
84
+ CI: 'true', // Make pnpm non-interactive
85
+ },
86
+ });
87
+ fixSpinner.succeed('Fixed pnpm global store');
88
+ // Retry the original install command
89
+ log.message('Retrying pnpm install...');
90
+ const retrySpinner = await runInstallCommand(pkgManager, projectDir);
91
+ if (retrySpinner) {
92
+ retrySpinner.succeed(chalk.green('Successfully installed dependencies!'));
93
+ }
94
+ else {
95
+ ora().succeed(chalk.green('Successfully installed dependencies!'));
96
+ }
97
+ return;
98
+ }
99
+ catch (retryError) {
100
+ ora().fail(chalk.red('Failed to fix pnpm path length issue'));
101
+ logger.error('⚠️ Could not automatically fix the issue.');
102
+ logger.message('');
103
+ logger.message('Try one of these solutions:');
104
+ logger.message(' 1. Move your project to a shorter path (e.g., C:\\dev\\my-app)');
105
+ logger.message(' 2. Use npm instead: npm install');
106
+ logger.message(' 3. Manually run: pnpm install -g');
107
+ logger.message('');
108
+ throw retryError;
109
+ }
110
+ }
111
+ // Re-throw other errors
112
+ throw error;
113
+ }
114
+ };
@@ -0,0 +1,8 @@
1
+ export declare const logger: {
2
+ message(...args: unknown[]): void;
3
+ error(...args: unknown[]): void;
4
+ warn(...args: unknown[]): void;
5
+ info(...args: unknown[]): void;
6
+ success(...args: unknown[]): void;
7
+ };
8
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM;qBACE,OAAO,EAAE;mBAGX,OAAO,EAAE;kBAGV,OAAO,EAAE;kBAGT,OAAO,EAAE;qBAGN,OAAO,EAAE;CAG7B,CAAA"}
@@ -0,0 +1,18 @@
1
+ import chalk from 'chalk';
2
+ export const logger = {
3
+ message(...args) {
4
+ console.log(chalk.gray(...args));
5
+ },
6
+ error(...args) {
7
+ console.log(chalk.red(...args));
8
+ },
9
+ warn(...args) {
10
+ console.log(chalk.yellow(...args));
11
+ },
12
+ info(...args) {
13
+ console.log(chalk.cyan(...args));
14
+ },
15
+ success(...args) {
16
+ console.log(chalk.green(...args));
17
+ },
18
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Creates a blog section file in the sections folder
3
+ */
4
+ export declare function createBlogSection(targetDir: string): Promise<void>;
5
+ /**
6
+ * Creates a category section file in the sections folder
7
+ */
8
+ export declare function createCategorySection(targetDir: string): Promise<void>;
9
+ /**
10
+ * Creates a simple section file in the sections folder
11
+ */
12
+ export declare function createSimpleSection(targetDir: string): Promise<void>;
13
+ //# sourceMappingURL=section-creators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"section-creators.d.ts","sourceRoot":"","sources":["../../src/lib/section-creators.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuExE;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkE5E;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2D1E"}
@@ -0,0 +1,201 @@
1
+ import fs from 'fs-extra';
2
+ import path from 'node:path';
3
+ /**
4
+ * Creates a blog section file in the sections folder
5
+ */
6
+ export async function createBlogSection(targetDir) {
7
+ const sectionsDir = path.join(targetDir, 'sections');
8
+ const blogSectionPath = path.join(sectionsDir, 'blog.section.ts');
9
+ // Ensure sections directory exists
10
+ await fs.ensureDir(sectionsDir);
11
+ const blogSectionContent = `import { photoField, richTextField, textField, tagsField } from 'nextjs-cms/core/fields'
12
+ import { hasItemsSection } from 'nextjs-cms/core/sections'
13
+
14
+ const title = textField({
15
+ name: 'title',
16
+ label: 'Title',
17
+ required: true,
18
+ order: 1,
19
+ })
20
+
21
+ const coverPhotoField = photoField({
22
+ name: 'coverphoto',
23
+ label: 'Cover Photo',
24
+ required: true,
25
+ order: 2,
26
+ fileType: ['jpg', 'jpeg', 'png', 'webp'],
27
+ })
28
+
29
+ const content = richTextField({
30
+ name: 'content',
31
+ label: 'Content',
32
+ required: true,
33
+ order: 3,
34
+ })
35
+
36
+ const keywords = tagsField({
37
+ name: 'keywords',
38
+ label: 'Keywords',
39
+ required: false,
40
+ order: 4,
41
+ })
42
+
43
+ export default hasItemsSection({
44
+ name: 'blog',
45
+ order: 1,
46
+ icon: 'icon',
47
+ readonly: false,
48
+ headingField: title,
49
+ title: {
50
+ section: 'Blog',
51
+ singular: 'Post',
52
+ plural: 'Posts',
53
+ },
54
+ gallery: {
55
+ db: {
56
+ tableName: 'blog_gallery',
57
+ identifierField: 'reference_id',
58
+ photoNameField: 'photo',
59
+ metaField: 'meta',
60
+ },
61
+ },
62
+ db: {
63
+ table: 'blog',
64
+ },
65
+ search: {
66
+ searchFields: [title],
67
+ },
68
+ coverPhotoField: coverPhotoField,
69
+ generateQR: false,
70
+ fields: [title, coverPhotoField, content, keywords],
71
+ })
72
+ `;
73
+ await fs.writeFile(blogSectionPath, blogSectionContent, 'utf-8');
74
+ }
75
+ /**
76
+ * Creates a category section file in the sections folder
77
+ */
78
+ export async function createCategorySection(targetDir) {
79
+ const sectionsDir = path.join(targetDir, 'sections');
80
+ const categorySectionPath = path.join(sectionsDir, 'categories.section.ts');
81
+ // Ensure sections directory exists
82
+ await fs.ensureDir(sectionsDir);
83
+ const categorySectionContent = `import { numberField, photoField, textField } from 'nextjs-cms/core/fields'
84
+ import { categorySection } from 'nextjs-cms/core/sections'
85
+
86
+ const orderInput = numberField({
87
+ name: 'cat_order',
88
+ label: 'Order',
89
+ required: true,
90
+ order: 0,
91
+ })
92
+
93
+ const title = textField({
94
+ name: 'title',
95
+ label: 'Title',
96
+ required: true,
97
+ order: 1,
98
+ })
99
+
100
+ const slugInput = textField({
101
+ name: 'slug',
102
+ label: 'Slug',
103
+ required: true,
104
+ order: 2,
105
+ })
106
+
107
+ const image = photoField({
108
+ name: 'image',
109
+ label: 'Image',
110
+ required: false,
111
+ order: 3,
112
+ fileType: ['png', 'jpg', 'jpeg', 'webp'],
113
+ })
114
+
115
+ const description = textField({
116
+ name: 'description',
117
+ label: 'Description',
118
+ required: false,
119
+ order: 4,
120
+ })
121
+
122
+ export default categorySection({
123
+ title: {
124
+ section: 'Categories',
125
+ singular: 'Category',
126
+ plural: 'Categories',
127
+ },
128
+ name: 'categories',
129
+ icon: 'category',
130
+ headingField: title,
131
+ order: 2,
132
+ db: {
133
+ table: 'categories',
134
+ unique: [{ columns: [slugInput] }],
135
+ },
136
+ fields: [orderInput, title, slugInput, image, description],
137
+ depth: 3,
138
+ })
139
+ `;
140
+ await fs.writeFile(categorySectionPath, categorySectionContent, 'utf-8');
141
+ }
142
+ /**
143
+ * Creates a simple section file in the sections folder
144
+ */
145
+ export async function createSimpleSection(targetDir) {
146
+ const sectionsDir = path.join(targetDir, 'sections');
147
+ const simpleSectionPath = path.join(sectionsDir, 'settings.section.ts');
148
+ // Ensure sections directory exists
149
+ await fs.ensureDir(sectionsDir);
150
+ const simpleSectionContent = `import { richTextField, textField } from 'nextjs-cms/core/fields'
151
+ import { simpleSection } from 'nextjs-cms/core/sections'
152
+
153
+ const facebook = textField({
154
+ name: 'facebook',
155
+ label: 'Facebook',
156
+ required: false,
157
+ order: 1,
158
+ })
159
+
160
+ const instagram = textField({
161
+ name: 'instagram',
162
+ label: 'Instagram',
163
+ required: false,
164
+ order: 2,
165
+ })
166
+
167
+ const twitter = textField({
168
+ name: 'twitter',
169
+ label: 'Twitter',
170
+ required: false,
171
+ order: 3,
172
+ })
173
+
174
+ const about = richTextField({
175
+ name: 'about',
176
+ label: 'About',
177
+ required: false,
178
+ order: 4,
179
+ })
180
+
181
+ const contact = richTextField({
182
+ name: 'contact',
183
+ label: 'Contact',
184
+ required: false,
185
+ order: 5,
186
+ })
187
+
188
+ export default simpleSection({
189
+ name: 'settings',
190
+ order: 3,
191
+ icon: 'settings',
192
+ readonly: false,
193
+ title: 'Site Settings',
194
+ db: {
195
+ table: 'settings',
196
+ },
197
+ fields: [facebook, instagram, twitter, about, contact],
198
+ })
199
+ `;
200
+ await fs.writeFile(simpleSectionPath, simpleSectionContent, 'utf-8');
201
+ }
package/dist/lib/utils.js CHANGED
@@ -57,7 +57,7 @@ export function detectPackageManager() {
57
57
  }
58
58
  else {
59
59
  // If no user agent is set, assume npm
60
- return 'npm';
60
+ return 'pnpm';
61
61
  }
62
62
  }
63
63
  /** Validate template structure */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextjs-cms",
3
- "version": "0.5.62",
3
+ "version": "0.5.66",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,10 +14,12 @@
14
14
  "@clack/prompts": "^0.11.0",
15
15
  "chalk": "^5.4.1",
16
16
  "commander": "^14.0.2",
17
+ "execa": "9.6.1",
17
18
  "fs-extra": "^11.3.3",
18
19
  "glob": "^10.4.5",
19
20
  "gradient-string": "^3.0.0",
20
- "js-yaml": "^4.1.1"
21
+ "js-yaml": "^4.1.1",
22
+ "ora": "9.0.0"
21
23
  },
22
24
  "devDependencies": {
23
25
  "@types/fs-extra": "^11.0.4",
@@ -27,8 +29,8 @@
27
29
  "tsx": "^4.20.6",
28
30
  "typescript": "^5.9.2",
29
31
  "@lzcms/eslint-config": "0.3.0",
30
- "@lzcms/tsconfig": "0.1.0",
31
- "@lzcms/prettier-config": "0.1.0"
32
+ "@lzcms/prettier-config": "0.1.0",
33
+ "@lzcms/tsconfig": "0.1.0"
32
34
  },
33
35
  "prettier": "@lzcms/prettier-config",
34
36
  "scripts": {
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * AUTO-GENERATED. DO NOT EDIT.
3
- * This file is used to track the last time the sections schema was updated.
4
- * It is used to trigger a hot reload of the section schema in development mode.
3
+ * This file is used to track the last time the sections/config schema was updated.
4
+ * It is used to trigger a hot reload of the section/config in development mode.
5
5
  */
6
6
 
7
7
  export const revalidate = 0
8
8
 
9
9
  // @refresh reset
10
10
 
11
- export const configLastUpdated = 1766836070295
11
+ export const configLastUpdated = 1766857134012
@@ -11,4 +11,4 @@ const targetDir = path.join(__dirname, '../public', 'tinymce')
11
11
  fse.emptyDirSync(targetDir)
12
12
  fse.copySync(tinymcePath, targetDir, { overwrite: true })
13
13
 
14
- console.log('Successfully copied TinyMCE to public directory')
14
+ // console.log('Successfully copied TinyMCE to public directory')
@@ -64,7 +64,7 @@
64
64
  "nanoid": "^5.1.2",
65
65
  "next": "16.1.1",
66
66
  "next-themes": "^0.4.6",
67
- "nextjs-cms": "0.5.62",
67
+ "nextjs-cms": "0.5.66",
68
68
  "plaiceholder": "^3.0.0",
69
69
  "prettier-plugin-tailwindcss": "^0.7.2",
70
70
  "qrcode": "^1.5.4",