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 pnpm for monorepo #37259

Merged
merged 35 commits into from
May 29, 2022
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c219beb
Update to leverage pnpm for monorepo
ijjk May 28, 2022
65d85b1
update compiled
ijjk May 28, 2022
9a322fc
update stats action
ijjk May 28, 2022
cb81d92
update ci install step
ijjk May 28, 2022
4579487
update ci
ijjk May 28, 2022
1765a75
add test dep
ijjk May 28, 2022
7f5be35
update invoking scripts
ijjk May 28, 2022
ac670e9
update caching
ijjk May 28, 2022
ccbb9d7
skip cache for now
ijjk May 28, 2022
44d9c73
update dep
ijjk May 28, 2022
9415a05
update packages and fix babel
ijjk May 28, 2022
50b2240
update compiled
ijjk May 28, 2022
6c5cd4e
update lint
ijjk May 28, 2022
f5e73f8
update test
ijjk May 28, 2022
6c59acf
update ci
ijjk May 28, 2022
bc7b937
update pnpm store caching
ijjk May 28, 2022
3ef07ee
update path for windows
ijjk May 28, 2022
32f40d0
update restore-key config
ijjk May 28, 2022
20cee43
update caching
ijjk May 28, 2022
9a931c1
remove extra build azure stage
ijjk May 28, 2022
08e4d22
re-add checkout
ijjk May 28, 2022
c3b14d2
update setting pnpm store
ijjk May 28, 2022
95e9968
bump
ijjk May 28, 2022
ec48bf3
remove azure caching as pnpm is faster to download
ijjk May 28, 2022
9d8123e
update contributing
ijjk May 28, 2022
eab1ce7
apply suggestions
ijjk May 28, 2022
11cd69f
remove install-peers
ijjk May 28, 2022
41c8f8f
prepublish -> prepublishOnly
ijjk May 28, 2022
10973f9
prepublish -> prepublishOnly more
ijjk May 28, 2022
56c938c
more yarn -> pnpm references
ijjk May 28, 2022
3072628
more yarn -> pnpm references take 2
ijjk May 28, 2022
d2555f4
use workspace protocol for root package.json
ijjk May 29, 2022
6f0710a
Merge branch 'canary' into update/use-pnpm
ijjk May 29, 2022
e055947
Merge branch 'canary' into update/use-pnpm
ijjk May 29, 2022
99a7423
Merge branch 'canary' into update/use-pnpm
styfle May 29, 2022
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
3 changes: 2 additions & 1 deletion .github/actions/next-stats-action/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ LABEL repository="https://github.com/vercel/next-stats-action"
COPY . /next-stats

# Install node_modules
RUN cd /next-stats && yarn install --production
RUN npm i -g pnpm@7.1.6
RUN cd /next-stats && pnpm install --production

RUN git config --global user.email 'stats@localhost'
RUN git config --global user.name 'next stats'
Expand Down
3 changes: 2 additions & 1 deletion .github/actions/next-stats-action/src/constants.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const path = require('path')
const os = require('os')

