Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/site/webpack-dev-mid…
Browse files Browse the repository at this point in the history
…dleware-5.3.4
  • Loading branch information
Roy Razon authored Mar 28, 2024
2 parents d985f21 + aa60a4b commit 0a581ce
Show file tree
Hide file tree
Showing 45 changed files with 2,928 additions and 3,777 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
done
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
draft: ${{ !startsWith(github.ref, 'refs/tags/') }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"syncpack": "11.2.1",
"typescript": "^5.3.3"
"typescript": "^5.4.3"
},
"resolutions": {
"**/@oclif/core": "^3.15.1"
Expand Down
8 changes: 4 additions & 4 deletions packages/cli-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"@jest/globals": "29.7.0",
"@types/lodash-es": "^4.17.12",
"@types/node": "18",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"eslint": "^8.36.0",
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"eslint": "^8.57.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "27.4.2",
Expand All @@ -36,7 +36,7 @@
"lint-staged": "^15.2.0",
"shx": "^0.3.3",
"tslib": "^2.5.0",
"typescript": "^5.3.3"
"typescript": "^5.4.3"
},
"scripts": {
"lint": "eslint . --ext .ts,.tsx --cache",
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"@types/lodash-es": "^4.17.12",
"@types/node": "18",
"@types/shell-escape": "^0.2.1",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"eslint": "^8.36.0",
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"eslint": "^8.57.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-oclif": "^4",
"eslint-config-oclif-typescript": "^1.0.3",
Expand All @@ -68,7 +68,7 @@
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"tslib": "^2.5.0",
"typescript": "^5.3.3"
"typescript": "^5.4.3"
},
"oclif": {
"bin": "preevy",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/drivers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import kubePod from '@preevy/driver-kube-pod'
import { Flag } from '@oclif/core/lib/interfaces'
import { Interfaces } from '@oclif/core'
import { formatFlagsToArgs } from '@preevy/cli-common'
import {} from '@preevy/core' // https://github.com/microsoft/TypeScript/issues/47663#issuecomment-1270716220

export const machineDrivers = {
lightsail,
Expand Down
18 changes: 9 additions & 9 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@
"http-proxy": "^1.18.1",
"lodash-es": "^4.17.21",
"p-limit": "^3.1.0",
"pino": "^8.11.0",
"pino-pretty": "^10.2.3",
"pino": "^8.19.0",
"pino-pretty": "^10.3.1",
"ssh2": "^1.12.0"
},
"devDependencies": {
"@jest/globals": "29.7.0",
"@types/dockerode": "^3.3.14",
"@types/dockerode": "^3.3.26",
"@types/lodash-es": "^4.17.12",
"@types/node": "18",
"@types/shell-escape": "^0.2.1",
"@types/ssh2": "^1.11.8",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"esbuild": "^0.19.9",
"eslint": "^8.36.0",
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"esbuild": "^0.19.12",
"eslint": "^8.57.0",
"husky": "^8.0.0",
"jest": "29.7.0",
"lint-staged": "^15.2.0",
"ts-jest": "29.1.1",
"ts-jest": "29.1.2",
"tsx": "^3.12.3",
"typescript": "^5.3.3",
"typescript": "^5.4.3",
"yaml": "^2.3.2"
},
"scripts": {
Expand Down
16 changes: 8 additions & 8 deletions packages/compose-tunnel-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,33 @@
"http-proxy": "^1.18.1",
"lodash-es": "^4.17.21",
"p-limit": "^3.1.0",
"pino": "^8.11.0",
"pino-pretty": "^10.2.3",
"pino": "^8.19.0",
"pino-pretty": "^10.3.1",
"rimraf": "^5.0.5",
"ssh2": "^1.12.0",
"ws": "^8.13.0",
"zod": "^3.21.4"
},
"devDependencies": {
"@jest/globals": "29.7.0",
"@types/dockerode": "^3.3.14",
"@types/dockerode": "^3.3.26",
"@types/http-proxy": "^1.17.9",
"@types/lodash-es": "^4.17.12",
"@types/node": "18",
"@types/node-fetch": "^2.6.3",
"@types/shell-escape": "^0.2.1",
"@types/ssh2": "^1.11.8",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"esbuild": "^0.19.9",
"eslint": "^8.36.0",
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"esbuild": "^0.19.12",
"eslint": "^8.57.0",
"husky": "^8.0.0",
"jest": "29.7.0",
"lint-staged": "^15.2.0",
"shx": "^0.3.3",
"strip-ansi": "6.0.0",
"tsx": "^3.12.3",
"typescript": "^5.3.3",
"typescript": "^5.4.3",
"wait-for-expect": "^3.0.2"
},
"scripts": {
Expand Down
46 changes: 34 additions & 12 deletions packages/compose-tunnel-agent/src/api-server/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import { AddressInfo } from 'node:net'
import { describe, expect, beforeAll, afterAll, jest, it } from '@jest/globals'
import { ChildProcess, spawn, exec } from 'child_process'
import { pino } from 'pino'
import pinoPrettyModule from 'pino-pretty'
import * as pino from 'pino'
import pinoPretty from 'pino-pretty'
import Dockerode from 'dockerode'
import { inspect, promisify } from 'node:util'
import waitForExpectModule from 'wait-for-expect'
import waitForExpect from 'wait-for-expect'
import WebSocket from 'ws'
import stripAnsi from 'strip-ansi'
import { createApp } from './index.js'
import { filteredClient } from '../docker/index.js'
import { SshState } from '../ssh/index.js'
import { COMPOSE_PROJECT_LABEL } from '../docker/labels.js'

const PinoPretty = pinoPrettyModule.default

const waitForExpect = waitForExpectModule.default
const TEST_COMPOSE_PROJECT = 'my-project'

const setupDockerContainer = () => {
Expand Down Expand Up @@ -57,9 +54,12 @@ const setupDockerContainer = () => {
}

const setupApiServer = () => {
const log = pino({
level: 'debug',
}, PinoPretty({ destination: pino.destination(process.stderr) }))
const log = pino.pino(
{ level: 'debug' },
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
pinoPretty({ destination: pino.destination(process.stderr) }),
)

let app: Awaited<ReturnType<typeof createApp>>
let serverBaseUrl: string
Expand Down Expand Up @@ -134,6 +134,8 @@ describe('docker api', () => {

const waitForContainerId = async () => {
let containerId = ''
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await waitForExpect(async () => {
const containers = await fetchJson(`http://${serverBaseUrl()}/containers`) as { Id: string; Names: string[] }[]
const container = containers.find(({ Names: names }) => names.includes(`/${containerName()}`))
Expand All @@ -153,8 +155,14 @@ describe('docker api', () => {
describe('tty=true', () => {
it('should communicate via websocket', async () => {
const { receivedBuffers, send, close } = await openWebSocket(`ws://${serverBaseUrl()}/containers/${containerId}/exec`)
await waitForExpect(() => expect(receivedBuffers.length).toBeGreaterThan(0))
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await waitForExpect(
() => expect(receivedBuffers.length).toBeGreaterThan(0),
)
await send('ls \n')
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await waitForExpect(() => {
const received = stripAnsi(Buffer.concat(receivedBuffers).toString('utf-8'))
expect(received).toMatch(/#/)
Expand All @@ -168,6 +176,8 @@ describe('docker api', () => {
describe('tty=false', () => {
it('should communicate via websocket', async () => {
const { receivedBuffers, send, close } = await openWebSocket(`ws://${serverBaseUrl()}/containers/${containerId}/exec`)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await waitForExpect(async () => {
await send('ls\n')
const received = Buffer.concat(receivedBuffers).toString('utf-8')
Expand All @@ -191,8 +201,14 @@ describe('docker api', () => {
describe(`${s.join(' and ')}`, () => {
it(`should show the ${s.join(' and ')} logs via websocket`, async () => {
const { receivedBuffers, close } = await openWebSocket(`ws://${serverBaseUrl()}/containers/${containerId}/logs?${s.map(st => `${st}=true`).join('&')}`)
await waitForExpect(() => expect(receivedBuffers.length).toBeGreaterThan(0))
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await waitForExpect(
() => expect(receivedBuffers.length).toBeGreaterThan(0),
)
const length1 = receivedBuffers.length
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await waitForExpect(() => {
const received = Buffer.concat(receivedBuffers).toString('utf-8')
s.forEach(st => {
Expand All @@ -202,6 +218,8 @@ describe('docker api', () => {
expect(received).not.toContain(`hello ${st}`)
})
})
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await waitForExpect(() => {
expect(receivedBuffers.length).toBeGreaterThan(length1)
})
Expand All @@ -217,7 +235,11 @@ describe('docker api', () => {
describe('timestamps', () => {
it('should show the logs with a timestamp', async () => {
const { receivedBuffers, close } = await openWebSocket(`ws://${serverBaseUrl()}/containers/${containerId}/logs?stdout=true&timestamps=true`)
await waitForExpect(() => expect(receivedBuffers.length).toBeGreaterThan(0))
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await waitForExpect(
() => expect(receivedBuffers.length).toBeGreaterThan(0),
)
const received = Buffer.concat(receivedBuffers).toString('utf-8')
expect(received).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d*Z/)
await close()
Expand Down
2 changes: 1 addition & 1 deletion packages/compose-tunnel-agent/src/docker/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const filters = ({

const listContainers = async () => await docker.listContainers({
all: true,
filters: { ...apiFilter },
filters: JSON.stringify({ ...apiFilter }),
})

const adhocFilter = (c: Pick<Docker.ContainerInfo, 'Labels'>): boolean => (
Expand Down
12 changes: 6 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"ora": "5.4.1",
"p-limit": "^3.1.0",
"p-memoize": "^4",
"p-queue": "^6.6.2",
"p-queue": "^8.0.1",
"p-retry": "^4.6.2",
"rimraf": "^5.0.5",
"shell-escape": "^0.2.0",
Expand Down Expand Up @@ -56,9 +56,9 @@
"@types/sshpk": "^1.17.1",
"@types/tar": "^6.1.4",
"@types/tar-stream": "^2.2.2",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"eslint": "^8.36.0",
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"eslint": "^8.57.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "27.4.2",
Expand All @@ -67,10 +67,10 @@
"jest": "29.7.0",
"lint-staged": "^15.2.0",
"shx": "^0.3.3",
"ts-jest": "29.1.1",
"ts-jest": "29.1.2",
"ts-node": "^10.9.1",
"tslib": "^2.5.0",
"typescript": "^5.3.3"
"typescript": "^5.4.3"
},
"scripts": {
"test": "node --no-warnings=ExperimentalWarning --experimental-vm-modules ../../node_modules/.bin/jest",
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/upload-files/walk.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import fs from 'fs'
import PQueueModule from 'p-queue'
import PQueue from 'p-queue'
import { DirInfo, FileInfo } from './files.js'

const PQueue = PQueueModule.default
const readDir = async (filename: string) => await fs.promises.readdir(filename)

const normalizeFile = async (local: string | FileInfo | DirInfo) => {
Expand Down
8 changes: 4 additions & 4 deletions packages/driver-azure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"@types/inquirer-autocomplete-prompt": "^3.0.3",
"@types/lodash-es": "^4.17.12",
"@types/node": "18",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"eslint": "^8.36.0",
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"eslint": "^8.57.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-oclif": "^4",
"eslint-config-oclif-typescript": "^1.0.3",
Expand All @@ -50,7 +50,7 @@
"shx": "^0.3.3",
"ts-node": "^10.9.1",
"tslib": "^2.5.0",
"typescript": "^5.3.3"
"typescript": "^5.4.3"
},
"scripts": {
"lint": "eslint . --ext .ts,.tsx --cache",
Expand Down
8 changes: 4 additions & 4 deletions packages/driver-gce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"@types/inquirer-autocomplete-prompt": "^3.0.3",
"@types/lodash-es": "^4.17.12",
"@types/node": "18",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"eslint": "^8.36.0",
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"eslint": "^8.57.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-oclif": "^4",
"eslint-config-oclif-typescript": "^1.0.3",
Expand All @@ -44,7 +44,7 @@
"shx": "^0.3.3",
"ts-node": "^10.9.1",
"tslib": "^2.5.0",
"typescript": "^5.3.3"
"typescript": "^5.4.3"
},
"scripts": {
"lint": "eslint . --ext .ts,.tsx --cache",
Expand Down
8 changes: 4 additions & 4 deletions packages/driver-kube-pod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"@types/lodash-es": "^4.17.12",
"@types/node": "18",
"@types/stream-buffers": "^3.0.4",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"eslint": "^8.36.0",
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"eslint": "^8.57.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-oclif": "^4",
"eslint-config-oclif-typescript": "^1.0.3",
Expand All @@ -46,7 +46,7 @@
"shx": "^0.3.3",
"ts-node": "^10.9.1",
"tslib": "^2.5.0",
"typescript": "^5.3.3"
"typescript": "^5.4.3"
},
"scripts": {
"test": "node --no-warnings=ExperimentalWarning --experimental-vm-modules ../../node_modules/.bin/jest",
Expand Down
1 change: 1 addition & 0 deletions packages/driver-kube-pod/src/driver/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { flags, factory } from './driver.js'
import { flags as machineCreationFlags, factory as machineCreationFactory } from './creation-driver.js'
import { inquireFlags } from './questions.js'
import type {} from '@preevy/core' // https://github.com/microsoft/TypeScript/issues/47663#issuecomment-1270716220

export type { StatefulSetMachine, DeploymentMachine, ResourceType } from './common.js'
export type { MachineCreationFlagTypes } from './creation-driver.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/driver-kube-pod/static/default-template.yaml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
serviceAccountName: {{ id }}-sa
containers:
- name: docker
image: docker:24-dind
image: docker:24.0.7-dind-alpine3.18
securityContext:
privileged: true
command: ["dockerd", "--host=tcp://0.0.0.0:2375", "--host=unix:///var/run/docker.sock"]
Expand Down
Loading

0 comments on commit 0a581ce

Please sign in to comment.