Comparing version 0.6.2 to 0.7.0
#!/usr/bin/env node | ||
import DefaultLogger from '../lib/logger.js' | ||
import { loadModule } from 'load-module' | ||
try { | ||
/* TODO: build a command map from config */ | ||
const commandMap = new Map() | ||
const command = process.argv[2] | ||
const args = process.argv.slice(3) | ||
const logger = new DefaultLogger() | ||
let Strategy | ||
if (command && commandMap.has(command)) { | ||
Strategy = commandMap.get(command) | ||
} else if (command) { | ||
Strategy = await loadModule(command, { paths: process.cwd() }) | ||
} else { | ||
throw new Error('Usage: nature <command|strategy-file|strategy-module> [<args...>]') | ||
} | ||
const strategy = new Strategy() | ||
const completionReport = await strategy.execute(args) | ||
if (completionReport) { | ||
logger.info(completionReport.toString()) | ||
} | ||
} catch (err) { | ||
console.error(err.cause) | ||
console.error(err.stack) | ||
process.exitCode = 1 | ||
} |
{ | ||
"name": "nature", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "0.6.2", | ||
"version": "0.7.0", | ||
"description": "Naturalise your inventory", | ||
@@ -11,6 +11,3 @@ "repository": { | ||
"type": "module", | ||
"exports": { | ||
"./strategy": "./lib/strategy.js", | ||
"./completion-report": "./lib/completion-report.js" | ||
}, | ||
"exports": "./index.js", | ||
"bin": { | ||
@@ -25,4 +22,3 @@ "nature": "bin/cli.js" | ||
"scripts": { | ||
"test": "npm run test:ci", | ||
"test:ci": "" | ||
"test": "npm run test:ci" | ||
}, | ||
@@ -29,0 +25,0 @@ "files": [ |
@@ -5,1 +5,2 @@ Work In Progress. | ||
* module-level await | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
1984
5
36