@form8ion/codecov 1.3.0 → 1.4.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/README.md +35 -2
- package/example.js +4 -2
- package/lib/index.cjs.js +10 -2
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.es.js +10 -2
- package/lib/index.es.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,20 +11,40 @@ code coverage service plugin for form8ion
|
|
|
11
11
|
|
|
12
12
|
## Table of Contents
|
|
13
13
|
|
|
14
|
+
* [Features](#features)
|
|
15
|
+
* [Scaffold](#scaffold)
|
|
16
|
+
* [Lift](#lift)
|
|
14
17
|
* [Usage](#usage)
|
|
15
18
|
* [Installation](#installation)
|
|
16
19
|
* [Example](#example)
|
|
17
20
|
* [Import](#import)
|
|
18
21
|
* [Execute](#execute)
|
|
19
22
|
* [API](#api)
|
|
20
|
-
* [scaffold](#scaffold)
|
|
23
|
+
* [scaffold](#scaffold-1)
|
|
21
24
|
* [`vcs` __object__ (_required_)](#vcs-object-required)
|
|
22
25
|
* [`visibility` __string__ (_required_)](#visibility-string-required)
|
|
23
26
|
* [`apiAccessToken` __string__ (_optional_)](#apiaccesstoken-string-optional)
|
|
27
|
+
* [lift](#lift-1)
|
|
28
|
+
* [`projectRoot` __string__ (_required_)](#projectroot-string-required)
|
|
24
29
|
* [Contributing](#contributing)
|
|
25
30
|
* [Dependencies](#dependencies)
|
|
26
31
|
* [Verification](#verification)
|
|
27
32
|
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
### Scaffold
|
|
36
|
+
|
|
37
|
+
* Define a coverage status badge to communicate current coverage details
|
|
38
|
+
* Link from the status badge to further details on the [Codecov](https://codecov.io/)
|
|
39
|
+
site
|
|
40
|
+
* Define a coverage status badge for private projects when an [`apiAccessToken` __string__ (_optional_)](#apiaccesstoken-string-optional)
|
|
41
|
+
is provided
|
|
42
|
+
|
|
43
|
+
### Lift
|
|
44
|
+
|
|
45
|
+
* Migrate from the [legacy node uploader](https://github.com/codecov/codecov-node)
|
|
46
|
+
to the [modern uploader](https://docs.codecov.com/docs/codecov-uploader)
|
|
47
|
+
|
|
28
48
|
## Usage
|
|
29
49
|
|
|
30
50
|
<!--consumer-badges start -->
|
|
@@ -46,7 +66,7 @@ $ npm install @form8ion/codecov --save
|
|
|
46
66
|
#### Import
|
|
47
67
|
|
|
48
68
|
```javascript
|
|
49
|
-
import {scaffold} from '
|
|
69
|
+
import {scaffold, lift} from '@form8ion/codecov';
|
|
50
70
|
```
|
|
51
71
|
|
|
52
72
|
#### Execute
|
|
@@ -71,6 +91,8 @@ import {scaffold} from './lib/index.cjs';
|
|
|
71
91
|
},
|
|
72
92
|
apiAccessToken: 'XXXXXX'
|
|
73
93
|
});
|
|
94
|
+
|
|
95
|
+
await lift({projectRoot: process.cwd()});
|
|
74
96
|
})();
|
|
75
97
|
```
|
|
76
98
|
|
|
@@ -108,6 +130,17 @@ Since the [Codecov API](https://docs.codecov.com/reference) appears to only
|
|
|
108
130
|
support GitHub at the time of this implementation, GitHub is the only VCS host
|
|
109
131
|
supported by this scaffolder at this time.
|
|
110
132
|
|
|
133
|
+
#### lift
|
|
134
|
+
|
|
135
|
+
Migrates [Codecov](https://codecov.io/) details from legacy conventions to
|
|
136
|
+
modern conventions.
|
|
137
|
+
|
|
138
|
+
Takes a single options object as an argument, containing:
|
|
139
|
+
|
|
140
|
+
##### `projectRoot` __string__ (_required_)
|
|
141
|
+
|
|
142
|
+
path to the root of the project
|
|
143
|
+
|
|
111
144
|
## Contributing
|
|
112
145
|
|
|
113
146
|
<!--contribution-badges start -->
|
package/example.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import stubbedFs from 'mock-fs';
|
|
4
4
|
import nock from 'nock';
|
|
5
5
|
import {StatusCodes} from 'http-status-codes';
|
|
6
|
-
import {scaffold} from './lib/index.cjs';
|
|
6
|
+
import {scaffold, lift} from './lib/index.cjs';
|
|
7
7
|
|
|
8
8
|
// remark-usage-ignore-next 5
|
|
9
|
-
stubbedFs();
|
|
9
|
+
stubbedFs({'package.json': JSON.stringify({scripts: {}})});
|
|
10
10
|
nock.disableNetConnect();
|
|
11
11
|
nock('https://codecov.io/')
|
|
12
12
|
.get('/api/gh/foo/bar')
|
|
@@ -33,4 +33,6 @@ nock('https://codecov.io/')
|
|
|
33
33
|
},
|
|
34
34
|
apiAccessToken: 'XXXXXX'
|
|
35
35
|
});
|
|
36
|
+
|
|
37
|
+
await lift({projectRoot: process.cwd()});
|
|
36
38
|
})();
|
package/lib/index.cjs.js
CHANGED
|
@@ -123,7 +123,15 @@ async function liftReporting ({
|
|
|
123
123
|
await fs.promises.writeFile(pathToPackageJson, JSON.stringify(_objectSpread2(_objectSpread2({}, otherTopLevelProperties), {}, {
|
|
124
124
|
scripts: otherScripts
|
|
125
125
|
})));
|
|
126
|
+
return {
|
|
127
|
+
nextSteps: [{
|
|
128
|
+
summary: 'Configure modern reporting to Codecov on your CI service',
|
|
129
|
+
description: 'Configure the [Codecov Uploader](https://docs.codecov.com/docs/codecov-uploader) appropriately' + ' for your CI Provider. If available for your provider, prefer one of the dedicated wrappers.'
|
|
130
|
+
}]
|
|
131
|
+
};
|
|
126
132
|
}
|
|
133
|
+
|
|
134
|
+
return {};
|
|
127
135
|
}
|
|
128
136
|
|
|
129
137
|
async function fetchRepositoryDetails ({
|
|
@@ -179,10 +187,10 @@ async function scaffold({
|
|
|
179
187
|
}));
|
|
180
188
|
}
|
|
181
189
|
|
|
182
|
-
|
|
190
|
+
function lift({
|
|
183
191
|
projectRoot
|
|
184
192
|
}) {
|
|
185
|
-
|
|
193
|
+
return liftReporting({
|
|
186
194
|
projectRoot
|
|
187
195
|
});
|
|
188
196
|
}
|
package/lib/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/predicates.js","../src/reporter/scaffolder.js","../src/reporter/lifter.js","../src/badge/repository-details-fetcher.js","../src/badge/scaffolder.js","../src/scaffolder.js","../src/lifter.js"],"sourcesContent":["export function coverageShouldBeReportedToCodecov({vcs, visibility, apiAccessToken}) {\n return !!('Public' === visibility || (apiAccessToken && 'github' === vcs.host));\n}\n","export function scaffold() {\n return {\n devDependencies: ['codecov'],\n scripts: {'coverage:report': 'c8 report --reporter=text-lcov > coverage.lcov && codecov'}\n };\n}\n","import {promises as fs} from 'fs';\n\nexport default async function ({projectRoot}) {\n const pathToPackageJson = `${projectRoot}/package.json`;\n\n const existingPackageContents = await fs.readFile(pathToPackageJson, 'utf-8');\n const {scripts, ...otherTopLevelProperties} = JSON.parse(existingPackageContents);\n const {'coverage:report': reportCoverageScript, ...otherScripts} = scripts;\n\n if (scripts['coverage:report']) {\n await fs.writeFile(pathToPackageJson, JSON.stringify({...otherTopLevelProperties, scripts: otherScripts}));\n }\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 {coverageShouldBeReportedToCodecov} from './predicates';\nimport {scaffold as scaffoldReporter} from './reporter';\nimport {scaffold as scaffoldBadge} from './badge';\n\nexport async function scaffold({vcs, visibility, apiAccessToken}) {\n if (!coverageShouldBeReportedToCodecov({vcs, visibility, apiAccessToken})) return {};\n\n return {\n ...scaffoldReporter(),\n ...await scaffoldBadge({vcs, apiAccessToken})\n };\n}\n","import {lift as liftReporting} from './reporter';\n\nexport
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/predicates.js","../src/reporter/scaffolder.js","../src/reporter/lifter.js","../src/badge/repository-details-fetcher.js","../src/badge/scaffolder.js","../src/scaffolder.js","../src/lifter.js"],"sourcesContent":["export function coverageShouldBeReportedToCodecov({vcs, visibility, apiAccessToken}) {\n return !!('Public' === visibility || (apiAccessToken && 'github' === vcs.host));\n}\n","export function scaffold() {\n return {\n devDependencies: ['codecov'],\n scripts: {'coverage:report': 'c8 report --reporter=text-lcov > coverage.lcov && codecov'}\n };\n}\n","import {promises as fs} from 'fs';\n\nexport default async function ({projectRoot}) {\n const pathToPackageJson = `${projectRoot}/package.json`;\n\n const existingPackageContents = await fs.readFile(pathToPackageJson, 'utf-8');\n const {scripts, ...otherTopLevelProperties} = JSON.parse(existingPackageContents);\n const {'coverage:report': reportCoverageScript, ...otherScripts} = scripts;\n\n if (scripts['coverage:report']) {\n await fs.writeFile(pathToPackageJson, JSON.stringify({...otherTopLevelProperties, scripts: otherScripts}));\n\n return {\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 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 {coverageShouldBeReportedToCodecov} from './predicates';\nimport {scaffold as scaffoldReporter} from './reporter';\nimport {scaffold as scaffoldBadge} from './badge';\n\nexport async function scaffold({vcs, visibility, apiAccessToken}) {\n if (!coverageShouldBeReportedToCodecov({vcs, visibility, apiAccessToken})) return {};\n\n return {\n ...scaffoldReporter(),\n ...await scaffoldBadge({vcs, apiAccessToken})\n };\n}\n","import {lift as liftReporting} from './reporter';\n\nexport function lift({projectRoot}) {\n return liftReporting({projectRoot});\n}\n"],"names":["coverageShouldBeReportedToCodecov","vcs","visibility","apiAccessToken","host","scaffold","devDependencies","scripts","projectRoot","pathToPackageJson","existingPackageContents","fs","readFile","JSON","parse","otherTopLevelProperties","otherScripts","writeFile","stringify","nextSteps","summary","description","body","repo","got","owner","name","headers","Authorization","responseType","includes","badges","status","coverage","img","fetchRepositoryDetails","image_token","link","text","scaffoldReporter","scaffoldBadge","lift","liftReporting"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAASA,iCAAT,CAA2C;AAACC,EAAAA,GAAD;AAAMC,EAAAA,UAAN;AAAkBC,EAAAA;AAAlB,CAA3C,EAA8E;AACnF,SAAO,CAAC,EAAE,aAAaD,UAAb,IAA4BC,cAAc,IAAI,aAAaF,GAAG,CAACG,IAAjE,CAAR;AACD;;ACFM,SAASC,UAAT,GAAoB;AACzB,SAAO;AACLC,IAAAA,eAAe,EAAE,CAAC,SAAD,CADZ;AAELC,IAAAA,OAAO,EAAE;AAAC,yBAAmB;AAApB;AAFJ,GAAP;AAID;;;;AC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A3C,uBAA2CA,GAAG,CAAEG,IAAhD,KAAyD;AAC1D2B,IAAAA,MAAM,EAAE;AACNC,MAAAA,MAAM,EAAE;AACNC,QAAAA,QAAQ,EAAE;AACRC,UAAAA,GAAG,EAAG,oCAAmCjC,GAAG,CAACG,IAAK,IAAGH,GAAG,CAACwB,KAAM,IAAGxB,GAAG,CAACyB,IAAK,gBACzEvB,cAAc,GACT,UAAS,CAAC,MAAMgC,sBAAsB,CAAC;AAAClC,YAAAA,GAAD;AAAME,YAAAA;AAAN,WAAD,CAA7B,EAAsDiC,WAAY,EADlE,GAEV,EACL,EALO;AAMRC,UAAAA,IAAI,EAAG,sBAAqBpC,GAAG,CAACG,IAAK,IAAGH,GAAG,CAACwB,KAAM,IAAGxB,GAAG,CAACyB,IAAK,EANtD;AAORY,UAAAA,IAAI,EAAE;AAPE;AADJ;AADF;AADkD,GAD9D;AAiBD;;AChBM,eAAejC,QAAf,CAAwB;AAACJ,EAAAA,GAAD;AAAMC,EAAAA,UAAN;AAAkBC,EAAAA;AAAlB,CAAxB,EAA2D;AAChE,MAAI,CAACH,iCAAiC,CAAC;AAACC,IAAAA,GAAD;AAAMC,IAAAA,UAAN;AAAkBC,IAAAA;AAAlB,GAAD,CAAtC,EAA2E,OAAO,EAAP;AAE3E,2CACKoC,UAAgB,EADrB,GAEK,MAAMC,UAAa,CAAC;AAACvC,IAAAA,GAAD;AAAME,IAAAA;AAAN,GAAD,CAFxB;AAID;;ACTM,SAASsC,IAAT,CAAc;AAACjC,EAAAA;AAAD,CAAd,EAA6B;AAClC,SAAOkC,aAAa,CAAC;AAAClC,IAAAA;AAAD,GAAD,CAApB;AACD;;;;;"}
|
package/lib/index.es.js
CHANGED
|
@@ -115,7 +115,15 @@ async function liftReporting ({
|
|
|
115
115
|
await promises.writeFile(pathToPackageJson, JSON.stringify(_objectSpread2(_objectSpread2({}, otherTopLevelProperties), {}, {
|
|
116
116
|
scripts: otherScripts
|
|
117
117
|
})));
|
|
118
|
+
return {
|
|
119
|
+
nextSteps: [{
|
|
120
|
+
summary: 'Configure modern reporting to Codecov on your CI service',
|
|
121
|
+
description: 'Configure the [Codecov Uploader](https://docs.codecov.com/docs/codecov-uploader) appropriately' + ' for your CI Provider. If available for your provider, prefer one of the dedicated wrappers.'
|
|
122
|
+
}]
|
|
123
|
+
};
|
|
118
124
|
}
|
|
125
|
+
|
|
126
|
+
return {};
|
|
119
127
|
}
|
|
120
128
|
|
|
121
129
|
async function fetchRepositoryDetails ({
|
|
@@ -171,10 +179,10 @@ async function scaffold({
|
|
|
171
179
|
}));
|
|
172
180
|
}
|
|
173
181
|
|
|
174
|
-
|
|
182
|
+
function lift({
|
|
175
183
|
projectRoot
|
|
176
184
|
}) {
|
|
177
|
-
|
|
185
|
+
return liftReporting({
|
|
178
186
|
projectRoot
|
|
179
187
|
});
|
|
180
188
|
}
|
package/lib/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/predicates.js","../src/reporter/scaffolder.js","../src/reporter/lifter.js","../src/badge/repository-details-fetcher.js","../src/badge/scaffolder.js","../src/scaffolder.js","../src/lifter.js"],"sourcesContent":["export function coverageShouldBeReportedToCodecov({vcs, visibility, apiAccessToken}) {\n return !!('Public' === visibility || (apiAccessToken && 'github' === vcs.host));\n}\n","export function scaffold() {\n return {\n devDependencies: ['codecov'],\n scripts: {'coverage:report': 'c8 report --reporter=text-lcov > coverage.lcov && codecov'}\n };\n}\n","import {promises as fs} from 'fs';\n\nexport default async function ({projectRoot}) {\n const pathToPackageJson = `${projectRoot}/package.json`;\n\n const existingPackageContents = await fs.readFile(pathToPackageJson, 'utf-8');\n const {scripts, ...otherTopLevelProperties} = JSON.parse(existingPackageContents);\n const {'coverage:report': reportCoverageScript, ...otherScripts} = scripts;\n\n if (scripts['coverage:report']) {\n await fs.writeFile(pathToPackageJson, JSON.stringify({...otherTopLevelProperties, scripts: otherScripts}));\n }\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 {coverageShouldBeReportedToCodecov} from './predicates';\nimport {scaffold as scaffoldReporter} from './reporter';\nimport {scaffold as scaffoldBadge} from './badge';\n\nexport async function scaffold({vcs, visibility, apiAccessToken}) {\n if (!coverageShouldBeReportedToCodecov({vcs, visibility, apiAccessToken})) return {};\n\n return {\n ...scaffoldReporter(),\n ...await scaffoldBadge({vcs, apiAccessToken})\n };\n}\n","import {lift as liftReporting} from './reporter';\n\nexport
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/predicates.js","../src/reporter/scaffolder.js","../src/reporter/lifter.js","../src/badge/repository-details-fetcher.js","../src/badge/scaffolder.js","../src/scaffolder.js","../src/lifter.js"],"sourcesContent":["export function coverageShouldBeReportedToCodecov({vcs, visibility, apiAccessToken}) {\n return !!('Public' === visibility || (apiAccessToken && 'github' === vcs.host));\n}\n","export function scaffold() {\n return {\n devDependencies: ['codecov'],\n scripts: {'coverage:report': 'c8 report --reporter=text-lcov > coverage.lcov && codecov'}\n };\n}\n","import {promises as fs} from 'fs';\n\nexport default async function ({projectRoot}) {\n const pathToPackageJson = `${projectRoot}/package.json`;\n\n const existingPackageContents = await fs.readFile(pathToPackageJson, 'utf-8');\n const {scripts, ...otherTopLevelProperties} = JSON.parse(existingPackageContents);\n const {'coverage:report': reportCoverageScript, ...otherScripts} = scripts;\n\n if (scripts['coverage:report']) {\n await fs.writeFile(pathToPackageJson, JSON.stringify({...otherTopLevelProperties, scripts: otherScripts}));\n\n return {\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 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 {coverageShouldBeReportedToCodecov} from './predicates';\nimport {scaffold as scaffoldReporter} from './reporter';\nimport {scaffold as scaffoldBadge} from './badge';\n\nexport async function scaffold({vcs, visibility, apiAccessToken}) {\n if (!coverageShouldBeReportedToCodecov({vcs, visibility, apiAccessToken})) return {};\n\n return {\n ...scaffoldReporter(),\n ...await scaffoldBadge({vcs, apiAccessToken})\n };\n}\n","import {lift as liftReporting} from './reporter';\n\nexport function lift({projectRoot}) {\n return liftReporting({projectRoot});\n}\n"],"names":["coverageShouldBeReportedToCodecov","vcs","visibility","apiAccessToken","host","scaffold","devDependencies","scripts","projectRoot","pathToPackageJson","existingPackageContents","fs","readFile","JSON","parse","otherTopLevelProperties","otherScripts","writeFile","stringify","nextSteps","summary","description","body","repo","got","owner","name","headers","Authorization","responseType","includes","badges","status","coverage","img","fetchRepositoryDetails","image_token","link","text","scaffoldReporter","scaffoldBadge","lift","liftReporting"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAASA,iCAAT,CAA2C;AAACC,EAAAA,GAAD;AAAMC,EAAAA,UAAN;AAAkBC,EAAAA;AAAlB,CAA3C,EAA8E;AACnF,SAAO,CAAC,EAAE,aAAaD,UAAb,IAA4BC,cAAc,IAAI,aAAaF,GAAG,CAACG,IAAjE,CAAR;AACD;;ACFM,SAASC,UAAT,GAAoB;AACzB,SAAO;AACLC,IAAAA,eAAe,EAAE,CAAC,SAAD,CADZ;AAELC,IAAAA,OAAO,EAAE;AAAC,yBAAmB;AAApB;AAFJ,GAAP;AAID;;;;ACHc,8BAAgB;AAACC,EAAAA;AAAD,CAAhB,EAA+B;AAC5C,QAAMC,iBAAiB,GAAI,GAAED,WAAY,eAAzC;AAEA,QAAME,uBAAuB,GAAG,MAAMC,QAAE,CAACC,QAAH,CAAYH,iBAAZ,EAA+B,OAA/B,CAAtC;;AACA,sBAA8CI,IAAI,CAACC,KAAL,CAAWJ,uBAAX,CAA9C;AAAA,QAAM;AAACH,IAAAA;AAAD,GAAN;AAAA,QAAmBQ,uBAAnB;;AACA,QAAmDC,YAAnD,4BAAmET,OAAnE;;AAEA,MAAIA,OAAO,CAAC,iBAAD,CAAX,EAAgC;AAC9B,UAAMI,QAAE,CAACM,SAAH,CAAaR,iBAAb,EAAgCI,IAAI,CAACK,SAAL,mCAAmBH,uBAAnB;AAA4CR,MAAAA,OAAO,EAAES;AAArD,OAAhC,CAAN;AAEA,WAAO;AACLG,MAAAA,SAAS,EAAE,CAAC;AACVC,QAAAA,O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