Skip to content

Misc Typescript and export updates #55841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 94 additions & 79 deletions packages/next/src/build/index.ts

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions packages/next/src/build/manifests/formatter/format-manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Formats the manifest depending on the environment variable
* `NODE_ENV`. If it's set to `development`, it will return a pretty printed
* JSON string, otherwise it will return a minified JSON string.
*/
export function formatManifest<T extends object>(manifest: T): string {
if (process.env.NODE_ENV === 'development') {
return JSON.stringify(manifest, null, 2)
}

return JSON.stringify(manifest)
}
6 changes: 4 additions & 2 deletions packages/next/src/cli/next-export.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env node
import type { ExportAppOptions } from '../export/types'

import { resolve, join } from 'path'
import { existsSync } from 'fs'
import { cyan } from '../lib/picocolors'
import exportApp, { ExportError, ExportOptions } from '../export'
import exportApp, { ExportError } from '../export'
import * as Log from '../build/output/log'
import { printAndExit } from '../server/lib/utils'
import { CliCommand } from '../lib/commands'
Expand Down Expand Up @@ -43,7 +45,7 @@ const nextExport: CliCommand = (args) => {
printAndExit(`> No such directory exists as the project root: ${dir}`)
}

const options: ExportOptions = {
const options: ExportAppOptions = {
silent: args['--silent'] || false,
threads: args['--threads'],
outdir: args['--outdir'] ? resolve(args['--outdir']) : join(dir, 'out'),
Expand Down
Loading