From 615459487032161a630d186266826f0985a46452 Mon Sep 17 00:00:00 2001 From: Andrew Meyer Date: Tue, 31 Oct 2023 14:58:11 +0100 Subject: [PATCH] Unify a prepack command for packages --- .github/workflows/publish-package-release.yml | 4 ++-- packages/babel-plugin/package.json | 4 ++-- packages/realm-common/package.json | 1 + packages/realm-network-transport/package.json | 3 ++- packages/realm-react/package.json | 12 ++++++++++++ packages/realm-tools/package.json | 4 ++-- packages/realm-web/package.json | 5 ++--- 7 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-package-release.yml b/.github/workflows/publish-package-release.yml index f47b25e95c..bed44d6529 100644 --- a/.github/workflows/publish-package-release.yml +++ b/.github/workflows/publish-package-release.yml @@ -97,8 +97,8 @@ jobs: - name: Install node modules run: npm ci --ignore-scripts - - name: Bundle package - run: npm run bundle --workspace=${{env.PACKAGE_NAME}} + - name: Prepack package + run: npm run prepack --workspace=${{env.PACKAGE_NAME}} - name: Read version id: get-version diff --git a/packages/babel-plugin/package.json b/packages/babel-plugin/package.json index 23e4ca6daa..dd32f5d468 100644 --- a/packages/babel-plugin/package.json +++ b/packages/babel-plugin/package.json @@ -5,11 +5,11 @@ "main": "./dist/index.js", "types": "./dist/index.d.ts", "scripts": { - "bundle": "wireit", + "prepack": "wireit", "test": "wireit" }, "wireit": { - "bundle": { + "prepack": { "command": "tsc -p tsconfig.build.json", "files": [ "tsconfig.build.json", diff --git a/packages/realm-common/package.json b/packages/realm-common/package.json index a4b4f104c1..b427a2624e 100644 --- a/packages/realm-common/package.json +++ b/packages/realm-common/package.json @@ -11,6 +11,7 @@ "./dist/bundle.d.ts": "./dist/bundle.dom.d.ts" }, "scripts": { + "prepack": "npm run bundle", "bundle": "wireit", "lint": "eslint --ext .js,.ts .", "test": "mocha 'src/**/*.test.ts'" diff --git a/packages/realm-network-transport/package.json b/packages/realm-network-transport/package.json index baaf504867..55d002d4cc 100644 --- a/packages/realm-network-transport/package.json +++ b/packages/realm-network-transport/package.json @@ -12,12 +12,13 @@ "./dist/bundle.d.ts": "./dist/bundle.dom.d.ts" }, "scripts": { + "prepack": "npm run bundle", "bundle": "wireit", "lint": "eslint --ext .js,.ts .", "test": "mocha 'src/**/*.test.ts'" }, "wireit": { - "bundle": { + "prepack": { "command": "rollup --config", "dependencies": [ "generate-types", diff --git a/packages/realm-react/package.json b/packages/realm-react/package.json index 3537e99619..79f911e700 100644 --- a/packages/realm-react/package.json +++ b/packages/realm-react/package.json @@ -9,6 +9,7 @@ "source": "src/index.tsx", "scripts": { "bundle": "wireit", + "prepack": "npm run bundle", "start": "npm run bundle -- --watch", "test": "wireit", "lint": "eslint --ext .tsx .", @@ -18,6 +19,7 @@ "bundle": { "command": "rollup --config && tsc -p tsconfig.types.json", "dependencies": [ + "generate-types", "../realm:bundle", "../realm-common:bundle" ], @@ -30,6 +32,16 @@ "dist" ] }, + "generate-types": { + "command": "tsc -p tsconfig.types.json", + "files": [ + "src/**/*.ts" + ], + "output": [ + "dist/**/*.d.ts", + "dist/**/*.d.ts.map" + ] + }, "test": { "command": "jest --forceExit", "dependencies": [ diff --git a/packages/realm-tools/package.json b/packages/realm-tools/package.json index 6280646caa..a137b6989e 100644 --- a/packages/realm-tools/package.json +++ b/packages/realm-tools/package.json @@ -9,12 +9,12 @@ "dist" ], "scripts": { - "build": "wireit", + "prepack": "wireit", "lint": "eslint --ext .js,.ts .", "test": "echo \"Error: no test specified\" && exit 1" }, "wireit": { - "build": { + "prepack": { "command": "tsc -p tsconfig.build.json", "dependencies": [ "../realm:bundle" diff --git a/packages/realm-web/package.json b/packages/realm-web/package.json index 8867be737e..29e450a92c 100644 --- a/packages/realm-web/package.json +++ b/packages/realm-web/package.json @@ -11,8 +11,7 @@ "./dist/bundle.es.js": "./dist/bundle.dom.es.js" }, "scripts": { - "prepack": "npm run build", - "bundle": "wireit", + "prepack": "wireit", "start": "npm run build -- --watch", "lint": "eslint --ext .js,.ts .", "test": "mocha 'src/tests/**/*.test.ts'", @@ -20,7 +19,7 @@ "docs": "wireit" }, "wireit": { - "bundle": { + "prepack": { "command": "rollup --config", "dependencies": [ "generate-types"