diff --git a/.eslintrc.yml b/.eslintrc.yml index 0fe49c2b..cbeacb9c 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,4 +1,8 @@ extends: eslint:recommended +env: + es6: true +parserOptions: + sourceType: module rules: no-undef: 0 no-redeclare: 0 diff --git a/debian/changelog b/debian/changelog index 60bfad96..df3f3bf1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (1.405.50) stable; urgency=low +hedera-web (1.405.51) stable; urgency=low * Initial Release. diff --git a/package.json b/package.json index a8e60b77..5cf1e070 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "1.405.50", + "version": "1.405.51", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": { @@ -8,11 +8,14 @@ "url": "https://git.verdnatura.es/hedera-web" }, "devDependencies": { + "archiver": "^2.1.0", "assets-webpack-plugin": "^3.5.1", "bundle-loader": "^0.5.4", "css-loader": "^0.25.0", "eslint": "^3.16.1", "file-loader": "^0.9.0", + "fs-extra": "^5.0.0", + "glob": "^7.1.2", "json-loader": "^0.5.4", "raw-loader": "^0.5.1", "style-loader": "^0.19.0", diff --git a/rest/core/locale/en.json b/rest/core/locale/en.json new file mode 100644 index 00000000..75f9e384 --- /dev/null +++ b/rest/core/locale/en.json @@ -0,0 +1,5 @@ +{ + "InvalidAction": "Invalid action" + + ,"EmptyQuery": "Empty query" +} diff --git a/rest/dms/invoice.sql b/rest/dms/invoice.sql index 71e43303..f3249727 100644 --- a/rest/dms/invoice.sql +++ b/rest/dms/invoice.sql @@ -1,5 +1,5 @@ -SELECT CONCAT_WS('/', c.pdfs_dir, invoice_get_path (#invoice)) +SELECT CONCAT_WS('/', c.pdfs_dir, invoiceGetPath(#invoice)) FROM config c JOIN invoice_view i WHERE i.invoice_id = #invoice diff --git a/utils/extract-locale.js b/utils/extract-locale.js new file mode 100644 index 00000000..d6cac973 --- /dev/null +++ b/utils/extract-locale.js @@ -0,0 +1,88 @@ +var glob = require('glob'); +var fs = require('fs-extra'); +var path = require('path'); +var archiver = require('archiver'); + +let lang = process.argv[2]; + +if (lang == null) +{ + let baseName = path.basename(process.argv[1]); + console.log(`Usage: ${baseName} language_code`); + process.exit(1); +} + +let nDirs; +let projectDir; + +fs.remove(lang, () => { + fs.realpath(`${__dirname}/..`, (err, realPath) => { + projectDir = realPath; + let len = projectDir.length + 1; + + glob(`${projectDir}/**/locale/`, (err, localeDirs) => { + nDirs = localeDirs.length * 2; + + for (let localeDir of localeDirs) { + localeDir = localeDir.substr(len) + + if (/^node_modules\//.test (localeDir)) + continue; + + exportLocale(localeDir); + } + }) + }); +}); + +function exportLocale (localeDir) { + let dstDir = `${lang}/${localeDir}`; + + fs.mkdirp(dstDir, err => { + if (err) { + onError(err); + return; + } + + let src, dst; + + src = `${projectDir}/${localeDir}/en.json`; + dst = `${dstDir}/en.json`; + fs.copy(src, dst, onDirEnd); + + src = `${projectDir}/${localeDir}/${lang}.json`; + dst = `${dstDir}/${lang}.json`; + fs.copy(src, dst, onDirEnd); + }); +} + +function onError (err) { + console.log(err); + onDirEnd(); +} + +let output; +let archive; + +function onDirEnd() { + nDirs--; + if (nDirs > 0) return; + + output = fs.createWriteStream(`${lang}.zip`); + output.on ('close', onArchiveEnd); + + archive = archiver('zip', { + zlib: { level: 9 } + }); + archive.on ('error', err => { + throw err; + }); + archive.pipe(output); + archive.directory(lang); + archive.finalize(); +} + +function onArchiveEnd() { + fs.remove(lang); + console.log ('Export finalized!'); +} diff --git a/webpack.config.js b/webpack.config.js index e3a19003..9139ef47 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,12 +1,12 @@ -var path = require ('path'); -var webpack = require ('webpack'); -var AssetsWebpackPlugin = require ('assets-webpack-plugin'); -var WebpackChunkHash = require ('webpack-chunk-hash'); -var merge = require ('webpack-merge'); -var wpConfig = require ('./webpack.config.json'); +var path = require('path'); +var webpack = require('webpack'); +var AssetsWebpackPlugin = require('assets-webpack-plugin'); +var WebpackChunkHash = require('webpack-chunk-hash'); +var merge = require('webpack-merge'); +var wpConfig = require('./webpack.config.json'); var devMode = process.env.NODE_ENV !== 'production'; -var outputPath = path.join (__dirname, wpConfig.buildDir); +var outputPath = path.join(__dirname, wpConfig.buildDir); var publicPath = wpConfig.buildDir +'/'; var baseConfig = { @@ -34,12 +34,12 @@ var baseConfig = { __dirname: true }, plugins: [ - new webpack.DefinePlugin ({ + new webpack.DefinePlugin({ _DEV_MODE: devMode, _DEV_SERVER_PORT: wpConfig.devServerPort, _PUBLIC_PATH: JSON.stringify (publicPath) }), - new webpack.optimize.CommonsChunkPlugin ({ + new webpack.optimize.CommonsChunkPlugin({ names: ['vendor', 'manifest'] }) ], @@ -54,15 +54,15 @@ var prodConfig = { chunkFilename: 'chunk.[id].[chunkhash].js' }, plugins: [ - new webpack.optimize.UglifyJsPlugin ({ + new webpack.optimize.UglifyJsPlugin({ minimize: true, compress: { warnings: false } }), - new AssetsWebpackPlugin ({ + new AssetsWebpackPlugin({ path: outputPath }), - new webpack.HashedModuleIdsPlugin (), - new WebpackChunkHash () + new webpack.HashedModuleIdsPlugin(), + new WebpackChunkHash() ], devtool: 'source-map' }; @@ -73,7 +73,7 @@ var devConfig = { chunkFilename: 'chunk.[id].js' }, plugins: [ - new webpack.NamedModulesPlugin () + new webpack.NamedModulesPlugin() ], devServer: { host: '0.0.0.0', @@ -85,4 +85,4 @@ var devConfig = { }; var mrgConfig = devMode ? devConfig : prodConfig; -module.exports = merge (baseConfig, mrgConfig); +module.exports = merge(baseConfig, mrgConfig);