@form8ion/codecov 7.0.0-beta.6 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +26 -20
- package/lib/index.js.map +1 -1
- package/package.json +29 -28
package/lib/index.js
CHANGED
|
@@ -5,11 +5,11 @@ import { execa } from 'execa';
|
|
|
5
5
|
import { removeActionFromJobs, loadWorkflowFile, writeWorkflowFile, workflowFileExists } from '@form8ion/github-workflows-core';
|
|
6
6
|
import got from 'got';
|
|
7
7
|
|
|
8
|
-
async function scaffold$
|
|
8
|
+
async function scaffold$1() {
|
|
9
9
|
return {};
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
async function fetchRepositoryDetails
|
|
12
|
+
async function fetchRepositoryDetails({vcs, apiAccessToken}) {
|
|
13
13
|
const {body: {repo}} = await got(
|
|
14
14
|
`https://codecov.io/api/gh/${vcs.owner}/${vcs.name}`,
|
|
15
15
|
{headers: {Authorization: apiAccessToken}, responseType: 'json'}
|
|
@@ -18,7 +18,7 @@ async function fetchRepositoryDetails ({vcs, apiAccessToken}) {
|
|
|
18
18
|
return repo;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
async function scaffold
|
|
21
|
+
async function scaffold({vcs, apiAccessToken}) {
|
|
22
22
|
return {
|
|
23
23
|
...['github', 'gitlab', 'bitbucket'].includes(vcs?.host) && {
|
|
24
24
|
badges: {
|
|
@@ -40,6 +40,20 @@ async function scaffold$1({vcs, apiAccessToken}) {
|
|
|
40
40
|
|
|
41
41
|
const ACTION_NAME = 'codecov/codecov-action';
|
|
42
42
|
|
|
43
|
+
function removeCodecovActionFrom(jobs) {
|
|
44
|
+
return removeActionFromJobs(jobs, ACTION_NAME);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function scaffoldAction() {
|
|
48
|
+
return {
|
|
49
|
+
uses: `${ACTION_NAME}@v5.5.2`,
|
|
50
|
+
with: {
|
|
51
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
52
|
+
token: '${{ secrets.CODECOV_TOKEN }}'
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
43
57
|
function stepIsCodecovAction(step) {
|
|
44
58
|
if (!step.uses) return false;
|
|
45
59
|
|
|
@@ -48,16 +62,8 @@ function stepIsCodecovAction(step) {
|
|
|
48
62
|
return ACTION_NAME === actionName;
|
|
49
63
|
}
|
|
50
64
|
|
|
51
|
-
function
|
|
52
|
-
return steps.find(step => stepIsCodecovAction(step));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function removeCodecovActionFrom(jobs) {
|
|
56
|
-
return removeActionFromJobs(jobs, ACTION_NAME);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function scaffold() {
|
|
60
|
-
return {uses: `${ACTION_NAME}@v5.5.2`};
|
|
65
|
+
function codecovActionExistsInSteps(steps) {
|
|
66
|
+
return !!steps.find(step => stepIsCodecovAction(step));
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
async function lift$1({projectRoot}) {
|
|
@@ -66,7 +72,7 @@ async function lift$1({projectRoot}) {
|
|
|
66
72
|
const workflowDetails = await loadWorkflowFile({projectRoot, name: ciWorkflowName});
|
|
67
73
|
const {jobs: {verify: {steps}}} = workflowDetails;
|
|
68
74
|
|
|
69
|
-
if (!
|
|
75
|
+
if (!codecovActionExistsInSteps(steps)) {
|
|
70
76
|
const stepsWithLegacyReportingRemoved = steps.filter(({run}) => 'npm run coverage:report' !== run);
|
|
71
77
|
|
|
72
78
|
await writeWorkflowFile({
|
|
@@ -78,7 +84,7 @@ async function lift$1({projectRoot}) {
|
|
|
78
84
|
...workflowDetails.jobs,
|
|
79
85
|
verify: {
|
|
80
86
|
...workflowDetails.jobs.verify,
|
|
81
|
-
steps: [...stepsWithLegacyReportingRemoved,
|
|
87
|
+
steps: [...stepsWithLegacyReportingRemoved, scaffoldAction()]
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
}
|
|
@@ -86,7 +92,7 @@ async function lift$1({projectRoot}) {
|
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
94
|
|
|
89
|
-
async function
|
|
95
|
+
async function removeCodecovAction({projectRoot}) {
|
|
90
96
|
const existingConfig = await loadWorkflowFile({projectRoot, name: 'node-ci'});
|
|
91
97
|
existingConfig.jobs = removeCodecovActionFrom(existingConfig.jobs);
|
|
92
98
|
|
|
@@ -133,19 +139,19 @@ async function liftReporter({projectRoot, packageManager}) {
|
|
|
133
139
|
async function lift({projectRoot, packageManager, vcs}) {
|
|
134
140
|
const [reportingResults, badgeResults] = await Promise.all([
|
|
135
141
|
liftReporter({projectRoot, packageManager}),
|
|
136
|
-
scaffold
|
|
142
|
+
scaffold({vcs})
|
|
137
143
|
]);
|
|
138
144
|
|
|
139
145
|
return deepmerge.all([reportingResults, badgeResults]);
|
|
140
146
|
}
|
|
141
147
|
|
|
142
|
-
async function
|
|
148
|
+
async function removeCodecov({projectRoot}) {
|
|
143
149
|
if (await ciWorkflowExists({projectRoot})) {
|
|
144
|
-
await
|
|
150
|
+
await removeCodecovAction({projectRoot});
|
|
145
151
|
}
|
|
146
152
|
|
|
147
153
|
return {};
|
|
148
154
|
}
|
|
149
155
|
|
|
150
|
-
export { lift,
|
|
156
|
+
export { lift, removeCodecov as remove, scaffold$1 as scaffold };
|
|
151
157
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/scaffolder.js","../src/badge/repository-details-fetcher.js","../src/badge/scaffolder.js","../src/reporter/ci-providers/github-workflows/codecov-action.js","../src/reporter/ci-providers/github-workflows/lifter.js","../src/reporter/ci-providers/github-workflows/remover.js","../src/reporter/ci-providers/github-workflows/predicate.js","../src/reporter/lifter.js","../src/lifter.js","../src/remover.js"],"sourcesContent":["export async function scaffold() {\n return {};\n}\n","import got from 'got';\n\nexport default async function ({vcs, apiAccessToken}) {\n const {body: {repo}} = await got(\n `https://codecov.io/api/gh/${vcs.owner}/${vcs.name}`,\n {headers: {Authorization: apiAccessToken}, responseType: 'json'}\n );\n\n return repo;\n}\n","import fetchRepositoryDetails from './repository-details-fetcher.js';\n\nexport async function scaffold({vcs, apiAccessToken}) {\n return {\n ...['github', 'gitlab', 'bitbucket'].includes(vcs?.host) && {\n badges: {\n status: {\n coverage: {\n img: `https://img.shields.io/codecov/c/${vcs.host}/${vcs.owner}/${vcs.name}?logo=codecov${\n apiAccessToken\n ? `&token=${(await fetchRepositoryDetails({vcs, apiAccessToken})).image_token}`\n : ''\n }`,\n link: `https://codecov.io/${vcs.host}/${vcs.owner}/${vcs.name}`,\n text: 'Codecov'\n }\n }\n }\n }\n };\n}\n","import {removeActionFromJobs} from '@form8ion/github-workflows-core';\n\nexport const ACTION_NAME = 'codecov/codecov-action';\n\nfunction stepIsCodecovAction(step) {\n if (!step.uses) return false;\n\n const [actionName] = step.uses.split('@');\n\n return ACTION_NAME === actionName;\n}\n\nexport function findCodecovActionIn(steps) {\n return steps.find(step => stepIsCodecovAction(step));\n}\n\nexport function removeCodecovActionFrom(jobs) {\n return removeActionFromJobs(jobs, ACTION_NAME);\n}\n\nexport function scaffold() {\n return {uses: `${ACTION_NAME}@v5.5.2`};\n}\n","import {loadWorkflowFile, writeWorkflowFile} from '@form8ion/github-workflows-core';\n\nimport {findCodecovActionIn, scaffold as scaffoldCodecov} from './codecov-action.js';\n\nexport async function lift({projectRoot}) {\n const ciWorkflowName = 'node-ci';\n\n const workflowDetails = await loadWorkflowFile({projectRoot, name: ciWorkflowName});\n const {jobs: {verify: {steps}}} = workflowDetails;\n\n if (!findCodecovActionIn(steps)) {\n const stepsWithLegacyReportingRemoved = steps.filter(({run}) => 'npm run coverage:report' !== run);\n\n await writeWorkflowFile({\n projectRoot,\n name: ciWorkflowName,\n config: {\n ...workflowDetails,\n jobs: {\n ...workflowDetails.jobs,\n verify: {\n ...workflowDetails.jobs.verify,\n steps: [...stepsWithLegacyReportingRemoved, scaffoldCodecov()]\n }\n }\n }\n });\n }\n}\n","import {loadWorkflowFile, writeWorkflowFile} from '@form8ion/github-workflows-core';\nimport {removeCodecovActionFrom} from './codecov-action.js';\n\nexport default async function ({projectRoot}) {\n const existingConfig = await loadWorkflowFile({projectRoot, name: 'node-ci'});\n existingConfig.jobs = removeCodecovActionFrom(existingConfig.jobs);\n\n await writeWorkflowFile({projectRoot, name: 'node-ci', config: existingConfig});\n}\n","import {workflowFileExists} from '@form8ion/github-workflows-core';\n\nexport default function ciWorkflowExists({projectRoot}) {\n return workflowFileExists({projectRoot, name: 'node-ci'});\n}\n","import {promises as fs} from 'node:fs';\nimport {writePackageJson} from '@form8ion/javascript-core';\n\nimport {execa} from 'execa';\nimport {lift as liftCiProvider, test as ciProviderIsLiftable} from './ci-providers/index.js';\n\nexport default async function liftReporter({projectRoot, packageManager}) {\n const pathToPackageJson = `${projectRoot}/package.json`;\n\n const [ciProviderCanBeLifted, existingPackageContents] = await Promise.all([\n ciProviderIsLiftable({projectRoot}),\n fs.readFile(pathToPackageJson, 'utf-8')\n ]);\n const parsedPackageContents = JSON.parse(existingPackageContents);\n const {scripts} = parsedPackageContents;\n const {'coverage:report': reportCoverageScript, ...otherScripts} = scripts;\n\n if (ciProviderCanBeLifted) await liftCiProvider({projectRoot});\n\n if (scripts['coverage:report']) {\n parsedPackageContents.scripts = otherScripts;\n await writePackageJson({projectRoot, config: parsedPackageContents});\n\n await execa(packageManager, ['remove', 'codecov']);\n\n return {\n ...!ciProviderCanBeLifted && {\n nextSteps: [{\n summary: 'Configure modern reporting to Codecov on your CI service',\n description: 'Configure the [Codecov Uploader](https://docs.codecov.com/docs/codecov-uploader) appropriately'\n + ' for your CI Provider. If available for your provider, prefer one of the dedicated wrappers.'\n }]\n }\n };\n }\n\n return {};\n}\n","import deepmerge from 'deepmerge';\n\nimport {scaffold as scaffoldBadge} from './badge/index.js';\nimport {lift as liftReporting} from './reporter/index.js';\n\nexport async function lift({projectRoot, packageManager, vcs}) {\n const [reportingResults, badgeResults] = await Promise.all([\n liftReporting({projectRoot, packageManager}),\n scaffoldBadge({vcs})\n ]);\n\n return deepmerge.all([reportingResults, badgeResults]);\n}\n","import {remove as removeAction, test as githubWorkflowExists} from './reporter/ci-providers/github-workflows/index.js';\n\nexport default async function ({projectRoot}) {\n if (await githubWorkflowExists({projectRoot})) {\n await removeAction({projectRoot});\n }\n\n return {};\n}\n"],"names":["scaffold","lift","scaffoldCodecov","ciProviderIsLiftable","fs","liftCiProvider","liftReporting","scaffoldBadge","githubWorkflowExists"],"mappings":";;;;;;;AAAO,eAAeA,UAAQ,GAAG;AACjC,EAAE,OAAO,EAAE;AACX;;ACAe,qCAAc,EAAE,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE;AACtD,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,GAAG;AAClC,IAAI,CAAC,0BAA0B,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;AACxD,IAAI,CAAC,OAAO,EAAE,CAAC,aAAa,EAAE,cAAc,CAAC,EAAE,YAAY,EAAE,MAAM;AACnE,GAAG;;AAEH,EAAE,OAAO,IAAI;AACb;;ACPO,eAAeA,UAAQ,CAAC,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE;AACtD,EAAE,OAAO;AACT,IAAI,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI;AAChE,MAAM,MAAM,EAAE;AACd,QAAQ,MAAM,EAAE;AAChB,UAAU,QAAQ,EAAE;AACpB,YAAY,GAAG,EAAE,CAAC,iCAAiC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,aAAa;AACpG,cAAc;AACd,kBAAkB,CAAC,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AS,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;AACxD;;ACVe,sBAAc,EAAE,CAAC,WAAW,CAAC,EAAE;AAC9C,EAAE,IAAI,MAAMC,gBAAoB,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE;AACjD,IAAI,MAAM,YAAY,CAAC,CAAC,WAAW,CAAC,CAAC;AACrC,EAAE;;AAEF,EAAE,OAAO,EAAE;AACX;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/scaffolder.js","../src/badge/repository-details-fetcher.js","../src/badge/scaffolder.js","../src/reporter/ci-providers/github-workflows/codecov-action.js","../src/reporter/ci-providers/github-workflows/action/scaffolder.js","../src/reporter/ci-providers/github-workflows/action/tester.js","../src/reporter/ci-providers/github-workflows/lifter.js","../src/reporter/ci-providers/github-workflows/remover.js","../src/reporter/ci-providers/github-workflows/predicate.js","../src/reporter/lifter.js","../src/lifter.js","../src/remover.js"],"sourcesContent":["export async function scaffold() {\n return {};\n}\n","import got from 'got';\n\nexport default async function fetchRepositoryDetails({vcs, apiAccessToken}) {\n const {body: {repo}} = await got(\n `https://codecov.io/api/gh/${vcs.owner}/${vcs.name}`,\n {headers: {Authorization: apiAccessToken}, responseType: 'json'}\n );\n\n return repo;\n}\n","import fetchRepositoryDetails from './repository-details-fetcher.js';\n\nexport async function scaffold({vcs, apiAccessToken}) {\n return {\n ...['github', 'gitlab', 'bitbucket'].includes(vcs?.host) && {\n badges: {\n status: {\n coverage: {\n img: `https://img.shields.io/codecov/c/${vcs.host}/${vcs.owner}/${vcs.name}?logo=codecov${\n apiAccessToken\n ? `&token=${(await fetchRepositoryDetails({vcs, apiAccessToken})).image_token}`\n : ''\n }`,\n link: `https://codecov.io/${vcs.host}/${vcs.owner}/${vcs.name}`,\n text: 'Codecov'\n }\n }\n }\n }\n };\n}\n","import {removeActionFromJobs} from '@form8ion/github-workflows-core';\n\nexport const ACTION_NAME = 'codecov/codecov-action';\n\nexport function removeCodecovActionFrom(jobs) {\n return removeActionFromJobs(jobs, ACTION_NAME);\n}\n","import {ACTION_NAME} from '../codecov-action.js';\n\nexport default function scaffoldAction() {\n return {\n uses: `${ACTION_NAME}@v5.5.2`,\n with: {\n // eslint-disable-next-line no-template-curly-in-string\n token: '${{ secrets.CODECOV_TOKEN }}'\n }\n };\n}\n","import {ACTION_NAME} from '../codecov-action.js';\n\nfunction stepIsCodecovAction(step) {\n if (!step.uses) return false;\n\n const [actionName] = step.uses.split('@');\n\n return ACTION_NAME === actionName;\n}\n\nexport default function codecovActionExistsInSteps(steps) {\n return !!steps.find(step => stepIsCodecovAction(step));\n}\n","import {loadWorkflowFile, writeWorkflowFile} from '@form8ion/github-workflows-core';\n\nimport {test as codecovActionExistsInSteps, scaffold as scaffoldAction} from './action/index.js';\n\nexport async function lift({projectRoot}) {\n const ciWorkflowName = 'node-ci';\n\n const workflowDetails = await loadWorkflowFile({projectRoot, name: ciWorkflowName});\n const {jobs: {verify: {steps}}} = workflowDetails;\n\n if (!codecovActionExistsInSteps(steps)) {\n const stepsWithLegacyReportingRemoved = steps.filter(({run}) => 'npm run coverage:report' !== run);\n\n await writeWorkflowFile({\n projectRoot,\n name: ciWorkflowName,\n config: {\n ...workflowDetails,\n jobs: {\n ...workflowDetails.jobs,\n verify: {\n ...workflowDetails.jobs.verify,\n steps: [...stepsWithLegacyReportingRemoved, scaffoldAction()]\n }\n }\n }\n });\n }\n}\n","import {loadWorkflowFile, writeWorkflowFile} from '@form8ion/github-workflows-core';\nimport {removeCodecovActionFrom} from './codecov-action.js';\n\nexport default async function removeCodecovAction({projectRoot}) {\n const existingConfig = await loadWorkflowFile({projectRoot, name: 'node-ci'});\n existingConfig.jobs = removeCodecovActionFrom(existingConfig.jobs);\n\n await writeWorkflowFile({projectRoot, name: 'node-ci', config: existingConfig});\n}\n","import {workflowFileExists} from '@form8ion/github-workflows-core';\n\nexport default function ciWorkflowExists({projectRoot}) {\n return workflowFileExists({projectRoot, name: 'node-ci'});\n}\n","import {promises as fs} from 'node:fs';\nimport {writePackageJson} from '@form8ion/javascript-core';\n\nimport {execa} from 'execa';\nimport {lift as liftCiProvider, test as ciProviderIsLiftable} from './ci-providers/index.js';\n\nexport default async function liftReporter({projectRoot, packageManager}) {\n const pathToPackageJson = `${projectRoot}/package.json`;\n\n const [ciProviderCanBeLifted, existingPackageContents] = await Promise.all([\n ciProviderIsLiftable({projectRoot}),\n fs.readFile(pathToPackageJson, 'utf-8')\n ]);\n const parsedPackageContents = JSON.parse(existingPackageContents);\n const {scripts} = parsedPackageContents;\n const {'coverage:report': reportCoverageScript, ...otherScripts} = scripts;\n\n if (ciProviderCanBeLifted) await liftCiProvider({projectRoot});\n\n if (scripts['coverage:report']) {\n parsedPackageContents.scripts = otherScripts;\n await writePackageJson({projectRoot, config: parsedPackageContents});\n\n await execa(packageManager, ['remove', 'codecov']);\n\n return {\n ...!ciProviderCanBeLifted && {\n nextSteps: [{\n summary: 'Configure modern reporting to Codecov on your CI service',\n description: 'Configure the [Codecov Uploader](https://docs.codecov.com/docs/codecov-uploader) appropriately'\n + ' for your CI Provider. If available for your provider, prefer one of the dedicated wrappers.'\n }]\n }\n };\n }\n\n return {};\n}\n","import deepmerge from 'deepmerge';\n\nimport {scaffold as scaffoldBadge} from './badge/index.js';\nimport {lift as liftReporting} from './reporter/index.js';\n\nexport async function lift({projectRoot, packageManager, vcs}) {\n const [reportingResults, badgeResults] = await Promise.all([\n liftReporting({projectRoot, packageManager}),\n scaffoldBadge({vcs})\n ]);\n\n return deepmerge.all([reportingResults, badgeResults]);\n}\n","import {remove as removeAction, test as githubWorkflowExists} from './reporter/ci-providers/github-workflows/index.js';\n\nexport default async function removeCodecov({projectRoot}) {\n if (await githubWorkflowExists({projectRoot})) {\n await removeAction({projectRoot});\n }\n\n return {};\n}\n"],"names":["scaffold","lift","ciProviderIsLiftable","fs","liftCiProvider","liftReporting","scaffoldBadge","githubWorkflowExists","removeAction"],"mappings":";;;;;;;AAAO,eAAeA,UAA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CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@form8ion/codecov",
|
|
3
3
|
"description": "code coverage service plugin for form8ion",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "7.
|
|
5
|
+
"version": "7.1.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": "^20.19.0 || >=22.14.0"
|
|
@@ -18,32 +18,32 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"pretest": "run-s build",
|
|
20
20
|
"test": "npm-run-all --print-label --parallel lint:* --parallel test:*",
|
|
21
|
-
"lint:
|
|
21
|
+
"lint:engines": "ls-engines",
|
|
22
|
+
"lint:gherkin": "gherkin-lint",
|
|
22
23
|
"lint:js": "eslint . --cache",
|
|
23
24
|
"lint:js:fix": "run-s 'lint:js -- --fix'",
|
|
25
|
+
"lint:lockfile": "lockfile-lint",
|
|
24
26
|
"lint:md": "remark . --frail",
|
|
25
|
-
"generate:md": "remark . --output",
|
|
26
|
-
"pregenerate:md": "run-s build",
|
|
27
|
-
"prepare": "husky install",
|
|
28
|
-
"build:js": "rollup --config",
|
|
29
|
-
"watch": "run-s 'build:js -- --watch'",
|
|
30
|
-
"clean": "rimraf ./lib",
|
|
31
|
-
"prebuild": "run-s clean",
|
|
32
|
-
"build": "npm-run-all --print-label --parallel build:*",
|
|
33
|
-
"prepack": "run-s build",
|
|
34
|
-
"test:unit": "cross-env NODE_ENV=test c8 run-s test:unit:base",
|
|
35
|
-
"test:unit:base": "DEBUG=any vitest run",
|
|
36
27
|
"lint:peer": "npm ls >/dev/null",
|
|
37
|
-
"lint:
|
|
28
|
+
"lint:publish": "publint --strict",
|
|
29
|
+
"test:unit": "run-s 'test:unit:base -- --coverage'",
|
|
30
|
+
"test:unit:base": "DEBUG=any vitest run",
|
|
38
31
|
"test:integration": "run-s 'test:integration:base -- --profile noWip'",
|
|
39
32
|
"pretest:integration:base": "run-s build",
|
|
40
33
|
"test:integration:base": "NODE_OPTIONS=--enable-source-maps DEBUG=any cucumber-js test/integration",
|
|
41
34
|
"test:integration:debug": "DEBUG=test run-s test:integration",
|
|
35
|
+
"test:integration:focus": "run-s 'test:integration:base -- --profile focus'",
|
|
42
36
|
"test:integration:wip": "run-s 'test:integration:base -- --profile wip'",
|
|
43
37
|
"test:integration:wip:debug": "DEBUG=test run-s 'test:integration:wip'",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
38
|
+
"prebuild": "run-s clean",
|
|
39
|
+
"build": "npm-run-all --print-label --parallel build:*",
|
|
40
|
+
"build:js": "rollup --config",
|
|
41
|
+
"clean": "rimraf ./lib",
|
|
42
|
+
"pregenerate:md": "run-s build",
|
|
43
|
+
"generate:md": "remark . --output",
|
|
44
|
+
"prepack": "run-s build",
|
|
45
|
+
"prepare": "husky",
|
|
46
|
+
"watch": "run-s 'build:js -- --watch'"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
49
49
|
"example.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"access": "public",
|
|
54
54
|
"provenance": true
|
|
55
55
|
},
|
|
56
|
-
"packageManager": "npm@11.
|
|
56
|
+
"packageManager": "npm@11.11.1+sha512.6ac6b30a876415dcf545e433ba4cb34bf0c3efbb86088a9415e446de0b5a4fc6fd511d277b59bd40e06e3204fbda28f5aeded346b3a8c780355b39ed31622e12",
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@form8ion/core": "^4.6.1",
|
|
59
59
|
"@form8ion/github-workflows-core": "^6.0.0-beta.1",
|
|
@@ -63,15 +63,16 @@
|
|
|
63
63
|
"got": "^14.6.6"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@cucumber/cucumber": "12.
|
|
67
|
-
"@form8ion/commitlint-config": "2.0.
|
|
68
|
-
"@form8ion/eslint-config": "7.0.
|
|
66
|
+
"@cucumber/cucumber": "12.7.0",
|
|
67
|
+
"@form8ion/commitlint-config": "2.0.10",
|
|
68
|
+
"@form8ion/eslint-config": "7.1.0-beta.1",
|
|
69
69
|
"@form8ion/eslint-config-cucumber": "1.4.1",
|
|
70
70
|
"@form8ion/eslint-config-vitest": "1.1.0",
|
|
71
71
|
"@form8ion/remark-lint-preset": "6.0.7",
|
|
72
72
|
"@rollup/plugin-node-resolve": "16.0.3",
|
|
73
73
|
"@travi/any": "3.1.3",
|
|
74
|
-
"
|
|
74
|
+
"@vitest/coverage-v8": "4.1.0",
|
|
75
|
+
"c8": "11.0.0",
|
|
75
76
|
"chai": "6.2.2",
|
|
76
77
|
"cross-env": "10.1.0",
|
|
77
78
|
"cz-conventional-changelog": "3.3.0",
|
|
@@ -79,20 +80,20 @@
|
|
|
79
80
|
"http-status-codes": "2.3.0",
|
|
80
81
|
"husky": "9.1.7",
|
|
81
82
|
"js-yaml": "4.1.1",
|
|
82
|
-
"lockfile-lint": "
|
|
83
|
+
"lockfile-lint": "5.0.0",
|
|
83
84
|
"ls-engines": "0.9.4",
|
|
84
85
|
"mock-fs": "5.5.0",
|
|
85
|
-
"nock": "14.0.
|
|
86
|
+
"nock": "14.0.11",
|
|
86
87
|
"npm-run-all2": "8.0.4",
|
|
87
|
-
"publint": "0.3.
|
|
88
|
+
"publint": "0.3.18",
|
|
88
89
|
"remark-cli": "12.0.1",
|
|
89
90
|
"remark-toc": "9.0.0",
|
|
90
91
|
"remark-usage": "11.0.1",
|
|
91
|
-
"rimraf": "6.1.
|
|
92
|
-
"rollup": "4.
|
|
92
|
+
"rimraf": "6.1.3",
|
|
93
|
+
"rollup": "4.59.0",
|
|
93
94
|
"rollup-plugin-auto-external": "2.0.0",
|
|
94
95
|
"testdouble": "3.20.2",
|
|
95
|
-
"vitest": "4.0
|
|
96
|
+
"vitest": "4.1.0",
|
|
96
97
|
"vitest-when": "0.10.0"
|
|
97
98
|
}
|
|
98
99
|
}
|