Skip to content

Commit

Permalink
always generate routes on nsm build command
Browse files Browse the repository at this point in the history
  • Loading branch information
itelo committed Sep 13, 2023
1 parent 250a68e commit f91ffc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
19 changes: 7 additions & 12 deletions lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ const build = async ({
skipBuild = false,
nextless = false,
onlyApiFiles = false,
skipNextBuild = false,
skipGenerateRoutes = false
skipNextBuild = false
}) => {
if (skipNextBuild) {
console.log("Deprecated. Use --skip-build and/or --nextless instead")
Expand Down Expand Up @@ -57,7 +56,7 @@ const build = async ({

await init({ dir, verbose })

logv({ skipBuild, onlyApiFiles, skipGenerateRoutes })
logv({ skipBuild, onlyApiFiles })

const executionOptions = nextless
? getNextlessOptions({
Expand All @@ -74,15 +73,11 @@ const build = async ({
await executionOptions.build(dir, null, false, false, false)
}

// The "generate_routes.ts" file will be generated by searching for source files instead of transpiled ones.
// super useful for tests
if (!skipGenerateRoutes) {
logv("generating routes...")
await getNextlessOptions({ dir }).generateRoutes({
onlyApiFiles,
skipBuild,
})
}
logv("generating routes...")
await executionOptions.generateRoutes({
onlyApiFiles,
skipBuild,
})

logv("copying nextjs config...")
await require(`${dir}/.nsm/scripts/copy-nextjs-config.js`).copyNextjsConfig()
Expand Down
8 changes: 1 addition & 7 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ async function main() {
default: false,
description: "Skip the build step (nextjs and nextless)",
})
.option("skip-generate-routes", {
type: "boolean",
default: false,
description: "Skip the generate routes step (nextjs and nextless)",
})
.option("nextless", {
type: "boolean",
default: false,
Expand All @@ -54,8 +49,7 @@ async function main() {
skipBuild: argv["skip-build"],
nextless: argv["nextless"],
onlyApiFiles: argv["only-api-files"],
skipNextBuild: argv["skip-next-build"],
skipGenerateRoutes: argv["skip-generate-routes"],
skipNextBuild: argv["skip-next-build"]
})
break
}
Expand Down

0 comments on commit f91ffc1

Please sign in to comment.