Skip to content

Commit

Permalink
chore(user-data, workspaces): add missing dependencies; always exclud…
Browse files Browse the repository at this point in the history
…e electron from bundle; fix exports paths COMPASS-7361 (#5024)

* chore(user-data): fix package dependencies

* chore(webpack-config): always externalize electron package

* chore(workspace): check that exports exist; fix missing export paths
  • Loading branch information
gribnoysup authored Oct 26, 2023
1 parent e35c177 commit 02aa0f0
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 34 deletions.
3 changes: 3 additions & 0 deletions configs/webpack-config-compass/src/externals.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { execSync } from 'child_process';

export const sharedExternals: string[] = [
// Electron should always stay external. For electron webpack target this
// happens automatically, for other targets we should never try to bundle it
'electron',
// Native Modules are very hard to bundle correctly with Webpack (and there is
// not much reason to do so) so to make our lives easier, we will always
// externalize them from the bulid
Expand Down
21 changes: 9 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions packages/atlas-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
"url": "https://github.com/mongodb-js/compass.git"
},
"files": [
"dist"
"dist",
"main.js",
"main.d.ts",
"renderer.js",
"renderer.d.ts"
],
"license": "SSPL",
"exports": {
Expand All @@ -32,7 +36,7 @@
},
"scripts": {
"bootstrap": "npm run compile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "tsc -p tsconfig.json",
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
"eslint": "eslint",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-app-stores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"types": "./dist/src/index.d.ts",
"scripts": {
"bootstrap": "npm run postcompile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "npm run webpack -- --mode production",
"webpack": "webpack-compass",
"postcompile": "tsc --emitDeclarationOnly",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-connection-import-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"types": "./dist/index.d.ts",
"scripts": {
"bootstrap": "npm run compile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
"eslint": "eslint",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"types": "./dist/index.d.ts",
"scripts": {
"bootstrap": "npm run compile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "tsc -p tsconfig.json",
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
"eslint": "eslint",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-export-to-language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"scripts": {
"bootstrap": "npm run postcompile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "npm run webpack -- --mode production",
"webpack": "webpack-compass",
"postcompile": "tsc --emitDeclarationOnly",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-field-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"types": "./dist/src/index.d.ts",
"scripts": {
"bootstrap": "npm run postcompile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "npm run webpack -- --mode production",
"webpack": "webpack-compass",
"postcompile": "tsc --emitDeclarationOnly",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-generative-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"types": "./dist/src/index.d.ts",
"scripts": {
"bootstrap": "npm run postcompile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "npm run webpack -- --mode production",
"webpack": "webpack-compass",
"postcompile": "tsc --emitDeclarationOnly",
Expand Down
3 changes: 2 additions & 1 deletion packages/compass-import-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@mongodb-js/compass-utils": "^0.5.2",
"bson": "^6.0.0",
"compass-preferences-model": "^2.15.3",
"electron": "^25.8.4",
"hadron-document": "^8.4.2",
"react": "^17.0.2"
},
Expand All @@ -71,6 +72,7 @@
"@mongodb-js/compass-utils": "^0.5.2",
"bson": "^6.0.0",
"compass-preferences-model": "^2.15.3",
"electron": "^25.8.4",
"hadron-document": "^8.4.2"
},
"devDependencies": {
Expand All @@ -97,7 +99,6 @@
"chai-as-promised": "^7.1.1",
"debug": "^4.2.0",
"depcheck": "^1.4.1",
"electron": "^25.8.4",
"eslint": "^7.25.0",
"hadron-app-registry": "^9.0.12",
"lodash": "^4.17.21",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"types": "./dist/index.d.ts",
"scripts": {
"bootstrap": "npm run compile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
"eslint": "eslint",
Expand Down
4 changes: 2 additions & 2 deletions packages/compass-settings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"license": "SSPL",
"main": "dist/index.js",
"compass:main": "src/index.ts",
"types": "dist/index.d.ts",
"types": "dist/src/index.d.ts",
"exports": {
"require": "./dist/index.js",
"browser": "./dist/browser.js"
Expand All @@ -34,7 +34,7 @@
},
"scripts": {
"bootstrap": "npm run postcompile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "npm run webpack -- --mode production",
"webpack": "webpack-compass",
"postcompile": "tsc --emitDeclarationOnly",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-test-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"types": "./dist/index.d.ts",
"scripts": {
"bootstrap": "npm run compile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
"eslint": "eslint",
Expand Down
10 changes: 6 additions & 4 deletions packages/compass-user-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"types": "./dist/index.d.ts",
"scripts": {
"bootstrap": "npm run compile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
"eslint": "eslint",
Expand All @@ -48,6 +48,10 @@
"test-ci": "npm run test-cov",
"reformat": "npm run prettier -- --write . && npm run eslint . --fix"
},
"dependencies": {
"write-file-atomic": "^5.0.1",
"zod": "^3.22.3"
},
"devDependencies": {
"@mongodb-js/compass-logging": "^1.2.3",
"@mongodb-js/compass-utils": "^0.5.2",
Expand All @@ -67,8 +71,6 @@
"nyc": "^15.1.0",
"prettier": "^2.7.1",
"sinon": "^9.2.3",
"typescript": "^5.0.4",
"write-file-atomic": "^5.0.1",
"zod": "^3.22.3"
"typescript": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion packages/compass-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"types": "./dist/index.d.ts",
"scripts": {
"bootstrap": "npm run compile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
"eslint": "eslint",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-welcome/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"scripts": {
"bootstrap": "npm run postcompile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "npm run webpack -- --mode production",
"webpack": "webpack-compass",
"postcompile": "tsc --emitDeclarationOnly",
Expand Down
2 changes: 1 addition & 1 deletion packages/connection-storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"scripts": {
"bootstrap": "npm run compile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "tsc -p tsconfig.json",
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
"eslint": "eslint",
Expand Down
2 changes: 1 addition & 1 deletion packages/mongodb-query-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"types": "./dist/index.d.ts",
"scripts": {
"bootstrap": "npm run compile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
"eslint": "eslint",
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ async function createWorkspace({
types: isPlugin ? './dist/src/index.d.ts' : './dist/index.d.ts',
scripts: {
bootstrap: 'npm run compile',
prepublishOnly: 'npm run compile',
prepublishOnly: 'npm run compile && compass-scripts check-exports-exist',
// For normal packages we are just compiling code with typescript, for
// plugins (but only for them) we are using webpack to create independent
// plugin packages
Expand Down

0 comments on commit 02aa0f0

Please sign in to comment.