-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(boxes-costs): add month parameter * interim: connect - copy password * refactor: move to typescript * build: compiles and tests, but dynamic imports not working * fix: colors working, box state enum added * refactor: finished testing except SSH * chore: lint * build: testing other node versions * build: retest build * refactor: typescript complete
- Loading branch information
Showing
32 changed files
with
912 additions
and
492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Ignore artifacts. | ||
build | ||
coverage | ||
dist | ||
CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
extends: ["prettier"] | ||
plugins: ["prettier"] | ||
rules: | ||
extends: ["plugin:@typescript-eslint/recommended", "prettier"] | ||
plugins: ["@typescript-eslint", "prettier"] | ||
rules: | ||
prettier/prettier: ["error"] | ||
parserOptions: | ||
ecmaVersion: 2020 | ||
sourceType: "module" | ||
parser: '@typescript-eslint/parser' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ package-lock.json | |
boxes.json | ||
artifacts/ | ||
.DS_Store | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import type { Config } from "jest"; | ||
/* | ||
* For a detailed explanation regarding each configuration property, visit: | ||
* https://jestjs.io/docs/configuration | ||
*/ | ||
|
||
const config: Config = { | ||
// We're using ts-jest for typescript support. Treat *.ts files as ESM | ||
// modules so that we can use 'import'. | ||
// See: | ||
// https://kulshekhar.github.io/ts-jest/docs/next/guides/esm-support/ | ||
preset: "ts-jest", | ||
extensionsToTreatAsEsm: [".ts"], | ||
moduleNameMapper: { | ||
"^(\\.{1,2}/.*)\\.js$": "$1", | ||
}, | ||
transform: { | ||
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest` | ||
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest` | ||
"^.+\\.tsx?$": [ | ||
"ts-jest", | ||
{ | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
|
||
// Only look for tests in the src folder, i.e. excluded build. | ||
roots: ["./src/"], | ||
|
||
// Initial config/setup function for jest | ||
globalSetup: "./src/jest-global-setup.ts", | ||
|
||
// Automatically clear mock calls, instances, contexts and results before every test | ||
clearMocks: true, | ||
|
||
// Indicates whether the coverage information should be collected while executing the test | ||
collectCoverage: true, | ||
collectCoverageFrom: ["src/**/*.{js,ts}"], | ||
|
||
// The directory where Jest should output its coverage files | ||
coverageDirectory: "artifacts/coverage", | ||
|
||
// Indicates which provider should be used to instrument code for coverage | ||
coverageProvider: "v8", | ||
|
||
// The types of coverage reporters to use. | ||
coverageReporters: ["text", "cobertura"], | ||
|
||
// A list of paths to modules that run some code to configure or set up the testing framework before each test | ||
// setupFilesAfterEnv: ["./src/setup-jest.js"], | ||
|
||
// The test environment that will be used for testing | ||
testEnvironment: "node", | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Instance } from "@aws-sdk/client-ec2"; | ||
|
||
export enum BoxState { | ||
Unknown, | ||
Pending, | ||
Running, | ||
ShuttingDown, | ||
Terminated, | ||
Stopping, | ||
Stopped, | ||
} | ||
|
||
export function awsStateToBoxState(awsState?: string): BoxState { | ||
switch (awsState) { | ||
case "pending": | ||
return BoxState.Pending; | ||
case "running": | ||
return BoxState.Running; | ||
case "shutting-down": | ||
return BoxState.ShuttingDown; | ||
case "terminated": | ||
return BoxState.Terminated; | ||
case "stopping": | ||
return BoxState.Stopping; | ||
case "stopped": | ||
return BoxState.Stopped; | ||
default: | ||
return BoxState.Unknown; | ||
} | ||
} | ||
|
||
export interface Box { | ||
boxId: string; | ||
name: string; | ||
state: BoxState; | ||
instanceId: string | undefined; | ||
instance: Instance | undefined; | ||
} |
Oops, something went wrong.