create-mvc-project
Advanced tools
Comparing version
@@ -33,3 +33,3 @@ #!/usr/bin/env node | ||
__dirname, | ||
'./../lib/build-files/content-files/storage-install.json' | ||
'./../lib/build-files/content-files/metadata/storage-install.json' | ||
) , | ||
@@ -36,0 +36,0 @@ JSON.stringify( data ) |
@@ -26,15 +26,19 @@ /** | ||
// only dev dependencies | ||
let colorLog = null ; | ||
const {buildLogCli,logCli} = require('./mvc-vendor/logger') ; | ||
if( paramInstall.find( arg => /^no\-npm$/.test( arg ) ) ) { | ||
logCli('you cant start project because you have install as `no-npm` project, if you dont debug local files you should re install with not `--no-npm` argument', "red","bold") ; | ||
process.exit() ; | ||
} | ||
if( CMP.isDev ) { | ||
// load dev dependencies | ||
colorLog = require('chalk') ; | ||
console.log( colorLog.cyan.bold("\nstart in development mode\n") ) ; | ||
// dev started | ||
logCli("\nstart in development mode\n" , "cyan", "bold" ) ; | ||
process.env.PORT = 3000 ; | ||
} | ||
setupMysql instanceof Function ? | ||
@@ -89,12 +93,4 @@ setupMysql( { | ||
if( colorLog ) { | ||
logCli( message, "red", "bold" ) ; | ||
console.log( | ||
colorLog.red.bold( message ) | ||
) ; | ||
} else { | ||
console.log( message ) ; | ||
} | ||
process.exit() ; | ||
@@ -106,3 +102,3 @@ } | ||
console.log('requirement: `config.express.js` , should be return, express') ; | ||
logCli('requirement: `config.express.js` , should be return, express', "red", "bold" ) ; | ||
process.exit() ; | ||
@@ -155,3 +151,3 @@ } | ||
console.log( colorLog.cyan.bold( startMessage ) ) ; | ||
console.log( buildLogCli( startMessage, "cyan", "bold" ) ) ; | ||
@@ -174,12 +170,4 @@ } else { | ||
if( CMP.isDev ) { | ||
console.log( buildLogCli( message, "red", "bold" ) ) ; | ||
console.log( colorLog.red.bold( message ) ) ; | ||
} else { | ||
console.log( message ) ; | ||
} | ||
process.exit() ; | ||
@@ -186,0 +174,0 @@ |
@@ -5,3 +5,3 @@ [ | ||
"path": "/", | ||
"contentPath": "./content-files/_package.json" | ||
"contentPath": "./content-files/metadata/_package.json" | ||
} , | ||
@@ -11,3 +11,3 @@ { | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/resolve-conflict-routes.js" | ||
"contentPath": "./content-files/router/resolve-conflict-routes.js" | ||
} , | ||
@@ -17,3 +17,3 @@ { | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/extract-constructor-header.js" | ||
"contentPath": "./content-files/controllers/extract-constructor-header.js" | ||
} , | ||
@@ -23,3 +23,3 @@ { | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/extract-dependencies-list.js" | ||
"contentPath": "./content-files/controllers/extract-dependencies-list.js" | ||
} , | ||
@@ -34,3 +34,3 @@ { | ||
"path": "/src/controller", | ||
"contentPath": "./content-files/Main.js" | ||
"contentPath": "./content-files/EJS/Main.js" | ||
} , | ||
@@ -40,3 +40,3 @@ { | ||
"path": "/views/main", | ||
"contentPath": "./content-files/index.ejs" | ||
"contentPath": "./content-files/EJS/index.ejs" | ||
} , | ||
@@ -51,3 +51,3 @@ { | ||
"path": "/bin", | ||
"contentPath": "./content-files/console.js" | ||
"contentPath": "./content-files/CLI/console.js" | ||
} , | ||
@@ -57,3 +57,3 @@ { | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/routes.json" | ||
"contentPath": "./content-files/metadata/routes.json" | ||
} , | ||
@@ -63,3 +63,3 @@ { | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/controller-model-ejs.txt" | ||
"contentPath": "./content-files/models/controller-ejs.txt" | ||
} , | ||
@@ -69,16 +69,26 @@ { | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/build-routes.js" | ||
"contentPath": "./content-files/router/build-routes.js" | ||
} , | ||
{ | ||
"filename": "read-file-item.js", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/router/read-file-item.js" | ||
} , | ||
{ | ||
"filename": "read-directory-item.js", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/router/read-directory-item.js" | ||
} , | ||
{ | ||
"filename": "write-routes.js", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/write-routes.js" | ||
"contentPath": "./content-files/router/write-routes.js" | ||
} , { | ||
"filename": ".env", | ||
"path": "/", | ||
"contentPath": "./content-files/.env-sql" | ||
"contentPath": "./content-files/SQL/.env-sql" | ||
} , { | ||
"filename": ".env", | ||
"path": "/", | ||
"contentPath": "./content-files/.env-no-sql" | ||
"contentPath": "./content-files/NO-SQL/.env-no-sql" | ||
} , { | ||
@@ -91,35 +101,35 @@ "filename": "read-envfile.js", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/resolve-dependencies-controller.js" | ||
"contentPath": "./content-files/controllers/resolve-dependencies-controller.js" | ||
}, { | ||
"filename": "injector-dependence.js", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/injector-dependence.js" | ||
"contentPath": "./content-files/controllers/injector-dependence.js" | ||
}, { | ||
"filename": "404.html", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/404.html" | ||
"contentPath": "./content-files/render/404.html" | ||
}, { | ||
"filename": "home-404.html", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/home-404.html" | ||
"contentPath": "./content-files/render/home-404.html" | ||
}, { | ||
"filename": "build-model-controller.js", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/build-model-controller.js" | ||
"contentPath": "./content-files/CLI/lib/build-model-controller.js" | ||
}, { | ||
"filename": "build-view-controller.js", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/build-view-controller.js" | ||
"contentPath": "./content-files/CLI/lib/build-view-controller.js" | ||
}, { | ||
"filename": "index-model", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/index-model-ejs.txt" | ||
"contentPath": "./content-files/models/index-ejs.txt" | ||
}, { | ||
"filename": "controller-model-json", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/controller-model-json.txt" | ||
"contentPath": "./content-files/models/controller-json.txt" | ||
}, { | ||
"filename": "express.config.js", | ||
"path": "/config", | ||
"contentPath": "./content-files/express.config.js" | ||
"contentPath": "./content-files/EJS/express.config.js" | ||
}, { | ||
@@ -132,7 +142,7 @@ "filename": "affect-config-express.js", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/mysql-config.js" | ||
"contentPath": "./content-files/SQL/mysql-config.js" | ||
}, { | ||
"filename": "setup-mysql.js", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/setup-mysql.js" | ||
"contentPath": "./content-files/SQL/mysql-setup.js" | ||
}, { | ||
@@ -145,16 +155,20 @@ "filename": "execute-custom-entry-point.js", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/mysql-error.js" | ||
"contentPath": "./content-files/SQL/mysql-error.js" | ||
}, { | ||
"filename": "build-data-error-mysql.js", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/build-data-error-mysql.js" | ||
"contentPath": "./content-files/SQL/mysql-build-data-error.js" | ||
}, { | ||
"filename": "express.config.js", | ||
"path": "/config", | ||
"contentPath": "./content-files/express.config-no-ejs.js" | ||
"contentPath": "./content-files/NO-EJS/express.config-no-ejs.js" | ||
}, { | ||
"filename": "Main.js", | ||
"path": "/src/controller", | ||
"contentPath": "./content-files/Main-no-ejs.js" | ||
"contentPath": "./content-files/NO-EJS/Main-no-ejs.js" | ||
}, { | ||
"filename": "build-controllers-list.js", | ||
"path": "/mvc-vendor/", | ||
"contentPath": "./content-files/controllers/build-controllers-list.js" | ||
}, { | ||
"filename": "normalize-package-name.js", | ||
@@ -166,16 +180,20 @@ "path": "/mvc-vendor", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/storage-install.json" | ||
"contentPath": "./content-files/metadata/storage-install.json" | ||
}, { | ||
"filename": "index-model", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/index-model-no-ejs.txt" | ||
"contentPath": "./content-files/models/index-no-ejs.txt" | ||
}, { | ||
"filename": "controller-model-template", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/controller-model-no-ejs.txt" | ||
"contentPath": "./content-files/models/controller-no-ejs.txt" | ||
}, { | ||
"filename": "index.html", | ||
"path": "/views/main/", | ||
"contentPath": "./content-files/index-no-ejs.html" | ||
"contentPath": "./content-files/NO-EJS/index-no-ejs.html" | ||
} , { | ||
"filename": "logger.js", | ||
"path": "/mvc-vendor", | ||
"contentPath": "./content-files/logger/logger.js" | ||
} | ||
] |
{ | ||
"name": "create-mvc-project", | ||
"version": "0.1.1-alpha", | ||
"version": "0.1.2-alpha", | ||
"description": "build your will flexible new project with a standard model view controller structure and enjoy with integrate console, make yourcontroller in one command , define your route with annotations and other...", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,3 +5,3 @@ Please if you detect a error inside documentation or if you have | ||
# [create-mvc-project](https://github.com/Orivoir/create-mvc-project) version 0.1.0-alpha | ||
# [create-mvc-project](https://github.com/Orivoir/create-mvc-project) version 0.1.2-alpha | ||
@@ -8,0 +8,0 @@ > build your will flexible new project with a standard model view controller structure and enjoy with integrate console, make yourcontroller in one command , define your route with annotations and other... |
@@ -12,3 +12,3 @@ const | ||
buildRoutes = require('./../lib/build-files/content-files/build-routes') | ||
buildRoutes = require('./../lib/build-files/content-files/router/build-routes') | ||
; | ||
@@ -36,2 +36,34 @@ | ||
describe('should build routes:' , () => { | ||
const an = new ClassAnnotations('./build-routes/controller/') ; | ||
const routes = buildRoutes( an ) ; | ||
factoryData.output.forEach( (route,index) => { | ||
Object.keys( route ).forEach( (key) => { | ||
const messageIt = `await: ${route[key]} receveid: ${routes[index][key]} ` | ||
it( messageIt , () => { | ||
if( route[key] instanceof Array ) { | ||
assert.isArray( routes[index][key] ) ; | ||
expect( route[key] ).to.be.lengthOf( routes[index][key].length ) ; | ||
} else { | ||
expect( route[key] ).to.be.equal( routes[index][key] ) ; | ||
} | ||
} ) ; | ||
} ) ; | ||
} ) ; | ||
} ) ; | ||
} ) ; |
const | ||
{expect,assert} = require('chai') , | ||
factoryData = require('./factory-data/extract-constructor-header.json') , | ||
extractConstructorHeader = require('./../lib/build-files/content-files/extract-constructor-header') , | ||
extractConstructorHeader = require('./../lib/build-files/content-files/controllers/extract-constructor-header') , | ||
@@ -6,0 +6,0 @@ fs = require('fs') , |
const | ||
{expect, assert} = require('chai'), | ||
extractDependenciesList = require('./../lib/build-files/content-files/extract-dependencies-list'), | ||
extractDependenciesList = require('./../lib/build-files/content-files/controllers/extract-dependencies-list'), | ||
factoryData = require('./factory-data/extract-dependencies-list.json') | ||
@@ -5,0 +5,0 @@ ; |
@@ -1,6 +0,17 @@ | ||
[ | ||
{ | ||
"entry": "./class-0.js", | ||
"output": "./route-0.json" | ||
} | ||
] | ||
{ | ||
"output": [ | ||
{ | ||
"name": "foo_index", | ||
"controller": "Foo", | ||
"methods": ["GET"], | ||
"methodName": "index", | ||
"path": "/foo/index" | ||
} , { | ||
"name": "bar_index", | ||
"controller": "Bar", | ||
"methods": ["GET","POST"], | ||
"methodName": "index", | ||
"path": "/bar/index" | ||
} | ||
] | ||
} |
const | ||
{expect,assert} = require('chai'), | ||
resolveConflictRoutes = require('./../lib/build-files/content-files/resolve-conflict-routes') , | ||
resolveConflictRoutes = require('./../lib/build-files/content-files/router/resolve-conflict-routes') , | ||
@@ -6,0 +6,0 @@ factoryData = require('./factory-data/resolve-confict-routes.json') |
118196
12.47%87
27.94%2537
10.45%