Skip to content

Commit

Permalink
chore: dependency updates (#5357)
Browse files Browse the repository at this point in the history
* chore: bump cpy to 11.0.0

* chore: bump get-port and remove get-port-please

* chore: bump execa

* chore: bump p-* packages

* chore: bump slash

* chore: bump query-string

* chore: bump mimic-fn

* chore: bump log-symbols

* chore: bump type-fest

* chore: bump p-event

* chore: bump which

* chore: bump username

* chore: fix execa in e2e

* chore: bump titleize

* chore: update tempy

* chore: bump cli-truncate

* chore: bump string-width

* chore: bump crypto-random-string

* chore: remove redundant types package

* fix: artifacts copy

* fix: another artifacts copy bug
  • Loading branch information
TimBeyer authored Nov 7, 2023
1 parent e446f43 commit cf38646
Show file tree
Hide file tree
Showing 40 changed files with 1,299 additions and 3,459 deletions.
42 changes: 20 additions & 22 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
"circular-json": "^0.5.9",
"cli-highlight": "^2.1.11",
"cli-table3": "^0.6.3",
"cli-truncate": "^2.1.0",
"cpy": "^8.1.2",
"cli-truncate": "^4.0.0",
"cpy": "^11.0.0",
"cross-spawn": "^7.0.3",
"crypto-random-string": "^3.3.1",
"crypto-random-string": "^5.0.0",
"date-fns": "^2.29.3",
"dedent": "^0.7.0",
"deline": "^1.0.4",
Expand All @@ -65,11 +65,10 @@
"env-var": "^7.3.0",
"eventemitter2": "^6.4.9",
"eventemitter3": "^5.0.0",
"execa": "^4.1.0",
"execa": "^8.0.1",
"fast-copy": "^3.0.1",
"fs-extra": "^11.1.1",
"get-port": "^5.1.1",
"get-port-please": "^3.1.1",
"get-port": "^7.0.0",
"glob": "^10.2.6",
"global-agent": "^3.0.0",
"got": "^13.0.0",
Expand Down Expand Up @@ -98,9 +97,9 @@
"koa-websocket": "^6.0.0",
"linewrap": "^0.2.1",
"lodash-es": "^4.17.21",
"log-symbols": "^4.1.0",
"log-symbols": "^6.0.0",
"micromatch": "^4.0.5",
"mimic-fn": "^3.1.0",
"mimic-fn": "^5.0.0",
"minimatch": "^7.1.1",
"minimist": "^1.2.8",
"moment": "^2.29.4",
Expand All @@ -110,11 +109,11 @@
"normalize-path": "^3.0.0",
"normalize-url": "^5.3.1",
"open": "^9.1.0",
"p-filter": "^2.1.0",
"p-map": "^4.0.0",
"p-props": "^4.0.0",
"p-filter": "^3.0.0",
"p-map": "^6.0.0",
"p-props": "^6.0.0",
"p-queue": "^7.4.1",
"p-retry": "^4.6.2",
"p-retry": "^6.1.0",
"parse-duration": "^1.0.2",
"parse-git-config": "^3.0.0",
"path-is-inside": "^1.0.2",
Expand All @@ -124,23 +123,23 @@
"proper-url-join": "^2.1.1",
"proxy-agent": "^6.3.1",
"qs": "^6.11.2",
"query-string": "^6.14.1",
"query-string": "^8.1.0",
"react": "^18.2.0",
"readdir-enhanced": "^6.0.4",
"respawn": "^2.6.0",
"semver": "^7.5.4",
"slash": "^3.0.0",
"slash": "^5.1.0",
"slice-ansi": "^4.0.0",
"source-map-support": "^0.5.21",
"split": "^1.0.1",
"split2": "^4.1.0",
"string-argv": "^0.3.2",
"string-width": "^4.2.3",
"string-width": "^7.0.0",
"strip-ansi": "^6.0.1",
"supertest": "^6.3.3",
"tar": "^6.1.13",
"tempy": "^1.0.1",
"titleize": "^2.1.0",
"tempy": "^3.1.0",
"titleize": "^4.0.0",
"tmp-promise": "^3.0.3",
"toposort": "^2.0.2",
"touch": "^3.1.0",
Expand All @@ -150,9 +149,9 @@
"uniqid": "^5.4.0",
"unixify": "^1.0.0",
"unzip-stream": "^0.3.1",
"username": "^5.1.0",
"username": "^6.0.0",
"uuid": "^9.0.0",
"which": "^3.0.0",
"which": "^4.0.0",
"winston": "^3.8.2",
"wrap-ansi": "^7.0.0",
"write-file-atomic": "^5.0.0",
Expand Down Expand Up @@ -213,7 +212,6 @@
"@types/sinon": "^10.0.14",
"@types/slice-ansi": "^4.0.0",
"@types/split2": "^3.2.1",
"@types/string-argv": "^0.3.0",
"@types/supertest": "^2.0.12",
"@types/tar": "^6.1.4",
"@types/touch": "^3.1.2",
Expand All @@ -238,7 +236,7 @@
"mocha": "^10.2.0",
"nock": "^12.0.3",
"nodemon": "^3.0.1",
"p-event": "^4.2.0",
"p-event": "^6.0.0",
"peggy": "^3.0.2",
"prettier": "3.0.0",
"ps-tree": "^1.2.0",
Expand All @@ -247,7 +245,7 @@
"sinon": "^15.0.4",
"testdouble": "^3.17.2",
"timekeeper": "^2.2.0",
"type-fest": "^3.12.0",
"type-fest": "^4.6.0",
"typescript": "^5.1.3",
"utility-types": "^3.10.0"
},
Expand Down
4 changes: 2 additions & 2 deletions core/src/commands/cloud/secrets/secrets-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { stringify } from "query-string"
import queryString from "query-string"
import { ConfigurationError, CloudApiError } from "../../../exceptions.js"
import type { ListSecretsResponse } from "@garden-io/platform-api-types"

