@canyonjs/cli 1.0.9 → 1.0.10
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/dist/index.js +8 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,10 +5,10 @@ import node_path from "node:path";
|
|
|
5
5
|
import axios from "axios";
|
|
6
6
|
import { log } from "node:console";
|
|
7
7
|
var package_namespaceObject = {
|
|
8
|
-
rE: "1.0.
|
|
8
|
+
rE: "1.0.10"
|
|
9
9
|
};
|
|
10
10
|
async function mapCommand(params, options) {
|
|
11
|
-
const { dsn, repo_id: repoID, sha: sha, provider, build_target } = params;
|
|
11
|
+
const { dsn, repo_id: repoID, sha: sha, provider, build_target, debug } = params;
|
|
12
12
|
if (!node_fs.existsSync(node_path.resolve(process.cwd(), '.canyon_output'))) return void log('不存在');
|
|
13
13
|
const files = node_fs.readdirSync(node_path.resolve(process.cwd(), '.canyon_output'));
|
|
14
14
|
let data = {};
|
|
@@ -19,8 +19,11 @@ async function mapCommand(params, options) {
|
|
|
19
19
|
const pathString = node_fs.readFileSync(node_path.resolve(Object.keys(fileCoverage)[0] + '.map'), 'utf-8');
|
|
20
20
|
Object.entries(fileCoverage).forEach((item)=>{
|
|
21
21
|
item[1].inputSourceMap = JSON.parse(pathString);
|
|
22
|
+
if ('true' === debug) log(`${item[1].path}有inputSourceMap`);
|
|
22
23
|
});
|
|
23
|
-
} catch (e) {
|
|
24
|
+
} catch (e) {
|
|
25
|
+
if ('true' === debug) log(e);
|
|
26
|
+
}
|
|
24
27
|
data = {
|
|
25
28
|
...data,
|
|
26
29
|
...fileCoverage
|
|
@@ -37,7 +40,7 @@ async function mapCommand(params, options) {
|
|
|
37
40
|
buildTarget: build_target || '',
|
|
38
41
|
coverage: Object.keys(data)
|
|
39
42
|
};
|
|
40
|
-
log(p);
|
|
43
|
+
if ('true' === debug) log(p);
|
|
41
44
|
await axios.post(dsn, {
|
|
42
45
|
...p,
|
|
43
46
|
coverage: data
|
|
@@ -54,7 +57,7 @@ program.name('canyon').version(package_namespaceObject.rE, '-v, --version', 'see
|
|
|
54
57
|
subcommandTerm: (cmd)=>accent(cmd.name(), cmd.usage()),
|
|
55
58
|
argumentTerm: (arg)=>accent(arg.name())
|
|
56
59
|
}).showHelpAfterError(true);
|
|
57
|
-
program.command('upload').option('--dsn <dsn>', 'dsn of the canyon server').option('--repo_id <repo_id>', 'repo id of the canyon server').option('--instrument_cwd <instrument_cwd>', 'instrument cwd of the canyon server').option('--sha <sha>', 'sha of the canyon server').option('--branch <branch>', 'branch of the canyon server').option('--provider <provider>', 'provider of the canyon server').option('--build_target <build_target>', 'build target of the canyon server').option('--coverage <coverage>', 'coverage of the canyon server').allowExcessArguments(false).allowUnknownOption(false).description('modify react native project code to adapt to canyon').addHelpText('after', `\nFor help, head on to ${accent('https://github.com/canyon-project/canyon')}`).action(async (params, options)=>await mapCommand(params, options));
|
|
60
|
+
program.command('upload').option('--debug <dsn>', 'debug').option('--dsn <dsn>', 'dsn of the canyon server').option('--repo_id <repo_id>', 'repo id of the canyon server').option('--instrument_cwd <instrument_cwd>', 'instrument cwd of the canyon server').option('--sha <sha>', 'sha of the canyon server').option('--branch <branch>', 'branch of the canyon server').option('--provider <provider>', 'provider of the canyon server').option('--build_target <build_target>', 'build target of the canyon server').option('--coverage <coverage>', 'coverage of the canyon server').allowExcessArguments(false).allowUnknownOption(false).description('modify react native project code to adapt to canyon').addHelpText('after', `\nFor help, head on to ${accent('https://github.com/canyon-project/canyon')}`).action(async (params, options)=>await mapCommand(params, options));
|
|
58
61
|
const cli = async (args)=>{
|
|
59
62
|
try {
|
|
60
63
|
await program.parseAsync(args);
|