create-nextly-app 0.0.2-alpha.75 → 0.0.2-alpha.76
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/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{create-nextly-N_COehCu.mjs → create-nextly-BmGN2BX8.mjs} +103 -4
- package/dist/create-nextly-BmGN2BX8.mjs.map +1 -0
- package/dist/{create-nextly-DdIL2e9E.cjs → create-nextly-CXsN4jfA.cjs} +103 -4
- package/dist/create-nextly-CXsN4jfA.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
- package/skills/nextly-authentication/SKILL.md +1 -1
- package/skills/nextly-collections/SKILL.md +1 -1
- package/skills/nextly-deploy/SKILL.md +1 -1
- package/skills/nextly-install/SKILL.md +1 -1
- package/templates/base/src/app/admin/[[...params]]/layout.tsx +12 -0
- package/dist/create-nextly-DdIL2e9E.cjs.map +0 -1
- package/dist/create-nextly-N_COehCu.mjs.map +0 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_create_nextly = require("./create-nextly-
|
|
3
|
+
const require_create_nextly = require("./create-nextly-CXsN4jfA.cjs");
|
|
4
4
|
// ../../node_modules/.pnpm/commander@14.0.2/node_modules/commander/lib/error.js
|
|
5
5
|
var require_error = /* @__PURE__ */ require_create_nextly.__commonJSMin(((exports) => {
|
|
6
6
|
/**
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as getAvailableTemplateNames, c as init, d as __require, f as __toESM, i as validateTemplateName, l as shutdown, n as resolveProjectArg, o as packageVersion, r as validateProjectName, s as capture, t as createNextly, u as __commonJSMin } from "./create-nextly-
|
|
2
|
+
import { a as getAvailableTemplateNames, c as init, d as __require, f as __toESM, i as validateTemplateName, l as shutdown, n as resolveProjectArg, o as packageVersion, r as validateProjectName, s as capture, t as createNextly, u as __commonJSMin } from "./create-nextly-BmGN2BX8.mjs";
|
|
3
3
|
// ../../node_modules/.pnpm/commander@14.0.2/node_modules/commander/lib/error.js
|
|
4
4
|
var require_error = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5
5
|
/**
|
|
@@ -42566,8 +42566,11 @@ const REQUIRE_IMPORT = "import { createRequire } from \"node:module\";";
|
|
|
42566
42566
|
const requireDeclaration = (createRequireName) => `// Resolves Nextly's cache handlers from this app's node_modules.
|
|
42567
42567
|
const require = ${createRequireName}(import.meta.url);`;
|
|
42568
42568
|
const REQUIRE_DECLARATION = requireDeclaration("createRequire");
|
|
42569
|
-
/**
|
|
42570
|
-
|
|
42569
|
+
/**
|
|
42570
|
+
* Where a new app's config takes the crawlers that wait for the whole head,
|
|
42571
|
+
* and the files its deployed routes need beyond their traces.
|
|
42572
|
+
*/
|
|
42573
|
+
const HTML_LIMITED_BOTS_IMPORT = "import { nextlyHtmlLimitedBots, nextlyTracingIncludes } from \"nextly/next\";";
|
|
42571
42574
|
/**
|
|
42572
42575
|
* The crawlers answered with each page's whole head in the first HTML rather
|
|
42573
42576
|
* than streamed it: Next.js's own list, the main Googlebot and the AI
|
|
@@ -42577,6 +42580,14 @@ const HTML_LIMITED_BOTS_LINE = ` // Search engines and AI crawlers read each pa
|
|
|
42577
42580
|
// HTML, rather than metadata streamed in after it.
|
|
42578
42581
|
htmlLimitedBots: nextlyHtmlLimitedBots,`;
|
|
42579
42582
|
/**
|
|
42583
|
+
* The files Nextly loads at request time that a route's build trace leaves
|
|
42584
|
+
* out (`nextlyTracingIncludes`): without them, a host that deploys each route
|
|
42585
|
+
* with only its traced files (Vercel) fails the first request needing one.
|
|
42586
|
+
*/
|
|
42587
|
+
const TRACING_INCLUDES_LINE = ` // Files Nextly loads at request time that the build's trace leaves out,
|
|
42588
|
+
// which a host deploying only traced files (Vercel) needs.
|
|
42589
|
+
outputFileTracingIncludes: { "/**": nextlyTracingIncludes() },`;
|
|
42590
|
+
/**
|
|
42580
42591
|
* Render a complete next.config.ts file for the selected database.
|
|
42581
42592
|
*/
|
|
42582
42593
|
function buildNextConfigTemplate(database) {
|
|
@@ -42587,6 +42598,7 @@ const nextConfig: NextConfig = {
|
|
|
42587
42598
|
${CACHE_COMPONENTS_ON}
|
|
42588
42599
|
serverExternalPackages: ${packageListLiteral(database)},
|
|
42589
42600
|
${HTML_LIMITED_BOTS_LINE}
|
|
42601
|
+
${TRACING_INCLUDES_LINE}
|
|
42590
42602
|
};
|
|
42591
42603
|
|
|
42592
42604
|
export default nextConfig;
|
|
@@ -42604,6 +42616,7 @@ const nextConfig = {
|
|
|
42604
42616
|
${CACHE_COMPONENTS_ON}
|
|
42605
42617
|
serverExternalPackages: ${packageListLiteral(database)},
|
|
42606
42618
|
${HTML_LIMITED_BOTS_LINE}
|
|
42619
|
+
${TRACING_INCLUDES_LINE}
|
|
42607
42620
|
};
|
|
42608
42621
|
|
|
42609
42622
|
export default nextConfig;
|
|
@@ -47054,7 +47067,7 @@ async function copyTemplate(options) {
|
|
|
47054
47067
|
if (await import_lib$1.default.pathExists(sharedSrc)) await import_lib$1.default.copy(sharedSrc, path.join(targetDir, "shared.ts"), { overwrite: true });
|
|
47055
47068
|
}
|
|
47056
47069
|
const templateMigrationsDir = path.join(typeDir, "migrations");
|
|
47057
|
-
if (await import_lib$1.default.pathExists(templateMigrationsDir)) await import_lib$1.default.copy(templateMigrationsDir, path.join(targetDir, "migrations"), { overwrite: false });
|
|
47070
|
+
if (approach !== "code-first" && await import_lib$1.default.pathExists(templateMigrationsDir)) await import_lib$1.default.copy(templateMigrationsDir, path.join(targetDir, "migrations"), { overwrite: false });
|
|
47058
47071
|
const templateScriptsDir = path.join(typeDir, "scripts");
|
|
47059
47072
|
if (await import_lib$1.default.pathExists(templateScriptsDir)) await import_lib$1.default.copy(templateScriptsDir, path.join(targetDir, "scripts"), {
|
|
47060
47073
|
overwrite: false,
|
|
@@ -48752,6 +48765,73 @@ async function installWithYalc(cwd, pm, allPackages, pluginPackages) {
|
|
|
48752
48765
|
for (const pkg of yalcPackages) await execa("yalc", ["add", pkg], { cwd });
|
|
48753
48766
|
await execa(pm, ["install"], { cwd });
|
|
48754
48767
|
}
|
|
48768
|
+
// src/installers/initial-migration.ts
|
|
48769
|
+
/**
|
|
48770
|
+
* A code-first project's first migration, written from its own config by the
|
|
48771
|
+
* `nextly migrate:create` the install brought.
|
|
48772
|
+
*
|
|
48773
|
+
* The build a template gives runs `nextly migrate`, which applies the files in
|
|
48774
|
+
* the folder the config reads and creates nothing else. A code-first blog's
|
|
48775
|
+
* schema is its config, the plugins it registers included, so its first
|
|
48776
|
+
* migration is generated from that config for the database the project was
|
|
48777
|
+
* scaffolded for, rather than copied from SQL written by hand for the visual
|
|
48778
|
+
* blog. The command needs the installed `nextly` and the project's `.env`, so
|
|
48779
|
+
* it runs after both.
|
|
48780
|
+
*
|
|
48781
|
+
* @module installers/initial-migration
|
|
48782
|
+
*/
|
|
48783
|
+
/** The arguments to `nextly` that write the first migration. */
|
|
48784
|
+
const MIGRATE_CREATE_ARGS = ["migrate:create", "initial"];
|
|
48785
|
+
/**
|
|
48786
|
+
* Whether a new project gets its first migration written from its config: a
|
|
48787
|
+
* fresh project whose template has a code-first approach. A visual project
|
|
48788
|
+
* runs the template's own migration, and a template without approaches
|
|
48789
|
+
* (blank, plugin) declares nothing to migrate.
|
|
48790
|
+
*/
|
|
48791
|
+
function writesInitialMigration(project) {
|
|
48792
|
+
return project.isFreshProject && project.projectType !== "plugin" && project.approach === "code-first";
|
|
48793
|
+
}
|
|
48794
|
+
/** The command, as the person runs it in the project with `packageManager`. */
|
|
48795
|
+
function initialMigrationCommand(packageManager) {
|
|
48796
|
+
return [
|
|
48797
|
+
binaryRunner(packageManager),
|
|
48798
|
+
"nextly",
|
|
48799
|
+
...MIGRATE_CREATE_ARGS
|
|
48800
|
+
].join(" ");
|
|
48801
|
+
}
|
|
48802
|
+
/**
|
|
48803
|
+
* Runs `nextly migrate:create initial` in `projectDir`. Resolves undefined
|
|
48804
|
+
* once it has written the migration, or with what went wrong, so the caller
|
|
48805
|
+
* can name the command to run by hand rather than stop a scaffold that is
|
|
48806
|
+
* otherwise whole.
|
|
48807
|
+
*
|
|
48808
|
+
* The shell's `DATABASE_URL`, `DB_DIALECT` and `NODE_ENV` are left out, so the
|
|
48809
|
+
* migration is written for the database the project's `.env` names, not one a
|
|
48810
|
+
* variable in the person's shell happens to name. Nothing is read from stdin:
|
|
48811
|
+
* a first migration has no rename to ask about.
|
|
48812
|
+
*/
|
|
48813
|
+
async function writeInitialMigration(projectDir, packageManager) {
|
|
48814
|
+
const [file, ...runnerArgs] = binaryRunner(packageManager).split(" ");
|
|
48815
|
+
try {
|
|
48816
|
+
await execa(file, [
|
|
48817
|
+
...runnerArgs,
|
|
48818
|
+
"nextly",
|
|
48819
|
+
...MIGRATE_CREATE_ARGS
|
|
48820
|
+
], {
|
|
48821
|
+
cwd: projectDir,
|
|
48822
|
+
env: {
|
|
48823
|
+
DATABASE_URL: void 0,
|
|
48824
|
+
DB_DIALECT: void 0,
|
|
48825
|
+
NODE_ENV: void 0
|
|
48826
|
+
},
|
|
48827
|
+
stdin: "ignore"
|
|
48828
|
+
});
|
|
48829
|
+
return;
|
|
48830
|
+
} catch (error) {
|
|
48831
|
+
const said = error.stderr;
|
|
48832
|
+
return typeof said === "string" && said.trim().length > 0 ? said.trim() : error.message;
|
|
48833
|
+
}
|
|
48834
|
+
}
|
|
48755
48835
|
// ../../node_modules/.pnpm/tar@7.5.22/node_modules/tar/dist/esm/index.min.js
|
|
48756
48836
|
var zr = Object.defineProperty;
|
|
48757
48837
|
var Ur = (s, t) => {
|
|
@@ -53051,6 +53131,21 @@ async function createNextly(options = {}) {
|
|
|
53051
53131
|
stopAtConfig(error, overallStartedAt);
|
|
53052
53132
|
}
|
|
53053
53133
|
}
|
|
53134
|
+
const initialMigration = writesInitialMigration({
|
|
53135
|
+
isFreshProject,
|
|
53136
|
+
projectType,
|
|
53137
|
+
approach
|
|
53138
|
+
});
|
|
53139
|
+
if (initialMigration && !skipInstall) {
|
|
53140
|
+
const s = be$1();
|
|
53141
|
+
s.start("Writing the first migration from your config...");
|
|
53142
|
+
const failed = await writeInitialMigration(cwd, projectInfo.packageManager);
|
|
53143
|
+
if (failed === void 0) s.stop("First migration written");
|
|
53144
|
+
else {
|
|
53145
|
+
s.stop("The first migration was not written");
|
|
53146
|
+
R.warn(`${failed}\nRun ${initialMigrationCommand(projectInfo.packageManager)} in the project before its first build.`);
|
|
53147
|
+
}
|
|
53148
|
+
}
|
|
53054
53149
|
const pm = projectInfo.packageManager;
|
|
53055
53150
|
const devCommand = `${scriptRunner(pm)} dev`;
|
|
53056
53151
|
const lines = [];
|
|
@@ -53067,6 +53162,10 @@ async function createNextly(options = {}) {
|
|
|
53067
53162
|
lines.push("");
|
|
53068
53163
|
lines.push(` Use it in an app: add ${import_picocolors.default.dim("myPlugin()")} to ${import_picocolors.default.dim("plugins")} in nextly.config.ts.`);
|
|
53069
53164
|
} else {
|
|
53165
|
+
if (initialMigration && skipInstall) {
|
|
53166
|
+
lines.push(` ${import_picocolors.default.bold(initialMigrationCommand(pm))}`);
|
|
53167
|
+
lines.push(` ${import_picocolors.default.dim("→ after installing: writes the first migration your build applies")}`);
|
|
53168
|
+
}
|
|
53070
53169
|
lines.push(` ${import_picocolors.default.bold(devCommand)}`);
|
|
53071
53170
|
lines.push("");
|
|
53072
53171
|
if (databaseType === "sqlite") lines.push(` Your database (SQLite) is stored at ${import_picocolors.default.dim("./data/nextly.db")}`);
|
|
@@ -53089,4 +53188,4 @@ async function createNextly(options = {}) {
|
|
|
53089
53188
|
}
|
|
53090
53189
|
export { getAvailableTemplateNames as a, init as c, __require as d, __toESM$1 as f, validateTemplateName as i, shutdown as l, resolveProjectArg as n, packageVersion as o, validateProjectName as r, capture as s, createNextly as t, __commonJSMin$1 as u };
|
|
53091
53190
|
|
|
53092
|
-
//# sourceMappingURL=create-nextly-
|
|
53191
|
+
//# sourceMappingURL=create-nextly-BmGN2BX8.mjs.map
|