diff --git a/build/Gruntfile.js b/build/Gruntfile.js index 74ebe193c..663778d31 100644 --- a/build/Gruntfile.js +++ b/build/Gruntfile.js @@ -102,6 +102,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-mocha'); grunt.loadNpmTasks('grunt-inline'); grunt.loadNpmTasks('grunt-svgmin'); + grunt.loadNpmTasks('grunt-exec'); function doRegisterTask(name, callbackConfig) { return grunt.registerTask(name + '-init', function() { @@ -483,7 +484,10 @@ module.exports = function(grunt) { files:[] .concat(packageFile['mobile']['copy']['images-app']) .concat(packageFile['mobile']['copy']['images-common']) - } + }, + 'webpack-dist': { + files: packageFile.mobile.copy['assets'] + }, }, replace: { @@ -508,6 +512,25 @@ module.exports = function(grunt) { to: '../mobile' }] } + }, + + exec: { + webpack_app_build: { + options: { + cwd: '../vendor/framework7-react', + }, + cmd: function() { + const editor = packageFile.name == 'presentationeditor' ? 'slide' : + packageFile.name == 'spreadsheeteditor' ? 'cell' : 'word'; + return `npm run deploy-${editor}`; + }, + }, + webpack_install: { + options: { + cwd: '../vendor/framework7-react', + }, + cmd: 'npm i', + }, } }); @@ -597,10 +620,10 @@ module.exports = function(grunt) { 'requirejs', 'concat', 'copy', 'svgmin', 'inline:index-page', 'inline:old-loader-page', 'json-minify', 'replace:writeVersion', 'replace:prepareHelp', 'clean:postbuild']); - grunt.registerTask('deploy-app-mobile', ['mobile-app-init', 'clean:deploy', 'cssmin', 'copy:template-backup', - 'htmlmin', 'requirejs', 'concat', 'copy:template-restore', - 'clean:template-backup', 'copy:localization', 'copy:index-page', - 'copy:images-app', 'json-minify', + grunt.registerTask('deploy-app-mobile', ['mobile-app-init', 'clean:deploy', /*'cssmin',*/ /*'copy:template-backup',*/ + 'htmlmin', /*'requirejs',*/ 'exec:webpack_install', 'exec:webpack_app_build', /*'concat',*/ /*'copy:template-restore',*/ + /*'clean:template-backup',*/ 'copy:localization', 'copy:index-page', + /*'copy:images-app',*/ 'copy:webpack-dist', 'json-minify', 'replace:writeVersion', 'replace:fixResourceUrl']); grunt.registerTask('deploy-app-embed', ['embed-app-init', 'clean:prebuild', 'uglify', 'less', 'copy', diff --git a/build/documenteditor.json b/build/documenteditor.json index 13c6c8be6..54332dd7e 100644 --- a/build/documenteditor.json +++ b/build/documenteditor.json @@ -353,8 +353,7 @@ } ], "index-page": { - "../deploy/web-apps/apps/documenteditor/mobile/index.html": "../apps/documenteditor/mobile/index.html.deploy", - "../deploy/web-apps/apps/documenteditor/mobile/index_loader.html": "../apps/documenteditor/mobile/index_loader.html.deploy" + "../deploy/web-apps/apps/documenteditor/mobile/index.html": "../apps/documenteditor/mobile/index.html" }, "localization": [ { @@ -379,6 +378,18 @@ "src": "**", "dest": "../deploy/web-apps/apps/documenteditor/mobile/resources/img/" } + ], + "assets": [ + { + "src": "../apps/documenteditor/mobile/css/app.css", + "dest": "../deploy/web-apps/apps/documenteditor/mobile/css/app.css" + }, + { + "expand": true, + "cwd": "../apps/documenteditor/mobile/dist", + "src": "**", + "dest": "../deploy/web-apps/apps/documenteditor/mobile/dist" + } ] } }, diff --git a/build/package.json b/build/package.json index 44961d8c8..6fee65bc8 100644 --- a/build/package.json +++ b/build/package.json @@ -27,6 +27,7 @@ }, "devDependencies": { "chai": "1.9.1", + "grunt-exec": "^3.0.0", "mocha": "^6.2.2", "grunt-mocha": "^1.0.0" } diff --git a/build/presentationeditor.json b/build/presentationeditor.json index 29bf6d14c..159842fcc 100644 --- a/build/presentationeditor.json +++ b/build/presentationeditor.json @@ -337,6 +337,18 @@ "files": "../deploy/web-apps/apps/presentationeditor/mobile/**/*.json" }, "copy": { + "assets": [ + { + "src": "../apps/presentationeditor/mobile/css/app.css", + "dest": "../deploy/web-apps/apps/presentationeditor/mobile/css/app.css" + }, + { + "expand": true, + "cwd": "../apps/presentationeditor/mobile/dist", + "src": "**", + "dest": "../deploy/web-apps/apps/presentationeditor/mobile/dist" + } + ], "template-backup": [ { "expand": true, @@ -356,8 +368,7 @@ } ], "index-page": { - "../deploy/web-apps/apps/presentationeditor/mobile/index.html": "../apps/presentationeditor/mobile/index.html.deploy", - "../deploy/web-apps/apps/presentationeditor/mobile/index_loader.html": "../apps/presentationeditor/mobile/index_loader.html.deploy" + "../deploy/web-apps/apps/presentationeditor/mobile/index.html": "../apps/presentationeditor/mobile/index.html", }, "localization": [ { diff --git a/build/spreadsheeteditor.json b/build/spreadsheeteditor.json index 9001b3643..1d5bd7de5 100644 --- a/build/spreadsheeteditor.json +++ b/build/spreadsheeteditor.json @@ -343,6 +343,18 @@ "files": "../deploy/web-apps/apps/spreadsheeteditor/mobile/**/*.json" }, "copy": { + "assets": [ + { + "src": "../apps/spreadsheeteditor/mobile/css/app.css", + "dest": "../deploy/web-apps/apps/spreadsheeteditor/mobile/css/app.css" + }, + { + "expand": true, + "cwd": "../apps/spreadsheeteditor/mobile/dist", + "src": "**", + "dest": "../deploy/web-apps/apps/spreadsheeteditor/mobile/dist" + } + ], "template-backup": [ { "expand": true, @@ -362,8 +374,7 @@ } ], "index-page": { - "../deploy/web-apps/apps/spreadsheeteditor/mobile/index.html": "../apps/spreadsheeteditor/mobile/index.html.deploy", - "../deploy/web-apps/apps/spreadsheeteditor/mobile/index_loader.html": "../apps/spreadsheeteditor/mobile/index_loader.html.deploy" + "../deploy/web-apps/apps/spreadsheeteditor/mobile/index.html": "../apps/spreadsheeteditor/mobile/index.html" }, "localization": [ { diff --git a/vendor/framework7-react/build/webpack.config.js b/vendor/framework7-react/build/webpack.config.js index 10daaf441..27b02b18c 100644 --- a/vendor/framework7-react/build/webpack.config.js +++ b/vendor/framework7-react/build/webpack.config.js @@ -41,7 +41,7 @@ module.exports = { }, modules: [path.resolve(__dirname, '..', 'node_modules'), 'node_modules'], }, - watch: true, + watch: env == 'development', watchOptions: { aggregateTimeout: 600, poll: 1000, @@ -50,7 +50,7 @@ module.exports = { jquery: 'jQuery' }, - devtool: env === 'production' ? 'source-map' : 'source-map', + devtool: env === 'production' ? false : 'source-map', optimization: { minimizer: [new TerserPlugin({ sourceMap: true, diff --git a/vendor/framework7-react/package.json b/vendor/framework7-react/package.json index 4f10dcfef..3dc653b35 100644 --- a/vendor/framework7-react/package.json +++ b/vendor/framework7-react/package.json @@ -10,6 +10,9 @@ "dev": "cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.js", "build-dev": "cross-env NODE_ENV=development node ./build/build.js", "build-prod": "cross-env NODE_ENV=production node ./build/build.js", + "deploy-word": "cross-env TARGET_EDITOR=word NODE_ENV=production node ./build/build.js", + "deploy-cell": "cross-env TARGET_EDITOR=cell NODE_ENV=production node ./build/build.js", + "deploy-slide": "cross-env TARGET_EDITOR=slide NODE_ENV=production node ./build/build.js", "postinstall": "cpy ./node_modules/framework7-icons/fonts/*.* ./src/fonts/", "build-word": "cross-env NODE_ENV=development node ./build/build.js", "build-slide": "cross-env NODE_ENV=development TARGET_EDITOR=slide node ./build/build.js",