Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
imaustink committed Jul 22, 2023
1 parent 5c279f0 commit c5e4a0a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ name: Node.js CI

on:
push:
branches: ['main']
branches: ["main"]
pull_request:
branches: ['main']
branches: ["main"]

jobs:
build:
name: 'Automated Tests'
name: "Automated Tests"
runs-on: ubuntu-latest

strategy:
Expand All @@ -25,6 +25,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache: "npm"
- run: npm ci
- run: npm test
- run: npm run format:check
- run: npm test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "envmagic",
"description": "A smarter way of managing environment variables",
"version": "0.1.1",
"version": "0.1.2",
"author": "Austin Kurpuis <[email protected]> (https://www.austinkurpuis.com/)",
"bugs": {
"url": "https://github.com/imaustink/envmagic/issues"
Expand Down
5 changes: 2 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export function normalizeVariable(event: Events, message: string) {
case ACTION_THROW:
throw new Error(message);
case ACTION_WARN:
// TODO make this plugable
configuration.get("logger")(message);
break;
case ACTION_NULL:
Expand All @@ -94,13 +93,13 @@ export const env = new Proxy(process.env, {
) {
return normalizeVariable(
"onMissing",
`The environment variable "${name}" is required!`
`The environment variable "${name}" is required!`,
);
}
if (typeof value === "string" && !value.length) {
return normalizeVariable(
"onEmpty",
`The environment variable "${name}" is empty!`
`The environment variable "${name}" is empty!`,
);
}
return value;
Expand Down
8 changes: 4 additions & 4 deletions test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("magicenv", () => {
expect(() => {
env.MISSING;
}).toThrowError(
new Error('The environment variable "MISSING" is required!')
new Error('The environment variable "MISSING" is required!'),
);
});
test("should warn onEmpty", () => {
Expand All @@ -30,7 +30,7 @@ describe("magicenv", () => {
expect(() => {
env.MISSING;
}).toThrowError(
new Error('The environment variable "MISSING" is required!')
new Error('The environment variable "MISSING" is required!'),
);
});
test("should error onEmpty", () => {
Expand All @@ -47,13 +47,13 @@ describe("magicenv", () => {
test("should warn onMissing", () => {
env.MISSING;
expect(console.warn).toHaveBeenCalledWith(
'The environment variable "MISSING" is required!'
'The environment variable "MISSING" is required!',
);
});
test("should warn onEmpty", () => {
env.EMPTY;
expect(console.warn).toHaveBeenCalledWith(
'The environment variable "EMPTY" is empty!'
'The environment variable "EMPTY" is empty!',
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "**/*.test.ts"]
}
}

0 comments on commit c5e4a0a

Please sign in to comment.