Skip to content

Commit 6a0fe0a

Browse files
committed
fix(deps): leverage execa without the wrapper
1 parent 61dfc03 commit 6a0fe0a

24 files changed

+467
-118
lines changed

package-lock.json

+420-71
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@
6464
"@form8ion/config-file": "^1.1.1",
6565
"@form8ion/core": "^4.0.0",
6666
"@form8ion/eslint": "^6.1.0",
67-
"@form8ion/execa-wrapper": "^1.0.0-alpha.1",
68-
"@form8ion/husky": "^5.3.0",
67+
"@form8ion/husky": "^6.0.0-beta.2",
6968
"@form8ion/javascript-core": "^12.0.0-beta.1",
7069
"@form8ion/overridable-prompts": "^1.2.0",
7170
"@form8ion/prettier": "^2.0.0",
@@ -74,6 +73,7 @@
7473
"@travi/language-scaffolder-prompts": "^2.0.0-beta.1",
7574
"camelcase": "^8.0.0",
7675
"deepmerge": "^4.2.2",
76+
"execa": "^9.5.1",
7777
"filedirname": "^3.0.0",
7878
"ini": "^5.0.0",
7979
"joi": "^17.5.0",

src/corepack/lifter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import execa from '../../thirdparty-wrappers/execa.js';
1+
import {execa} from 'execa';
22

