Skip to content

Commit

Permalink
Merge pull request #4201 from coralproject/develop
Browse files Browse the repository at this point in the history
v8.0.1
  • Loading branch information
tessalt authored Mar 29, 2023
2 parents 48b1e22 + 81f02d6 commit 4bb4a75
Show file tree
Hide file tree
Showing 31 changed files with 419 additions and 114 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,17 @@ jobs:
name: Lint Versions
run: npx @coralproject/package-version-lint
-
name: Run Unit Tests
run: npm run test -- --ci --runInBand --reporters=default --reporters=jest-junit
name: Run Server Unit Tests
run: npm run test:server -- --ci --runInBand --reporters=default --reporters=jest-junit
-
name: Run Client Stream Unit Tests
run: npm run test:client:stream -- --ci --runInBand --reporters=default --reporters=jest-junit
-
name: Run Client Admin Unit Tests
run: npm run test:client:admin -- --ci --runInBand --reporters=default --reporters=jest-junit
-
name: Run Client Other Unit Tests
run: npm run test:client:other -- --ci --runInBand --reporters=default --reporters=jest-junit
-
name: Build
run: npm run build
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,17 @@ jobs:
name: Lint Versions
run: npx @coralproject/package-version-lint
-
name: Run Unit Tests
run: npm run test -- --ci --runInBand --reporters=default --reporters=jest-junit
name: Run Server Unit Tests
run: npm run test:server -- --ci --runInBand --reporters=default --reporters=jest-junit
-
name: Run Client Stream Unit Tests
run: npm run test:client:stream -- --ci --runInBand --reporters=default --reporters=jest-junit
-
name: Run Client Admin Unit Tests
run: npm run test:client:admin -- --ci --runInBand --reporters=default --reporters=jest-junit
-
name: Run Client Other Unit Tests
run: npm run test:client:other -- --ci --runInBand --reporters=default --reporters=jest-junit
-
name: Build
run: npm run build
Expand Down
11 changes: 10 additions & 1 deletion INDEXES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ The goal of this document is to date-mark the indexes you add to support the cha

If you are releasing, you can use this readme to check all the indexes prior to the release you are deploying and have a good idea of what indexes you might need to deploy to Mongo along with your release of a new Coral Docker image to kubernetes.

## 2023-03-28

```
db.archivedCommentActions.createIndex({ tenantID: 1, storyID: 1 });
```

- This is used to speed up when the redis cache asks for the `archivedCommentActions` associated with a specific story.
- This is common when an archived story is loaded into the redis cache.

## 2022-03-07

