mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
cli.js
This commit is contained in:
parent
f68ffb23ec
commit
d6888a8bb3
30
cli.js
Executable file
30
cli.js
Executable file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const program = require('commander');
|
||||
const fs = require('fs');
|
||||
const utils = require('frappejs/utils');
|
||||
const process = require('process');
|
||||
|
||||
program.command('new-model <name>')
|
||||
.description('Create a new model in the `models/doctype` folder')
|
||||
.action((name) => {
|
||||
fs.mkdirSync(`./models/doctype/${utils.slug(name)}`);
|
||||
fs.writeFileSync(`./models/doctype/${utils.slug(name)}/${utils.slug(name)}`, `{
|
||||
"name": "${name}",
|
||||
"doctype": "DocType",
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"keyword_fields": [
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "name",
|
||||
"label": "Name",
|
||||
"fieldtype": "Data",
|
||||
"reqd": 1
|
||||
}
|
||||
]
|
||||
}`);
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
@ -9,8 +9,8 @@ module.exports = class FormPage extends Page {
|
||||
doctype: doctype,
|
||||
parent: this.body
|
||||
});
|
||||
page.on('show', async () => {
|
||||
await page.list.run();
|
||||
this.on('show', async () => {
|
||||
await this.list.run();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
"version": "0.0.1",
|
||||
"description": "Frappe.js",
|
||||
"main": "index.js",
|
||||
"bin": "cli.js",
|
||||
"scripts": {
|
||||
"test": "mocha tests",
|
||||
"start": "nodemon app.js"
|
||||
@ -11,6 +12,7 @@
|
||||
"awesomplete": "^1.1.2",
|
||||
"body-parser": "^1.18.2",
|
||||
"bootstrap": "^4.0.0",
|
||||
"commander": "^2.13.0",
|
||||
"express": "^4.16.2",
|
||||
"jquery": "^3.3.1",
|
||||
"node-fetch": "^1.7.3",
|
||||
@ -39,11 +41,11 @@
|
||||
"nodemon": "^1.14.7",
|
||||
"precss": "^2.0.0",
|
||||
"rollup": "^0.55.1",
|
||||
"rollup-plugin-postcss": "^1.2.7",
|
||||
"rollup-plugin-sass": "^0.5.3",
|
||||
"rollup-plugin-commonjs": "^8.3.0",
|
||||
"rollup-plugin-json": "^2.3.0",
|
||||
"rollup-plugin-node-builtins": "^2.1.2",
|
||||
"rollup-plugin-node-resolve": "^3.0.2"
|
||||
"rollup-plugin-node-resolve": "^3.0.2",
|
||||
"rollup-plugin-postcss": "^1.2.7",
|
||||
"rollup-plugin-sass": "^0.5.3"
|
||||
}
|
||||
}
|
||||
|
@ -638,6 +638,10 @@ commander@2.11.0:
|
||||
version "2.11.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
|
||||
|
||||
commander@^2.13.0:
|
||||
version "2.13.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
|
||||
|
||||
commander@^2.9.0:
|
||||
version "2.12.2"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.2.tgz#0f5946c427ed9ec0d91a46bb9def53e54650e555"
|
||||
|
Loading…
Reference in New Issue
Block a user