proca 0.5.6 → 0.6.1
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 +1 -1
- package/package.json +1 -4
- package/src/procaCommand.mjs +10 -1
- package/src/util/flags.mjs +0 -33
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "proca",
|
|
3
3
|
"description": "Access the proca api",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"author": "Xavier",
|
|
6
6
|
"bin": {
|
|
7
7
|
"proca": "./proca-cli"
|
|
@@ -64,9 +64,6 @@
|
|
|
64
64
|
"topicSeparator": " ",
|
|
65
65
|
"commands": "./src/commands",
|
|
66
66
|
"helpClass": "./src/hooks/help.mjs",
|
|
67
|
-
"hooks": {
|
|
68
|
-
"init": "./src/hooks/init.mjs"
|
|
69
|
-
},
|
|
70
67
|
"topics": {
|
|
71
68
|
"widget": {
|
|
72
69
|
"description": "widgets (actionPages in the API)"
|
package/src/procaCommand.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import debug from "debug";
|
|
|
3
3
|
import { parse as dxid, id } from "dxid";
|
|
4
4
|
import Table from "easy-table";
|
|
5
5
|
import fastcsv from "fast-csv";
|
|
6
|
-
|
|
6
|
+
import initHook from "#src/hooks/init.mjs";
|
|
7
7
|
import { createClient } from "#src/urql.mjs";
|
|
8
8
|
|
|
9
9
|
class ProcaCommand extends Command {
|
|
@@ -82,6 +82,13 @@ class ProcaCommand extends Command {
|
|
|
82
82
|
}
|
|
83
83
|
return parsed;
|
|
84
84
|
}
|
|
85
|
+
|
|
86
|
+
static hooks = {
|
|
87
|
+
init: async (options) => {
|
|
88
|
+
console.log("init hook called", options);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
},
|
|
91
|
+
};
|
|
85
92
|
async init() {
|
|
86
93
|
await super.init();
|
|
87
94
|
const { argv, flags } = await this.parse();
|
|
@@ -90,7 +97,9 @@ class ProcaCommand extends Command {
|
|
|
90
97
|
if (flags.csv) this.format = "csv";
|
|
91
98
|
|
|
92
99
|
this.debug = debug("proca");
|
|
100
|
+
initHook({ config: this.config });
|
|
93
101
|
this.procaConfig = this.config.procaConfig; // set up from the hooks/init
|
|
102
|
+
// await this.config.runHook('init', { config: this.config });
|
|
94
103
|
createClient(this.procaConfig);
|
|
95
104
|
}
|
|
96
105
|
|
package/src/util/flags.mjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* inspired by https://github.com/salesforcecli/cli/blob/main/src/flags.ts
|
|
3
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
// -------------------------------------------------------------------------------
|
|
10
|
-
// No requires or imports since this is loaded early in the cli lifecycle and we
|
|
11
|
-
// want to minimize the number of packages that load before enabling require
|
|
12
|
-
// instrumentation.
|
|
13
|
-
// -------------------------------------------------------------------------------
|
|
14
|
-
|
|
15
|
-
export function _preprocessCliFlags(process) {
|
|
16
|
-
process.argv.map((arg) => {
|
|
17
|
-
if (arg === "--dev-debug") {
|
|
18
|
-
let debug = "*";
|
|
19
|
-
const filterIndex = process.argv.indexOf("--debug-filter");
|
|
20
|
-
if (filterIndex > 0) {
|
|
21
|
-
debug = process.argv[filterIndex + 1];
|
|
22
|
-
|
|
23
|
-
process.argv.splice(filterIndex, 2);
|
|
24
|
-
}
|
|
25
|
-
// convert --dev-debug into a set of environment variables
|
|
26
|
-
process.env.DEBUG = debug;
|
|
27
|
-
process.env.PROCA_ENV = "development";
|
|
28
|
-
|
|
29
|
-
// need to calculate indexOf --dev-debug here because it might've changed based on --debug-filter
|
|
30
|
-
process.argv.splice(process.argv.indexOf("--dev-debug"), 1);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|