Comparing version 0.1.15 to 0.1.16
@@ -19,5 +19,2 @@ { | ||
"eslint-plugin-promise": "^6.1.1", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.2.1", | ||
"prettier": "2.8.7", | ||
"tsc-watch": "^6.0.0", | ||
@@ -27,4 +24,4 @@ "typescript": "^5.2.2" | ||
"dependencies": { | ||
"uranio": "0.1.15" | ||
"uranio": "0.1.16" | ||
} | ||
} |
@@ -13,2 +13,1 @@ /** | ||
export {Client}; | ||
#!/usr/bin/env node | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const index_1 = require("./generate/index"); | ||
const root = `/Users/x71c9/repos/uranio/builder`; | ||
(0, index_1.generate)({ root }); | ||
const i0n_1 = __importDefault(require("i0n")); | ||
const index_1 = require("./cli/log/index"); | ||
const exception = __importStar(require("./cli/exception/index")); | ||
const index_2 = __importDefault(require("./cli/index")); | ||
const args = process.argv.slice(2); | ||
_handle_exception_wrapper(index_2.default.resolve_args, args)().then(async (resolved_arguments) => { | ||
async function _set_verbosity(args) { | ||
var _a; | ||
if (((_a = args.flags) === null || _a === void 0 ? void 0 : _a.verbose) === true) { | ||
index_1.log.params.log_level = i0n_1.default.LOG_LEVEL.TRACE; | ||
return; | ||
} | ||
index_1.log.params.log_level = i0n_1.default.LOG_LEVEL.INFO; | ||
} | ||
async function _run_command(args) { | ||
switch (args.command) { | ||
case 'generate': { | ||
await index_2.default.generate(args); | ||
break; | ||
} | ||
default: { | ||
await index_2.default.version(args); | ||
break; | ||
} | ||
} | ||
} | ||
await _handle_exception_wrapper(_set_verbosity, resolved_arguments)(); | ||
await _handle_exception_wrapper(_run_command, resolved_arguments)(); | ||
}); | ||
function _handle_exception_wrapper(fn, ...args) { | ||
return async () => { | ||
try { | ||
return await fn(...args); | ||
} | ||
catch (err) { | ||
if (err instanceof exception.UranioCLIException && | ||
err.family === 'UranioCLIException') { | ||
index_1.log.error(err.message); | ||
} | ||
process.exit(1); | ||
} | ||
}; | ||
} | ||
//# sourceMappingURL=bin.js.map |
{ | ||
"name": "uranio", | ||
"version": "0.1.15", | ||
"version": "0.1.16", | ||
"description": "Uranio is a type-safe ODM for MongoDB", | ||
@@ -8,4 +8,3 @@ "main": "dist/index.js", | ||
"type": "git", | ||
"url": "git+ssh://git@github.com/x71c9/uranio.git", | ||
"directory": "packages/cli" | ||
"url": "git+ssh://git@github.com/x71c9/uranio.git" | ||
}, | ||
@@ -17,2 +16,7 @@ "author": "x71c9 <108585118+x71c9@users.noreply.github.com>", | ||
}, | ||
"lint-staged": { | ||
"src/**/*.{js,ts,json}": [ | ||
"yarn prettier --write" | ||
] | ||
}, | ||
"scripts": { | ||
@@ -25,4 +29,8 @@ ".uranio:build": "yarn tsc --project ./.uranio", | ||
"dev:base": "node ./dist/index.js", | ||
"dev:bin": "NODE_ENV=dev node ./dist/bin.js", | ||
"dev:bin": "node ./dist/bin.js generate --root ~/repos/uranio/builder", | ||
"dev:bin:verbose": "node ./dist/bin.js generate -v --root ~/repos/uranio/builder", | ||
"dev:bin:version": "node ./dist/bin.js --root ~/repos/uranio/builder", | ||
"dev:run": "yarn tsc-watch --onSuccess \"yarn dev:bin\"", | ||
"dev:run:verbose": "yarn tsc-watch --onSuccess \"yarn dev:bin:verbose\"", | ||
"dev:run:version": "yarn tsc-watch --onSuccess \"yarn dev:bin:version\"", | ||
"push:patch": "bash ./scripts/version.sh patch", | ||
@@ -44,2 +52,5 @@ "push:minor": "bash ./scripts/version.sh minor", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.2.1", | ||
"prettier": "2.8.7", | ||
"tsc-watch": "^6.0.0", | ||
@@ -49,2 +60,3 @@ "typescript": "^5.2.2" | ||
"dependencies": { | ||
"app-root-path": "^3.1.0", | ||
"i0n": "^0.8.1", | ||
@@ -51,0 +63,0 @@ "mongodb": "^6.3.0", |
#!/usr/bin/env node | ||
import {generate} from './generate/index'; | ||
const root = `/Users/x71c9/repos/uranio/builder`; | ||
generate({root}); | ||
import ion from 'i0n'; | ||
import {log} from './cli/log/index'; | ||
import * as exception from './cli/exception/index'; | ||
import cli from './cli/index'; | ||
const args = process.argv.slice(2); | ||
_handle_exception_wrapper(cli.resolve_args, args)().then( | ||
async (resolved_arguments) => { | ||
async function _set_verbosity(args: cli.Arguments) { | ||
if (args.flags?.verbose === true) { | ||
log.params.log_level = ion.LOG_LEVEL.TRACE; | ||
return; | ||
} | ||
log.params.log_level = ion.LOG_LEVEL.INFO; | ||
} | ||
async function _run_command(args: cli.Arguments) { | ||
switch (args.command) { | ||
case 'generate': { | ||
await cli.generate(args); | ||
break; | ||
} | ||
default: { | ||
await cli.version(args); | ||
break; | ||
} | ||
} | ||
} | ||
await _handle_exception_wrapper(_set_verbosity, resolved_arguments)(); | ||
await _handle_exception_wrapper(_run_command, resolved_arguments)(); | ||
} | ||
); | ||
function _handle_exception_wrapper(fn: (...args: any) => any, ...args: any) { | ||
return async () => { | ||
try { | ||
return await fn(...args); | ||
} catch (err) { | ||
if ( | ||
err instanceof exception.UranioCLIException && | ||
err.family === 'UranioCLIException' | ||
) { | ||
log.error(err.message); | ||
} | ||
process.exit(1); | ||
} | ||
}; | ||
} |
Sorry, the diff of this file is not supported yet
97773
94
2248
5
15
4
+ Addedapp-root-path@^3.1.0
+ Addedapp-root-path@3.1.0(transitive)