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
|
@@ -42579,8 +42579,11 @@ const REQUIRE_IMPORT = "import { createRequire } from \"node:module\";";
|
|
|
42579
42579
|
const requireDeclaration = (createRequireName) => `// Resolves Nextly's cache handlers from this app's node_modules.
|
|
42580
42580
|
const require = ${createRequireName}(import.meta.url);`;
|
|
42581
42581
|
const REQUIRE_DECLARATION = requireDeclaration("createRequire");
|
|
42582
|
-
/**
|
|
42583
|
-
|
|
42582
|
+
/**
|
|
42583
|
+
* Where a new app's config takes the crawlers that wait for the whole head,
|
|
42584
|
+
* and the files its deployed routes need beyond their traces.
|
|
42585
|
+
*/
|
|
42586
|
+
const HTML_LIMITED_BOTS_IMPORT = "import { nextlyHtmlLimitedBots, nextlyTracingIncludes } from \"nextly/next\";";
|
|
42584
42587
|
/**
|
|
42585
42588
|
* The crawlers answered with each page's whole head in the first HTML rather
|
|
42586
42589
|
* than streamed it: Next.js's own list, the main Googlebot and the AI
|
|
@@ -42590,6 +42593,14 @@ const HTML_LIMITED_BOTS_LINE = ` // Search engines and AI crawlers read each pa
|
|
|
42590
42593
|
// HTML, rather than metadata streamed in after it.
|
|
42591
42594
|
htmlLimitedBots: nextlyHtmlLimitedBots,`;
|
|
42592
42595
|
/**
|
|
42596
|
+
* The files Nextly loads at request time that a route's build trace leaves
|
|
42597
|
+
* out (`nextlyTracingIncludes`): without them, a host that deploys each route
|
|
42598
|
+
* with only its traced files (Vercel) fails the first request needing one.
|
|
42599
|
+
*/
|
|
42600
|
+
const TRACING_INCLUDES_LINE = ` // Files Nextly loads at request time that the build's trace leaves out,
|
|
42601
|
+
// which a host deploying only traced files (Vercel) needs.
|
|
42602
|
+
outputFileTracingIncludes: { "/**": nextlyTracingIncludes() },`;
|
|
42603
|
+
/**
|
|
42593
42604
|
* Render a complete next.config.ts file for the selected database.
|
|
42594
42605
|
*/
|
|
42595
42606
|
function buildNextConfigTemplate(database) {
|
|
@@ -42600,6 +42611,7 @@ const nextConfig: NextConfig = {
|
|
|
42600
42611
|
${CACHE_COMPONENTS_ON}
|
|
42601
42612
|
serverExternalPackages: ${packageListLiteral(database)},
|
|
42602
42613
|
${HTML_LIMITED_BOTS_LINE}
|
|
42614
|
+
${TRACING_INCLUDES_LINE}
|
|
42603
42615
|
};
|
|
42604
42616
|
|
|
42605
42617
|
export default nextConfig;
|
|
@@ -42617,6 +42629,7 @@ const nextConfig = {
|
|
|
42617
42629
|
${CACHE_COMPONENTS_ON}
|
|
42618
42630
|
serverExternalPackages: ${packageListLiteral(database)},
|
|
42619
42631
|
${HTML_LIMITED_BOTS_LINE}
|
|
42632
|
+
${TRACING_INCLUDES_LINE}
|
|
42620
42633
|
};
|
|
42621
42634
|
|
|
42622
42635
|
export default nextConfig;
|
|
@@ -47067,7 +47080,7 @@ async function copyTemplate(options) {
|
|
|
47067
47080
|
if (await import_lib$1.default.pathExists(sharedSrc)) await import_lib$1.default.copy(sharedSrc, path.default.join(targetDir, "shared.ts"), { overwrite: true });
|
|
47068
47081
|
}
|
|
47069
47082
|
const templateMigrationsDir = path.default.join(typeDir, "migrations");
|
|
47070
|
-
if (await import_lib$1.default.pathExists(templateMigrationsDir)) await import_lib$1.default.copy(templateMigrationsDir, path.default.join(targetDir, "migrations"), { overwrite: false });
|
|
47083
|
+
if (approach !== "code-first" && await import_lib$1.default.pathExists(templateMigrationsDir)) await import_lib$1.default.copy(templateMigrationsDir, path.default.join(targetDir, "migrations"), { overwrite: false });
|
|
47071
47084
|
const templateScriptsDir = path.default.join(typeDir, "scripts");
|
|
47072
47085
|
if (await import_lib$1.default.pathExists(templateScriptsDir)) await import_lib$1.default.copy(templateScriptsDir, path.default.join(targetDir, "scripts"), {
|
|
47073
47086
|
overwrite: false,
|
|
@@ -48765,6 +48778,73 @@ async function installWithYalc(cwd, pm, allPackages, pluginPackages) {
|
|
|
48765
48778
|
for (const pkg of yalcPackages) await execa("yalc", ["add", pkg], { cwd });
|
|
48766
48779
|
await execa(pm, ["install"], { cwd });
|
|
48767
48780
|
}
|
|
48781
|
+
// src/installers/initial-migration.ts
|
|
48782
|
+
/**
|
|
48783
|
+
* A code-first project's first migration, written from its own config by the
|
|
48784
|
+
* `nextly migrate:create` the install brought.
|
|
48785
|
+
*
|
|
48786
|
+
* The build a template gives runs `nextly migrate`, which applies the files in
|
|
48787
|
+
* the folder the config reads and creates nothing else. A code-first blog's
|
|
48788
|
+
* schema is its config, the plugins it registers included, so its first
|
|
48789
|
+
* migration is generated from that config for the database the project was
|
|
48790
|
+
* scaffolded for, rather than copied from SQL written by hand for the visual
|
|
48791
|
+
* blog. The command needs the installed `nextly` and the project's `.env`, so
|
|
48792
|
+
* it runs after both.
|
|
48793
|
+
*
|
|
48794
|
+
* @module installers/initial-migration
|
|
48795
|
+
*/
|
|
48796
|
+
/** The arguments to `nextly` that write the first migration. */
|
|
48797
|
+
const MIGRATE_CREATE_ARGS = ["migrate:create", "initial"];
|
|
48798
|
+
/**
|
|
48799
|
+
* Whether a new project gets its first migration written from its config: a
|
|
48800
|
+
* fresh project whose template has a code-first approach. A visual project
|
|
48801
|
+
* runs the template's own migration, and a template without approaches
|
|
48802
|
+
* (blank, plugin) declares nothing to migrate.
|
|
48803
|
+
*/
|
|
48804
|
+
function writesInitialMigration(project) {
|
|
48805
|
+
return project.isFreshProject && project.projectType !== "plugin" && project.approach === "code-first";
|
|
48806
|
+
}
|
|
48807
|
+
/** The command, as the person runs it in the project with `packageManager`. */
|
|
48808
|
+
function initialMigrationCommand(packageManager) {
|
|
48809
|
+
return [
|
|
48810
|
+
binaryRunner(packageManager),
|
|
48811
|
+
"nextly",
|
|
48812
|
+
...MIGRATE_CREATE_ARGS
|
|
48813
|
+
].join(" ");
|
|
48814
|
+
}
|
|
48815
|
+
/**
|
|
48816
|
+
* Runs `nextly migrate:create initial` in `projectDir`. Resolves undefined
|
|
48817
|
+
* once it has written the migration, or with what went wrong, so the caller
|
|
48818
|
+
* can name the command to run by hand rather than stop a scaffold that is
|
|
48819
|
+
* otherwise whole.
|
|
48820
|
+
*
|
|
48821
|
+
* The shell's `DATABASE_URL`, `DB_DIALECT` and `NODE_ENV` are left out, so the
|
|
48822
|
+
* migration is written for the database the project's `.env` names, not one a
|
|
48823
|
+
* variable in the person's shell happens to name. Nothing is read from stdin:
|
|
48824
|
+
* a first migration has no rename to ask about.
|
|
48825
|
+
*/
|
|
48826
|
+
async function writeInitialMigration(projectDir, packageManager) {
|
|
48827
|
+
const [file, ...runnerArgs] = binaryRunner(packageManager).split(" ");
|
|
48828
|
+
try {
|
|
48829
|
+
await execa(file, [
|
|
48830
|
+
...runnerArgs,
|
|
48831
|
+
"nextly",
|
|
48832
|
+
...MIGRATE_CREATE_ARGS
|
|
48833
|
+
], {
|
|
48834
|
+
cwd: projectDir,
|
|
48835
|
+
env: {
|
|
48836
|
+
DATABASE_URL: void 0,
|
|
48837
|
+
DB_DIALECT: void 0,
|
|
48838
|
+
NODE_ENV: void 0
|
|
48839
|
+
},
|
|
48840
|
+
stdin: "ignore"
|
|
48841
|
+
});
|
|
48842
|
+
return;
|
|
48843
|
+
} catch (error) {
|
|
48844
|
+
const said = error.stderr;
|
|
48845
|
+
return typeof said === "string" && said.trim().length > 0 ? said.trim() : error.message;
|
|
48846
|
+
}
|
|
48847
|
+
}
|
|
48768
48848
|
// ../../node_modules/.pnpm/tar@7.5.22/node_modules/tar/dist/esm/index.min.js
|
|
48769
48849
|
var zr = Object.defineProperty;
|
|
48770
48850
|
var Ur = (s, t) => {
|
|
@@ -53064,6 +53144,21 @@ async function createNextly(options = {}) {
|
|
|
53064
53144
|
stopAtConfig(error, overallStartedAt);
|
|
53065
53145
|
}
|
|
53066
53146
|
}
|
|
53147
|
+
const initialMigration = writesInitialMigration({
|
|
53148
|
+
isFreshProject,
|
|
53149
|
+
projectType,
|
|
53150
|
+
approach
|
|
53151
|
+
});
|
|
53152
|
+
if (initialMigration && !skipInstall) {
|
|
53153
|
+
const s = be$1();
|
|
53154
|
+
s.start("Writing the first migration from your config...");
|
|
53155
|
+
const failed = await writeInitialMigration(cwd, projectInfo.packageManager);
|
|
53156
|
+
if (failed === void 0) s.stop("First migration written");
|
|
53157
|
+
else {
|
|
53158
|
+
s.stop("The first migration was not written");
|
|
53159
|
+
R$1.warn(`${failed}\nRun ${initialMigrationCommand(projectInfo.packageManager)} in the project before its first build.`);
|
|
53160
|
+
}
|
|
53161
|
+
}
|
|
53067
53162
|
const pm = projectInfo.packageManager;
|
|
53068
53163
|
const devCommand = `${scriptRunner(pm)} dev`;
|
|
53069
53164
|
const lines = [];
|
|
@@ -53080,6 +53175,10 @@ async function createNextly(options = {}) {
|
|
|
53080
53175
|
lines.push("");
|
|
53081
53176
|
lines.push(` Use it in an app: add ${import_picocolors.default.dim("myPlugin()")} to ${import_picocolors.default.dim("plugins")} in nextly.config.ts.`);
|
|
53082
53177
|
} else {
|
|
53178
|
+
if (initialMigration && skipInstall) {
|
|
53179
|
+
lines.push(` ${import_picocolors.default.bold(initialMigrationCommand(pm))}`);
|
|
53180
|
+
lines.push(` ${import_picocolors.default.dim("→ after installing: writes the first migration your build applies")}`);
|
|
53181
|
+
}
|
|
53083
53182
|
lines.push(` ${import_picocolors.default.bold(devCommand)}`);
|
|
53084
53183
|
lines.push("");
|
|
53085
53184
|
if (databaseType === "sqlite") lines.push(` Your database (SQLite) is stored at ${import_picocolors.default.dim("./data/nextly.db")}`);
|
|
@@ -53167,4 +53266,4 @@ Object.defineProperty(exports, "validateTemplateName", {
|
|
|
53167
53266
|
}
|
|
53168
53267
|
});
|
|
53169
53268
|
|
|
53170
|
-
//# sourceMappingURL=create-nextly-
|
|
53269
|
+
//# sourceMappingURL=create-nextly-CXsN4jfA.cjs.map
|