Skip to content

Commit 3ae0157

Browse files
committed
chore: fix knip --production
1 parent cd9fa57 commit 3ae0157

File tree

15 files changed

+63
-52
lines changed

15 files changed

+63
-52
lines changed

knip.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const config: KnipConfig = {
5252

5353
// Special cases for packages with different entry points
5454
"packages/cli-repl": {
55-
project: ["src/**/*.ts", "bin/**/*.js", "test/**/*.ts"],
55+
project: ["src/**/*.ts!", "bin/**/*.js", "test/**/*.ts"],
5656
ignoreDependencies: [
5757
// Eagerly loaded startup snapshot dependencies
5858
"@mongodb-js/saslprep",
@@ -67,17 +67,17 @@ const config: KnipConfig = {
6767
},
6868

6969
"packages/shell-api": {
70-
entry: ["src/api.ts"],
70+
entry: ["src/api.ts!", "scripts/*.ts", "test/*.ts"],
7171
},
7272

7373
"packages/mongosh": {
7474
project: ["bin/**/*.js"],
7575
},
7676

7777
"packages/e2e-tests": {
78-
entry: ["test/**/*", "test/fixtures/**/*"],
78+
entry: ["test/**/*.ts", "test/fixtures/**/*"],
7979
ignoreDependencies: [
80-
// Used indirectly
80+
// This is used for version check. TODO: Consider changing that test.
8181
"@mongosh/cli-repl",
8282
],
8383
},
@@ -109,9 +109,13 @@ const config: KnipConfig = {
109109
],
110110
},
111111

112+
"packages/errors": {
113+
entry: ["src/index.ts!", "scripts/*.ts"],
114+
},
115+
112116
"packages/browser-repl": {
113-
entry: ["config/*.js"],
114-
project: ["src/**/*.{ts,tsx}"],
117+
entry: ["src/index.tsx!", "config/*.js"],
118+
project: ["src/**/*.{ts,tsx}!"],
115119
ignoreDependencies: [
116120
"@wojtekmaj/enzyme-adapter-react-17",
117121
"enzyme",
@@ -149,7 +153,13 @@ const config: KnipConfig = {
149153
},
150154

151155
"packages/async-rewriter2": {
152-
entry: ["test/fixtures/**/*"],
156+
entry: [
157+
"src/index.ts!",
158+
"bin/*.js!",
159+
"test/fixtures/**/*",
160+
"scripts/*.js",
161+
"benchmark/index.ts",
162+
],
153163
ignoreFiles: [
154164
// Used by make-runtime-support.js
155165
"src/runtime-support.nocov.js",
@@ -185,7 +195,11 @@ const config: KnipConfig = {
185195

186196
// Webpack configuration
187197
webpack: {
188-
config: ["config/webpack.base.config.js", "**/webpack.config.js"],
198+
config: [
199+
"config/webpack.base.config.js",
200+
"**/webpack.config.js",
201+
"**/webpack.config.*.js",
202+
],
189203
},
190204

191205
// ESLint configuration

mongosh.code-workspace

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
"name": "📦 @mongosh/history",
3333
"path": "packages/history"
3434
},
35-
{
36-
"name": "📦 @mongosh/java-shell",
37-
"path": "packages/java-shell"
38-
},
3935
{
4036
"name": "📦 @mongosh/js-multiline-to-singleline",
4137
"path": "packages/js-multiline-to-singleline"
@@ -64,6 +60,10 @@
6460
"name": "📦 @mongosh/arg-parser",
6561
"path": "packages/arg-parser"
6662
},
63+
{
64+
"name": "📦 @mongosh/java-shell",
65+
"path": "packages/java-shell"
66+
},
6767
{
6868
"name": "📦 @mongosh/service-provider-core",
6969
"path": "packages/service-provider-core"

package-lock.json

Lines changed: 12 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
"check-ci": "npm run check --workspaces --if-present",
1515
"depalign": "depalign",
1616
"predepcheck": "npm run depalign",
17-
"depcheck": "knip",
18-
"knip:production": "knip --production --strict",
17+
"depcheck": "knip && knip --production",
1918
"lint": "npm run lint --workspaces --if-present",
2019
"test": "rimraf .nyc_output && npm run test-coverage --workspaces --if-present && npm run report-coverage",
2120
"test-ci": "rimraf .nyc_output && npm run test-ci-coverage --workspaces --if-present && npm run post-process-nyc",
@@ -110,7 +109,7 @@
110109
"find-up": "^5.0.0",
111110
"glob": "^10.3.12",
112111
"husky": "^9.0.11",
113-
"knip": "^5.69.1",
112+
"knip": "^5.71.0",
114113
"mocha": "^10.2.0",
115114
"mongodb-runner": "^6.0.0",
116115
"nyc": "^15.1.0",
@@ -139,14 +138,14 @@
139138
"packages/build",
140139
"packages/errors",
141140
"packages/history",
142-
"packages/java-shell",
143141
"packages/js-multiline-to-singleline",
144142
"packages/types",
145143
"packages/i18n",
146144
"packages/logging",
147145
"packages/shell-bson",
148146
"packages/testing",
149147
"packages/arg-parser",
148+
"packages/java-shell",
150149
"packages/service-provider-core",
151150
"packages/service-provider-node-driver",
152151
"packages/shell-api",

packages/async-rewriter2/bin/async-rewrite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22
'use strict';
3-
const AsyncWriter = require('../').default;
3+
const AsyncWriter = require('../lib').default;
44
const fs = require('fs');
55
const input = fs.readFileSync(process.argv[2], 'utf8');
66
const asyncWriter = new AsyncWriter();

packages/browser-repl/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
}
2222
},
2323
"scripts": {
24-
"start": "webpack serve --config ./config/webpack.config.watch.js",
24+
"start": "npm run webpack-serve",
25+
"webpack-serve": "webpack serve --config ./config/webpack.config.watch.js",
2526
"clean": "rimraf ./lib",
2627
"preprepublish": "rimraf ./lib",
2728
"prepublish": "npm run compile",

packages/e2e-tests/package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@
2626
"engines": {
2727
"node": ">=16.15.0"
2828
},
29-
"dependencies": {
30-
"@mongosh/cli-repl": "2.5.10",
31-
"@mongosh/service-provider-core": "3.7.0",
32-
"@mongodb-js/oidc-plugin": "^2.0.5",
33-
"strip-ansi": "^6.0.0"
34-
},
3529
"devDependencies": {
3630
"mongodb-log-writer": "^2.4.3",
3731
"@mongodb-js/eslint-config-mongosh": "^1.0.0",
@@ -50,6 +44,10 @@
5044
"mongodb": "^6.19.0",
5145
"node-fetch": "^3.3.2",
5246
"prettier": "^2.8.8",
53-
"rimraf": "^3.0.2"
47+
"rimraf": "^3.0.2",
48+
"@mongodb-js/oidc-plugin": "^2.0.5",
49+
"strip-ansi": "^6.0.0",
50+
"@mongosh/cli-repl": "2.5.10",
51+
"@mongosh/service-provider-core": "3.7.0"
5452
}
5553
}

packages/e2e-tests/test/e2e.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ describe('e2e', function () {
442442
}
443443
const currentOp = await shell.executeLine('db.currentOp()');
444444
const expectedVersion =
445-
require('../package.json')['dependencies']['@mongosh/cli-repl'];
445+
require('../package.json')['devDependencies']['@mongosh/cli-repl'];
446446
expect(currentOp).to.include(`appName: 'mongosh ${expectedVersion}'`);
447447
expect(currentOp).to.include("name: 'nodejs|mongosh'");
448448
shell.assertNoErrors();

packages/logging/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"dependencies": {
2020
"@mongodb-js/device-id": "^0.2.1",
2121
"@mongodb-js/devtools-connect": "^3.9.4",
22-
"@mongosh/errors": "2.4.5",
2322
"@mongosh/types": "^3.14.1",
2423
"mongodb-log-writer": "^2.4.3",
2524
"mongodb-redact": "^1.3.0",
@@ -33,7 +32,8 @@
3332
"depcheck": "^1.4.7",
3433
"eslint": "^7.25.0",
3534
"prettier": "^2.8.8",
36-
"sinon": "^19.0.4"
35+
"sinon": "^19.0.4",
36+
"@mongosh/errors": "2.4.5"
3737
},
3838
"scripts": {
3939
"test": "mocha",

0 commit comments

Comments
 (0)