From fd32c3234f1e439468fe454c8b4d16299594382c Mon Sep 17 00:00:00 2001 From: Jessica Franco Date: Fri, 29 Jul 2022 19:16:09 +0900 Subject: [PATCH 1/4] Document @napi-rs/cli as required to build Rust code Otherwise build-native fails with "napi: command not found.". Alternatively, this is missing from this package's devDependencies. --- contributing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing.md b/contributing.md index b07d1eb88737..11f873fc2518 100644 --- a/contributing.md +++ b/contributing.md @@ -61,7 +61,7 @@ pnpm build pnpm prepublishOnly ``` -By default the latest canary of the next-swc binaries will be installed and used. If you are actively working on Rust code or you need to test out the most recent Rust code that hasn't been published as a canary yet you can [install Rust](https://www.rust-lang.org/tools/install) and run `pnpm --filter=@next/swc build-native`. +By default the latest canary of the next-swc binaries will be installed and used. If you are actively working on Rust code or you need to test out the most recent Rust code that hasn't been published as a canary yet you can [install Rust](https://www.rust-lang.org/tools/install), the `napi` build tool with `npm install -g @napi-rs/cli`, and run `pnpm --filter=@next/swc build-native`. If you want to test out the wasm build locally, you will need to [install wasm-pack](https://rustwasm.github.io/wasm-pack/installer/). Run `pnpm --filter=@next/swc build-wasm --target ` to build and `node ./scripts/setup-wasm.mjs` to copy it into your `node_modules`. Run next with `NODE_OPTIONS='--no-addons'` to force it to use the wasm binary. From f57d321ec7e94ba6e1289a78d0daeed117c5a665 Mon Sep 17 00:00:00 2001 From: Jessica Franco Date: Sat, 30 Jul 2022 13:39:36 +0900 Subject: [PATCH 2/4] Add @napi-rs/cli as next-swc devDependency, revert contributing.md change It already existed as a dependency but on the "next" package, so it was not in the PATH of "next-swc"'s scripts. --- contributing.md | 2 +- packages/next-swc/package.json | 3 +++ pnpm-lock.yaml | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/contributing.md b/contributing.md index 11f873fc2518..b07d1eb88737 100644 --- a/contributing.md +++ b/contributing.md @@ -61,7 +61,7 @@ pnpm build pnpm prepublishOnly ``` -By default the latest canary of the next-swc binaries will be installed and used. If you are actively working on Rust code or you need to test out the most recent Rust code that hasn't been published as a canary yet you can [install Rust](https://www.rust-lang.org/tools/install), the `napi` build tool with `npm install -g @napi-rs/cli`, and run `pnpm --filter=@next/swc build-native`. +By default the latest canary of the next-swc binaries will be installed and used. If you are actively working on Rust code or you need to test out the most recent Rust code that hasn't been published as a canary yet you can [install Rust](https://www.rust-lang.org/tools/install) and run `pnpm --filter=@next/swc build-native`. If you want to test out the wasm build locally, you will need to [install wasm-pack](https://rustwasm.github.io/wasm-pack/installer/). Run `pnpm --filter=@next/swc build-wasm --target ` to build and `node ./scripts/setup-wasm.mjs` to copy it into your `node_modules`. Run next with `NODE_OPTIONS='--no-addons'` to force it to use the wasm binary. diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 5fa63e85c9e7..f59d6300b861 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -24,5 +24,8 @@ "aarch64-pc-windows-msvc" ] } + }, + "devDependencies": { + "@napi-rs/cli": "2.4.4" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d5413128e9b4..00ab1eb764f4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -832,7 +832,10 @@ importers: whatwg-fetch: 3.0.0 packages/next-swc: - specifiers: {} + specifiers: + '@napi-rs/cli': 2.4.4 + devDependencies: + '@napi-rs/cli': 2.4.4 packages/react-dev-overlay: specifiers: @@ -10428,6 +10431,7 @@ packages: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 dependencies: eslint: 7.32.0 + dev: false /eslint-plugin-react/7.23.2_eslint@7.24.0: resolution: {integrity: sha512-AfjgFQB+nYszudkxRkTFu0UR1zEQig0ArVMPloKhxwlwkzaw/fBiH0QWcBBhZONlXqQC51+nfqFrkn4EzHcGBw==} From 7121604f778f8e5ebba234c3650c8751b0005def Mon Sep 17 00:00:00 2001 From: Jessica Franco Date: Sat, 30 Jul 2022 13:46:05 +0900 Subject: [PATCH 3/4] Ignore Rust build artifacts in prettier It doesn't like the json files that appear in there. --- .prettierignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.prettierignore b/.prettierignore index c8fb26e5e1e7..85f4d4535762 100644 --- a/.prettierignore +++ b/.prettierignore @@ -12,6 +12,8 @@ packages/react-dev-overlay/lib/** lerna.json .github/actions/next-stats-action/.work packages/next-swc/crates/**/* +packages/next-swc/target/**/* +packages/next-swc/native/**/* packages/next-codemod/transforms/__testfixtures__/**/* packages/next-codemod/transforms/__tests__/**/* packages/next-codemod/**/*.js @@ -21,4 +23,4 @@ test-timings.json test/**/out/** bench/nested-deps/pages/**/* bench/nested-deps/components/**/* -pnpm-lock.yaml \ No newline at end of file +pnpm-lock.yaml From 98e93e28a6d0bc8dbd69e5b9d91be96ebae34038 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sat, 30 Jul 2022 09:28:23 -0500 Subject: [PATCH 4/4] match version to CI version --- packages/next-swc/package.json | 2 +- packages/next/package.json | 2 +- pnpm-lock.yaml | 13 ++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index f59d6300b861..2bc63afe62e6 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -26,6 +26,6 @@ } }, "devDependencies": { - "@napi-rs/cli": "2.4.4" + "@napi-rs/cli": "2.7.0" } } diff --git a/packages/next/package.json b/packages/next/package.json index f75497659702..a974e66a11d0 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -119,7 +119,7 @@ "@babel/types": "7.18.0", "@edge-runtime/primitives": "1.1.0-beta.23", "@hapi/accept": "5.0.2", - "@napi-rs/cli": "2.4.4", + "@napi-rs/cli": "2.7.0", "@napi-rs/triples": "1.1.0", "@next/polyfill-module": "12.2.4-canary.8", "@next/polyfill-nomodule": "12.2.4-canary.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 00ab1eb764f4..0bfddc53a0f8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -416,7 +416,7 @@ importers: '@babel/types': 7.18.0 '@edge-runtime/primitives': 1.1.0-beta.23 '@hapi/accept': 5.0.2 - '@napi-rs/cli': 2.4.4 + '@napi-rs/cli': 2.7.0 '@napi-rs/triples': 1.1.0 '@next/env': 12.2.4-canary.8 '@next/polyfill-module': 12.2.4-canary.8 @@ -609,7 +609,7 @@ importers: '@babel/types': 7.18.0 '@edge-runtime/primitives': 1.1.0-beta.23 '@hapi/accept': 5.0.2 - '@napi-rs/cli': 2.4.4 + '@napi-rs/cli': 2.7.0 '@napi-rs/triples': 1.1.0 '@next/polyfill-module': link:../next-polyfill-module '@next/polyfill-nomodule': link:../next-polyfill-nomodule @@ -833,9 +833,9 @@ importers: packages/next-swc: specifiers: - '@napi-rs/cli': 2.4.4 + '@napi-rs/cli': 2.7.0 devDependencies: - '@napi-rs/cli': 2.4.4 + '@napi-rs/cli': 2.7.0 packages/react-dev-overlay: specifiers: @@ -4647,8 +4647,8 @@ packages: glob-to-regexp: 0.3.0 dev: true - /@napi-rs/cli/2.4.4: - resolution: {integrity: sha512-f+tvwCv1ka24dBqI2DgBhR7Oxl3DKHOp4onxLXwyBFt6iCADnr3YZIr1/2Iq5r3uqxFgaf01bfPsRQZPkEp0kQ==} + /@napi-rs/cli/2.7.0: + resolution: {integrity: sha512-bQb+r9/xW8LFRbpEN7A/4fX8LnEWbI0JzyOzXGDpO+cI8dXRxX7OPySOpzT2nBgP1brA2Ydkw/t9lyxLN9TlxQ==} engines: {node: '>= 10'} hasBin: true dev: true @@ -10431,7 +10431,6 @@ packages: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 dependencies: eslint: 7.32.0 - dev: false /eslint-plugin-react/7.23.2_eslint@7.24.0: resolution: {integrity: sha512-AfjgFQB+nYszudkxRkTFu0UR1zEQig0ArVMPloKhxwlwkzaw/fBiH0QWcBBhZONlXqQC51+nfqFrkn4EzHcGBw==}