Skip to content
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

Update to leverage turbo for build/prepublish #37280

Merged
merged 5 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Build, test, and deploy

env:
NAPI_CLI_VERSION: 2.7.0
TURBO_VERSION: 1.2.9
TURBO_VERSION: 1.2.14
RUST_TOOLCHAIN: nightly-2022-02-23
PNPM_VERSION: 7.1.6

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Generate Pull Request Stats

env:
NAPI_CLI_VERSION: 2.7.0
TURBO_VERSION: 1.2.9
TURBO_VERSION: 1.2.14
RUST_TOOLCHAIN: nightly-2022-02-23
PNPM_VERSION: 7.1.6

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"new-error": "plop error",
"new-test": "plop test",
"clean": "pnpm lerna clean -y && pnpm lerna bootstrap && pnpm lerna exec 'rm -rf ./dist'",
"build": "pnpm prepublishOnly",
"build": "turbo run build",
"lerna": "lerna",
"dev": "lerna run dev --stream --parallel",
"test-types": "pnpm tsc",
Expand All @@ -31,8 +31,8 @@
"prettier-check": "prettier --check .",
"prettier-fix": "prettier --write .",
"types": "lerna run types --stream",
"typescript": "lerna run typescript",
"prepublishOnly": "lerna run prepublishOnly",
"typescript": "turbo run typescript",
"prepublishOnly": "turbo run build",
"publish-canary": "git checkout canary && git pull && lerna version prerelease --preid canary --force-publish && release --pre --skip-questions",
"publish-stable": "lerna version --force-publish",
"lint-staged": "lint-staged",
Expand All @@ -49,8 +49,8 @@
"devDependencies": {
"@babel/core": "7.15.0",
"@babel/eslint-parser": "7.15.0",
"@babel/parser": "7.12.11",
"@babel/generator": "7.15.0",
"@babel/parser": "7.12.11",
"@babel/plugin-proposal-object-rest-spread": "7.14.7",
"@babel/preset-flow": "7.14.5",
"@babel/preset-react": "7.14.5",
Expand Down Expand Up @@ -188,7 +188,7 @@
"taskr": "1.1.0",
"tree-kill": "1.2.2",
"tsec": "0.2.1",
"turbo": "1.2.9",
"turbo": "1.2.14",
"typescript": "4.6.3",
"wait-port": "0.2.2",
"web-streams-polyfill": "2.1.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"dev": "ncc build ./index.ts -w -o dist/",
"prerelease": "rimraf ./dist/",
"release": "ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register",
"prepublishOnly": "pnpm release"
"prepublishOnly": "cd ../../ && turbo run build",
"build": "pnpm release"
},
"devDependencies": {
"@types/async-retry": "1.4.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"lib/cra-to-next/gitignore"
],
"scripts": {
"prepublishOnly": "pnpm tsc -d -p tsconfig.json",
"build": "pnpm tsc -d -p tsconfig.json",
"prepublishOnly": "cd ../../ && turbo run build",
"dev": "pnpm tsc -d -w -p tsconfig.json",
"test": "jest"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"prerelease": "rimraf ./dist/",
"types": "tsc index.ts --declaration --emitDeclarationOnly --declarationDir types --esModuleInterop",
"release": "ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register",
"prepublishOnly": "pnpm release && pnpm types"
"build": "pnpm release && pnpm types",
"prepublishOnly": "cd ../../ && turbo run build"
},
"devDependencies": {
"@vercel/ncc": "0.33.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"directory": "packages/next-polyfill-module"
},
"scripts": {
"prepublishOnly": "microbundle -i src/index.js -o dist/polyfill-module.js -f iife --no-sourcemap --external none --no-pkg-main",
"build": "microbundle watch -i src/index.js -o dist/polyfill-module.js -f iife --no-sourcemap --external none --no-pkg-main"
"build": "microbundle -i src/index.js -o dist/polyfill-module.js -f iife --no-sourcemap --external none --no-pkg-main",
"prepublishOnly": "cd ../../ && turbo run build"
},
"devDependencies": {
"microbundle": "0.13.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"directory": "packages/next-polyfill-nomodule"
},
"scripts": {
"prepublishOnly": "microbundle -i src/index.js -o dist/polyfill-nomodule.js -f iife --no-sourcemap --external none --no-pkg-main",
"build": "microbundle watch -i src/index.js -o dist/polyfill-nomodule.js -f iife --no-sourcemap --external none --no-pkg-main"
"build": "microbundle -i src/index.js -o dist/polyfill-nomodule.js -f iife --no-sourcemap --external none --no-pkg-main",
"prepublishOnly": "cd ../../ && turbo run build"
},
"devDependencies": {
"core-js": "3.6.5",
Expand Down
8 changes: 4 additions & 4 deletions packages/next/build/webpack-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ReactRefreshWebpackPlugin from 'next/dist/compiled/@next/react-refresh-utils/ReactRefreshWebpackPlugin'
import ReactRefreshWebpackPlugin from 'next/dist/compiled/@next/react-refresh-utils/dist/ReactRefreshWebpackPlugin'
import chalk from 'next/dist/compiled/chalk'
import crypto from 'crypto'
import { webpack } from 'next/dist/compiled/webpack/webpack'
Expand Down Expand Up @@ -155,7 +155,7 @@ export function attachReactRefresh(
) {
let injections = 0
const reactRefreshLoaderName =
'next/dist/compiled/@next/react-refresh-utils/loader'
'next/dist/compiled/@next/react-refresh-utils/dist/loader'
const reactRefreshLoader = require.resolve(reactRefreshLoaderName)
webpackConfig.module?.rules.forEach((rule) => {
const curr = rule.use
Expand Down Expand Up @@ -548,7 +548,7 @@ export default async function getBaseWebpackConfig(
...(dev
? {
[CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH]: require.resolve(
`next/dist/compiled/@next/react-refresh-utils/runtime`
`next/dist/compiled/@next/react-refresh-utils/dist/runtime`
),
[CLIENT_STATIC_FILES_RUNTIME_AMP]:
`./` +
Expand Down Expand Up @@ -1319,7 +1319,7 @@ export default async function getBaseWebpackConfig(
dev && isClient
? [
require.resolve(
'next/dist/compiled/@next/react-refresh-utils/loader'
'next/dist/compiled/@next/react-refresh-utils/dist/loader'
),
defaultLoaders.babel,
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Chalk from 'next/dist/compiled/chalk'
import { SimpleWebpackError } from './simpleWebpackError'
import { createOriginalStackFrame } from 'next/dist/compiled/@next/react-dev-overlay/middleware'
import { createOriginalStackFrame } from 'next/dist/compiled/@next/react-dev-overlay/dist/middleware'
import type { webpack5 } from 'next/dist/compiled/webpack/webpack'
import {
getNodeBuiltinModuleNotSupportedInEdgeRuntimeMessage,
Expand Down
2 changes: 1 addition & 1 deletion packages/next/client/dev/error-overlay/hot-dev-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
onBuildOk,
onRefresh,
onFullRefreshNeeded,
} from 'next/dist/compiled/@next/react-dev-overlay/client'
} from 'next/dist/compiled/@next/react-dev-overlay/dist/client'
import stripAnsi from 'next/dist/compiled/strip-ansi'
import { addMessageListener, sendMessage } from './websocket'
import formatWebpackMessages from './format-webpack-messages'
Expand Down
4 changes: 2 additions & 2 deletions packages/next/client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class Container extends React.Component<{
} else {
const {
ReactDevOverlay,
} = require('next/dist/compiled/@next/react-dev-overlay/client')
} = require('next/dist/compiled/@next/react-dev-overlay/dist/client')
return <ReactDevOverlay>{this.props.children}</ReactDevOverlay>
}
}
Expand Down Expand Up @@ -351,7 +351,7 @@ export async function hydrate(opts?: { beforeRender?: () => Promise<void> }) {
if (process.env.NODE_ENV === 'development') {
const {
getNodeError,
} = require('next/dist/compiled/@next/react-dev-overlay/client')
} = require('next/dist/compiled/@next/react-dev-overlay/dist/client')
// Server-side runtime errors need to be re-thrown on the client-side so
// that the overlay is rendered.
if (initialErr) {
Expand Down
3 changes: 2 additions & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"scripts": {
"dev": "taskr",
"release": "taskr release",
"prepublishOnly": "pnpm release && pnpm types",
"build": "pnpm release && pnpm types",
"prepublishOnly": "cd ../../ && turbo run build",
"types": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
"typescript": "tsec --noEmit",
"ncc-compiled": "ncc cache clean && taskr ncc"
Expand Down
2 changes: 1 addition & 1 deletion packages/next/server/dev/hot-reloader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getOverlayMiddleware } from 'next/dist/compiled/@next/react-dev-overlay/middleware'
import { getOverlayMiddleware } from 'next/dist/compiled/@next/react-dev-overlay/dist/middleware'
import { IncomingMessage, ServerResponse } from 'http'
import { WebpackHotMiddleware } from './hot-middleware'
import { join, relative, isAbsolute } from 'path'
Expand Down
4 changes: 2 additions & 2 deletions packages/next/server/dev/next-dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import {
createOriginalStackFrame,
getSourceById,
parseStack,
} from 'next/dist/compiled/@next/react-dev-overlay/middleware'
} from 'next/dist/compiled/@next/react-dev-overlay/dist/middleware'
import * as Log from '../../build/output/log'
import isError, { getProperError } from '../../lib/is-error'
import {
Expand All @@ -76,7 +76,7 @@ let ReactDevOverlayImpl: React.FunctionComponent
const ReactDevOverlay = (props: any) => {
if (ReactDevOverlayImpl === undefined) {
ReactDevOverlayImpl =
require('next/dist/compiled/@next/react-dev-overlay/client').ReactDevOverlay
require('next/dist/compiled/@next/react-dev-overlay/dist/client').ReactDevOverlay
}
return ReactDevOverlayImpl(props)
}
Expand Down
20 changes: 12 additions & 8 deletions packages/next/taskfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export async function ncc_next__react_dev_overlay(task, opts) {
opts.src ||
relative(
__dirname,
require.resolve('@next/react-dev-overlay/lib/middleware')
require.resolve('@next/react-dev-overlay/dist/middleware')
)
)
.ncc({
Expand All @@ -168,14 +168,14 @@ export async function ncc_next__react_dev_overlay(task, opts) {
externals: overlayExternals,
target: 'es5',
})
.target('dist/compiled/@next/react-dev-overlay')
.target('dist/compiled/@next/react-dev-overlay/dist')

await task
.source(
opts.src ||
relative(
__dirname,
require.resolve('@next/react-dev-overlay/lib/client')
require.resolve('@next/react-dev-overlay/dist/client')
)
)
.ncc({
Expand All @@ -184,11 +184,11 @@ export async function ncc_next__react_dev_overlay(task, opts) {
externals: overlayExternals,
target: 'es5',
})
.target('dist/compiled/@next/react-dev-overlay')
.target('dist/compiled/@next/react-dev-overlay/dist')

const clientFile = join(
__dirname,
'dist/compiled/@next/react-dev-overlay/client.js'
'dist/compiled/@next/react-dev-overlay/dist/client.js'
)
const content = fs.readFileSync(clientFile, 'utf8')
// remove AMD define branch as this forces the module to not
Expand Down Expand Up @@ -280,10 +280,14 @@ export async function ncc_react_refresh_utils(task, opts) {
join(__dirname, 'dist/compiled/react-refresh')
)

const srcDir = dirname(
require.resolve('@next/react-refresh-utils/package.json')
const srcDir = join(
dirname(require.resolve('@next/react-refresh-utils/package.json')),
'dist'
)
const destDir = join(
__dirname,
'dist/compiled/@next/react-refresh-utils/dist'
)
const destDir = join(__dirname, 'dist/compiled/@next/react-refresh-utils')
await fs.remove(destDir)
await fs.ensureDir(destDir)

Expand Down
10 changes: 5 additions & 5 deletions packages/next/types/misc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ declare module 'next/dist/compiled/react-server-dom-webpack'
declare module 'next/dist/compiled/react-server-dom-webpack/writer.browser.server'
declare module 'next/dist/compiled/browserslist'

declare module 'next/dist/compiled/@next/react-dev-overlay/client' {
export * from '@next/react-dev-overlay/lib/client'
declare module 'next/dist/compiled/@next/react-dev-overlay/dist/client' {
export * from '@next/react-dev-overlay/dist/client'
}

declare module 'next/dist/compiled/@next/react-dev-overlay/middleware' {
export * from '@next/react-dev-overlay/lib/middleware'
declare module 'next/dist/compiled/@next/react-dev-overlay/dist/middleware' {
export * from '@next/react-dev-overlay/dist/middleware'
}

declare module 'next/dist/compiled/@next/react-refresh-utils/ReactRefreshWebpackPlugin' {
declare module 'next/dist/compiled/@next/react-refresh-utils/dist/ReactRefreshWebpackPlugin' {
import m from '@next/react-refresh-utils/ReactRefreshWebpackPlugin'
export = m
}
Expand Down
5 changes: 3 additions & 2 deletions packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
"directory": "packages/react-dev-overlay"
},
"files": [
"lib/"
"dist"
],
"author": "Joe Haddad <timer@vercel.com>",
"license": "MIT",
"scripts": {
"prepublishOnly": "tsc -d -p tsconfig.json",
"build": "rm -rf dist && tsc -d -p tsconfig.json",
"prepublishOnly": "cd ../../ && turbo run build",
"dev": "tsc -d -w -p tsconfig.json",
"typescript": "tsec --noEmit -p tsconfig.json"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lib": ["dom"],
"downlevelIteration": true,
"preserveWatchOutput": true,
"outDir": "lib",
"outDir": "dist",
"jsx": "react",
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true
Expand Down
6 changes: 3 additions & 3 deletions packages/react-refresh-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Its API is not stable as that of Next.js, nor does it follow semver rules.

All entrypoints below must wired into your build tooling for this to work.

### `@next/react-refresh-utils/loader`
### `@next/react-refresh-utils/dist/loader`

### `@next/react-refresh-utils/ReactRefreshWebpackPlugin`
### `@next/react-refresh-utils/dist/ReactRefreshWebpackPlugin`

### `@next/react-refresh-utils/runtime`
### `@next/react-refresh-utils/dist/runtime`
8 changes: 3 additions & 5 deletions packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
"directory": "packages/react-refresh-utils"
},
"files": [
"internal/*.d.ts",
"internal/*.js",
"*.d.ts",
"*.js"
"dist"
],
"author": "Joe Haddad <timer@vercel.com>",
"license": "MIT",
"scripts": {
"prepublishOnly": "tsc -d -p tsconfig.json",
"build": "rm -rf dist && tsc -d -p tsconfig.json",
"prepublishOnly": "cd ../../ && turbo run build",
"dev": "tsc -d -w -p tsconfig.json"
},
"peerDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/react-refresh-utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"lib": ["dom"],
"downlevelIteration": true,
"preserveWatchOutput": true,
"outDir": "dist",
"paths": {
"webpack": ["../../node_modules/webpack5"]
}
Expand Down
Loading