create-nextly-app 0.0.2-alpha.6 → 0.0.2-alpha.60

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 (54) hide show
  1. package/dist/{chunk-6NVRVAZA.mjs → chunk-SEU6FVET.mjs} +2701 -1726
  2. package/dist/chunk-SEU6FVET.mjs.map +1 -0
  3. package/dist/cli.cjs +2803 -1831
  4. package/dist/cli.cjs.map +1 -1
  5. package/dist/cli.mjs +31 -35
  6. package/dist/cli.mjs.map +1 -1
  7. package/dist/index.cjs +2620 -1643
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +2 -1
  10. package/dist/index.d.ts +2 -1
  11. package/dist/index.mjs +1 -1
  12. package/package.json +11 -12
  13. package/templates/base/.env.example +11 -0
  14. package/templates/base/AGENTS.md.template +158 -0
  15. package/templates/base/CLAUDE.md.template +1 -0
  16. package/templates/base/gitignore +42 -0
  17. package/templates/base/next.config.ts +11 -17
  18. package/templates/base/src/app/admin/api/media/[[...path]]/route.ts +26 -0
  19. package/templates/base/src/app/globals.css +15 -2
  20. package/templates/base/src/app/layout.tsx +30 -15
  21. package/templates/base/tsconfig.json +8 -1
  22. package/templates/blank/src/app/globals.css +37 -1
  23. package/templates/blank/src/app/layout.tsx +26 -15
  24. package/templates/plugin/AGENTS.md.template +96 -0
  25. package/templates/plugin/CLAUDE.md.template +1 -0
  26. package/templates/plugin/README.md +44 -0
  27. package/templates/plugin/dev/.env.example +8 -0
  28. package/templates/plugin/dev/instrumentation.ts +10 -0
  29. package/templates/plugin/dev/next.config.ts +30 -0
  30. package/templates/plugin/dev/nextly.config.ts +17 -0
  31. package/templates/plugin/dev/src/app/admin/[[...params]]/page.tsx +9 -0
  32. package/templates/plugin/dev/src/app/admin/api/[[...params]]/route.ts +19 -0
  33. package/templates/plugin/dev/src/app/layout.tsx +13 -0
  34. package/templates/plugin/dev/tsconfig.json +22 -0
  35. package/templates/plugin/eslint.config.mjs +8 -0
  36. package/templates/plugin/gitignore +10 -0
  37. package/templates/plugin/src/admin/SettingsPage.tsx +57 -0
  38. package/templates/plugin/src/admin/index.ts +24 -0
  39. package/templates/plugin/src/collections/example.ts +13 -0
  40. package/templates/plugin/src/index.ts +6 -0
  41. package/templates/plugin/src/plugin.test.ts +28 -0
  42. package/templates/plugin/src/plugin.ts +48 -0
  43. package/templates/plugin/src/types.ts +17 -0
  44. package/templates/plugin/template.json +14 -0
  45. package/templates/plugin/tsconfig.json +18 -0
  46. package/templates/plugin/tsup.config.ts +24 -0
  47. package/templates/plugin/vitest.config.ts +8 -0
  48. package/dist/chunk-6NVRVAZA.mjs.map +0 -1
  49. package/templates/blank/src/access/README.md +0 -22
  50. package/templates/blank/src/collections/README.md +0 -22
  51. package/templates/blank/src/lib/README.md +0 -15
  52. package/templates/blank/src/singles/README.md +0 -19
  53. /package/templates/blank/src/{components → app/(frontend)/components}/README.md +0 -0
  54. /package/templates/blank/src/{components → app/(frontend)/components}/ThemeToggle.tsx +0 -0
package/dist/cli.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
- import { __commonJS, __require, __toESM, init, capture, createNextly, shutdown } from './chunk-6NVRVAZA.mjs';
4
- import path from 'path';
3
+ import { __commonJS, __require, __toESM, init, resolveProjectArg, validateProjectName, capture, createNextly, shutdown } from './chunk-SEU6FVET.mjs';
5
4
 
6
5
  createRequire(import.meta.url);
7
6
 
@@ -1168,7 +1167,7 @@ var require_command = __commonJS({
1168
1167
  "../../node_modules/.pnpm/commander@14.0.2/node_modules/commander/lib/command.js"(exports$1) {
1169
1168
  var EventEmitter = __require("events").EventEmitter;
1170
1169
  var childProcess = __require("child_process");
1171
- var path2 = __require("path");
1170
+ var path = __require("path");
1172
1171
  var fs = __require("fs");
1173
1172
  var process2 = __require("process");
1174
1173
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -2180,9 +2179,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2180
2179
  let launchWithNode = false;
2181
2180
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2182
2181
  function findFile(baseDir, baseName) {
2183
- const localBin = path2.resolve(baseDir, baseName);
2182
+ const localBin = path.resolve(baseDir, baseName);
2184
2183
  if (fs.existsSync(localBin)) return localBin;
2185
- if (sourceExt.includes(path2.extname(baseName))) return void 0;
2184
+ if (sourceExt.includes(path.extname(baseName))) return void 0;
2186
2185
  const foundExt = sourceExt.find(
2187
2186
  (ext) => fs.existsSync(`${localBin}${ext}`)
2188
2187
  );
@@ -2200,17 +2199,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
2200
2199
  } catch {
2201
2200
  resolvedScriptPath = this._scriptPath;
2202
2201
  }
2203
- executableDir = path2.resolve(
2204
- path2.dirname(resolvedScriptPath),
2202
+ executableDir = path.resolve(
2203
+ path.dirname(resolvedScriptPath),
2205
2204
  executableDir
2206
2205
  );
2207
2206
  }
2208
2207
  if (executableDir) {
2209
2208
  let localFile = findFile(executableDir, executableFile);
2210
2209
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
2211
- const legacyName = path2.basename(
2210
+ const legacyName = path.basename(
2212
2211
  this._scriptPath,
2213
- path2.extname(this._scriptPath)
2212
+ path.extname(this._scriptPath)
2214
2213
  );
2215
2214
  if (legacyName !== this._name) {
2216
2215
  localFile = findFile(
@@ -2221,7 +2220,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2221
2220
  }
2222
2221
  executableFile = localFile || executableFile;
2223
2222
  }
2224
- launchWithNode = sourceExt.includes(path2.extname(executableFile));
2223
+ launchWithNode = sourceExt.includes(path.extname(executableFile));
2225
2224
  let proc;
2226
2225
  if (process2.platform !== "win32") {
2227
2226
  if (launchWithNode) {
@@ -3136,7 +3135,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3136
3135
  * @return {Command}
3137
3136
  */
3138
3137
  nameFromFilename(filename) {
3139
- this._name = path2.basename(filename, path2.extname(filename));
3138
+ this._name = path.basename(filename, path.extname(filename));
3140
3139
  return this;
3141
3140
  }
3142
3141
  /**
@@ -3150,9 +3149,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3150
3149
  * @param {string} [path]
3151
3150
  * @return {(string|null|Command)}
3152
3151
  */
3153
- executableDir(path3) {
3154
- if (path3 === void 0) return this._executableDir;
3155
- this._executableDir = path3;
3152
+ executableDir(path2) {
3153
+ if (path2 === void 0) return this._executableDir;
3154
+ this._executableDir = path2;
3156
3155
  return this;
3157
3156
  }
3158
3157
  /**
@@ -3435,7 +3434,7 @@ var require_package = __commonJS({
3435
3434
  "package.json"(exports$1, module) {
3436
3435
  module.exports = {
3437
3436
  name: "create-nextly-app",
3438
- version: "0.0.2-alpha.6",
3437
+ version: "0.0.2-alpha.60",
3439
3438
  description: "CLI to scaffold Nextly in your Next.js project",
3440
3439
  license: "MIT",
3441
3440
  type: "module",
@@ -3472,27 +3471,26 @@ var require_package = __commonJS({
3472
3471
  commander: "^14.0.2",
3473
3472
  execa: "^9.6.0",
3474
3473
  "fs-extra": "^11.3.0",
3475
- ora: "^9.0.0",
3476
3474
  picocolors: "^1.1.1",
3477
- tar: "^7.4.0"
3475
+ tar: "^7.5.19"
3478
3476
  },
3479
3477
  devDependencies: {
3480
3478
  "@nextlyhq/eslint-config": "workspace:*",
3481
3479
  "@nextlyhq/telemetry": "workspace:*",
3482
3480
  "@nextlyhq/tsconfig": "workspace:*",
3483
3481
  "@types/fs-extra": "^11.0.4",
3484
- "@types/tar": "^6.1.13",
3485
3482
  "@types/node": "^20.19.17",
3486
- "@vitest/coverage-v8": "^4.0.8",
3487
- "@vitest/ui": "^4.0.8",
3488
- eslint: "^9.34.0",
3483
+ "@types/tar": "^6.1.13",
3484
+ "@vitest/coverage-v8": "^4.1.0",
3485
+ "@vitest/ui": "^4.1.0",
3486
+ eslint: "^9.39.1",
3489
3487
  tsup: "^8.5.0",
3490
3488
  typescript: "^5.9.3",
3491
3489
  "vite-tsconfig-paths": "^5.1.4",
3492
- vitest: "^4.0.8"
3490
+ vitest: "^4.1.0"
3493
3491
  },
3494
3492
  engines: {
3495
- node: ">=20.0.0"
3493
+ node: "^20.19.0 || ^22.12.0 || >=24.0.0"
3496
3494
  },
3497
3495
  keywords: [
3498
3496
  "nextly",
@@ -3538,15 +3536,6 @@ var {
3538
3536
  Option,
3539
3537
  Help
3540
3538
  } = import_index.default;
3541
- function resolveProjectArg(directory) {
3542
- if (!directory || directory === "") {
3543
- return { projectName: void 0, installInCwd: false };
3544
- }
3545
- if (directory === ".") {
3546
- return { projectName: void 0, installInCwd: true };
3547
- }
3548
- return { projectName: path.basename(directory), installInCwd: false };
3549
- }
3550
3539
 
3551
3540
  // src/cli.ts
3552
3541
  var pkg = require_package();
@@ -3555,8 +3544,7 @@ program2.name("create-nextly-app").description(
3555
3544
  "Scaffold a new Nextly CMS project or add Nextly to an existing Next.js app"
3556
3545
  ).version("0.1.0").argument(
3557
3546
  "[directory]",
3558
- "Project name or '.' to install in the current directory",
3559
- "."
3547
+ "Project name or '.' to install in the current directory (omit to be prompted)"
3560
3548
  ).option(
3561
3549
  "-y, --yes",
3562
3550
  "Skip prompts and use defaults (blank template, SQLite, local storage)"
@@ -3573,11 +3561,12 @@ program2.name("create-nextly-app").description(
3573
3561
  "after",
3574
3562
  `
3575
3563
  Examples:
3564
+ $ npx create-nextly-app@alpha (prompts for folder name)
3576
3565
  $ npx create-nextly-app@alpha my-project
3577
3566
  $ npx create-nextly-app@alpha my-project -y
3578
3567
  $ npx create-nextly-app@alpha my-blog -t blog -a code-first
3579
3568
  $ npx create-nextly-app@alpha my-project --database postgresql
3580
- $ npx create-nextly-app@alpha .
3569
+ $ npx create-nextly-app@alpha . (install in the current directory)
3581
3570
  `
3582
3571
  ).action(
3583
3572
  async (directory, options) => {
@@ -3588,6 +3577,13 @@ Examples:
3588
3577
  try {
3589
3578
  const cwd = process.cwd();
3590
3579
  const { projectName, installInCwd } = resolveProjectArg(directory);
3580
+ if (projectName) {
3581
+ const nameError = validateProjectName(projectName);
3582
+ if (nameError) {
3583
+ console.error(`Error: Invalid project name '${projectName}'. ${nameError}.`);
3584
+ process.exit(1);
3585
+ }
3586
+ }
3591
3587
  const projectType = options.template;
3592
3588
  const validTypes = ["blank", "blog"];
3593
3589
  if (projectType && !validTypes.includes(projectType)) {