Merge branch 'feature/mobile-apps-on-reactjs-deployment' into feature/mobile-apps-on-reactjs

This commit is contained in:
Maxim Kadushkin 2021-04-29 21:05:15 +03:00
commit 0ba574b9cf
7 changed files with 73 additions and 13 deletions

View file

@ -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',

View file

@ -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"
}
]
}
},

View file

@ -27,6 +27,7 @@
},
"devDependencies": {
"chai": "1.9.1",
"grunt-exec": "^3.0.0",
"mocha": "^6.2.2",
"grunt-mocha": "^1.0.0"
}

View file

@ -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": [
{

View file

@ -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": [
{

View file

@ -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,

View file

@ -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",