Merge pull request #1143 from ONLYOFFICE/feature/forms-deploy-script-for-forms

[DE] added build script for "forms" app
This commit is contained in:
maxkadushkin 2021-08-31 23:26:14 +03:00 committed by GitHub
commit f0939c6a2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 226 additions and 0 deletions

View file

@ -11,6 +11,7 @@ module.exports = function(grunt) {
' *\n' + ' *\n' +
' * Version: <%= pkg.version %> (build:<%= pkg.build %>)\n' + ' * Version: <%= pkg.version %> (build:<%= pkg.build %>)\n' +
' */\n'; ' */\n';
global.copyright = copyright;
let iconv_lite, encoding = process.env.SYSTEM_ENCODING; let iconv_lite, encoding = process.env.SYSTEM_ENCODING;
grunt.log.writeln('platform: ' + process.platform.green); grunt.log.writeln('platform: ' + process.platform.green);
@ -91,6 +92,8 @@ module.exports = function(grunt) {
addons.forEach((element,index,self) => self[index] = path.join('../..', element, '/build')); addons.forEach((element,index,self) => self[index] = path.join('../..', element, '/build'));
addons = addons.filter(element => grunt.file.isDir(element)); addons = addons.filter(element => grunt.file.isDir(element));
require('./appforms')(grunt);
grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
@ -187,6 +190,8 @@ module.exports = function(grunt) {
if ( !!_extConfig && _extConfig.name == packageFile.name ) { if ( !!_extConfig && _extConfig.name == packageFile.name ) {
_merge(packageFile, _extConfig); _merge(packageFile, _extConfig);
} }
global.packageFile = packageFile;
} else grunt.log.error().writeln('Could not load config file'.red); } else grunt.log.error().writeln('Could not load config file'.red);
}); });
} }

80
build/appforms.js Normal file
View file

@ -0,0 +1,80 @@
module.exports = (grunt) => {
grunt.registerTask('forms-app-init', function() {
const packageFile = global.packageFile;
if ( !global.packageFile )
grunt.log.ok('no package file'.red);
else {
const config = require('./appforms.json');
if ( config ) {
//packageFile.tasks.deploy.push(...config.tasks.deploy);
packageFile.forms = config.forms;
}
}
grunt.initConfig({
pkg: packageFile,
clean: {
options: {
force: true
},
postbuild: packageFile.forms.clean.postbuild,
prebuild: packageFile.forms.clean.prebuild
},
requirejs: {
compile: {
options: packageFile.forms.js.requirejs.options
}
},
less: {
production: {
options: {
compress: true,
ieCompat: false,
modifyVars: packageFile.forms.less.vars,
plugins: [
new (require('less-plugin-clean-css'))()
]
},
files: {
"<%= pkg.forms.less.files.dest %>": packageFile.forms.less.files.src
}
}
},
concat: {
options: {
stripBanners: true,
banner: global.copyright
},
dist: {
src: [packageFile.forms.js.requirejs.options.out],
dest: packageFile.forms.js.requirejs.options.out
}
},
copy: {
localization: {
files: packageFile.forms.copy.localization
},
indexhtml: {
files: packageFile.forms.copy.indexhtml
}
},
inline: {
dist: {
src: `${packageFile.forms.copy.indexhtml.dest}/index.html`
}
}
});
});
grunt.registerTask('deploy-app-forms', ['forms-app-init', 'clean:prebuild', /*'imagemin',*/ 'less',
'requirejs', 'concat', 'copy', 'inline', /*'json-minify',*/
/*'replace:writeVersion',*/ /*'replace:prepareHelp',*/ 'clean:postbuild']);
}

140
build/appforms.json Normal file
View file

@ -0,0 +1,140 @@
{
"name": "documenteditor",
"version": "4.3.0",
"build": 1149,
"homepage": "http://www.onlyoffice.com",
"private": true,
"forms": {
"clean": {
"prebuild": [
"../deploy/web-apps/apps/documenteditor/forms"
],
"postbuild": [
"../deploy/web-apps/apps/documenteditor/forms/resources/img"
]
},
"js": {
"requirejs": {
"options": {
"name": "../apps/documenteditor/forms/app.js",
"out": "../deploy/web-apps/apps/documenteditor/forms/app.js",
"baseUrl": "../apps/",
"inlineText": true,
"findNestedDependencies": true,
"preserveLicenseComments": false,
"optimizeAllPluginResources": true,
"paths": {
"jquery": "../vendor/jquery/jquery",
"underscore": "../vendor/underscore/underscore",
"backbone": "../vendor/backbone/backbone",
"text": "../vendor/requirejs-text/text",
"bootstrap": "../vendor/bootstrap/dist/js/bootstrap",
"perfectscrollbar": "common/main/lib/mods/perfect-scrollbar",
"jmousewheel": "../vendor/perfect-scrollbar/src/jquery.mousewheel",
"xregexp": "empty:",
"sockjs": "empty:",
"jszip": "empty:",
"jszip-utils": "empty:",
"coapisettings": "empty:",
"allfonts": "empty:",
"sdk": "empty:",
"api": "empty:",
"core": "common/main/lib/core/application",
"notification": "common/main/lib/core/NotificationCenter",
"keymaster": "common/main/lib/core/keymaster",
"tip": "common/main/lib/util/Tip",
"analytics": "common/Analytics",
"gateway": "common/Gateway",
"locale": "common/locale",
"irregularstack": "common/IrregularStack"
},
"shim": {
"underscore": {
"exports": "_"
},
"backbone": {
"deps": [
"underscore",
"jquery"
],
"exports": "Backbone"
},
"bootstrap": {
"deps": [
"jquery"
]
},
"perfectscrollbar": {
"deps": [
"jmousewheel"
]
},
"notification": {
"deps": [
"backbone"
]
},
"core": {
"deps": [
"backbone",
"notification"
]
},
"sdk": {
"deps": [
"jquery",
"underscore",
"coapisettings",
"allfonts",
"xregexp",
"sockjs",
"jszip",
"jszip-utils"
]
},
"gateway": {
"deps": [
"jquery"
]
},
"analytics": {
"deps": [
"jquery"
]
}
}
}
}
},
"less": {
"files": {
"src": "../apps/documenteditor/forms/resources/less/application.less",
"dest": "../deploy/web-apps/apps/documenteditor/forms/resources/css/app.css"
},
"vars": {
"app-image-const-path": "'../img'",
"common-image-const-path": "'../img'",
"app-image-path": "'../../../../../deploy/web-apps/apps/documenteditor/forms/resources/img'",
"common-image-path": "'../../../../../deploy/web-apps/apps/documenteditor/forms/resources/img'"
}
},
"copy": {
"localization": [
{
"expand": true,
"cwd": "../apps/documenteditor/forms/locale/",
"src": "*",
"dest": "../deploy/web-apps/apps/documenteditor/forms/locale/"
}
],
"indexhtml": {
"../deploy/web-apps/apps/documenteditor/forms/index.html": "../apps/documenteditor/forms/index.html.deploy"
}
}
},
"tasks": {
"deploy": [
"deploy-app-forms"
]
}
}

View file

@ -368,6 +368,7 @@
"increment-build", "increment-build",
"deploy-app-main", "deploy-app-main",
"deploy-app-mobile", "deploy-app-mobile",
"deploy-app-forms",
"deploy-app-embed" "deploy-app-embed"
] ]
} }