|
1 | 1 | #!/usr/bin/env node
|
2 | 2 |
|
3 |
| -const app = require("../src"); |
| 3 | +const app = require('../src') |
4 | 4 |
|
5 |
| -var argv = require("yargs") // eslint-disable-line |
6 |
| - .usage("Usage: $0 <command> [options]") |
| 5 | +var argv = require('yargs') // eslint-disable-line |
| 6 | + .usage('Usage: $0 <command> [options]') |
7 | 7 | .options({
|
8 | 8 | build: {
|
9 |
| - alias: "b", |
10 |
| - description: "Specify the build number manually" |
| 9 | + alias: 'b', |
| 10 | + description: 'Specify the build number manually', |
11 | 11 | },
|
12 | 12 | branch: {
|
13 |
| - alias: "B", |
14 |
| - description: "Specify the branch manually" |
| 13 | + alias: 'B', |
| 14 | + description: 'Specify the branch manually', |
15 | 15 | },
|
16 | 16 | env: {
|
17 |
| - alias: "e", |
18 |
| - description: "Specify environment variables to be included with this build.\nAlso accepting environment variables: CODECOV_ENV=VAR,VAR2" |
| 17 | + alias: 'e', |
| 18 | + description: |
| 19 | + 'Specify environment variables to be included with this build.\nAlso accepting environment variables: CODECOV_ENV=VAR,VAR2', |
19 | 20 | },
|
20 | 21 | sha: {
|
21 |
| - alias: "C", |
22 |
| - description: "Specify the commit SHA mannually" |
| 22 | + alias: 'C', |
| 23 | + description: 'Specify the commit SHA mannually', |
23 | 24 | },
|
24 | 25 | file: {
|
25 |
| - alias: "f", |
26 |
| - description: "Target file(s) to upload" |
| 26 | + alias: 'f', |
| 27 | + description: 'Target file(s) to upload', |
27 | 28 | },
|
28 | 29 | flags: {
|
29 |
| - alias: "F", |
30 |
| - default: "", |
31 |
| - description: "Flag the upload to group coverage metrics" |
| 30 | + alias: 'F', |
| 31 | + default: '', |
| 32 | + description: 'Flag the upload to group coverage metrics', |
32 | 33 | },
|
33 | 34 | name: {
|
34 |
| - alias: "n", |
35 |
| - default: "", |
36 |
| - description: "Custom defined name of the upload. Visible in Codecov UI" |
| 35 | + alias: 'n', |
| 36 | + default: '', |
| 37 | + description: 'Custom defined name of the upload. Visible in Codecov UI', |
37 | 38 | },
|
38 | 39 | parent: {
|
39 |
| - alias: "N", |
40 |
| - description: "The commit SHA of the parent for which you are uploading coverage. If not present, the parent will be determined using the API of your repository provider. When using the repository provider's API, the parent is determined via finding the closest ancestor to the commit." |
| 40 | + alias: 'N', |
| 41 | + description: |
| 42 | + "The commit SHA of the parent for which you are uploading coverage. If not present, the parent will be determined using the API of your repository provider. When using the repository provider's API, the parent is determined via finding the closest ancestor to the commit.", |
41 | 43 | },
|
42 | 44 | pr: {
|
43 |
| - alias: "P", |
44 |
| - description: "Specify the pull request number mannually" |
| 45 | + alias: 'P', |
| 46 | + description: 'Specify the pull request number mannually', |
45 | 47 | },
|
46 | 48 | dir: {
|
47 |
| - alias: "s", |
48 |
| - description: "Directory to search for coverage reports.\nAlready searches project root and current working directory" |
| 49 | + alias: 's', |
| 50 | + description: |
| 51 | + 'Directory to search for coverage reports.\nAlready searches project root and current working directory', |
49 | 52 | },
|
50 | 53 | token: {
|
51 |
| - alias: "t", |
52 |
| - default: "", |
53 |
| - description: "Codecov upload token" |
| 54 | + alias: 't', |
| 55 | + default: '', |
| 56 | + description: 'Codecov upload token', |
54 | 57 | },
|
55 | 58 | tag: {
|
56 |
| - alias: "T", |
57 |
| - default: "", |
58 |
| - description: "Specify the git tag" |
| 59 | + alias: 'T', |
| 60 | + default: '', |
| 61 | + description: 'Specify the git tag', |
59 | 62 | },
|
60 | 63 | verbose: {
|
61 |
| - alias: "v", |
62 |
| - type: "boolean", |
63 |
| - description: "Run with verbose logging" |
| 64 | + alias: 'v', |
| 65 | + type: 'boolean', |
| 66 | + description: 'Run with verbose logging', |
64 | 67 | },
|
65 | 68 | rootDir: {
|
66 |
| - alias: "R", |
67 |
| - description: "Specify the project root directory when not in a git repo" |
| 69 | + alias: 'R', |
| 70 | + description: 'Specify the project root directory when not in a git repo', |
68 | 71 | },
|
69 | 72 | nonZero: {
|
70 |
| - alias: "Z", |
71 |
| - type: "boolean", |
| 73 | + alias: 'Z', |
| 74 | + type: 'boolean', |
72 | 75 | default: false,
|
73 |
| - description: "Should errors exit with a non-zero (default: false)" |
| 76 | + description: 'Should errors exit with a non-zero (default: false)', |
74 | 77 | },
|
75 | 78 | dryRun: {
|
76 |
| - alias: "d", |
77 |
| - type: "boolean", |
78 |
| - description: "Don't upload files to Codecov" |
| 79 | + alias: 'd', |
| 80 | + type: 'boolean', |
| 81 | + description: "Don't upload files to Codecov", |
79 | 82 | },
|
80 | 83 | slug: {
|
81 |
| - alias: "r", |
82 |
| - description: "Specify the slug manually (Enterprise use)" |
| 84 | + alias: 'r', |
| 85 | + description: 'Specify the slug manually (Enterprise use)', |
83 | 86 | },
|
84 | 87 | url: {
|
85 |
| - type: "string", |
86 |
| - description: "Change the upload host (Enterprise use)", |
87 |
| - default: "https://codecov.io" |
| 88 | + type: 'string', |
| 89 | + description: 'Change the upload host (Enterprise use)', |
| 90 | + default: 'https://codecov.io', |
88 | 91 | },
|
89 | 92 | clean: {
|
90 |
| - alias: "c", |
91 |
| - type: "boolean", |
| 93 | + alias: 'c', |
| 94 | + type: 'boolean', |
92 | 95 | default: false,
|
93 |
| - description: "Move discovered coverage reports to the trash" |
| 96 | + description: 'Move discovered coverage reports to the trash', |
94 | 97 | },
|
95 | 98 | feature: {
|
96 | 99 | alias: 'X',
|
97 |
| - type: "string", |
| 100 | + type: 'string', |
98 | 101 | description: `Toggle functionalities
|
99 |
| - -X network Disable uploading the file network` |
100 |
| - } |
| 102 | + -X network Disable uploading the file network`, |
| 103 | + }, |
101 | 104 | })
|
102 | 105 | .version()
|
103 |
| - .help("help") |
104 |
| - .alias("help", "h").argv; |
| 106 | + .help('help') |
| 107 | + .alias('help', 'h').argv |
105 | 108 |
|
106 |
| - const start = Date.now() |
| 109 | +const start = Date.now() |
107 | 110 |
|
108 |
| - app.log(`Start of uploader: ${start}...`, { level: 'debug', argv }) |
109 |
| - app.main(argv).then(() => { |
| 111 | +app.log(`Start of uploader: ${start}...`, { level: 'debug', argv }) |
| 112 | +app |
| 113 | + .main(argv) |
| 114 | + .then(() => { |
110 | 115 | const end = Date.now()
|
111 |
| - app.log(`End of uploader: ${end - start} milliseconds`, { level: 'debug', argv }) |
112 |
| - }).catch(error => { |
| 116 | + app.log(`End of uploader: ${end - start} milliseconds`, { |
| 117 | + level: 'debug', |
| 118 | + argv, |
| 119 | + }) |
| 120 | + }) |
| 121 | + .catch(error => { |
113 | 122 | app.log(`Error!: ${error}`, { level: 'error', argv })
|
114 | 123 | const end = Date.now()
|
115 |
| - app.log(`End of uploader: ${end - start} milliseconds`, { level: 'debug', argv }) |
| 124 | + app.log(`End of uploader: ${end - start} milliseconds`, { |
| 125 | + level: 'debug', |
| 126 | + argv, |
| 127 | + }) |
116 | 128 | process.exit(argv.nonZero ? -1 : 0)
|
117 |
| -}) |
118 |
| - |
| 129 | + }) |
0 commit comments