create-ui5-webapp
Advanced tools
Comparing version
module.exports = { | ||
controllerContent(componentName, namespace) { | ||
controllerContent(namespace, componentName) { | ||
return `sap.ui.define([ | ||
@@ -29,3 +29,3 @@ "sap/ui/core/mvc/Controller" | ||
</mvc:View>`, | ||
componentContent(componentName, namespace) { | ||
componentContent(namespace, componentName) { | ||
return `sap.ui.define([ | ||
@@ -60,3 +60,3 @@ "sap/ui/core/UIComponent" | ||
}, | ||
manifestContent(componentName, namespace) { | ||
manifestContent(namespace, componentName) { | ||
return `{ | ||
@@ -63,0 +63,0 @@ "_version": "1.5.0", |
17
index.js
@@ -5,6 +5,2 @@ const fs = require('fs'); | ||
exports.getComponentName = () => { | ||
let componentName = process.argv[2]; | ||
return componentName; | ||
} | ||
exports.getNameOfNamespace = () => { | ||
@@ -15,3 +11,8 @@ let namespace = process.argv[3]; | ||
exports.createComponent = (componentName = "webapp", namespace = "namespace") => { | ||
exports.getComponentName = () => { | ||
let componentName = process.argv[2]; | ||
return componentName; | ||
} | ||
exports.createComponent = (namespace = "namespace", componentName = "webapp") => { | ||
fs.mkdirSync(componentName); // component's name | ||
@@ -21,3 +22,3 @@ | ||
fs.mkdirSync(componentName + "/controller"); | ||
fs.writeFile(componentName + "/controller/app.controller.js", fileContent.controllerContent(componentName, namespace), (err) => { | ||
fs.writeFile(componentName + "/controller/app.controller.js", fileContent.controllerContent(namespace, componentName), (err) => { | ||
if (err) throw err; | ||
@@ -52,3 +53,3 @@ console.log("app controller has been created"); | ||
// create Component.js | ||
fs.writeFile(componentName + "/Component.js", fileContent.componentContent(componentName, namespace), (err) => { | ||
fs.writeFile(componentName + "/Component.js", fileContent.componentContent(namespace, componentName), (err) => { | ||
if (err) throw err; | ||
@@ -59,3 +60,3 @@ console.log("Component.js file has been created"); | ||
// create manifest.json | ||
fs.writeFile(componentName + "/manifest.json", fileContent.manifestContent(componentName, namespace), (err) => { | ||
fs.writeFile(componentName + "/manifest.json", fileContent.manifestContent(namespace, componentName), (err) => { | ||
if (err) throw err; | ||
@@ -62,0 +63,0 @@ console.log("manifest.json file has been created"); |
{ | ||
"name": "create-ui5-webapp", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
var createUi5Webapp = require("create-ui5-webapp"); | ||
let namespace = createUi5Webapp.getNameOfNamespace(); | ||
let componentName = createUi5Webapp.getComponentName(); | ||
let namespace = createUi5Webapp.getNameOfNamespace(); | ||
createUi5Webapp.createComponent(componentName, namespace); | ||
createUi5Webapp.createComponent(namespace, componentName); |
6101
0.03%