Skip to content

Commit

Permalink
chore: fix import paths for execa upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
mrstork committed May 21, 2024
1 parent 8f3130d commit 1363cec
Show file tree
Hide file tree
Showing 27 changed files with 33 additions and 36 deletions.
4 changes: 2 additions & 2 deletions e2e/install.e2e.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { readFileSync, existsSync } from 'fs'
import { existsSync, readFileSync } from 'fs'
import { mkdir } from 'fs/promises'
import { platform } from 'os'
import { join, resolve } from 'path'
import { env } from 'process'
import { fileURLToPath } from 'url'

import execa from 'execa'
import { execa } from 'execa'
import { expect, test } from 'vitest'

import { packageManagerConfig, packageManagerExists } from './utils.js'
Expand Down
2 changes: 1 addition & 1 deletion scripts/prepare-for-publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readFile, writeFile } from 'fs/promises'
import { dirname, join } from 'path'
import { fileURLToPath } from 'url'

import execa from 'execa'
import { execa } from 'execa'
import ora from 'ora'

// These scripts from package.json need to be preserved on publish
Expand Down
2 changes: 1 addition & 1 deletion src/commands/dev/dev-exec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { OptionValues } from 'commander'
import execa from 'execa'
import { execa } from 'execa'

import { getDotEnvVariables, injectEnvVariables } from '../../utils/dev.js'
import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.js'
Expand Down
1 change: 1 addition & 0 deletions src/lib/exec-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const shouldFetchLatestVersion = async ({
return false
}

// @ts-expect-error TS(2339) Property 'match' does not exist on type 'never'
const match = stdout.match(new RegExp(pattern))
if (!match) {
return false
Expand Down
2 changes: 1 addition & 1 deletion src/recipes/vscode/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join } from 'path'

import { DenoBridge } from '@netlify/edge-bundler'
import execa from 'execa'
import { execa } from 'execa'
import inquirer from 'inquirer'

import { NETLIFYDEVLOG, NETLIFYDEVWARN, chalk, error, log } from '../../utils/command-helpers.js'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/execa.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { env } from 'process'

import execaLib from 'execa'
import { execa as execaLib } from 'execa'

// This is a thin layer on top of `execa` that allows consumers to provide an
// alternative path to the module location, making it easier to mock its logic
Expand Down
2 changes: 1 addition & 1 deletion src/utils/lm/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path, { join, sep } from 'path'
import process from 'process'
import { fileURLToPath } from 'url'

import execa from 'execa'
import { execa } from 'execa'
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'hasb... Remove this comment to see the full error message
import hasbin from 'hasbin'
import { Listr } from 'listr2'
Expand Down
10 changes: 3 additions & 7 deletions src/utils/shell.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import process from 'process'

import execa from 'execa'
import { execaCommand } from 'execa'
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'stri... Remove this comment to see the full error message
import stripAnsiCc from 'strip-ansi-control-characters'

Expand Down Expand Up @@ -54,7 +54,7 @@ const cleanupBeforeExit = async ({ exitCode }) => {
export const runCommand = (command, options = {}) => {
// @ts-expect-error TS(2339) FIXME: Property 'cwd' does not exist on type '{}'.
const { cwd, env = {}, spinner = null } = options
const commandProcess = execa.command(command, {
const commandProcess = execaCommand(command, {
preferLocal: true,
// we use reject=false to avoid rejecting synchronously when the command doesn't exist
reject: false,
Expand Down Expand Up @@ -84,11 +84,8 @@ export const runCommand = (command, options = {}) => {
})
}

// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
commandProcess.stdout.pipe(stripAnsiCc.stream()).on('data', pipeDataWithSpinner.bind(null, process.stdout))
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
commandProcess.stderr.pipe(stripAnsiCc.stream()).on('data', pipeDataWithSpinner.bind(null, process.stderr))
// @ts-expect-error TS(2345) FIXME: Argument of type 'Writable | null' is not assignab... Remove this comment to see the full error message
process.stdin.pipe(commandProcess.stdin)

// we can't try->await->catch since we don't want to block on the framework server which
Expand All @@ -107,8 +104,7 @@ export const runCommand = (command, options = {}) => {
)
} else {
const errorMessage = result.failed
? // @ts-expect-error TS(2339) FIXME: Property 'shortMessage' does not exist on type 'Ex... Remove this comment to see the full error message
`${NETLIFYDEVERR} ${result.shortMessage}`
? `${NETLIFYDEVERR} ${result.shortMessage}`
: `${NETLIFYDEVWARN} "${command}" exited with code ${result.exitCode}`

log(`${errorMessage}. Shutting down Netlify Dev server`)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/commands/build/build.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path'
import process from 'process'

import execa from 'execa'
import { execa } from 'execa'
import { describe, test } from 'vitest'

import { cliPath } from '../../utils/cli-path.js'
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/commands/deploy/deploy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path'
import process from 'process'
import { fileURLToPath } from 'url'

import execa from 'execa'
import { execaCommand } from 'execa'
import fetch from 'node-fetch'
import { afterAll, beforeAll, describe, test } from 'vitest'

Expand Down Expand Up @@ -886,7 +886,7 @@ describe.skipIf(process.env.NETLIFY_TEST_DISABLE_LIVE === 'true').concurrent('co
})
.build()

await execa.command('npm install', { cwd: builder.directory })
await execaCommand('npm install', { cwd: builder.directory })
const { deploy_url: deployUrl } = await callCli(
['deploy', '--json'],
{
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/commands/dev/dev-miscellaneous.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { platform } from 'process'
import { fileURLToPath } from 'url'

import { setProperty } from 'dot-prop'
import execa from 'execa'
import { execa } from 'execa'
import getAvailablePort from 'get-port'
import jwt from 'jsonwebtoken'
import fetch from 'node-fetch'
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/commands/dev/v2-api.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { version } from 'process'

import execa from 'execa'
import { execa } from 'execa'
import { gte } from 'semver'
import { describe, expect, test } from 'vitest'

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/commands/env/env.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import process from 'process'

import execa from 'execa'
import { execa } from 'execa'
import { describe, test } from 'vitest'

import { callCli } from '../../utils/call-cli.js'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { existsSync } from 'fs'
import { readFile } from 'fs/promises'
import { join } from 'path'

import execa from 'execa'
import { execa } from 'execa'
import { describe, expect, test } from 'vitest'

import { fileExistsAsync } from '../../../../src/lib/fs.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import execa from 'execa'
import { execa } from 'execa'
import getPort from 'get-port'
import fetch from 'node-fetch'
import { describe, test } from 'vitest'
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/commands/init/init.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readFile } from 'fs/promises'

import cleanDeep from 'clean-deep'
import execa from 'execa'
import { execa } from 'execa'
import toml from 'toml'
import { describe, test } from 'vitest'

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/commands/lm/lm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readFile } from 'fs/promises'
import os from 'os'
import process from 'process'

import execa from 'execa'
import { execaCommand } from 'execa'
import ini from 'ini'
import { describe, expect, test } from 'vitest'

Expand Down Expand Up @@ -81,7 +81,7 @@ describe('lm command', () => {
const match = cliResponse.match(/source[\s\S]+?(\/.+inc)/)
if (!match) expect.fail('could not match path')
const [, sourcePath] = match
const { stdout } = await execa.command(`source ${sourcePath} && git-credential-netlify version`, {
const { stdout } = await execaCommand(`source ${sourcePath} && git-credential-netlify version`, {
shell: execOptions.env.SHELL,
})

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/commands/recipes/recipes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readFile } from 'fs/promises'
import { resolve } from 'path'

import { parse } from 'comment-json'
import execa from 'execa'
import { execa } from 'execa'
import { describe, test } from 'vitest'

import { callCli } from '../../utils/call-cli.js'
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/framework-detection.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import execa from 'execa'
import { execa } from 'execa'
import fetch from 'node-fetch'
import { describe, test } from 'vitest'

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/telemetry.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { env as _env, version as nodejsVersion } from 'process'

import type { Options } from 'execa'
import execa from 'execa'
import { execa } from 'execa'
import { version as uuidVersion } from 'uuid'
import { expect, test } from 'vitest'

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/utils/call-cli.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import execa from 'execa'
import { execaNode } from 'execa'

import { cliPath } from './cli-path.js'

Expand All @@ -13,7 +13,7 @@ const CLI_TIMEOUT = 3e5
* @returns {Promise<string|object>}
*/
export const callCli = async function (args, execOptions = {}, parseJson = false) {
const { stdout } = await execa.node(cliPath, args, {
const { stdout } = await execaNode(cliPath, args, {
timeout: CLI_TIMEOUT,
nodeOptions: [],
...execOptions,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/utils/curl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import execa from 'execa'
import { execa } from 'execa'

const CURL_TIMEOUT = 1e5

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/utils/dev-server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path'
import process from 'process'

import execa from 'execa'
import { execa } from 'execa'
import getPort from 'get-port'
import pTimeout from 'p-timeout'

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/utils/site-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from 'path'
import process from 'process'

import slugify from '@sindresorhus/slugify'
import execa from 'execa'
import { execa } from 'execa'
import serializeJS from 'serialize-javascript'
import tempDirectory from 'temp-dir'
import tomlify from 'tomlify-j0.4'
Expand Down
2 changes: 1 addition & 1 deletion tools/affected-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import process from 'process'
import { fileURLToPath } from 'url'

import chalk from 'chalk'
import execa from 'execa'
import { execa } from 'execa'
import glob from 'fast-glob'

import { DependencyGraph, fileVisitor, visitorPlugins } from './project-graph/index.js'
Expand Down
2 changes: 1 addition & 1 deletion tools/e2e/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { dirname, join } from 'path'
import { exit } from 'process'
import { fileURLToPath } from 'url'

import execa from 'execa'
import { execa } from 'execa'

import { setup } from './setup.js'

Expand Down
2 changes: 1 addition & 1 deletion tools/e2e/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { dirname, join, normalize, sep } from 'path'
import { env } from 'process'
import { fileURLToPath } from 'url'

import execa from 'execa'
import { execa } from 'execa'
import getPort from 'get-port'
import pTimeout from 'p-timeout'
import { runServer } from 'verdaccio'
Expand Down

0 comments on commit 1363cec

Please sign in to comment.