From df495edae0d1ab090c87a5a97abbadcc4e34df54 Mon Sep 17 00:00:00 2001 From: Pascal Jufer Date: Tue, 15 Nov 2022 15:51:04 +0100 Subject: [PATCH] Exclude unnecessary files from packages (#16374) * Exclude unnecessary files from packages * Add back 'copyfiles' in api to copy yaml and liquid files to dist * Exclude declaration maps and all declaration files for drive packages Excluding all declaration map files from published packages Since the "drive" packages are only expected to be used internally, it's enough to have the declaration files present when developing locally - no need to include the types in the published packages * Remove unnecessary entries in "files" field of app/package.json Co-authored-by: Rijk van Zanten --- api/package.json | 6 +++--- app/package.json | 4 +--- packages/create-directus-extension/package.json | 3 +++ packages/drive-azure/package.json | 4 ++-- packages/drive-gcs/package.json | 4 ++-- packages/drive-s3/package.json | 4 ++-- packages/drive/package.json | 4 ++-- packages/extensions-sdk/package.json | 5 +++++ packages/schema/package.json | 3 +++ packages/shared/package.json | 5 +++++ packages/specs/package.json | 2 -- 11 files changed, 28 insertions(+), 16 deletions(-) diff --git a/api/package.json b/api/package.json index b53fb92ffc..e4ac913976 100644 --- a/api/package.json +++ b/api/package.json @@ -59,7 +59,7 @@ "scripts": { "start": "npx directus start", "prebuild": "pnpm cleanup", - "build": "tsc --build && copyfiles \"src/**/*.*\" -e \"src/**/*.ts\" -u 1 dist", + "build": "tsc --build && copyfiles \"src/**/*.{yaml,liquid}\" -u 1 dist", "cleanup": "rimraf dist", "dev": "cross-env NODE_ENV=development SERVE_APP=false ts-node-dev --files --transpile-only --respawn --watch \".env\" --inspect=0 --exit-child -- src/start.ts", "cli": "cross-env NODE_ENV=development SERVE_APP=false ts-node --script-mode --transpile-only src/cli/run.ts", @@ -72,8 +72,8 @@ }, "files": [ "dist", - "LICENSE", - "README.md" + "!**/*.test.js", + "!**/__*__/" ], "dependencies": { "@authenio/samlify-node-xmllint": "2.0.0", diff --git a/app/package.json b/app/package.json index 05fbb610f0..fb45911f83 100644 --- a/app/package.json +++ b/app/package.json @@ -10,9 +10,7 @@ "./package.json": "./package.json" }, "files": [ - "dist", - "LICENSE", - "README.md" + "dist" ], "repository": { "type": "git", diff --git a/packages/create-directus-extension/package.json b/packages/create-directus-extension/package.json index fb3a821611..e72cb615d9 100644 --- a/packages/create-directus-extension/package.json +++ b/packages/create-directus-extension/package.json @@ -8,6 +8,9 @@ ".": "./lib/index.js", "./package.json": "./package.json" }, + "files": [ + "lib/index.js" + ], "bin": { "create-directus-extension": "./lib/index.js", "cde": "./lib/index.js" diff --git a/packages/drive-azure/package.json b/packages/drive-azure/package.json index 238a701560..3207b9792c 100644 --- a/packages/drive-azure/package.json +++ b/packages/drive-azure/package.json @@ -8,7 +8,6 @@ ".": "./dist/index.js", "./package.json": "./package.json" }, - "types": "dist/index.d.ts", "keywords": [ "storage", "filesystem", @@ -35,7 +34,8 @@ "Rijk van Zanten " ], "files": [ - "dist" + "dist", + "!**/*.d.ts?(.map)" ], "dependencies": { "@azure/storage-blob": "12.12.0", diff --git a/packages/drive-gcs/package.json b/packages/drive-gcs/package.json index eb7bfd355c..5c6e67836c 100644 --- a/packages/drive-gcs/package.json +++ b/packages/drive-gcs/package.json @@ -8,7 +8,6 @@ ".": "./dist/index.js", "./package.json": "./package.json" }, - "types": "dist/index.d.ts", "keywords": [ "storage", "filesystem", @@ -25,7 +24,8 @@ "Rijk van Zanten " ], "files": [ - "dist" + "dist", + "!**/*.d.ts?(.map)" ], "scripts": { "build": "tsc --project ./tsconfig.json", diff --git a/packages/drive-s3/package.json b/packages/drive-s3/package.json index 3baf8c17e2..ec1414c4f7 100644 --- a/packages/drive-s3/package.json +++ b/packages/drive-s3/package.json @@ -8,7 +8,6 @@ ".": "./dist/index.js", "./package.json": "./package.json" }, - "types": "dist/index.d.ts", "keywords": [ "storage", "filesystem", @@ -26,7 +25,8 @@ "Rijk van Zanten " ], "files": [ - "dist" + "dist", + "!**/*.d.ts?(.map)" ], "scripts": { "build": "tsc --project ./tsconfig.json", diff --git a/packages/drive/package.json b/packages/drive/package.json index 25cacaffaf..0d9a51af40 100644 --- a/packages/drive/package.json +++ b/packages/drive/package.json @@ -8,7 +8,6 @@ ".": "./dist/index.js", "./package.json": "./package.json" }, - "types": "dist/index.d.ts", "keywords": [ "storage", "filesystem", @@ -27,7 +26,8 @@ "Rijk van Zanten " ], "files": [ - "dist" + "dist", + "!**/*.d.ts?(.map)" ], "scripts": { "build": "tsc --project ./tsconfig.json", diff --git a/packages/extensions-sdk/package.json b/packages/extensions-sdk/package.json index e99be0a72f..9d338242fe 100644 --- a/packages/extensions-sdk/package.json +++ b/packages/extensions-sdk/package.json @@ -15,6 +15,11 @@ }, "./package.json": "./package.json" }, + "files": [ + "dist", + "templates", + "!**/*.d.ts.map" + ], "types": "dist/esm/index.d.ts", "bin": { "directus-extension": "cli.js" diff --git a/packages/schema/package.json b/packages/schema/package.json index b0baf0e056..3a0d07212e 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -8,6 +8,9 @@ "./package.json": "./package.json" }, "types": "dist/index.d.ts", + "files": [ + "dist" + ], "scripts": { "build": "tsc --build && echo \"Built successfully\"", "dev": "npm-watch build" diff --git a/packages/shared/package.json b/packages/shared/package.json index 6b0f780b44..b719bc9b1c 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -33,6 +33,11 @@ }, "./package.json": "./package.json" }, + "files": [ + "dist", + "!**/*.test.js", + "!**/*.d.ts.map" + ], "sideEffects": false, "scripts": { "build": "run-p \"build:* {@}\"", diff --git a/packages/specs/package.json b/packages/specs/package.json index 80c4d6694b..dc2657fe01 100644 --- a/packages/specs/package.json +++ b/packages/specs/package.json @@ -36,8 +36,6 @@ "homepage": "https://github.com/directus/directus#readme", "files": [ "dist", - "LICENSE", - "README.md", "index.d.ts", "index.js" ],