Skip to content

Commit

Permalink
feat: add cli stub to project
Browse files Browse the repository at this point in the history
Refs: #30

PR-URL: #33
  • Loading branch information
tshemsedinov committed Sep 15, 2020
1 parent 17e2f1f commit 1307586
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
15 changes: 15 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env node
'use strict';

const path = require('path');
const metasql = require('..');

const [,, command, version] = process.argv;

if (command === 'g') {
const schemaPath = path.join(__dirname, '../application/schemas');
metasql.migrate(schemaPath);
} else if (command === 'm') {
if (version) console.log(`Migrate to version ${version}`);
else console.log(`Migrate to the latest version`);
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
"version": "0.1.3",
"description": "Metarhia SQL builder",
"main": "sql.js",
"bin": {
"metasql": "bin/cli.js"
},
"files": [
"lib/",
"typings/"
"typings/",
"bin/"
],
"scripts": {
"lint": "eslint . && remark . && prettier --check \"**/*.js\" \"**/*.json\" \"**/*.md\" \"**/.*rc\" \"**/*.yml\" \"**/*.ts\"",
Expand Down

0 comments on commit 1307586

Please sign in to comment.