Skip to content

Commit

Permalink
Separate non-gcp core code into its own "core" package
Browse files Browse the repository at this point in the history
  • Loading branch information
mlev committed Dec 13, 2023
1 parent df956e8 commit af40b25
Show file tree
Hide file tree
Showing 94 changed files with 460 additions and 266 deletions.
100 changes: 58 additions & 42 deletions package-lock.json

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

38 changes: 38 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "@mondokit/core",
"version": "1.0.0-alpha.1",
"description": "",
"type": "module",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"files": [
"/dist"
],
"scripts": {
"build": "tsc --build --verbose tsconfig.prod.json",
"clean": "rm -rf dist/ coverage/ tsconfig.tsbuildinfo tsconfig.prod.tsbuildinfo",
"format": "prettier --write \"./src/**/*.ts\"",
"prepublishOnly": "npm run build",
"test": "vitest run",
"test:ci": "vitest run"
},
"publishConfig": {
"access": "public"
},
"author": "",
"license": "MIT",
"homepage": "https://github.com/mondo-mob/mondokit",
"dependencies": {
"bunyan": "^1.8.15",
"lodash-es": "^4.17.21"
},
"peerDependencies": {
"express": ">= 4.17.1",
"zod": "^3.21.0"
},
"devDependencies": {
"@types/bunyan": "^1.8.11",
"@types/lodash-es": "^4.17.8",
"zod": "^3.22.4"
}
}
5 changes: 5 additions & 0 deletions packages/core/src/__test/setup-after-env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import nock from "nock";

afterEach(() => {
nock.cleanAll();
});
6 changes: 6 additions & 0 deletions packages/core/src/__test/setup-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import "vitest/globals.d.ts";
import "jest-extended";
import nock from "nock";

nock.disableNetConnect();
nock.enableNetConnect("127.0.0.1");
13 changes: 13 additions & 0 deletions packages/core/src/__test/test-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// NOTE: This will only work for code that does not inspect the process on initialisation
export const withEnvVars = (vars: Record<string, string | undefined>, testFn: () => Promise<unknown>) => {
return () => {
const originalEnv = process.env;
process.env = {
...originalEnv,
...vars,
};
return testFn().finally(() => {
process.env = originalEnv;
});
};
};
File renamed without changes.
5 changes: 5 additions & 0 deletions packages/core/src/auth/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from "./requires-header.js";
export * from "./requires-role.js";
export * from "./requires-user.js";
export * from "./auth-user.js";
export * from "./user-request-storage-provider.js";
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export class UserRequestStorageProvider<U extends AuthUser, T extends RequestSto

export const userRequestStorageProvider = new UserRequestStorageProvider(
undefined,
"No User request storage instance found. Please initialise userRequestStorageProvider."
"No User request storage instance found. Please initialise userRequestStorageProvider.",
);
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit af40b25

Please sign in to comment.