Skip to content

Commit 1d0257e

Browse files
authored
chore(atlas-service): add atlas-service package COMPASS-7029 (#4655)
* chore(atlas-service): add atlas-service package * chore(typescript-config): revert module resolution change and provide submodule exports using cjs approach * chore(atlas-service): add tests * chore(compass): ignore more folders for the ts lint project * chore(mocha-config-compass): fix handling of export submodules in source resolver * chore(mocha-config): fix windows * chore: bump devtools-connect
1 parent 613cff3 commit 1d0257e

28 files changed

+592
-30
lines changed

configs/mocha-config-compass/register/resolve-from-source-register.js

+19-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const workspaces = fs
1919

2020
const sourcePaths = Object.fromEntries(
2121
workspaces
22-
.map((workspacePath) => {
22+
.flatMap((workspacePath) => {
2323
let packageJson = {};
2424
try {
2525
packageJson = require(path.join(workspacePath, 'package.json'));
@@ -28,13 +28,25 @@ const sourcePaths = Object.fromEntries(
2828
`\x1b[33mWarning: Directory at path "${workspacePath}" is not a workspace. Did you forget to clean up?\x1b[0m`
2929
);
3030
}
31-
if (packageJson['compass:main'] || packageJson['compass:exports']) {
31+
if (packageJson['compass:exports']) {
32+
return Object.entries(packageJson['compass:exports']).map(
33+
([submodule, subpath]) => {
34+
return [
35+
path
36+
.join(packageJson.name, submodule)
37+
// Handle windows case where join will convert `/` to `\`
38+
.replace(/\\/g, '/'),
39+
path.join(workspacePath, subpath),
40+
];
41+
}
42+
);
43+
}
44+
if (packageJson['compass:main']) {
3245
return [
33-
packageJson.name,
34-
path.join(
35-
workspacePath,
36-
packageJson['compass:exports']?.['.'] ?? packageJson['compass:main']
37-
),
46+
[
47+
packageJson.name,
48+
path.join(workspacePath, packageJson['compass:main']),
49+
],
3850
];
3951
}
4052
return false;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "@mongodb-js/tsconfig-devtools/tsconfig.common.js"
2+
"extends": "@mongodb-js/tsconfig-devtools/tsconfig.common.json"
33
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "@mongodb-js/tsconfig-devtools/tsconfig.react.js"
2+
"extends": "@mongodb-js/tsconfig-devtools/tsconfig.react.json"
33
}

package-lock.json

+127-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/atlas-service/.depcheckrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ignores:
2+
- '@mongodb-js/prettier-config-compass'
3+
- '@mongodb-js/tsconfig-compass'
4+
- '@types/chai'
5+
- '@types/sinon-chai'
6+
- 'sinon'
7+
ignore-patterns:
8+
- 'dist'

packages/atlas-service/.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.nyc-output
2+
dist

packages/atlas-service/.eslintrc.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['@mongodb-js/eslint-config-compass'],
4+
parserOptions: {
5+
tsconfigRootDir: __dirname,
6+
project: ['./tsconfig-lint.json'],
7+
},
8+
};

packages/atlas-service/.mocharc.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('@mongodb-js/mocha-config-compass');
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.nyc_output
2+
dist
3+
coverage
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@mongodb-js/prettier-config-compass"

packages/atlas-service/main.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './dist/main.d';

packages/atlas-service/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./dist/main');

0 commit comments

Comments
 (0)