```
Expand Down Expand Up @@ -47,7 +56,7 @@ db.sites.createIndex({ tenantID: 1, "$**": "text", createdAt: -1 });
#### uniqueness constraint indexes:

```
db.commentActions.createIndex({ _id: 1 });
db.commentActions.createIndex({ _id: 1 });
db.commentActions.createIndex({ tenantID: 1, id: 1 });
```

Expand Down
5 changes: 5 additions & 0 deletions config/jest.client.admin.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
projects: [
"<rootDir>/jest/client.admin.config.js",
],
};
5 changes: 5 additions & 0 deletions config/jest.client.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
projects: [
"<rootDir>/jest/client.config.js",
],
};
5 changes: 5 additions & 0 deletions config/jest.client.other.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
projects: [
"<rootDir>/jest/client.other.config.js",
],
};
5 changes: 5 additions & 0 deletions config/jest.client.stream.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
projects: [
"<rootDir>/jest/client.stream.config.js",
],
};
5 changes: 5 additions & 0 deletions config/jest.server.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
projects: [
"<rootDir>/jest/server.config.js",
],
};
9 changes: 9 additions & 0 deletions config/jest/client.admin.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const createConfig = require("./client.baseConfig");

const baseConfig = createConfig();

module.exports = {
...baseConfig,
displayName: "client:admin",
roots: ["<rootDir>/src/core/client/admin"],
}
87 changes: 87 additions & 0 deletions config/jest/client.baseConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
const path = require("path");

const createConfig = () => {
const d3Pkgs = [
"d3",
"d3-array",
"d3-axis",
"d3-brush",
"d3-chord",
"d3-color",
"d3-contour",
"d3-delaunay",
"d3-dispatch",
"d3-drag",
"d3-dsv",
"d3-ease",
"d3-fetch",
"d3-force",
"d3-format",
"d3-geo",
"d3-hierarchy",
"d3-interpolate",
"d3-path",
"d3-polygon",
"d3-quadtree",
"d3-random",
"d3-scale",
"d3-scale-chromatic",
"d3-selection",
"d3-shape",
"d3-time",
"d3-time-format",
"d3-timer",
"d3-transition",
"d3-zoom",
];

return {
displayName: "jestBaseConfig",
rootDir: "../../",
roots: ["<rootDir>/src/core/"],
collectCoverageFrom: ["**/*.{js,jsx,mjs,ts,tsx}"],
coveragePathIgnorePatterns: ["/node_modules/"],
setupFiles: [
"<rootDir>/src/core/client/test/polyfills.ts",
"<rootDir>/src/core/client/test/setup.ts",
],
setupFilesAfterEnv: ["<rootDir>/src/core/client/test/setupTestFramework.ts"],
testMatch: ["**/*.spec.{js,jsx,mjs,ts,tsx}"],
testEnvironment: "node",
testURL: "http://localhost",
transform: {
"^.+\\.jsx?$": "<rootDir>/node_modules/babel-jest",
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^.+\\.ftl$": "<rootDir>/config/jest/contentTransform.js",
"^(?!.*\\.(js|jsx|mjs|ts|tsx|css|json|ftl)$)":
"<rootDir>/config/jest/fileTransform.js",
},
transformIgnorePatterns: [
`[/\\\\]node_modules[/\\\\](?!(fluent|react-relay-network-modern|@coralproject/rte/lib|internmap|${d3Pkgs.join(
"|"
)})[/\\\\]).+\\.(js|jsx|mjs|ts|tsx)$`,
],
moduleNameMapper: {
"^coral-account/(.*)$": "<rootDir>/src/core/client/account/$1",
"^coral-admin/(.*)$": "<rootDir>/src/core/client/admin/$1",
"^coral-auth/(.*)$": "<rootDir>/src/core/client/auth/$1",
"^coral-count/(.*)$": "<rootDir>/src/core/client/count/$1",
"^coral-ui/(.*)$": "<rootDir>/src/core/client/ui/$1",
"^coral-stream/(.*)$": "<rootDir>/src/core/client/stream/$1",
"^coral-framework/(.*)$": "<rootDir>/src/core/client/framework/$1",
"^coral-common/(.*)$": "<rootDir>/src/core/common/$1",
"^coral-test/(.*)$": "<rootDir>/src/core/client/test/$1",
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node", "ftl"],
globals: {
"ts-jest": {
babelConfig: true,
tsConfig: path.resolve(__dirname, "../../src/core/client/tsconfig.json"),
},
},
preset: "ts-jest/presets/js-with-babel",
};
}

module.exports = createConfig;
82 changes: 4 additions & 78 deletions config/jest/client.config.js
Original file line number Diff line number Diff line change
@@ -1,83 +1,9 @@
const path = require("path");
const createConfig = require("./client.baseConfig");

const d3Pkgs = [
"d3",
"d3-array",
"d3-axis",
"d3-brush",
"d3-chord",
"d3-color",
"d3-contour",
"d3-delaunay",
"d3-dispatch",
"d3-drag",
"d3-dsv",
"d3-ease",
"d3-fetch",
"d3-force",
"d3-format",
"d3-geo",
"d3-hierarchy",
"d3-interpolate",
"d3-path",
"d3-polygon",
"d3-quadtree",
"d3-random",
"d3-scale",
"d3-scale-chromatic",
"d3-selection",
"d3-shape",
"d3-time",
"d3-time-format",
"d3-timer",
"d3-transition",
"d3-zoom",
];
const baseConfig = createConfig();

module.exports = {
...baseConfig,
displayName: "client",
rootDir: "../../",
roots: ["<rootDir>/src/core/client"],
collectCoverageFrom: ["**/*.{js,jsx,mjs,ts,tsx}"],
coveragePathIgnorePatterns: ["/node_modules/"],
setupFiles: [
"<rootDir>/src/core/client/test/polyfills.ts",
"<rootDir>/src/core/client/test/setup.ts",
],
setupFilesAfterEnv: ["<rootDir>/src/core/client/test/setupTestFramework.ts"],
testMatch: ["**/*.spec.{js,jsx,mjs,ts,tsx}"],
testEnvironment: "node",
testURL: "http://localhost",
transform: {
"^.+\\.jsx?$": "<rootDir>/node_modules/babel-jest",
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^.+\\.ftl$": "<rootDir>/config/jest/contentTransform.js",
"^(?!.*\\.(js|jsx|mjs|ts|tsx|css|json|ftl)$)":
"<rootDir>/config/jest/fileTransform.js",
},
transformIgnorePatterns: [
`[/\\\\]node_modules[/\\\\](?!(fluent|react-relay-network-modern|@coralproject/rte/lib|internmap|${d3Pkgs.join(
"|"
)})[/\\\\]).+\\.(js|jsx|mjs|ts|tsx)$`,
],
moduleNameMapper: {
"^coral-account/(.*)$": "<rootDir>/src/core/client/account/$1",
"^coral-admin/(.*)$": "<rootDir>/src/core/client/admin/$1",
"^coral-auth/(.*)$": "<rootDir>/src/core/client/auth/$1",
"^coral-count/(.*)$": "<rootDir>/src/core/client/count/$1",
"^coral-ui/(.*)$": "<rootDir>/src/core/client/ui/$1",
"^coral-stream/(.*)$": "<rootDir>/src/core/client/stream/$1",
"^coral-framework/(.*)$": "<rootDir>/src/core/client/framework/$1",
"^coral-common/(.*)$": "<rootDir>/src/core/common/$1",
"^coral-test/(.*)$": "<rootDir>/src/core/client/test/$1",
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node", "ftl"],
globals: {
"ts-jest": {
babelConfig: true,
tsConfig: path.resolve(__dirname, "../../src/core/client/tsconfig.json"),
},
},
preset: "ts-jest/presets/js-with-babel",
};
}
27 changes: 27 additions & 0 deletions config/jest/client.other.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const fs = require("fs");
const path = require("path");
const createConfig = require("./client.baseConfig");

const dir = "./src/core/client";
const dirItems = fs.readdirSync(dir);
let roots = [];

const excludedRoots = ["src/core/client/stream", "src/core/client/admin"];

for (const item of dirItems) {
const fullPath = path.join(dir, item);
const stats = fs.statSync(fullPath);
if (stats.isDirectory() && !excludedRoots.includes(fullPath)) {
roots.push(fullPath);
}
}

roots = roots.map((r) => `<rootDir>/${r}`);

const baseConfig = createConfig();

module.exports = {
...baseConfig,
displayName: "client:other",
roots
}
9 changes: 9 additions & 0 deletions config/jest/client.stream.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const createConfig = require("./client.baseConfig");

const baseConfig = createConfig();

module.exports = {
...baseConfig,
displayName: "client:stream",
roots: ["<rootDir>/src/core/client/stream"],
}
15 changes: 15 additions & 0 deletions config/paths.client.admin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
import appPaths from "../src/core/build/paths";

// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = (relativePath: string) =>
path.resolve(appDirectory, relativePath);

// config after eject: we're in ./config/
export default {
...appPaths,
appJestConfig: resolveApp("config/jest.client.admin.config.js"),
};
15 changes: 15 additions & 0 deletions config/paths.client.other.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
import appPaths from "../src/core/build/paths";

// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = (relativePath: string) =>
path.resolve(appDirectory, relativePath);

// config after eject: we're in ./config/
export default {
...appPaths,
appJestConfig: resolveApp("config/jest.client.other.config.js"),
};
15 changes: 15 additions & 0 deletions config/paths.client.stream.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
import appPaths from "../src/core/build/paths";

// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = (relativePath: string) =>
path.resolve(appDirectory, relativePath);

// config after eject: we're in ./config/
export default {
...appPaths,
appJestConfig: resolveApp("config/jest.client.stream.config.js"),
};
15 changes: 15 additions & 0 deletions config/paths.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
import appPaths from "../src/core/build/paths";

// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = (relativePath: string) =>
path.resolve(appDirectory, relativePath);

// config after eject: we're in ./config/
export default {
...appPaths,
appJestConfig: resolveApp("config/jest.client.config.js"),
};
15 changes: 15 additions & 0 deletions config/paths.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import fs from "fs";
import path from "path";
import appPaths from "../src/core/build/paths";

// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = (relativePath: string) =>
path.resolve(appDirectory, relativePath);

// config after eject: we're in ./config/
export default {
...appPaths,
appJestConfig: resolveApp("config/jest.server.config.js"),
};
Loading

0 comments on commit 4bb4a75

Please sign in to comment.