From 67ea821e5fe6ddf3c734ec08ccf3630de9ef73ae Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Tue, 14 May 2024 11:01:16 -0400 Subject: [PATCH] [publish] Fix `files` field for packages, invalid version range The [`files` field](https://docs.npmjs.com/cli/v10/commands/npm-publish#files-included-in-package) controls what files get included in the published package. This PR specifies the `files` field on our publishable packages to only include the `dist` directory, since we don't need to ship any types or sourcemaps with 3 of them. react-compiler-runtime is a runtime package which has sourcemaps, so we also include the `src` directory in the published package. Also fixes an invalid version range for the react peer dependency in react-compiler-runtime, tested that it works via https://semver.npmjs.com/ ghstack-source-id: 12b36c203fc9fd8d72a1995fb3fba2312de4aa51 Pull Request resolved: https://github.com/facebook/react-forget/pull/2965 --- compiler/packages/babel-plugin-react-compiler/package.json | 2 +- compiler/packages/eslint-plugin-react-compiler/package.json | 3 +++ compiler/packages/react-compiler-runtime/package.json | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/packages/babel-plugin-react-compiler/package.json b/compiler/packages/babel-plugin-react-compiler/package.json index c0eb70eae2..4996233e1c 100644 --- a/compiler/packages/babel-plugin-react-compiler/package.json +++ b/compiler/packages/babel-plugin-react-compiler/package.json @@ -5,7 +5,7 @@ "main": "dist/index.js", "license": "MIT", "files": [ - "src" + "dist" ], "scripts": { "build": "rimraf dist && rollup --config --bundleConfigAsCjs", diff --git a/compiler/packages/eslint-plugin-react-compiler/package.json b/compiler/packages/eslint-plugin-react-compiler/package.json index ccd5c97a87..ce74bf46d7 100644 --- a/compiler/packages/eslint-plugin-react-compiler/package.json +++ b/compiler/packages/eslint-plugin-react-compiler/package.json @@ -6,6 +6,9 @@ "build": "rimraf dist && rollup --config --bundleConfigAsCjs", "test": "tsc && jest" }, + "files": [ + "dist" + ], "dependencies": { "@babel/core": "^7.24.4", "@babel/parser": "^7.24.4", diff --git a/compiler/packages/react-compiler-runtime/package.json b/compiler/packages/react-compiler-runtime/package.json index 5098d8c5c4..08f7473a5f 100644 --- a/compiler/packages/react-compiler-runtime/package.json +++ b/compiler/packages/react-compiler-runtime/package.json @@ -5,10 +5,11 @@ "license": "MIT", "main": "dist/index.js", "files": [ + "dist", "src" ], "peerDependencies": { - "react": "^18.2.0 | ^19.0.0" + "react": "^18.2.0 || ^19.0.0" }, "scripts": { "build": "rimraf dist && rollup --config --bundleConfigAsCjs",