Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ jobs:
unset NPM_CONFIG_USER
npm ci
- name: Unit tests
run: "npm run test"
run: "npm run test:ci"
env:
YEPCODE_API_TOKEN: ${{ secrets.TEST_YEPCODE_API_TOKEN }}
15 changes: 0 additions & 15 deletions package-lock.json

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

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "jest --coverage --verbose",
"test": "node --env-file=.env node_modules/.bin/jest --coverage --verbose",
"test:ci": "jest --coverage --verbose",
"build": "tsc --project tsconfig.json"
},
"devDependencies": {
Expand All @@ -33,8 +34,5 @@
"jest": "^29.7.0",
"typescript": "^5.8.2"
},
"dependencies": {
"dotenv": "^16.4.7"
},
"types": "dist/index.d.ts"
}
37 changes: 0 additions & 37 deletions src/api/apiManager.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/utils/configManager.ts → src/api/configManager.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { YepCodeApiConfig } from "../api/types";
import dotenv from "dotenv";

export class ConfigManager {
static readYepCodeEnvConfig(): any {
dotenv.config();
const envConfig = Object.entries(process.env)
.filter(([key]) => key.startsWith("YEPCODE_"))
.reduce<YepCodeApiConfig>((acc, [key, value]) => {
Expand Down
1 change: 0 additions & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from "./apiManager";
export * from "./yepcodeApi";
export * from "./types";
3 changes: 3 additions & 0 deletions src/api/yepcodeApi.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ConfigManager } from "./configManager";
import {
YepCodeApiConfig,
Process,
Expand Down Expand Up @@ -65,9 +66,11 @@ export class YepCodeApi {
`Global fetch API is not available. Please use Node.js 18+ or provide a global fetch polyfill (current node version: ${process.version})`
);
}
const envConfig = ConfigManager.readYepCodeEnvConfig();
const finalConfig = {
apiHost: "https://cloud.yepcode.io",
timeout: 60000,
...envConfig,
...config,
};
if (!finalConfig.authUrl) {
Expand Down
9 changes: 2 additions & 7 deletions src/env/yepcodeEnv.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import {
YepCodeApiManager,
YepCodeApi,
YepCodeApiConfig,
TeamVariable,
} from "../api";
import { YepCodeApi, YepCodeApiConfig, TeamVariable } from "../api";
import { EnvVar } from "../types";

export class YepCodeEnv {
private yepCodeApi: YepCodeApi;

constructor(config: YepCodeApiConfig = {}) {
this.yepCodeApi = YepCodeApiManager.getInstance(config);
this.yepCodeApi = new YepCodeApi(config);
}

getTeamId(): string {
Expand Down
4 changes: 2 additions & 2 deletions src/run/yepcodeRun.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import crypto from "crypto";
import { YepCodeApi, YepCodeApiError, YepCodeApiManager } from "../api";
import { YepCodeApi, YepCodeApiError } from "../api";
import { Execution } from "./execution";
import { YepCodeApiConfig } from "../api/types";
import { RunOpts, ExecutionError, Log } from "../types";
Expand All @@ -10,7 +10,7 @@ export class YepCodeRun {
private PROCESS_NAME_PREFIX: string;

constructor(config: YepCodeApiConfig = {}) {
this.yepCodeApi = YepCodeApiManager.getInstance(config);
this.yepCodeApi = new YepCodeApi(config);
this.PROCESS_NAME_PREFIX = "yepcode-run-";
}

Expand Down
4 changes: 2 additions & 2 deletions src/storage/yepcodeStorage.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { YepCodeApi, YepCodeApiManager } from "../api";
import { YepCodeApi } from "../api";
import { StorageObject, YepCodeApiConfig } from "../api/types";
import { Readable } from "stream";

export class YepCodeStorage {
private api: YepCodeApi;

constructor(config: YepCodeApiConfig = {}) {
this.api = YepCodeApiManager.getInstance(config);
this.api = new YepCodeApi(config);
}

async upload(
Expand Down
1 change: 0 additions & 1 deletion src/utils/index.ts

This file was deleted.