@form8ion/codecov 5.0.0-beta.1 → 5.0.0-beta.2
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.cjs.js +71 -165
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.es.js +71 -165
- package/lib/index.es.js.map +1 -1
- package/package.json +1 -2
package/lib/index.cjs.js
CHANGED
|
@@ -11,201 +11,107 @@ async function scaffold$1() {
|
|
|
11
11
|
return {};
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
20
|
-
})), keys.push.apply(keys, symbols);
|
|
21
|
-
}
|
|
22
|
-
return keys;
|
|
23
|
-
}
|
|
24
|
-
function _objectSpread2(target) {
|
|
25
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
26
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
27
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
28
|
-
_defineProperty(target, key, source[key]);
|
|
29
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
30
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return target;
|
|
34
|
-
}
|
|
35
|
-
function _defineProperty(obj, key, value) {
|
|
36
|
-
key = _toPropertyKey(key);
|
|
37
|
-
if (key in obj) {
|
|
38
|
-
Object.defineProperty(obj, key, {
|
|
39
|
-
value: value,
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: true,
|
|
42
|
-
writable: true
|
|
43
|
-
});
|
|
44
|
-
} else {
|
|
45
|
-
obj[key] = value;
|
|
46
|
-
}
|
|
47
|
-
return obj;
|
|
48
|
-
}
|
|
49
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
50
|
-
if (source == null) return {};
|
|
51
|
-
var target = {};
|
|
52
|
-
var sourceKeys = Object.keys(source);
|
|
53
|
-
var key, i;
|
|
54
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
55
|
-
key = sourceKeys[i];
|
|
56
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
57
|
-
target[key] = source[key];
|
|
58
|
-
}
|
|
59
|
-
return target;
|
|
60
|
-
}
|
|
61
|
-
function _objectWithoutProperties(source, excluded) {
|
|
62
|
-
if (source == null) return {};
|
|
63
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
64
|
-
var key, i;
|
|
65
|
-
if (Object.getOwnPropertySymbols) {
|
|
66
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
67
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
68
|
-
key = sourceSymbolKeys[i];
|
|
69
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
70
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
71
|
-
target[key] = source[key];
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return target;
|
|
75
|
-
}
|
|
76
|
-
function _toPrimitive(input, hint) {
|
|
77
|
-
if (typeof input !== "object" || input === null) return input;
|
|
78
|
-
var prim = input[Symbol.toPrimitive];
|
|
79
|
-
if (prim !== undefined) {
|
|
80
|
-
var res = prim.call(input, hint || "default");
|
|
81
|
-
if (typeof res !== "object") return res;
|
|
82
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
83
|
-
}
|
|
84
|
-
return (hint === "string" ? String : Number)(input);
|
|
85
|
-
}
|
|
86
|
-
function _toPropertyKey(arg) {
|
|
87
|
-
var key = _toPrimitive(arg, "string");
|
|
88
|
-
return typeof key === "symbol" ? key : String(key);
|
|
89
|
-
}
|
|
14
|
+
async function fetchRepositoryDetails ({vcs, apiAccessToken}) {
|
|
15
|
+
const {body: {repo}} = await got(
|
|
16
|
+
`https://codecov.io/api/gh/${vcs.owner}/${vcs.name}`,
|
|
17
|
+
{headers: {Authorization: apiAccessToken}, responseType: 'json'}
|
|
18
|
+
);
|
|
90
19
|
|
|
91
|
-
async function fetchRepositoryDetails ({
|
|
92
|
-
vcs,
|
|
93
|
-
apiAccessToken
|
|
94
|
-
}) {
|
|
95
|
-
const {
|
|
96
|
-
body: {
|
|
97
|
-
repo
|
|
98
|
-
}
|
|
99
|
-
} = await got(`https://codecov.io/api/gh/${vcs.owner}/${vcs.name}`, {
|
|
100
|
-
headers: {
|
|
101
|
-
Authorization: apiAccessToken
|
|
102
|
-
},
|
|
103
|
-
responseType: 'json'
|
|
104
|
-
});
|
|
105
20
|
return repo;
|
|
106
21
|
}
|
|
107
22
|
|
|
108
|
-
async function scaffold({
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
23
|
+
async function scaffold({vcs, apiAccessToken}) {
|
|
24
|
+
return {
|
|
25
|
+
...['github', 'gitlab', 'bitbucket'].includes(vcs?.host) && {
|
|
26
|
+
badges: {
|
|
27
|
+
status: {
|
|
28
|
+
coverage: {
|
|
29
|
+
img: `https://img.shields.io/codecov/c/${vcs.host}/${vcs.owner}/${vcs.name}?logo=codecov${
|
|
30
|
+
apiAccessToken
|
|
31
|
+
? `&token=${(await fetchRepositoryDetails({vcs, apiAccessToken})).image_token}`
|
|
32
|
+
: ''
|
|
33
|
+
}`,
|
|
34
|
+
link: `https://codecov.io/${vcs.host}/${vcs.owner}/${vcs.name}`,
|
|
35
|
+
text: 'Codecov'
|
|
36
|
+
}
|
|
122
37
|
}
|
|
123
38
|
}
|
|
124
39
|
}
|
|
125
|
-
}
|
|
40
|
+
};
|
|
126
41
|
}
|
|
127
42
|
|
|
128
43
|
function getPathToWorkflowFile(projectRoot) {
|
|
129
44
|
return `${projectRoot}/.github/workflows/node-ci.yml`;
|
|
130
45
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}) {
|
|
46
|
+
|
|
47
|
+
function test({projectRoot}) {
|
|
134
48
|
return core.fileExists(getPathToWorkflowFile(projectRoot));
|
|
135
49
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}) {
|
|
50
|
+
|
|
51
|
+
async function lift$1({projectRoot}) {
|
|
139
52
|
const pathToWorkflowFile = getPathToWorkflowFile(projectRoot);
|
|
53
|
+
|
|
140
54
|
const workflowDetails = jsYaml.load(await fs.promises.readFile(pathToWorkflowFile, 'utf-8'));
|
|
141
|
-
const {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
verify: _objectSpread2(_objectSpread2({}, workflowDetails.jobs.verify), {}, {
|
|
158
|
-
steps: [...stepsWithLegacyReportingRemoved, {
|
|
159
|
-
uses: 'codecov/codecov-action@v3'
|
|
160
|
-
}]
|
|
161
|
-
})
|
|
55
|
+
const {jobs: {verify: {steps}}} = workflowDetails;
|
|
56
|
+
|
|
57
|
+
if (!steps.find(step => step.uses?.startsWith('codecov/codecov-action'))) {
|
|
58
|
+
const stepsWithLegacyReportingRemoved = steps.filter(({run}) => 'npm run coverage:report' !== run);
|
|
59
|
+
|
|
60
|
+
await fs.promises.writeFile(
|
|
61
|
+
pathToWorkflowFile,
|
|
62
|
+
jsYaml.dump({
|
|
63
|
+
...workflowDetails,
|
|
64
|
+
jobs: {
|
|
65
|
+
...workflowDetails.jobs,
|
|
66
|
+
verify: {
|
|
67
|
+
...workflowDetails.jobs.verify,
|
|
68
|
+
steps: [...stepsWithLegacyReportingRemoved, {uses: 'codecov/codecov-action@v3'}]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
162
71
|
})
|
|
163
|
-
|
|
72
|
+
);
|
|
164
73
|
}
|
|
165
74
|
}
|
|
166
75
|
|
|
167
|
-
|
|
168
|
-
async function liftReporting ({
|
|
169
|
-
projectRoot,
|
|
170
|
-
packageManager
|
|
171
|
-
}) {
|
|
76
|
+
async function liftReporting ({projectRoot, packageManager}) {
|
|
172
77
|
const pathToPackageJson = `${projectRoot}/package.json`;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
78
|
+
|
|
79
|
+
const [ciProviderCanBeLifted, existingPackageContents] = await Promise.all([
|
|
80
|
+
test({projectRoot}),
|
|
81
|
+
fs.promises.readFile(pathToPackageJson, 'utf-8')
|
|
82
|
+
]);
|
|
176
83
|
const parsedPackageContents = JSON.parse(existingPackageContents);
|
|
177
|
-
const {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
projectRoot
|
|
183
|
-
});
|
|
84
|
+
const {scripts} = parsedPackageContents;
|
|
85
|
+
const {'coverage:report': reportCoverageScript, ...otherScripts} = scripts;
|
|
86
|
+
|
|
87
|
+
if (ciProviderCanBeLifted) await lift$1({projectRoot});
|
|
88
|
+
|
|
184
89
|
if (scripts['coverage:report']) {
|
|
185
90
|
parsedPackageContents.scripts = otherScripts;
|
|
186
91
|
await fs.promises.writeFile(pathToPackageJson, JSON.stringify(parsedPackageContents));
|
|
92
|
+
|
|
187
93
|
await execa(packageManager, ['remove', 'codecov']);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
...!ciProviderCanBeLifted && {
|
|
97
|
+
nextSteps: [{
|
|
98
|
+
summary: 'Configure modern reporting to Codecov on your CI service',
|
|
99
|
+
description: 'Configure the [Codecov Uploader](https://docs.codecov.com/docs/codecov-uploader) appropriately'
|
|
100
|
+
+ ' for your CI Provider. If available for your provider, prefer one of the dedicated wrappers.'
|
|
101
|
+
}]
|
|
102
|
+
}
|
|
103
|
+
};
|
|
194
104
|
}
|
|
105
|
+
|
|
195
106
|
return {};
|
|
196
107
|
}
|
|
197
108
|
|
|
198
|
-
async function lift({
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
projectRoot,
|
|
205
|
-
packageManager
|
|
206
|
-
}), scaffold({
|
|
207
|
-
vcs
|
|
208
|
-
})]);
|
|
109
|
+
async function lift({projectRoot, packageManager, vcs}) {
|
|
110
|
+
const [reportingResults, badgeResults] = await Promise.all([
|
|
111
|
+
liftReporting({projectRoot, packageManager}),
|
|
112
|
+
scaffold({vcs})
|
|
113
|
+
]);
|
|
114
|
+
|
|
209
115
|
return deepmerge.all([reportingResults, badgeResults]);
|
|
210
116
|
}
|
|
211
117
|
|
package/lib/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/scaffolder.js","../src/badge/repository-details-fetcher.js","../src/badge/scaffolder.js","../src/reporter/ci-providers/github-workflows/lifter.js","../src/reporter/lifter.js","../src/lifter.js"],"sourcesContent":["export async function scaffold() {\n return {};\n}\n","import got from '../../thirdparty-wrappers/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';\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 {promises as fs} from 'fs';\nimport {dump, load} from 'js-yaml';\nimport {fileExists} from '@form8ion/core';\n\nfunction getPathToWorkflowFile(projectRoot) {\n return `${projectRoot}/.github/workflows/node-ci.yml`;\n}\n\nexport function test({projectRoot}) {\n return fileExists(getPathToWorkflowFile(projectRoot));\n}\n\nexport async function lift({projectRoot}) {\n const pathToWorkflowFile = getPathToWorkflowFile(projectRoot);\n\n const workflowDetails = load(await fs.readFile(pathToWorkflowFile, 'utf-8'));\n const {jobs: {verify: {steps}}} = workflowDetails;\n\n if (!steps.find(step => step.uses?.startsWith('codecov/codecov-action'))) {\n const stepsWithLegacyReportingRemoved = steps.filter(({run}) => 'npm run coverage:report' !== run);\n\n await fs.writeFile(\n pathToWorkflowFile,\n dump({\n ...workflowDetails,\n jobs: {\n ...workflowDetails.jobs,\n verify: {\n ...workflowDetails.jobs.verify,\n steps: [...stepsWithLegacyReportingRemoved, {uses: 'codecov/codecov-action@v3'}]\n }\n }\n })\n );\n }\n}\n","import {promises as fs} from 'fs';\n\nimport execa from '../../thirdparty-wrappers/execa';\nimport {lift as liftCiProvider, test as ciProviderIsLiftable} from './ci-providers';\n\nexport default async function ({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 fs.writeFile(pathToPackageJson, JSON.stringify(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';\nimport {lift as liftReporting} from './reporter';\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"],"names":["scaffold","
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/scaffolder.js","../src/badge/repository-details-fetcher.js","../src/badge/scaffolder.js","../src/reporter/ci-providers/github-workflows/lifter.js","../src/reporter/lifter.js","../src/lifter.js"],"sourcesContent":["export async function scaffold() {\n return {};\n}\n","import got from '../../thirdparty-wrappers/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';\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 {promises as fs} from 'fs';\nimport {dump, load} from 'js-yaml';\nimport {fileExists} from '@form8ion/core';\n\nfunction getPathToWorkflowFile(projectRoot) {\n return `${projectRoot}/.github/workflows/node-ci.yml`;\n}\n\nexport function test({projectRoot}) {\n return fileExists(getPathToWorkflowFile(projectRoot));\n}\n\nexport async function lift({projectRoot}) {\n const pathToWorkflowFile = getPathToWorkflowFile(projectRoot);\n\n const workflowDetails = load(await fs.readFile(pathToWorkflowFile, 'utf-8'));\n const {jobs: {verify: {steps}}} = workflowDetails;\n\n if (!steps.find(step => step.uses?.startsWith('codecov/codecov-action'))) {\n const stepsWithLegacyReportingRemoved = steps.filter(({run}) => 'npm run coverage:report' !== run);\n\n await fs.writeFile(\n pathToWorkflowFile,\n dump({\n ...workflowDetails,\n jobs: {\n ...workflowDetails.jobs,\n verify: {\n ...workflowDetails.jobs.verify,\n steps: [...stepsWithLegacyReportingRemoved, {uses: 'codecov/codecov-action@v3'}]\n }\n }\n })\n );\n }\n}\n","import {promises as fs} from 'fs';\n\nimport execa from '../../thirdparty-wrappers/execa';\nimport {lift as liftCiProvider, test as ciProviderIsLiftable} from './ci-providers';\n\nexport default async function ({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 fs.writeFile(pathToPackageJson, JSON.stringify(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';\nimport {lift as liftReporting} from './reporter';\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"],"names":["scaffold","fileExists","lift","load","fs","dump","ciProviderIsLiftable","liftCiProvider","scaffoldBadge"],"mappings":";;;;;;;;;AAAO,eAAeA,UAAQ,GAAG;AACjC,EAAE,OAAO,EAAE,CAAC;AACZ;;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,CAAC;AACpE,GAAG,CAAC;AACJ;AACA,EAAE,OAAO,IAAI,CAAC;AACd;;ACPO,eAAe,QAAQ,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,cAAc;AAC5B,kBAAkB,CAAC,OAAO,EAAE,CAAC,MAAM,sBAAsB,CAAC,CAAC,GAAG,EAA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C,CAAC;AACjF;AACA,IAAI,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AACvD;AACA,IAAI,OAAO;AACX,MAAM,GAAG,CAAC,qBAAqB,IAAI;AACnC,QAAQ,SAAS,EAAE,CAAC;AACpB,UAAU,OAAO,EAAE,0DAA0D;AAC7E,UAAU,WAAW,EAAE,gGAAgG;AACvH,cAAc,8FAA8F;AAC5G,SAAS,CAAC;AACV,OAAO;AACP,KAAK,CAAC;AACN,GAAG;AACH;AACA,EAAE,OAAO,EAAE,CAAC;AACZ;;AC/BO,eAAe,IAAI,CAAC,CAAC,WAAW,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE;AAC/D,EAAE,MAAM,CAAC,gBAAgB,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;AAC7D,IAAI,aAAa,CAAC,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAChD,IAAII,QAAa,CAAC,CAAC,GAAG,CAAC,CAAC;AACxB,GAAG,CAAC,CAAC;AACL;AACA,EAAE,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC,CAAC;AACzD;;;;;"}
|
package/lib/index.es.js
CHANGED
|
@@ -9,201 +9,107 @@ async function scaffold$1() {
|
|
|
9
9
|
return {};
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
18
|
-
})), keys.push.apply(keys, symbols);
|
|
19
|
-
}
|
|
20
|
-
return keys;
|
|
21
|
-
}
|
|
22
|
-
function _objectSpread2(target) {
|
|
23
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
24
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
25
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
26
|
-
_defineProperty(target, key, source[key]);
|
|
27
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
28
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
}
|
|
33
|
-
function _defineProperty(obj, key, value) {
|
|
34
|
-
key = _toPropertyKey(key);
|
|
35
|
-
if (key in obj) {
|
|
36
|
-
Object.defineProperty(obj, key, {
|
|
37
|
-
value: value,
|
|
38
|
-
enumerable: true,
|
|
39
|
-
configurable: true,
|
|
40
|
-
writable: true
|
|
41
|
-
});
|
|
42
|
-
} else {
|
|
43
|
-
obj[key] = value;
|
|
44
|
-
}
|
|
45
|
-
return obj;
|
|
46
|
-
}
|
|
47
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
48
|
-
if (source == null) return {};
|
|
49
|
-
var target = {};
|
|
50
|
-
var sourceKeys = Object.keys(source);
|
|
51
|
-
var key, i;
|
|
52
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
53
|
-
key = sourceKeys[i];
|
|
54
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
55
|
-
target[key] = source[key];
|
|
56
|
-
}
|
|
57
|
-
return target;
|
|
58
|
-
}
|
|
59
|
-
function _objectWithoutProperties(source, excluded) {
|
|
60
|
-
if (source == null) return {};
|
|
61
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
62
|
-
var key, i;
|
|
63
|
-
if (Object.getOwnPropertySymbols) {
|
|
64
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
65
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
66
|
-
key = sourceSymbolKeys[i];
|
|
67
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
68
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
69
|
-
target[key] = source[key];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return target;
|
|
73
|
-
}
|
|
74
|
-
function _toPrimitive(input, hint) {
|
|
75
|
-
if (typeof input !== "object" || input === null) return input;
|
|
76
|
-
var prim = input[Symbol.toPrimitive];
|
|
77
|
-
if (prim !== undefined) {
|
|
78
|
-
var res = prim.call(input, hint || "default");
|
|
79
|
-
if (typeof res !== "object") return res;
|
|
80
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
81
|
-
}
|
|
82
|
-
return (hint === "string" ? String : Number)(input);
|
|
83
|
-
}
|
|
84
|
-
function _toPropertyKey(arg) {
|
|
85
|
-
var key = _toPrimitive(arg, "string");
|
|
86
|
-
return typeof key === "symbol" ? key : String(key);
|
|
87
|
-
}
|
|
12
|
+
async function fetchRepositoryDetails ({vcs, apiAccessToken}) {
|
|
13
|
+
const {body: {repo}} = await got(
|
|
14
|
+
`https://codecov.io/api/gh/${vcs.owner}/${vcs.name}`,
|
|
15
|
+
{headers: {Authorization: apiAccessToken}, responseType: 'json'}
|
|
16
|
+
);
|
|
88
17
|
|
|
89
|
-
async function fetchRepositoryDetails ({
|
|
90
|
-
vcs,
|
|
91
|
-
apiAccessToken
|
|
92
|
-
}) {
|
|
93
|
-
const {
|
|
94
|
-
body: {
|
|
95
|
-
repo
|
|
96
|
-
}
|
|
97
|
-
} = await got(`https://codecov.io/api/gh/${vcs.owner}/${vcs.name}`, {
|
|
98
|
-
headers: {
|
|
99
|
-
Authorization: apiAccessToken
|
|
100
|
-
},
|
|
101
|
-
responseType: 'json'
|
|
102
|
-
});
|
|
103
18
|
return repo;
|
|
104
19
|
}
|
|
105
20
|
|
|
106
|
-
async function scaffold({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
21
|
+
async function scaffold({vcs, apiAccessToken}) {
|
|
22
|
+
return {
|
|
23
|
+
...['github', 'gitlab', 'bitbucket'].includes(vcs?.host) && {
|
|
24
|
+
badges: {
|
|
25
|
+
status: {
|
|
26
|
+
coverage: {
|
|
27
|
+
img: `https://img.shields.io/codecov/c/${vcs.host}/${vcs.owner}/${vcs.name}?logo=codecov${
|
|
28
|
+
apiAccessToken
|
|
29
|
+
? `&token=${(await fetchRepositoryDetails({vcs, apiAccessToken})).image_token}`
|
|
30
|
+
: ''
|
|
31
|
+
}`,
|
|
32
|
+
link: `https://codecov.io/${vcs.host}/${vcs.owner}/${vcs.name}`,
|
|
33
|
+
text: 'Codecov'
|
|
34
|
+
}
|
|
120
35
|
}
|
|
121
36
|
}
|
|
122
37
|
}
|
|
123
|
-
}
|
|
38
|
+
};
|
|
124
39
|
}
|
|
125
40
|
|
|
126
41
|
function getPathToWorkflowFile(projectRoot) {
|
|
127
42
|
return `${projectRoot}/.github/workflows/node-ci.yml`;
|
|
128
43
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}) {
|
|
44
|
+
|
|
45
|
+
function test({projectRoot}) {
|
|
132
46
|
return fileExists(getPathToWorkflowFile(projectRoot));
|
|
133
47
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}) {
|
|
48
|
+
|
|
49
|
+
async function lift$1({projectRoot}) {
|
|
137
50
|
const pathToWorkflowFile = getPathToWorkflowFile(projectRoot);
|
|
51
|
+
|
|
138
52
|
const workflowDetails = load(await promises.readFile(pathToWorkflowFile, 'utf-8'));
|
|
139
|
-
const {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
verify: _objectSpread2(_objectSpread2({}, workflowDetails.jobs.verify), {}, {
|
|
156
|
-
steps: [...stepsWithLegacyReportingRemoved, {
|
|
157
|
-
uses: 'codecov/codecov-action@v3'
|
|
158
|
-
}]
|
|
159
|
-
})
|
|
53
|
+
const {jobs: {verify: {steps}}} = workflowDetails;
|
|
54
|
+
|
|
55
|
+
if (!steps.find(step => step.uses?.startsWith('codecov/codecov-action'))) {
|
|
56
|
+
const stepsWithLegacyReportingRemoved = steps.filter(({run}) => 'npm run coverage:report' !== run);
|
|
57
|
+
|
|
58
|
+
await promises.writeFile(
|
|
59
|
+
pathToWorkflowFile,
|
|
60
|
+
dump({
|
|
61
|
+
...workflowDetails,
|
|
62
|
+
jobs: {
|
|
63
|
+
...workflowDetails.jobs,
|
|
64
|
+
verify: {
|
|
65
|
+
...workflowDetails.jobs.verify,
|
|
66
|
+
steps: [...stepsWithLegacyReportingRemoved, {uses: 'codecov/codecov-action@v3'}]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
160
69
|
})
|
|
161
|
-
|
|
70
|
+
);
|
|
162
71
|
}
|
|
163
72
|
}
|
|
164
73
|
|
|
165
|
-
|
|
166
|
-
async function liftReporting ({
|
|
167
|
-
projectRoot,
|
|
168
|
-
packageManager
|
|
169
|
-
}) {
|
|
74
|
+
async function liftReporting ({projectRoot, packageManager}) {
|
|
170
75
|
const pathToPackageJson = `${projectRoot}/package.json`;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
76
|
+
|
|
77
|
+
const [ciProviderCanBeLifted, existingPackageContents] = await Promise.all([
|
|
78
|
+
test({projectRoot}),
|
|
79
|
+
promises.readFile(pathToPackageJson, 'utf-8')
|
|
80
|
+
]);
|
|
174
81
|
const parsedPackageContents = JSON.parse(existingPackageContents);
|
|
175
|
-
const {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
projectRoot
|
|
181
|
-
});
|
|
82
|
+
const {scripts} = parsedPackageContents;
|
|
83
|
+
const {'coverage:report': reportCoverageScript, ...otherScripts} = scripts;
|
|
84
|
+
|
|
85
|
+
if (ciProviderCanBeLifted) await lift$1({projectRoot});
|
|
86
|
+
|
|
182
87
|
if (scripts['coverage:report']) {
|
|
183
88
|
parsedPackageContents.scripts = otherScripts;
|
|
184
89
|
await promises.writeFile(pathToPackageJson, JSON.stringify(parsedPackageContents));
|
|
90
|
+
|
|
185
91
|
await execa(packageManager, ['remove', 'codecov']);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
...!ciProviderCanBeLifted && {
|
|
95
|
+
nextSteps: [{
|
|
96
|
+
summary: 'Configure modern reporting to Codecov on your CI service',
|
|
97
|
+
description: 'Configure the [Codecov Uploader](https://docs.codecov.com/docs/codecov-uploader) appropriately'
|
|
98
|
+
+ ' for your CI Provider. If available for your provider, prefer one of the dedicated wrappers.'
|
|
99
|
+
}]
|
|
100
|
+
}
|
|
101
|
+
};
|
|
192
102
|
}
|
|
103
|
+
|
|
193
104
|
return {};
|
|
194
105
|
}
|
|
195
106
|
|
|
196
|
-
async function lift({
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
projectRoot,
|
|
203
|
-
packageManager
|
|
204
|
-
}), scaffold({
|
|
205
|
-
vcs
|
|
206
|
-
})]);
|
|
107
|
+
async function lift({projectRoot, packageManager, vcs}) {
|
|
108
|
+
const [reportingResults, badgeResults] = await Promise.all([
|
|
109
|
+
liftReporting({projectRoot, packageManager}),
|
|
110
|
+
scaffold({vcs})
|
|
111
|
+
]);
|
|
112
|
+
|
|
207
113
|
return deepmerge.all([reportingResults, badgeResults]);
|
|
208
114
|
}
|
|
209
115
|
|
package/lib/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/scaffolder.js","../src/badge/repository-details-fetcher.js","../src/badge/scaffolder.js","../src/reporter/ci-providers/github-workflows/lifter.js","../src/reporter/lifter.js","../src/lifter.js"],"sourcesContent":["export async function scaffold() {\n return {};\n}\n","import got from '../../thirdparty-wrappers/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';\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 {promises as fs} from 'fs';\nimport {dump, load} from 'js-yaml';\nimport {fileExists} from '@form8ion/core';\n\nfunction getPathToWorkflowFile(projectRoot) {\n return `${projectRoot}/.github/workflows/node-ci.yml`;\n}\n\nexport function test({projectRoot}) {\n return fileExists(getPathToWorkflowFile(projectRoot));\n}\n\nexport async function lift({projectRoot}) {\n const pathToWorkflowFile = getPathToWorkflowFile(projectRoot);\n\n const workflowDetails = load(await fs.readFile(pathToWorkflowFile, 'utf-8'));\n const {jobs: {verify: {steps}}} = workflowDetails;\n\n if (!steps.find(step => step.uses?.startsWith('codecov/codecov-action'))) {\n const stepsWithLegacyReportingRemoved = steps.filter(({run}) => 'npm run coverage:report' !== run);\n\n await fs.writeFile(\n pathToWorkflowFile,\n dump({\n ...workflowDetails,\n jobs: {\n ...workflowDetails.jobs,\n verify: {\n ...workflowDetails.jobs.verify,\n steps: [...stepsWithLegacyReportingRemoved, {uses: 'codecov/codecov-action@v3'}]\n }\n }\n })\n );\n }\n}\n","import {promises as fs} from 'fs';\n\nimport execa from '../../thirdparty-wrappers/execa';\nimport {lift as liftCiProvider, test as ciProviderIsLiftable} from './ci-providers';\n\nexport default async function ({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 fs.writeFile(pathToPackageJson, JSON.stringify(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';\nimport {lift as liftReporting} from './reporter';\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"],"names":["scaffold","
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/scaffolder.js","../src/badge/repository-details-fetcher.js","../src/badge/scaffolder.js","../src/reporter/ci-providers/github-workflows/lifter.js","../src/reporter/lifter.js","../src/lifter.js"],"sourcesContent":["export async function scaffold() {\n return {};\n}\n","import got from '../../thirdparty-wrappers/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';\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 {promises as fs} from 'fs';\nimport {dump, load} from 'js-yaml';\nimport {fileExists} from '@form8ion/core';\n\nfunction getPathToWorkflowFile(projectRoot) {\n return `${projectRoot}/.github/workflows/node-ci.yml`;\n}\n\nexport function test({projectRoot}) {\n return fileExists(getPathToWorkflowFile(projectRoot));\n}\n\nexport async function lift({projectRoot}) {\n const pathToWorkflowFile = getPathToWorkflowFile(projectRoot);\n\n const workflowDetails = load(await fs.readFile(pathToWorkflowFile, 'utf-8'));\n const {jobs: {verify: {steps}}} = workflowDetails;\n\n if (!steps.find(step => step.uses?.startsWith('codecov/codecov-action'))) {\n const stepsWithLegacyReportingRemoved = steps.filter(({run}) => 'npm run coverage:report' !== run);\n\n await fs.writeFile(\n pathToWorkflowFile,\n dump({\n ...workflowDetails,\n jobs: {\n ...workflowDetails.jobs,\n verify: {\n ...workflowDetails.jobs.verify,\n steps: [...stepsWithLegacyReportingRemoved, {uses: 'codecov/codecov-action@v3'}]\n }\n }\n })\n );\n }\n}\n","import {promises as fs} from 'fs';\n\nimport execa from '../../thirdparty-wrappers/execa';\nimport {lift as liftCiProvider, test as ciProviderIsLiftable} from './ci-providers';\n\nexport default async function ({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 fs.writeFile(pathToPackageJson, JSON.stringify(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';\nimport {lift as liftReporting} from './reporter';\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"],"names":["scaffold","lift","fs","ciProviderIsLiftable","liftCiProvider","scaffoldBadge"],"mappings":";;;;;;;AAAO,eAAeA,UAAQ,GAAG;AACjC,EAAE,OAAO,EAAE,CAAC;AACZ;;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,CAAC;AACpE,GAAG,CAAC;AACJ;AACA,EAAE,OAAO,IAAI,CAAC;AACd;;ACPO,eAAe,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AC,CAAC,CAAC;AACzD;;;;"}
|
package/package.json
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": "5.0.0-beta.
|
|
5
|
+
"version": "5.0.0-beta.2",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=16"
|
|
8
8
|
},
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
"@form8ion/eslint-config-mocha": "3.0.0",
|
|
70
70
|
"@form8ion/javascript-core": "10.0.1",
|
|
71
71
|
"@form8ion/remark-lint-preset": "6.0.0",
|
|
72
|
-
"@rollup/plugin-babel": "6.0.3",
|
|
73
72
|
"@rollup/plugin-node-resolve": "15.1.0",
|
|
74
73
|
"@travi/any": "2.1.8",
|
|
75
74
|
"ban-sensitive-files": "1.9.19",
|