const benchTitle = 'Page Load Tests'
const workDir = path.join(__dirname, '../.work')
const workDir = path.join(os.tmpdir(), 'next-stats')
const mainRepoName = 'main-repo'
const diffRepoName = 'diff-repo'
const mainRepoDir = path.join(workDir, mainRepoName)
Expand Down
21 changes: 11 additions & 10 deletions .github/actions/next-stats-action/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,12 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
for (const dir of repoDirs) {
logger(`Running initial build for ${dir}`)
if (!actionInfo.skipClone) {
const usePnpm = await fs.pathExists(path.join(dir, 'pnpm-lock.yaml'))
let buildCommand = `cd ${dir}${
!statsConfig.skipInitialInstall
? ' && yarn install --network-timeout 1000000'
? usePnpm
? ' && pnpm install && pnpm run build'
: ' && yarn install --network-timeout 1000000'
ijjk marked this conversation as resolved.
Show resolved Hide resolved
: ''
}`

Expand All @@ -118,15 +121,13 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
// in case of noisy environment slowing down initial repo build
await exec(buildCommand, false, { timeout: 5 * 60 * 1000 })
}
await fs.copy(
path.join(__dirname, '../native'),
path.join(dir, 'packages/next-swc/native')
)
// TODO: remove after next stable release (current v12.0.4)
await fs.copy(
path.join(__dirname, '../native'),
path.join(dir, 'packages/next/native')
)

await fs
.copy(
path.join(__dirname, '../native'),
path.join(dir, 'packages/next-swc/native')
)
.catch(console.error)

logger(`Linking packages in ${dir}`)
const pkgPaths = await linkPackages(dir)
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/next-stats-action/src/run/collect-diffs.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ module.exports = async function collectDiffs(
}

if (curFiles.length > 0) {
const prettierPath = path.join(
__dirname,
'../../node_modules/.bin/prettier'
)
await exec(
`cd "${process.env.LOCAL_STATS ? process.cwd() : diffingDir}" && ` +
`yarn prettier --write ${curFiles
`${prettierPath} --write ${curFiles
.map((f) => path.join(diffingDir, f))
.join(' ')}`
)
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/next-stats-action/src/run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ async function linkPkgs(pkgDir = '', pkgPaths) {
await fs.writeFile(pkgJsonPath, JSON.stringify(pkgData, null, 2), 'utf8')

await fs.remove(yarnEnvValues.YARN_CACHE_FOLDER)
await exec(`cd ${pkgDir} && yarn install`, false, {
await exec(`cd ${pkgDir} && pnpm install`, false, {
env: yarnEnvValues,
})
}
Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ Choose the right checklist for the change that you're making:

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
60 changes: 39 additions & 21 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
NAPI_CLI_VERSION: 2.7.0
TURBO_VERSION: 1.2.9
RUST_TOOLCHAIN: nightly-2022-02-23
PNPM_VERSION: 7.1.6

jobs:
check-examples:
Expand Down Expand Up @@ -49,7 +50,22 @@ jobs:
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off

- run: yarn install --frozen-lockfile --check-files
- run: npm i -g pnpm@${PNPM_VERSION}

- id: get-store-path
run: echo ::set-output name=STORE_PATH::$(pnpm store path)

- uses: actions/cache@v3
id: cache-pnpm-store
with:
path: ${{ steps.get-store-path.outputs.STORE_PATH }}
key: pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-
pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
- run: pnpm install
- run: pnpm run build
- run: node run-tests.js --timings --write-timings -g 1/1
- run: node ./scripts/fetch-tags.mjs ${{ github.sha }}

Expand Down Expand Up @@ -87,13 +103,15 @@ jobs:
node-version: 16
check-latest: true

- run: npm i -g pnpm@${PNPM_VERSION}

- uses: actions/cache@v3
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- run: ./scripts/check-manifests.js
- run: yarn lint
- run: pnpm lint

rust-check:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -740,7 +758,8 @@ jobs:
- run: node run-tests.js test/integration/production/test/index.test.js
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
# test rsc hydration on firefox due to limited support of TransformStream api
- run: xvfb-run yarn jest test/integration/react-streaming-and-server-components/test/index.test.js -t "should handle streaming server components correctly"
- run: npm i -g pnpm@${PNPM_VERSION}
- run: xvfb-run pnpm testheadless test/integration/react-streaming-and-server-components/test/index.test.js -t "should handle streaming server components correctly"
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

testSafari:
Expand Down Expand Up @@ -1054,7 +1073,7 @@ jobs:
# since the repo's dependencies aren't installed we need
# to install napi globally
- run: npm i -g @napi-rs/cli@${{ env.NAPI_CLI_VERSION }} turbo@${{ env.TURBO_VERSION }}
- run: npm i -g @napi-rs/cli@${{ env.NAPI_CLI_VERSION }} turbo@${{ env.TURBO_VERSION }} pnpm@${PNPM_VERSION}
- name: Build
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
run: turbo run build-native --cache-dir=".turbo" -- --release
Expand Down Expand Up @@ -1149,17 +1168,17 @@ jobs:
- host: macos-latest
target: 'x86_64-apple-darwin'
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}"
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native --cache-dir=".turbo" -- --release
strip -x packages/next-swc/native/next-swc.*.node
- host: windows-latest
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}"
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native --cache-dir=".turbo" -- --release
target: 'x86_64-pc-windows-msvc'
- host: windows-latest
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}"
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native --cache-dir=".turbo" -- --release --target i686-pc-windows-msvc
target: 'i686-pc-windows-msvc'
- host: ubuntu-latest
Expand All @@ -1170,7 +1189,7 @@ jobs:
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}" &&
turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-gnu &&
strip packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
Expand All @@ -1181,7 +1200,7 @@ jobs:
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-musl &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}" &&
turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-musl &&
strip packages/next-swc/native/next-swc.*.node
- host: macos-latest
Expand All @@ -1192,7 +1211,7 @@ jobs:
export CXX=$(xcrun -f clang++);
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}"
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-apple-darwin
strip -x packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
Expand All @@ -1203,7 +1222,7 @@ jobs:
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add aarch64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}" &&
export CC_aarch64_unknown_linux_gnu=/usr/aarch64-unknown-linux-gnu/bin/aarch64-unknown-linux-gnu-gcc &&
turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-unknown-linux-gnu &&
llvm-strip -x packages/next-swc/native/next-swc.*.node
Expand All @@ -1213,7 +1232,7 @@ jobs:
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}"
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native-no-plugin --cache-dir=".turbo" -- --release --target armv7-unknown-linux-gnueabihf
arm-linux-gnueabihf-strip packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
Expand All @@ -1223,7 +1242,7 @@ jobs:
export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}"
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-linux-android
${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
Expand All @@ -1233,15 +1252,15 @@ jobs:
export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++"
export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}"
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native-no-plugin --cache-dir=".turbo" -- --release --target armv7-linux-androideabi
${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
target: 'aarch64-unknown-linux-musl'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: >-
set -e &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}" &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add aarch64-unknown-linux-musl &&
Expand All @@ -1250,7 +1269,7 @@ jobs:
- host: windows-latest
target: 'aarch64-pc-windows-msvc'
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}"
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native-no-plugin --cache-dir=".turbo" -- --release --target aarch64-pc-windows-msvc
if: ${{ needs.build.outputs.isRelease == 'true' }}
needs: build
Expand Down Expand Up @@ -1301,7 +1320,6 @@ jobs:
with:
node-version: 16
check-latest: true
cache: yarn

- name: Install
uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -1397,8 +1415,8 @@ jobs:
whoami
env
freebsd-version
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}"
yarn --cwd packages/next-swc build-native --release --target x86_64-unknown-freebsd
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
pnpm --filter=@next/swc build-native --release --target x86_64-unknown-freebsd
rm -rf node_modules
rm -rf packages/next-swc/target
- name: Upload artifact
Expand Down Expand Up @@ -1436,7 +1454,7 @@ jobs:
override: true
target: wasm32-unknown-unknown

- run: npm i -g turbo@${{ env.TURBO_VERSION }}
- run: npm i -g turbo@${{ env.TURBO_VERSION }} pnpm@${PNPM_VERSION}

- name: Turbo cache
id: turbo-cache
Expand Down Expand Up @@ -1482,7 +1500,7 @@ jobs:
node-version: 16
check-latest: true

- run: npm i -g turbo@${{ env.TURBO_VERSION }}
- run: npm i -g turbo@${{ env.TURBO_VERSION }} pnpm@${PNPM_VERSION}

- name: Install Rust
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/pull_request_stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ on:

name: Generate Pull Request Stats

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

jobs:
build-native-dev:
name: Build dev binary for tests
Expand Down Expand Up @@ -78,7 +84,7 @@ jobs:
# since the repo's dependencies aren't installed we need
# to install napi globally
- run: npm i -g @napi-rs/cli@2.7.0
- run: npm i -g turbo@1.2.9
- run: npm i -g turbo@${TURBO_VERSION} pnpm@${PNPM_VERSION}

- name: Build
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
save-exact = true
tag-version-prefix=""
strict-peer-dependencies = false
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ test-timings.json
test/**/out/**
bench/nested-deps/pages/**/*
bench/nested-deps/components/**/*
pnpm-lock.yaml
1 change: 1 addition & 0 deletions .prettierignore_staged
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ packages/next/bundles/webpack/packages/*.runtime.js
lerna.json
packages/next-codemod/transforms/__testfixtures__/**/*
packages/next-codemod/transforms/__tests__/**/*
pnpm-lock.yaml
Loading