nodejs-nomer 1.3.7 → 1.3.9
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/.github/workflows/npm-publish.yml +16 -4
- package/bin/nomer +0 -0
- package/dist/index.js +1 -1
- package/dist/utils.js +5 -1
- package/install_nomer.sh +1 -1
- package/package.json +2 -2
- package/src/index.js +10 -1
- package/src/utils.js +7 -1
- package/test/script.js +0 -46
|
@@ -14,12 +14,24 @@ jobs:
|
|
|
14
14
|
contents: read
|
|
15
15
|
id-token: write
|
|
16
16
|
steps:
|
|
17
|
-
- uses: actions/checkout@
|
|
18
|
-
- uses: actions/setup-node@
|
|
17
|
+
- uses: actions/checkout@v5
|
|
18
|
+
- uses: actions/setup-node@v4
|
|
19
19
|
with:
|
|
20
|
-
node-version: '21.x'
|
|
20
|
+
node-version: '21.x'
|
|
21
21
|
registry-url: 'https://registry.npmjs.org'
|
|
22
22
|
- run: npm ci
|
|
23
|
-
-
|
|
23
|
+
- name: Run build process
|
|
24
|
+
run: npm run build
|
|
25
|
+
- name: Verify dist folder exists
|
|
26
|
+
run: |
|
|
27
|
+
if [! -d "dist" ]; then
|
|
28
|
+
echo "X dist folder not found after build!"
|
|
29
|
+
ls -la
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
echo "OK dist folder content:"
|
|
33
|
+
ls -la dist/
|
|
34
|
+
- name: Publish to npm
|
|
35
|
+
run: npm publish --provenance --access public
|
|
24
36
|
env:
|
|
25
37
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
package/bin/nomer
CHANGED
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -103,7 +103,7 @@ var Nomer = exports.Nomer = /*#__PURE__*/function () {
|
|
|
103
103
|
value: function appendAsync() {
|
|
104
104
|
var matcher = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "globi-taxon-cache";
|
|
105
105
|
var outputFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "tsv";
|
|
106
|
-
return (0, _utils.runNomerAsync)(
|
|
106
|
+
return (0, _utils.runNomerAsync)((0, _utils.getNomerMatchCmd)(null, "append", matcher, this.getPropertiesPath(), outputFormat, this.echoOpt));
|
|
107
107
|
}
|
|
108
108
|
}, {
|
|
109
109
|
key: "getPropertiesPath",
|
package/dist/utils.js
CHANGED
|
@@ -27,7 +27,11 @@ var getNomerMatchCmd = exports.getNomerMatchCmd = function getNomerMatchCmd() {
|
|
|
27
27
|
var properties = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
28
28
|
var outputFormat = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
29
29
|
var echoOpt = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "-e";
|
|
30
|
-
var nomerCmd = "
|
|
30
|
+
var nomerCmd = "";
|
|
31
|
+
if (query) {
|
|
32
|
+
nomerCmd = "echo ".concat(echoOpt, " '").concat(query, "' | ");
|
|
33
|
+
}
|
|
34
|
+
nomerCmd = "".concat(nomerCmd, "nomer ").concat(cmd, " ").concat(matcher);
|
|
31
35
|
if (properties) {
|
|
32
36
|
nomerCmd = "".concat(nomerCmd, " -p ").concat(properties);
|
|
33
37
|
}
|
package/install_nomer.sh
CHANGED
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -82,7 +82,16 @@ export class Nomer {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
appendAsync(matcher = "globi-taxon-cache", outputFormat = "tsv") {
|
|
85
|
-
return runNomerAsync(
|
|
85
|
+
return runNomerAsync(
|
|
86
|
+
getNomerMatchCmd(
|
|
87
|
+
null,
|
|
88
|
+
"append",
|
|
89
|
+
matcher,
|
|
90
|
+
this.getPropertiesPath(),
|
|
91
|
+
outputFormat,
|
|
92
|
+
this.echoOpt
|
|
93
|
+
)
|
|
94
|
+
);
|
|
86
95
|
}
|
|
87
96
|
|
|
88
97
|
getPropertiesPath() {
|
package/src/utils.js
CHANGED
|
@@ -13,7 +13,13 @@ export const getNomerValidateCmd = (filepath = "", cmd = "validate-term", proper
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export const getNomerMatchCmd = (query = "", cmd = "append", matcher = "globi-taxon-cache", properties = null, outputFormat = null, echoOpt = "-e") => {
|
|
16
|
-
let nomerCmd =
|
|
16
|
+
let nomerCmd = "";
|
|
17
|
+
|
|
18
|
+
if (query) {
|
|
19
|
+
nomerCmd = `echo ${echoOpt} '${query}' | `;
|
|
20
|
+
}
|
|
21
|
+
nomerCmd = `${nomerCmd}nomer ${cmd} ${matcher}`;
|
|
22
|
+
|
|
17
23
|
if (properties) {
|
|
18
24
|
nomerCmd = `${nomerCmd} -p ${properties}`;
|
|
19
25
|
}
|
package/test/script.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const Nomer = require("nodejs-nomer")
|
|
2
|
-
|
|
3
|
-
const nomer = new Nomer.Nomer();
|
|
4
|
-
|
|
5
|
-
console.time("version")
|
|
6
|
-
console.log(nomer.version());
|
|
7
|
-
console.timeEnd("version")
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
console.time("append async")
|
|
11
|
-
const process = nomer.appendAsync("col")
|
|
12
|
-
const resultsAsync = []
|
|
13
|
-
|
|
14
|
-
const result = (stdout) => new Promise(resolve => {
|
|
15
|
-
stdout.on('data', async (data) => {
|
|
16
|
-
console.log(data.toString())
|
|
17
|
-
return nomer.toObject(data).filter((obj) => obj.matchType !== "NONE")
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
stdout.on('end', () => {
|
|
21
|
-
resolve('end')
|
|
22
|
-
})
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
p = result(process.stdout)
|
|
26
|
-
for (let index = 0; index < 1000; index++) {
|
|
27
|
-
process.stdin.write("\tBauhinia rufa\t\n")
|
|
28
|
-
}
|
|
29
|
-
process.stdin.end()
|
|
30
|
-
|
|
31
|
-
result.then((v) => console.log(v))
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// console.time("append")
|
|
35
|
-
// const results = []
|
|
36
|
-
// for (let index = 0; index < 100; index++) {
|
|
37
|
-
// results.push(nomer.append("\tBauhinia rufa\t", "gbif"))
|
|
38
|
-
// }
|
|
39
|
-
// console.timeEnd("append")
|
|
40
|
-
|
|
41
|
-
// console.time("toObject")
|
|
42
|
-
// for (let index = 0; index < results.length; index++) {
|
|
43
|
-
// const element = results[index];
|
|
44
|
-
// nomer.toObject(element)
|
|
45
|
-
// }
|
|
46
|
-
// console.timeEnd("toObject")
|