Socket
Socket
Sign inDemoInstall

@modusjs/cli

Package Overview
Dependencies
29
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.6 to 0.0.7

34

dist/index.js

@@ -9,6 +9,8 @@ #! /usr/bin/env node

import { csv as moduscsv } from '@modusjs/convert';
const warn = debug('@modusjs/xsd2json#index:warn');
const info = debug('@modusjs/xsd2json#index:info');
const trace = debug('@modusjs/xsd2json#index:trace');
import { assert as assertModusResult } from '@oada/types/modus/v1/modus-result.js';
const warn = debug('@modusjs/cli:warn');
const info = debug('@modusjs/cli:info');
const trace = debug('@modusjs/cli:trace');
const { red, cyan } = chalk;
const VERSION = '0.0.7';
program

@@ -20,3 +22,3 @@ .command('tojson')

//.version(process.env.npm_package_version!)
.version('0.0.6')
.version(VERSION)
.description('Convert one or more Modus XML files, CSV files, or XLSX files to MODUS json. CSV/XLSX files must has supported structures.')

@@ -95,3 +97,27 @@ .action(async (filenames, opts) => {

});
program
.command('tocsv')
.requiredOption('-o,--output <filename.csv>', 'Name and path of output CSV file)')
.argument('<json files...>')
.version(VERSION)
.description('Condense one or more Modus JSON files into a single flat CSV with standardized headers')
.action(async (filenames, opts) => {
const modusresults = [];
for (const f of filenames) {
try {
const json = JSON.parse((await fs.readFile(f)).toString());
assertModusResult(json);
modusresults.push(json);
}
catch (e) {
warn(red('ERROR:'), 'Failed to parse file', f, 'as Modus JSON. Error was:', e);
continue;
}
}
info('Parsed', cyan(modusresults.length), ' Modus JSON files for inclusion in CSV output');
const { str } = moduscsv.toCsv(modusresults);
await fs.writeFile(opts.output, str);
info('Successfully wrote CSV output to', opts.output, 'from', cyan(modusresults.length), 'files');
});
program.parse();
//# sourceMappingURL=index.js.map

8

package.json
{
"name": "@modusjs/cli",
"packageManager": "yarn@3.2.1",
"version": "0.0.6",
"description": "Conversion utility to generate a JSON schema from the Modus XSD files.",
"version": "0.0.7",
"description": "Conversion utility between various forms of soil test files, including CSV, XLSX, Modus XML, and Modus JSON.",
"type": "module",

@@ -21,2 +21,3 @@ "main": "dist/index.js",

"tojson": "yarn run cli tojson",
"tocsv": "yarn run cli tocsv",
"cli": "node dist/index.js",

@@ -36,3 +37,4 @@ "clean": "rm -rf dist"

"dependencies": {
"@modusjs/convert": "^0.0.3",
"@modusjs/convert": "^0.0.4",
"@oada/types": "^3.1.5",
"chalk": "^4.0.0",

@@ -39,0 +41,0 @@ "commander": "^9.3.0",

@@ -19,9 +19,10 @@ # Modus xml/json command-line tools

Convert one or more supported files into JSON. Name and path of output file is generally same as input with `.xml` replaced by `.json`.
Except for xlxs files which will use a modified version of the sheetnames for the Modus JSON output files.
Except for xlxs files which group samples by the inferred date, and then creates separate modus files for each group of dates within
each worksheet.
```bash
modus tojson ./path/to/xml/file1 ./path/to/xml/file2 ...etc...
modus tojson -f tomkat ./path/to/tomkat/formatted/xlsx_file
modus tojson -f tomkat ./path/to/tomkat/formatted/xlsx_or_csv_file
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc