Skip to content

Commit

Permalink
Merge pull request #15126 from Budibase/typescript-5.7
Browse files Browse the repository at this point in the history
Update to TypeScript 5.7.2.
  • Loading branch information
samwho authored Dec 5, 2024
2 parents 63a5821 + 9f7f28a commit 9231b58
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 152 deletions.
2 changes: 1 addition & 1 deletion examples/nextjs-api-sales/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"@types/react": "17.0.39",
"eslint": "8.10.0",
"eslint-config-next": "12.1.0",
"typescript": "5.5.2"
"typescript": "5.7.2"
}
}
4 changes: 4 additions & 0 deletions globalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ async function killContainers(containers: ContainerInfo[]) {
}

export default async function setup() {
process.env.TESTCONTAINERS_RYUK_DISABLED = "true"

// For whatever reason, testcontainers doesn't always use the correct current
// docker context. This bit of code forces the issue by finding the current
// context and setting it as the DOCKER_HOST environment
Expand Down Expand Up @@ -75,6 +77,7 @@ export default async function setup() {

try {
const couchdb = new GenericContainer("budibase/couchdb:v3.3.3-sqs-v2.1.1")
.withName("couchdb_testcontainer")
.withExposedPorts(5984, 4984)
.withEnvironment({
COUCHDB_PASSWORD: "budibase",
Expand All @@ -99,6 +102,7 @@ export default async function setup() {
)

const minio = new GenericContainer("minio/minio")
.withName("minio_testcontainer")
.withExposedPorts(9000)
.withCommand(["server", "/data"])
.withTmpFs({ "/data": "rw" })
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"proper-lockfile": "^4.1.2",
"svelte": "4.2.19",
"svelte-eslint-parser": "^0.33.1",
"typescript": "5.5.2",
"typescript": "5.7.2",
"typescript-eslint": "^7.3.1",
"yargs": "^17.7.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/backend-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
"nock": "^13.5.6",
"pino-pretty": "10.0.0",
"pouchdb-adapter-memory": "7.2.2",
"testcontainers": "^10.7.2",
"testcontainers": "10.16.0",
"timekeeper": "2.2.0",
"typescript": "5.5.2"
"typescript": "5.7.2"
},
"nx": {
"targets": {
Expand Down
2 changes: 1 addition & 1 deletion packages/backend-core/src/redis/tests/redis.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("redis", () => {
let container: StartedTestContainer

beforeAll(async () => {
const container = await new GenericContainer("redis")
container = await new GenericContainer("redis")
.withExposedPorts(6379)
.start()

Expand Down
21 changes: 3 additions & 18 deletions packages/backend-core/tests/core/utilities/testContainerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ function getTestcontainers(): ContainerInfo[] {
)
}

function removeContainer(container: ContainerInfo) {
execSync(`docker rm ${container.ID}`)
}

export function getContainerByImage(image: string) {
const containers = getTestcontainers().filter(x => x.Image.startsWith(image))
if (containers.length > 1) {
Expand All @@ -53,10 +49,6 @@ export function getContainerByImage(image: string) {
return containers[0]
}

function getContainerByName(name: string) {
return getTestcontainers().find(x => x.Names === name)
}

export function getContainerById(id: string) {
return getTestcontainers().find(x => x.ID === id)
}
Expand Down Expand Up @@ -98,6 +90,8 @@ function getCurrentDockerContext(): DockerContext {
}

export function setupEnv(...envs: any[]) {
process.env.TESTCONTAINERS_RYUK_DISABLED = "true"

// For whatever reason, testcontainers doesn't always use the correct current
// docker context. This bit of code forces the issue by finding the current
// context and setting it as the DOCKER_HOST environment
Expand Down Expand Up @@ -153,19 +147,10 @@ export async function startContainer(container: GenericContainer) {
key = key.replace(/\//g, "-").replace(/:/g, "-")
const name = `${key}_testcontainer`

// If a container has died it hangs around and future attempts to start a
// container with the same name will fail. What we do here is if we find a
// matching container and it has exited, we remove it before carrying on. This
// removes the need to do this removal manually.
const existingContainer = getContainerByName(name)
if (existingContainer?.State === "exited") {
removeContainer(existingContainer)
}

container = container
.withReuse()
.withLabels({ "com.budibase": "true" })
.withName(`${key}_testcontainer`)
.withName(name)

let startedContainer: StartedTestContainer | undefined = undefined
let lastError = undefined
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"@types/node-fetch": "2.6.4",
"@types/pouchdb": "^6.4.0",
"ts-node": "10.8.1",
"typescript": "5.5.2"
"typescript": "5.7.2"
}
}
2 changes: 1 addition & 1 deletion packages/pro
Submodule pro updated from 7b8789 to 5321c7
4 changes: 2 additions & 2 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@
"rimraf": "3.0.2",
"supertest": "6.3.3",
"swagger-jsdoc": "6.1.0",
"testcontainers": "10.7.2",
"testcontainers": "10.16.0",
"timekeeper": "2.2.0",
"ts-node": "10.8.1",
"tsconfig-paths": "4.0.0",
"typescript": "5.5.2",
"typescript": "5.7.2",
"update-dotenv": "1.1.1",
"yargs": "^13.2.4",
"zod": "^3.23.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/shared-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"devDependencies": {
"rimraf": "3.0.2",
"typescript": "5.5.2"
"typescript": "5.7.2"
},
"nx": {
"targets": {
Expand Down
2 changes: 1 addition & 1 deletion packages/string-templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "29.1.1",
"typescript": "5.5.2"
"typescript": "5.7.2"
}
}
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@types/koa": "2.13.4",
"@types/redlock": "4.0.7",
"rimraf": "3.0.2",
"typescript": "5.5.2",
"typescript": "5.7.2",
"koa-useragent": "^4.1.0",
"zod": "^3.23.8"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"superagent": "^10.1.1",
"supertest": "6.3.3",
"timekeeper": "2.2.0",
"typescript": "5.5.2",
"typescript": "5.7.2",
"update-dotenv": "1.1.1"
},
"nx": {
Expand Down
Loading

0 comments on commit 9231b58

Please sign in to comment.