33
export default async function () {
44
await execa('corepack', ['use', 'npm@latest']);

src/corepack/lifter.test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import {execa} from 'execa';
2+
13
import {describe, it, vi, expect, afterEach} from 'vitest';
24

3-
import execa from '../../thirdparty-wrappers/execa.js';
45
import liftCorepack from './lifter.js';
56

6-
vi.mock('../../thirdparty-wrappers/execa.js');
7+
vi.mock('execa');
78

89
describe('corepack lifter', () => {
910
afterEach(() => {

src/dependencies/installer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {info, warn} from '@travi/cli-messages';
22
import {DEV_DEPENDENCY_TYPE, packageManagers} from '@form8ion/javascript-core';
33

4-
import execa from '../../thirdparty-wrappers/execa.js';
4+
import {execa} from 'execa';
55
import {getDependencyTypeFlag, getExactFlag, getInstallationCommandFor} from './package-managers.js';
66

77
export default async function (dependencies, dependenciesType, projectRoot, packageManager = packageManagers.NPM) {

src/dependencies/installer.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
import {execa} from 'execa';
12
import {DEV_DEPENDENCY_TYPE, packageManagers} from '@form8ion/javascript-core';
23

34
import {vi, it, describe, expect, beforeEach} from 'vitest';
45
import any from '@travi/any';
56
import {when} from 'jest-when';
67

7-
import execa from '../../thirdparty-wrappers/execa.js';
88
import {getDependencyTypeFlag, getInstallationCommandFor, getExactFlag} from './package-managers.js';
99
import install from './installer.js';
1010

11-
vi.mock('../../thirdparty-wrappers/execa.js');
11+
vi.mock('execa');
1212
vi.mock('./package-managers.js');
1313

1414
describe('dependencies installer', () => {

src/dependencies/remover.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import execa from '../../thirdparty-wrappers/execa.js';
1+
import {execa} from 'execa';
22

33
export default async function ({packageManager, dependencies}) {
44
await execa(packageManager, ['remove', ...dependencies]);

src/dependencies/remover.test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import {execa} from 'execa';
2+
13
import any from '@travi/any';
24
import {describe, it, expect, vi} from 'vitest';
35

4-
import execa from '../../thirdparty-wrappers/execa.js';
56
import removeDependencies from './remover.js';
67

7-
vi.mock('../../thirdparty-wrappers/execa.js');
8+
vi.mock('execa');
89

910
describe('dependency remover', () => {
1011
it('should remove the dependencies using the named package manager', async () => {

src/node-version/tasks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {info} from '@travi/cli-messages';
22

3-
import execa from '../../thirdparty-wrappers/execa.js';
3+
import {execa} from 'execa';
44

55
export async function determineLatestVersionOf(nodeVersionCategory) {
66
info('Determining version of node', {level: 'secondary'});

src/node-version/tasks.test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import {execa} from 'execa';
2+
13
import {it, expect, describe, afterEach, vi} from 'vitest';
24
import {when} from 'jest-when';
35
import any from '@travi/any';
46

5-
import execa from '../../thirdparty-wrappers/execa.js';
67
import {determineLatestVersionOf, install} from './tasks.js';
78

8-
vi.mock('../../thirdparty-wrappers/execa.js');
9+
vi.mock('execa');
910

1011
describe('node-version tasks', () => {
1112
const majorVersion = any.integer();

src/prompts/questions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {prompt as promptWithInquirer} from '@form8ion/overridable-prompts';
33
import {questionNames as commonQuestionNames, questions as commonQuestions} from '@travi/language-scaffolder-prompts';
44
import {warn} from '@travi/cli-messages';
55

6-
import execa from '../../thirdparty-wrappers/execa.js';
6+
import {execa} from 'execa';
77
import npmConfFactory from '../../thirdparty-wrappers/npm-conf.js';
88
import buildDialectChoices from '../dialects/prompt-choices.js';
99
import {

src/prompts/questions.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {execa} from 'execa';
12
import * as commonPrompts from '@travi/language-scaffolder-prompts';
23
import * as prompts from '@form8ion/overridable-prompts';
34
import {packageManagers, projectTypes} from '@form8ion/javascript-core';
@@ -6,17 +7,16 @@ import {expect, describe, it, vi, beforeEach} from 'vitest';
67
import any from '@travi/any';
78
import {when} from 'jest-when';
89

9-
import execa from '../../thirdparty-wrappers/execa.js';
1010
import npmConfFactory from '../../thirdparty-wrappers/npm-conf.js';
1111
import buildDialectChoices from '../dialects/prompt-choices.js';
1212
import {questionNames} from './question-names.js';
1313
import * as conditionals from './conditionals.js';
1414
import {prompt} from './questions.js';
1515
import * as validators from './validators.js';
1616

17+
vi.mock('execa');
1718
vi.mock('@travi/language-scaffolder-prompts');
1819
vi.mock('@form8ion/overridable-prompts');
19-
vi.mock('../../thirdparty-wrappers/execa.js');
2020
vi.mock('../../thirdparty-wrappers/npm-conf.js');
2121
vi.mock('../dialects/prompt-choices.js');
2222
vi.mock('./validators.js');

test/integration/features/step_definitions/common-steps.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function assertDevDependencyIsInstalled(execa, dependencyName) {
4747
Before(async function () {
4848
validateNpmPackageName(any.word());
4949

50-
this.execa = await td.replaceEsm('@form8ion/execa-wrapper');
50+
this.execa = (await td.replaceEsm('execa')).execa;
5151
this.projectRoot = process.cwd();
5252

5353
// eslint-disable-next-line import/no-extraneous-dependencies,import/no-unresolved
@@ -265,7 +265,7 @@ Then('the expected results for a(n) {string} are returned to the project scaffol
265265

266266
if (projectTypes.PACKAGE === type) {
267267
assert.equal(scripts['lint:publish'], 'publint --strict');
268-
assertDevDependencyIsInstalled(this.execa.default, 'publint');
268+
assertDevDependencyIsInstalled(this.execa, 'publint');
269269
}
270270

271271
if ('github' === this.vcs?.host && 'Public' === this.visibility && this.tested) {

test/integration/features/step_definitions/coverage-steps.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Then('nyc is not configured for code coverage', async function () {
2121
assert.isFalse(await fileExists(`${process.cwd()}/.nycrc`));
2222
assert.isFalse(await directoryExists(`${process.cwd()}/.nyc_output`));
2323
assertDependenciesWereRemoved(
24-
this.execa.default,
24+
this.execa,
2525
this.packageManager,
2626
['nyc', '@istanbuljs/nyc-config-babel', 'babel-plugin-istanbul']
2727
);

test/integration/features/step_definitions/dependencies-steps.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ export function assertDependenciesWereRemoved(execa, packageManager, dependencyN
2121
}
2222

2323
Then('ls-engines is added as a dependency', async function () {
24-
assertDevDependencyIsInstalled(this.execa.default, 'ls-engines');
24+
assertDevDependencyIsInstalled(this.execa, 'ls-engines');
2525
});

test/integration/features/step_definitions/dialect-steps.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Then('the {string} dialect is configured', async function (dialect) {
132132
} = this;
133133

134134
if (dialects.BABEL === dialect) {
135-
await assertBabelDialectDetailsAreCorrect(babelPreset, buildDirectory, this.execa.default);
135+
await assertBabelDialectDetailsAreCorrect(babelPreset, buildDirectory, this.execa);
136136
}
137137

138138
if (dialects.TYPESCRIPT === dialect) {
@@ -145,7 +145,7 @@ Then('the {string} dialect is configured', async function (dialect) {
145145
testFilenamePattern,
146146
projectType,
147147
this.packageTypeChoiceAnswer,
148-
this.execa.default
148+
this.execa
149149
);
150150
}
151151

test/integration/features/step_definitions/eslint-config-steps.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ Then('dependencies are defined for the additional configs', async function () {
5959
return `${this.eslintConfigScope}/eslint-config-${config.name}`;
6060
});
6161

62-
assertDevDependencyIsInstalled(this.execa.default, additionalConfigPackageNames.join(' '));
62+
assertDevDependencyIsInstalled(this.execa, additionalConfigPackageNames.join(' '));
6363
});

test/integration/features/step_definitions/husky-steps.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ export async function assertHookContainsScript(hook, script) {
1616

1717
Given('husky v5 is installed', async function () {
1818
td
19-
.when(this.execa.default('npm', ['ls', 'husky', '--json']))
19+
.when(this.execa('npm', ['ls', 'husky', '--json']))
2020
.thenResolve({stdout: JSON.stringify({dependencies: {husky: {version: '5.0.0'}}})});
2121
});
2222

2323
Given('husky v4 is installed', async function () {
2424
td
25-
.when(this.execa.default('npm', ['ls', 'husky', '--json']))
25+
.when(this.execa('npm', ['ls', 'husky', '--json']))
2626
.thenResolve({stdout: JSON.stringify({dependencies: {husky: {version: '4.5.6'}}})});
2727
});
2828

@@ -32,7 +32,7 @@ Given('husky is not installed', async function () {
3232
error.stdout = JSON.stringify({});
3333
error.command = 'npm ls husky --json';
3434

35-
td.when(this.execa.default('npm', ['ls', 'husky', '--json'])).thenReject(error);
35+
td.when(this.execa('npm', ['ls', 'husky', '--json'])).thenReject(error);
3636
});
3737

3838
Given('husky config is in v4 format', async function () {
@@ -44,7 +44,7 @@ Given('husky config is in v5 format', async function () {
4444
});
4545

4646
Then('husky is configured for a {string} project', async function (packageManager) {
47-
td.verify(this.execa.default(td.matchers.contains(/(npm install|yarn add).*husky/)), {ignoreExtraArgs: true});
47+
td.verify(this.execa(td.matchers.contains(/(npm install|yarn add).*husky/)), {ignoreExtraArgs: true});
4848

4949
await assertHookContainsScript('pre-commit', `${packageManager} test`);
5050
await assertHookContainsScript('commit-msg', 'npx --no-install commitlint --edit $1');
@@ -53,17 +53,17 @@ Then('husky is configured for a {string} project', async function (packageManage
5353
Then('husky is configured for {string}', async function (packageManager) {
5454
if (packageManagers.NPM === packageManager) {
5555
td.verify(
56-
this.execa.default(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && npm install')),
56+
this.execa(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && npm install')),
5757
{ignoreExtraArgs: true}
5858
);
5959
}
6060
if (packageManagers.YARN === packageManager) {
6161
td.verify(
62-
this.execa.default(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && yarn add')),
62+
this.execa(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && yarn add')),
6363
{ignoreExtraArgs: true}
6464
);
6565
}
66-
td.verify(this.execa.default(td.matchers.contains(/(npm install|yarn add).*husky@latest/)), {ignoreExtraArgs: true});
66+
td.verify(this.execa(td.matchers.contains(/(npm install|yarn add).*husky@latest/)), {ignoreExtraArgs: true});
6767
assert.equal(
6868
JSON.parse(await fs.readFile(`${process.cwd()}/package.json`, 'utf-8')).scripts.prepare,
6969
'husky'

test/integration/features/step_definitions/npm-steps.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ Given(/^the npm cli is logged in$/, function () {
156156
error.stdout = JSON.stringify({});
157157
error.command = 'npm ls husky --json';
158158

159-
td.when(this.execa.default('npm', ['whoami'])).thenResolve({stdout: this.npmAccount});
159+
td.when(this.execa('npm', ['whoami'])).thenResolve({stdout: this.npmAccount});
160160
td
161-
.when(this.execa.default(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && npm install')))
161+
.when(this.execa(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && npm install')))
162162
.thenResolve({stdout: ''});
163-
td.when(this.execa.default('npm', ['ls', 'husky', '--json'])).thenReject(error);
163+
td.when(this.execa('npm', ['ls', 'husky', '--json'])).thenReject(error);
164164
});
165165

166166
Then('the npm cli is configured for use', async function () {
@@ -176,7 +176,7 @@ Then('the npm cli is configured for use', async function () {
176176
assert.equal(path, 'package-lock.json');
177177
assert.equal(this.scaffoldResult.verificationCommand, 'npm run generate:md && npm test');
178178
td.verify(
179-
this.execa.default(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && npm install')),
179+
this.execa(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && npm install')),
180180
{ignoreExtraArgs: true}
181181
);
182182
});

test/integration/features/step_definitions/nvm-steps.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ Given(/^nvm is properly configured$/, function () {
1616
this.latestLtsMajorVersion = majorVersion;
1717
this.latestLtsVersion = semverStringFactory();
1818

19-
td.when(this.execa.default('. ~/.nvm/nvm.sh && nvm ls-remote --lts', {shell: true}))
19+
td.when(this.execa('. ~/.nvm/nvm.sh && nvm ls-remote --lts', {shell: true}))
2020
.thenResolve({stdout: [...any.listOf(semverStringFactory), this.latestLtsVersion, ''].join('\n')});
2121
td
22-
.when(this.execa.default('. ~/.nvm/nvm.sh && nvm install', {shell: true}))
22+
.when(this.execa('. ~/.nvm/nvm.sh && nvm install', {shell: true}))
2323
.thenReturn({stdout: {pipe: () => undefined}});
2424
});

test/integration/features/step_definitions/package-manager-steps.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Given('an {string} lockfile exists', async function (packageManager) {
1010
await fs.writeFile(`${process.cwd()}/package-lock.json`, JSON.stringify(any.simpleObject()));
1111

1212
td
13-
.when(this.execa.default(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && npm install')))
13+
.when(this.execa(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && npm install')))
1414
.thenResolve({stdout: ''});
1515
}
1616

1717
if (packageManagers.YARN === packageManager) {
1818
await fs.writeFile(`${process.cwd()}/yarn.lock`, any.string());
1919

2020
td
21-
.when(this.execa.default(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && yarn add')))
21+
.when(this.execa(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && yarn add')))
2222
.thenResolve({stdout: ''});
2323
}
2424

test/integration/features/step_definitions/publishable-steps.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ Then('publint is configured', async function () {
2323
const {scripts} = JSON.parse(await fs.readFile(`${process.cwd()}/package.json`, 'utf-8'));
2424

2525
assert.equal(scripts['lint:publish'], 'publint --strict');
26-
assertDevDependencyIsInstalled(this.execa.default, 'publint');
26+
assertDevDependencyIsInstalled(this.execa, 'publint');
2727
});

test/integration/features/step_definitions/yarn-steps.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ Given('the yarn cli is logged in', async function () {
1717
error.stdout = JSON.stringify({});
1818
error.command = 'npm ls husky --json';
1919

20-
td.when(this.execa.default(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && yarn add'))).thenResolve({stdout: ''});
21-
td.when(this.execa.default('npm', ['ls', 'husky', '--json'])).thenResolve({stdout: JSON.stringify({})});
22-
td.when(this.execa.default('npm', ['ls', 'husky', '--json'])).thenReject(error);
20+
td.when(this.execa(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && yarn add'))).thenResolve({stdout: ''});
21+
td.when(this.execa('npm', ['ls', 'husky', '--json'])).thenResolve({stdout: JSON.stringify({})});
22+
td.when(this.execa('npm', ['ls', 'husky', '--json'])).thenReject(error);
2323
});
2424

2525
Then('the yarn cli is configured for use', async function () {
@@ -35,7 +35,7 @@ Then('the yarn cli is configured for use', async function () {
3535
assert.equal(path, 'yarn.lock');
3636
assert.equal(this.scaffoldResult.verificationCommand, 'yarn generate:md && yarn test');
3737
td.verify(
38-
this.execa.default(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && yarn add')),
38+
this.execa(td.matchers.contains('. ~/.nvm/nvm.sh && nvm use && yarn add')),
3939
{ignoreExtraArgs: true}
4040
);
4141
});

thirdparty-wrappers/execa.js

-3
This file was deleted.

0 commit comments

Comments
 (0)