Merge branch 'master' of ssh://git.verdnatura.es:/var/lib/git/salix
This commit is contained in:
commit
a151268147
|
@ -17,3 +17,4 @@
|
|||
coverage
|
||||
node_modules
|
||||
npm-debug.log
|
||||
db.json
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"db": {
|
||||
"name": "db",
|
||||
"connector": "memory",
|
||||
"file": "myToken.json"
|
||||
"file": "db.json"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,4 +14,4 @@ export const bootstrap = () => {
|
|||
throw new Error("element is not defined");
|
||||
}
|
||||
ng.bootstrap(_element, [NAME]);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"app": ["buys", "crud"],
|
||||
"buys": ["crud"],
|
||||
"app": ["crud"],
|
||||
"crud": []
|
||||
}
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
export * from './src/buys';
|
||||
|
|
@ -1 +0,0 @@
|
|||
export * from './spliting';
|
|
@ -1,44 +1,25 @@
|
|||
|
||||
var gulp = require ('gulp');
|
||||
var gutil = require('gulp-util');
|
||||
var wrap = require('gulp-wrap');
|
||||
var concat = require ('gulp-concat');
|
||||
var babel = require ('gulp-babel');
|
||||
var fs = require ('fs');
|
||||
|
||||
// Routes
|
||||
|
||||
var fileTpl = '\n"<%=file.relative%>": <%=contents%>';
|
||||
var globalTpl = 'var routes = {<%=contents%>\n}';
|
||||
|
||||
gulp.task ('routes', function ()
|
||||
{
|
||||
return gulp.src ('./crud/**/routes.js')
|
||||
.pipe (wrap (fileTpl))
|
||||
.pipe (concat ('salix.routes.js', {newLine: ','}))
|
||||
.pipe (wrap (globalTpl))
|
||||
.pipe (babel ({presets: ['es2015']}))
|
||||
.pipe (gulp.dest ('./build/public'));
|
||||
});
|
||||
var webpack = require ('webpack-stream');
|
||||
var webpackConfig = require ('./webpack.config.js');
|
||||
|
||||
// Spliting
|
||||
|
||||
var baseDir = './app/src/spliting';
|
||||
var depsFile = baseDir +'/deps.json';
|
||||
var splitingDir = './app/src/spliting';
|
||||
var splitingFiles = splitingDir +'/*';
|
||||
|
||||
function splitingFunc ()
|
||||
gulp.task ('spliting', function ()
|
||||
{
|
||||
try {
|
||||
var jsonDeps = fs.readFileSync (depsFile);
|
||||
var modules = JSON.parse (jsonDeps);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
console.error (e);
|
||||
return;
|
||||
}
|
||||
|
||||
var importTpl = fs.readFileSync (baseDir +'/import.tpl.js', 'utf8');
|
||||
var requireTpl = fs.readFileSync (baseDir +'/require.tpl.js', 'utf8');
|
||||
var jsonDeps = fs.readFileSync (splitingDir +'/deps.json');
|
||||
var modules = JSON.parse (jsonDeps);
|
||||
|
||||
var importTpl = fs.readFileSync (splitingDir +'/import.tpl.js', 'utf8');
|
||||
var requireTpl = fs.readFileSync (splitingDir +'/require.tpl.js', 'utf8');
|
||||
|
||||
for (var modName in modules)
|
||||
{
|
||||
|
@ -57,16 +38,44 @@ function splitingFunc ()
|
|||
fs.appendFileSync (splitFile,
|
||||
requireTpl.replace (/\$module/g, deps[i]));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
gulp.task ('spliting', function ()
|
||||
// Webpack
|
||||
|
||||
gulp.task ('webpack', ['spliting'], function (callback)
|
||||
{
|
||||
splitingFunc ();
|
||||
//gulp.watch (depsFile, splitingFunc);
|
||||
return gulp.src (['app/index.js', 'login/index.js'])
|
||||
.pipe (webpack (webpackConfig))
|
||||
.pipe (gulp.dest ('build/public/'));
|
||||
});
|
||||
|
||||
// Routes
|
||||
|
||||
var routeFiles = './crud/**/routes.js';
|
||||
|
||||
gulp.task ('routes', function ()
|
||||
{
|
||||
var fileTpl = '\n"<%=file.relative%>": <%=contents%>';
|
||||
var globalTpl = 'var routes = {<%=contents%>\n}';
|
||||
|
||||
return gulp.src (routeFiles)
|
||||
.pipe (wrap (fileTpl))
|
||||
.pipe (concat ('salix.routes.js', {newLine: ','}))
|
||||
.pipe (wrap (globalTpl))
|
||||
.pipe (babel ({presets: ['es2015']}))
|
||||
.pipe (gulp.dest ('./build/public'));
|
||||
});
|
||||
|
||||
// Watch
|
||||
|
||||
gulp.task ('watch', function ()
|
||||
{
|
||||
gulp.watch (routeFiles, ['routes']);
|
||||
gulp.watch (splitingFiles, ['spliting']);
|
||||
});
|
||||
|
||||
// Default
|
||||
|
||||
gulp.task ('default', ['routes', 'spliting']);
|
||||
|
||||
gulp.task ('build', ['routes', 'webpack']);
|
||||
gulp.task ('default', ['watch', 'build']);
|
||||
|
||||
|
|
|
@ -42,5 +42,18 @@ http {
|
|||
proxy_pass http://127.0.0.1:3002/$1$is_args$args;
|
||||
}
|
||||
}
|
||||
|
||||
types {
|
||||
text/html html;
|
||||
application/json json;
|
||||
application/javascript js;
|
||||
text/css css scss;
|
||||
text/xml xml;
|
||||
image/x-icon ico;
|
||||
image/png png;
|
||||
image/svg+xml svg;
|
||||
image/gif gif;
|
||||
image/jpeg jpeg jpg;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
"gulp-babel": "^6.1.2",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-insert": "^0.5.0",
|
||||
"gulp-util": "^3.0.7",
|
||||
"gulp-wrap": "^0.13.0",
|
||||
"json-loader": "^0.5.4",
|
||||
"node-sass": "^3.11.0",
|
||||
|
@ -37,16 +38,13 @@
|
|||
"sass-loader": "^4.0.2",
|
||||
"style-loader": "^0.13.1",
|
||||
"webpack": "^1.13.3",
|
||||
"webpack-dev-server": "^1.16.2"
|
||||
"webpack-dev-server": "^1.16.2",
|
||||
"webpack-stream": "^3.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack --progress --colors --watch",
|
||||
"dev": "webpack-dev-server --progress --colors --hot",
|
||||
"lint": "eslint ./ --cache --ignore-pattern .gitignore",
|
||||
"gulp": "gulp",
|
||||
"express": "node server.js",
|
||||
"nginx": "/usr/sbin/nginx -p . -c nginx.conf",
|
||||
"nginx-stop": "/usr/sbin/nginx -p . -c nginx.conf -s stop"
|
||||
"lint": "eslint ./ --cache --ignore-pattern .gitignore"
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
var webpack = require ('webpack');
|
||||
var path = require ('path');
|
||||
|
||||
module.exports =
|
||||
|
@ -37,7 +38,13 @@ module.exports =
|
|||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
/* plugins: [
|
||||
new webpack.optimize.UglifyJsPlugin ({
|
||||
minimize: true,
|
||||
compress: { warnings: false }
|
||||
})
|
||||
],
|
||||
*/ resolve: {
|
||||
modulesDirectories: [
|
||||
__dirname,
|
||||
'node_modules'
|
||||
|
@ -47,6 +54,7 @@ module.exports =
|
|||
inline: true,
|
||||
host: '0.0.0.0'
|
||||
},
|
||||
devtool: 'eval-source-map'
|
||||
devtool: 'source-map',
|
||||
watch: true
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue