Unverified Commit 379ad1b3 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Rename package build scripts to dev (#21743)

The top-level script has always been `dev` so this makes the package scripts consistent
parent a6c1f9cf
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
], ],
"scripts": { "scripts": {
"lerna": "lerna", "lerna": "lerna",
"dev": "lerna run build --stream --parallel", "dev": "lerna run dev --stream --parallel",
"dev2": "while true; do yarn --check-files && yarn dev; done", "dev2": "while true; do yarn --check-files && yarn dev; done",
"testonly": "jest --runInBand", "testonly": "jest --runInBand",
"testheadless": "cross-env HEADLESS=true yarn testonly", "testheadless": "cross-env HEADLESS=true yarn testonly",
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"dist" "dist"
], ],
"scripts": { "scripts": {
"build": "ncc build ./index.ts -w -o dist/", "dev": "ncc build ./index.ts -w -o dist/",
"prerelease": "rimraf ./dist/", "prerelease": "rimraf ./dist/",
"release": "ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register", "release": "ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register",
"prepublish": "yarn release" "prepublish": "yarn release"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
], ],
"scripts": { "scripts": {
"prepublish": "yarn tsc -d -p tsconfig.json", "prepublish": "yarn tsc -d -p tsconfig.json",
"build": "yarn tsc -d -w -p tsconfig.json", "dev": "yarn tsc -d -w -p tsconfig.json",
"test": "jest" "test": "jest"
}, },
"bin": "./bin/next-codemod.js" "bin": "./bin/next-codemod.js"
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"types" "types"
], ],
"scripts": { "scripts": {
"build": "ncc build ./index.ts -w -o dist/", "dev": "ncc build ./index.ts -w -o dist/",
"prerelease": "rimraf ./dist/", "prerelease": "rimraf ./dist/",
"types": "tsc index.ts --declaration --emitDeclarationOnly --declarationDir types --esModuleInterop", "types": "tsc index.ts --declaration --emitDeclarationOnly --declarationDir types --esModuleInterop",
"release": "ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register", "release": "ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register",
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
"next": "./dist/bin/next" "next": "./dist/bin/next"
}, },
"scripts": { "scripts": {
"build": "taskr", "dev": "taskr",
"release": "taskr release", "release": "taskr release",
"prepublish": "npm run release && yarn types", "prepublish": "npm run release && yarn types",
"types": "tsc --declaration --emitDeclarationOnly --declarationDir dist", "types": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
......
...@@ -82,7 +82,7 @@ module.exports = function (task) { ...@@ -82,7 +82,7 @@ module.exports = function (task) {
task.plugin('babel', {}, function* ( task.plugin('babel', {}, function* (
file, file,
serverOrClient, serverOrClient,
{ stripExtension } = {} { stripExtension, dev } = {}
) { ) {
// Don't compile .d.ts // Don't compile .d.ts
if (file.base.endsWith('.d.ts')) return if (file.base.endsWith('.d.ts')) return
...@@ -111,7 +111,7 @@ module.exports = function (task) { ...@@ -111,7 +111,7 @@ module.exports = function (task) {
] ]
: false, : false,
].filter(Boolean), ].filter(Boolean),
compact: true, compact: !dev,
babelrc: false, babelrc: false,
configFile: false, configFile: false,
cwd: __dirname, cwd: __dirname,
......
...@@ -28,8 +28,8 @@ export async function next__polyfill_nomodule(task, opts) { ...@@ -28,8 +28,8 @@ export async function next__polyfill_nomodule(task, opts) {
.target('dist/build/polyfills') .target('dist/build/polyfills')
} }
export async function browser_polyfills(task) { export async function browser_polyfills(task, opts) {
await task.parallel(['next__polyfill_nomodule']) await task.parallel(['next__polyfill_nomodule'], opts)
} }
const externals = { const externals = {
...@@ -659,8 +659,11 @@ export async function path_to_regexp(task, opts) { ...@@ -659,8 +659,11 @@ export async function path_to_regexp(task, opts) {
.target('dist/compiled/path-to-regexp') .target('dist/compiled/path-to-regexp')
} }
export async function precompile(task) { export async function precompile(task, opts) {
await task.parallel(['browser_polyfills', 'path_to_regexp', 'copy_ncced']) await task.parallel(
['browser_polyfills', 'path_to_regexp', 'copy_ncced'],
opts
)
} }
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
...@@ -670,93 +673,99 @@ export async function copy_ncced(task) { ...@@ -670,93 +673,99 @@ export async function copy_ncced(task) {
await task.source('compiled/**/*').target('dist/compiled') await task.source('compiled/**/*').target('dist/compiled')
} }
export async function ncc(task) { export async function ncc(task, opts) {
await task await task
.clear('compiled') .clear('compiled')
.parallel([ .parallel(
'ncc_amphtml_validator', [
'ncc_arg', 'ncc_amphtml_validator',
'ncc_async_retry', 'ncc_arg',
'ncc_async_sema', 'ncc_async_retry',
'ncc_babel_bundle', 'ncc_async_sema',
'ncc_babel_bundle_packages', 'ncc_babel_bundle',
'ncc_bfj', 'ncc_babel_bundle_packages',
'ncc_cacache', 'ncc_bfj',
'ncc_cache_loader', 'ncc_cacache',
'ncc_ci_info', 'ncc_cache_loader',
'ncc_comment_json', 'ncc_ci_info',
'ncc_compression', 'ncc_comment_json',
'ncc_conf', 'ncc_compression',
'ncc_content_type', 'ncc_conf',
'ncc_cookie', 'ncc_content_type',
'ncc_css_loader', 'ncc_cookie',
'ncc_debug', 'ncc_css_loader',
'ncc_devalue', 'ncc_debug',
'ncc_escape_string_regexp', 'ncc_devalue',
'ncc_file_loader', 'ncc_escape_string_regexp',
'ncc_find_cache_dir', 'ncc_file_loader',
'ncc_find_up', 'ncc_find_cache_dir',
'ncc_fresh', 'ncc_find_up',
'ncc_gzip_size', 'ncc_fresh',
'ncc_http_proxy', 'ncc_gzip_size',
'ncc_ignore_loader', 'ncc_http_proxy',
'ncc_is_animated', 'ncc_ignore_loader',
'ncc_is_docker', 'ncc_is_animated',
'ncc_is_wsl', 'ncc_is_docker',
'ncc_json5', 'ncc_is_wsl',
'ncc_jsonwebtoken', 'ncc_json5',
'ncc_loader_utils', 'ncc_jsonwebtoken',
'ncc_lodash_curry', 'ncc_loader_utils',
'ncc_lru_cache', 'ncc_lodash_curry',
'ncc_nanoid', 'ncc_lru_cache',
'ncc_neo_async', 'ncc_nanoid',
'ncc_ora', 'ncc_neo_async',
'ncc_postcss_flexbugs_fixes', 'ncc_ora',
'ncc_postcss_loader', 'ncc_postcss_flexbugs_fixes',
'ncc_postcss_preset_env', 'ncc_postcss_loader',
'ncc_postcss_scss', 'ncc_postcss_preset_env',
'ncc_recast', 'ncc_postcss_scss',
'ncc_resolve_url_loader', 'ncc_recast',
'ncc_sass_loader', 'ncc_resolve_url_loader',
'ncc_schema_utils', 'ncc_sass_loader',
'ncc_schema_utils3', 'ncc_schema_utils',
'ncc_semver', 'ncc_schema_utils3',
'ncc_send', 'ncc_semver',
'ncc_source_map', 'ncc_send',
'ncc_string_hash', 'ncc_source_map',
'ncc_strip_ansi', 'ncc_string_hash',
'ncc_terser', 'ncc_strip_ansi',
'ncc_text_table', 'ncc_terser',
'ncc_thread_loader', 'ncc_text_table',
'ncc_unistore', 'ncc_thread_loader',
'ncc_web_vitals', 'ncc_unistore',
'ncc_webpack_bundle4', 'ncc_web_vitals',
'ncc_webpack_bundle5', 'ncc_webpack_bundle4',
'ncc_webpack_bundle_packages', 'ncc_webpack_bundle5',
'ncc_webpack_sources', 'ncc_webpack_bundle_packages',
'ncc_webpack_sources2', 'ncc_webpack_sources',
]) 'ncc_webpack_sources2',
} ],
opts
export async function compile(task) { )
await task.parallel([ }
'cli',
'bin', export async function compile(task, opts) {
'server', await task.parallel(
'nextbuild', [
'nextbuildstatic', 'cli',
'pages', 'bin',
'lib', 'server',
'client', 'nextbuild',
'telemetry', 'nextbuildstatic',
'nextserver', 'pages',
]) 'lib',
'client',
'telemetry',
'nextserver',
],
opts
)
} }
export async function bin(task, opts) { export async function bin(task, opts) {
await task await task
.source(opts.src || 'bin/*') .source(opts.src || 'bin/*')
.babel('server', { stripExtension: true }) .babel('server', { stripExtension: true, dev: opts.dev })
.target('dist/bin', { mode: '0755' }) .target('dist/bin', { mode: '0755' })
notify('Compiled binaries') notify('Compiled binaries')
} }
...@@ -764,7 +773,7 @@ export async function bin(task, opts) { ...@@ -764,7 +773,7 @@ export async function bin(task, opts) {
export async function cli(task, opts) { export async function cli(task, opts) {
await task await task
.source(opts.src || 'cli/**/*.+(js|ts|tsx)') .source(opts.src || 'cli/**/*.+(js|ts|tsx)')
.babel('server') .babel('server', { dev: opts.dev })
.target('dist/cli') .target('dist/cli')
notify('Compiled cli files') notify('Compiled cli files')
} }
...@@ -772,7 +781,7 @@ export async function cli(task, opts) { ...@@ -772,7 +781,7 @@ export async function cli(task, opts) {
export async function lib(task, opts) { export async function lib(task, opts) {
await task await task
.source(opts.src || 'lib/**/*.+(js|ts|tsx)') .source(opts.src || 'lib/**/*.+(js|ts|tsx)')
.babel('server') .babel('server', { dev: opts.dev })
.target('dist/lib') .target('dist/lib')
notify('Compiled lib files') notify('Compiled lib files')
} }
...@@ -780,7 +789,7 @@ export async function lib(task, opts) { ...@@ -780,7 +789,7 @@ export async function lib(task, opts) {
export async function server(task, opts) { export async function server(task, opts) {
await task await task
.source(opts.src || 'server/**/*.+(js|ts|tsx)') .source(opts.src || 'server/**/*.+(js|ts|tsx)')
.babel('server') .babel('server', { dev: opts.dev })
.target('dist/server') .target('dist/server')
notify('Compiled server files') notify('Compiled server files')
} }
...@@ -788,7 +797,7 @@ export async function server(task, opts) { ...@@ -788,7 +797,7 @@ export async function server(task, opts) {
export async function nextbuild(task, opts) { export async function nextbuild(task, opts) {
await task await task
.source(opts.src || 'build/**/*.+(js|ts|tsx)') .source(opts.src || 'build/**/*.+(js|ts|tsx)')
.babel('server') .babel('server', { dev: opts.dev })
.target('dist/build') .target('dist/build')
notify('Compiled build files') notify('Compiled build files')
} }
...@@ -796,7 +805,7 @@ export async function nextbuild(task, opts) { ...@@ -796,7 +805,7 @@ export async function nextbuild(task, opts) {
export async function client(task, opts) { export async function client(task, opts) {
await task await task
.source(opts.src || 'client/**/*.+(js|ts|tsx)') .source(opts.src || 'client/**/*.+(js|ts|tsx)')
.babel('client') .babel('client', { dev: opts.dev })
.target('dist/client') .target('dist/client')
notify('Compiled client files') notify('Compiled client files')
} }
...@@ -805,58 +814,68 @@ export async function client(task, opts) { ...@@ -805,58 +814,68 @@ export async function client(task, opts) {
export async function nextbuildstatic(task, opts) { export async function nextbuildstatic(task, opts) {
await task await task
.source(opts.src || 'export/**/*.+(js|ts|tsx)') .source(opts.src || 'export/**/*.+(js|ts|tsx)')
.babel('server') .babel('server', { dev: opts.dev })
.target('dist/export') .target('dist/export')
notify('Compiled export files') notify('Compiled export files')
} }
export async function pages_app(task) { export async function pages_app(task, opts) {
await task.source('pages/_app.tsx').babel('client').target('dist/pages') await task
.source('pages/_app.tsx')
.babel('client', { dev: opts.dev })
.target('dist/pages')
} }
export async function pages_error(task) { export async function pages_error(task, opts) {
await task.source('pages/_error.tsx').babel('client').target('dist/pages') await task
.source('pages/_error.tsx')
.babel('client', { dev: opts.dev })
.target('dist/pages')
} }
export async function pages_document(task) { export async function pages_document(task, opts) {
await task.source('pages/_document.tsx').babel('server').target('dist/pages') await task
.source('pages/_document.tsx')
.babel('server', { dev: opts.dev })
.target('dist/pages')
} }
export async function pages(task, _opts) { export async function pages(task, opts) {
await task.parallel(['pages_app', 'pages_error', 'pages_document']) await task.parallel(['pages_app', 'pages_error', 'pages_document'], opts)
} }
export async function telemetry(task, opts) { export async function telemetry(task, opts) {
await task await task
.source(opts.src || 'telemetry/**/*.+(js|ts|tsx)') .source(opts.src || 'telemetry/**/*.+(js|ts|tsx)')
.babel('server') .babel('server', { dev: opts.dev })
.target('dist/telemetry') .target('dist/telemetry')
notify('Compiled telemetry files') notify('Compiled telemetry files')
} }
export async function build(task) { export async function build(task, opts) {
await task.serial(['precompile', 'compile']) await task.serial(['precompile', 'compile'], opts)
} }
export default async function (task) { export default async function (task) {
const opts = { dev: true }
await task.clear('dist') await task.clear('dist')
await task.start('build') await task.start('build', opts)
await task.watch('bin/*', 'bin') await task.watch('bin/*', 'bin', opts)
await task.watch('pages/**/*.+(js|ts|tsx)', 'pages') await task.watch('pages/**/*.+(js|ts|tsx)', 'pages', opts)
await task.watch('server/**/*.+(js|ts|tsx)', 'server') await task.watch('server/**/*.+(js|ts|tsx)', 'server', opts)
await task.watch('build/**/*.+(js|ts|tsx)', 'nextbuild') await task.watch('build/**/*.+(js|ts|tsx)', 'nextbuild', opts)
await task.watch('export/**/*.+(js|ts|tsx)', 'nextbuildstatic') await task.watch('export/**/*.+(js|ts|tsx)', 'nextbuildstatic', opts)
await task.watch('client/**/*.+(js|ts|tsx)', 'client') await task.watch('client/**/*.+(js|ts|tsx)', 'client', opts)
await task.watch('lib/**/*.+(js|ts|tsx)', 'lib') await task.watch('lib/**/*.+(js|ts|tsx)', 'lib', opts)
await task.watch('cli/**/*.+(js|ts|tsx)', 'cli') await task.watch('cli/**/*.+(js|ts|tsx)', 'cli', opts)
await task.watch('telemetry/**/*.+(js|ts|tsx)', 'telemetry') await task.watch('telemetry/**/*.+(js|ts|tsx)', 'telemetry', opts)
await task.watch('next-server/**/*.+(js|ts|tsx)', 'nextserver') await task.watch('next-server/**/*.+(js|ts|tsx)', 'nextserver', opts)
} }
export async function nextserver(task, opts) { export async function nextserver(task, opts) {
await task await task
.source(opts.src || 'next-server/**/*.+(js|ts|tsx)') .source(opts.src || 'next-server/**/*.+(js|ts|tsx)')
.babel('server') .babel('server', { dev: opts.dev })
.target('dist/next-server') .target('dist/next-server')
notify('Compiled server files') notify('Compiled server files')
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"prepublish": "tsc -d -p tsconfig.json", "prepublish": "tsc -d -p tsconfig.json",
"build": "tsc -d -w -p tsconfig.json" "dev": "tsc -d -w -p tsconfig.json"
}, },
"dependencies": { "dependencies": {
"@babel/code-frame": "7.12.11", "@babel/code-frame": "7.12.11",
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"prepublish": "tsc -d -p tsconfig.json", "prepublish": "tsc -d -p tsconfig.json",
"build": "tsc -d -w -p tsconfig.json" "dev": "tsc -d -w -p tsconfig.json"
}, },
"peerDependencies": { "peerDependencies": {
"react-refresh": "0.8.3", "react-refresh": "0.8.3",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment