diff --git a/bin/apikana b/bin/apikana index 6b21d8a..0e6f76e 100755 --- a/bin/apikana +++ b/bin/apikana @@ -6,6 +6,7 @@ var colors = require('ansi-colors'); var params = require('../src/params'); var compareVersions = require('compare-versions'); var packge = require('../package.json'); +var yaml = require('yamljs'); var argc = process.argv.length; require('../src/logo'); @@ -114,6 +115,7 @@ function generate() { const os = require('os'); const currentPath = process.cwd(); const packageJSON = JSON.parse(fs.readFileSync(path.resolve(currentPath, './package.json'))); + const openapi = yaml.parse(fs.readFileSync(path.resolve(currentPath, './src/openapi/api.yaml')).toString()); const PluginManager = require('live-plugin-manager').PluginManager; const manager = new PluginManager({ @@ -124,7 +126,8 @@ function generate() { function run(defaults) { var plop = nodePlop(__dirname + '/../src/plopfile_start.js', { defaults }); var generator = plop.getGenerator('start'); - generator.runActions(packageJSON).then(_ => { + const model = Object.assign({}, packageJSON, { api: openapi }); + generator.runActions(model).then(_ => { require('../src/generate').generate(path.resolve(source), params.target()); }); } diff --git a/package.json b/package.json index 6ada789..167d402 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "apikana", - "version": "0.9.5", + "version": "0.9.6", "description": "Integrated tools for REST API design - アピ", "main": "index.js", "bin": { diff --git a/src/plopfile_init.js b/src/plopfile_init.js index 3067074..4217f9f 100644 --- a/src/plopfile_init.js +++ b/src/plopfile_init.js @@ -107,7 +107,8 @@ module.exports = function (plop, cfg) { default: Object.keys(defaults && defaults.plugins || {}).filter(key => defaults.plugins[key].active), choices: [ { name: 'Maven artifact with Java classes', value: 'maven' }, - { name: 'C# project', value: 'dotnet' } + { name: 'C# project', value: 'dotnet' }, + { name: 'Generate README', value: 'readme' } ] },{ type: 'input', @@ -210,7 +211,7 @@ module.exports = function (plop, cfg) { actions.push({ type: 'add', path: slash(path.join(currentPath, answers.projectName, '.gitignore')), - template: "node_modules/\ndist/\ngen/\n.vscode/\n.idea/\n*.iml\n.settings/\n.project/", + template: "node_modules/\ndist/\n/gen/\n.vscode/\n.idea/\n*.iml\n.settings/\n.project/", skipIfExists: true });