Expand All @@ -29,7 +29,7 @@ export const fetchAllSecrets = async (api: CloudApi, projectId: string, log: Log
let hasMore = true
while (hasMore) {
log.debug(`Fetching page ${page}`)
const q = stringify({ projectId, offset: page * pageLimit, limit: pageLimit })
const q = queryString.stringify({ projectId, offset: page * pageLimit, limit: pageLimit })
const res = await api.get<ListSecretsResponse>(`/secrets?${q}`)
if (res.data.length === 0) {
hasMore = false
Expand Down
2 changes: 1 addition & 1 deletion core/src/commands/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import chalk from "chalk"
import execa from "execa"
import { execa } from "execa"
import { apply as jsonMerge } from "json-merge-patch"
import cloneDeep from "fast-copy"
import { keyBy, mapValues, flatten } from "lodash-es"
Expand Down
2 changes: 1 addition & 1 deletion core/src/garden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ import {
import { dedent, deline, naturalList, wordWrap } from "./util/string.js"
import { DependencyGraph } from "./graph/common.js"
import { Profile, profileAsync } from "./util/profiling.js"
import username from "username"
import { username } from "username"
import {
throwOnMissingSecretKeys,
resolveTemplateString,
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/exec/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export async function copyArtifacts(
// Note: lazy-loading for startup performance
const { default: cpy } = await import("cpy")

await cpy(spec.source, join(artifactsPath, spec.target || "."), { cwd: from })
await cpy(`./${spec.source}`, join(artifactsPath, spec.target || "."), { cwd: from })
})
)
}
5 changes: 3 additions & 2 deletions core/src/plugins/exec/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import type { ExecOpts } from "../../util/util.js"
import { sleep } from "../../util/util.js"
import { TimeoutError } from "../../exceptions.js"
import type { Log } from "../../logger/log-entry.js"
import execa from "execa"
import type { ExecaReturnBase } from "execa"
import { execa } from "execa"
import chalk from "chalk"
import { renderMessageWithDivider } from "../../logger/util.js"
import { LogLevel } from "../../logger/logger.js"
Expand Down Expand Up @@ -266,7 +267,7 @@ export async function deployPersistentExecService({

if (spec.statusCommand) {
let ready = false
let lastStatusResult: execa.ExecaReturnBase<string> | undefined
let lastStatusResult: ExecaReturnBase<string> | undefined

while (!ready) {
await sleep(persistentLocalProcRetryIntervalMs)
Expand Down
4 changes: 2 additions & 2 deletions core/src/plugins/kubernetes/helm/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { flatten, isPlainObject } from "lodash-es"
import { join, resolve } from "path"
import fsExtra from "fs-extra"
const { pathExists, readFile, remove, writeFile } = fsExtra
import tempy from "tempy"
import { temporaryWrite } from "tempy"
import cryptoRandomString from "crypto-random-string"

import type { PluginContext } from "../../../plugin-context.js"
Expand Down Expand Up @@ -101,7 +101,7 @@ export async function prepareTemplates({ ctx, action, log }: PrepareTemplatesPar
version: action.versionString(),
}

const valuesPath = await tempy.write(safeDumpYaml(values))
const valuesPath = await temporaryWrite(safeDumpYaml(values))
log.silly(`Wrote chart values to ${valuesPath}`)

const releaseName = getReleaseName(action)
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/kubernetes/port-forward.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type { ForwardablePort } from "../../types/service.js"
import { isBuiltIn, matchSelector } from "./util.js"
import type { Log } from "../../logger/log-entry.js"
import { RuntimeError } from "../../exceptions.js"
import execa from "execa"
import { execa } from "execa"
import type { KubernetesDeployAction } from "./kubernetes-type/config.js"
import type { HelmDeployAction } from "./helm/config.js"
import type { DeployAction } from "../../actions/deploy.js"
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/octant/octant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { dedent } from "../../util/string.js"
import type { GetDashboardPageParams } from "../../plugin/handlers/Provider/getDashboardPage.js"
import type { ExecaChildProcess } from "execa"
import execa from "execa"
import { execa } from "execa"
import getPort from "get-port"
import { getK8sProvider } from "../kubernetes/util.js"
import { createGardenPlugin } from "../../plugin/plugin.js"
Expand Down
7 changes: 2 additions & 5 deletions core/src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import Router from "koa-router"
import type PTY from "node-pty-prebuilt-multiarch"
import websockify from "koa-websocket"
import bodyParser from "koa-bodyparser"
// TODO: switch from get-port-please to get-port once get-port is upgraded to v6.0+ which is ESM only
import * as getPortPlease from "get-port-please"
const { getPort } = getPortPlease
import getPort, { portNumbers } from "get-port"
import { isArray, omit } from "lodash-es"

import type { BaseServerRequest } from "./commands.js"
Expand Down Expand Up @@ -224,8 +222,7 @@ export class GardenServer extends EventEmitter {
try {
this.port = await getPort({
host: hostname,
port: defaultServerPort,
portRange: [defaultServerPort + 1, defaultServerPort + 99],
port: portNumbers(defaultServerPort, defaultServerPort + 99),
})
await _start()
serverStarted = true
Expand Down
2 changes: 1 addition & 1 deletion core/src/util/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export async function copyArtifacts({
const { default: cpy } = await import("cpy")

try {
files = await cpy("**/*", garden.artifactsPath, { cwd: artifactsPath, parents: true })
files = await cpy("./**/*", garden.artifactsPath, { cwd: artifactsPath })
} catch (err) {
if (!(err instanceof Error)) {
throw err
Expand Down
3 changes: 2 additions & 1 deletion core/src/util/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import _urlJoin from "proper-url-join"
import _stableStringify from "json-stable-stringify"
import _titleize from "titleize"
import CliTable from "cli-table3"
import type { Options as CliTruncateOptions } from "cli-truncate"
import cliTruncate from "cli-truncate"
import { getTerminalWidth } from "../logger/util.js"
import wrapAnsi from "wrap-ansi"
Expand Down Expand Up @@ -165,7 +166,7 @@ export function wordWrap(text: string, maxWidth: number, opts: any = {}) {
* @param length maximum length of the output text
* @param opts options passed to `cli-truncate`
*/
export function truncate(text: string, length: number, opts: cliTruncate.Options = {}) {
export function truncate(text: string, length: number, opts: CliTruncateOptions = {}) {
return cliTruncate(text, length, opts)
}

Expand Down
14 changes: 9 additions & 5 deletions core/src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
some,
uniqBy,
} from "lodash-es"
import type { Options as PMapOptions } from "p-map"
import pMap from "p-map"
import pProps from "p-props"
import { isAbsolute, relative } from "node:path"
Expand All @@ -47,7 +48,8 @@ import type { Log } from "../logger/log-entry.js"
import { getDefaultProfiler } from "./profiling.js"
import { dedent, naturalList, tailString } from "./string.js"
import split2 from "split2"
import execa from "execa"
import type { ExecaError, Options as ExecaOptions } from "execa"
import { execa } from "execa"
import corePackageJson from "../../package.json" assert { type: "json" }

export { apply as jsonMerge } from "json-merge-patch"
Expand Down Expand Up @@ -189,7 +191,7 @@ export function createOutputStream(log: Log, origin?: string) {

return outputStream
}
export interface ExecOpts extends execa.Options {
export interface ExecOpts extends ExecaOptions {
stdout?: Writable
stderr?: Writable
}
Expand Down Expand Up @@ -233,7 +235,7 @@ export async function exec(cmd: string, args: string[], opts: ExecOpts = {}) {
})
}

const error = <execa.ExecaError>err
const error = <ExecaError>err
throw new ChildProcessError({
cmd,
args,
Expand Down Expand Up @@ -396,7 +398,9 @@ export async function deepResolve<T>(
if (isArray(value)) {
return await pMap(value, deepResolve)
} else if (isPlainObject(value)) {
return await pProps(<ResolvableProps<T>>mapValues(<ResolvableProps<T>>value, deepResolve))
return (await pProps(<ResolvableProps<T>>mapValues(<ResolvableProps<T>>value, deepResolve))) as {
[K in keyof T]: T[K]
}
} else {
return Promise.resolve(<T>value)
}
Expand All @@ -411,7 +415,7 @@ type DeepMappable = any | ArrayLike<DeepMappable> | { [k: string]: DeepMappable
export async function asyncDeepMap<T extends DeepMappable>(
obj: T,
mapper: (value) => Promise<any>,
options?: pMap.Options
options?: PMapOptions
): Promise<T> {
if (isArray(obj)) {
return <any>pMap(obj, (v) => asyncDeepMap(v, mapper, options), options)
Expand Down
5 changes: 3 additions & 2 deletions core/src/vcs/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import AsyncLock from "async-lock"
import PQueue from "p-queue"
import { isSha1 } from "../util/hashing.js"
import split2 from "split2"
import execa from "execa"
import type { ExecaError } from "execa"
import { execa } from "execa"
import hasha from "hasha"

const gitConfigAsyncLock = new AsyncLock()
Expand Down Expand Up @@ -560,7 +561,7 @@ export class GitHandler extends VcsHandler {

proc.stdout?.pipe(splitStream)

void proc.on("error", (err: execa.ExecaError) => {
void proc.on("error", (err: ExecaError) => {
if (err.exitCode !== 128) {
fail(err)
}
Expand Down
2 changes: 1 addition & 1 deletion core/test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { defaultDotIgnoreFile, makeTempDir } from "../src/util/fs.js"
import type { DirectoryResult } from "tmp-promise"
import type tmp from "tmp-promise"
import { ConfigurationError } from "../src/exceptions.js"
import execa from "execa"
import { execa } from "execa"
import timekeeper from "timekeeper"
import type { ManyActionTypeDefinitions } from "../src/plugin/action-types.js"
import type { ProjectConfig } from "../src/config/project.js"
Expand Down
2 changes: 1 addition & 1 deletion core/test/integ/src/plugins/hadolint/hadolint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import tmp from "tmp-promise"
import type { ProjectConfig } from "../../../../../src/config/project.js"
import execa from "execa"
import { execa } from "execa"
import { DEFAULT_BUILD_TIMEOUT_SEC, GardenApiVersion } from "../../../../../src/constants.js"
import { createProjectConfig, getDataDir, TestGarden } from "../../../../helpers.js"
import { expect } from "chai"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { expect } from "chai"
import execa from "execa"
import { execa } from "execa"
import cloneDeep from "fast-copy"

import tmp from "tmp-promise"
Expand Down
2 changes: 1 addition & 1 deletion core/test/integ/src/plugins/kubernetes/volume/configmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import type tmp from "tmp-promise"
import type { ProjectConfig } from "../../../../../../src/config/project.js"
import execa from "execa"
import { execa } from "execa"
import { DEFAULT_BUILD_TIMEOUT_SEC, GardenApiVersion } from "../../../../../../src/constants.js"
import { expect } from "chai"
import { TestGarden, makeTempDir, createProjectConfig } from "../../../../../helpers.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import type tmp from "tmp-promise"
import type { ProjectConfig } from "../../../../../../src/config/project.js"
import execa from "execa"
import { execa } from "execa"
import { DEFAULT_BUILD_TIMEOUT_SEC, GardenApiVersion } from "../../../../../../src/constants.js"
import { expect } from "chai"
import { TestGarden, makeTempDir, createProjectConfig } from "../../../../../helpers.js"
Expand Down
2 changes: 1 addition & 1 deletion core/test/unit/src/vcs/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import execa from "execa"
import { execa } from "execa"
import { expect } from "chai"
import tmp from "tmp-promise"
import fsExtra from "fs-extra"
Expand Down
Loading

0 comments on commit cf38646

Please sign in to comment.