web-apps/build/Gruntfile.js

728 lines
28 KiB
JavaScript
Raw Normal View History

2016-03-11 00:48:53 +00:00
module.exports = function(grunt) {
var _ = require('lodash'),
defaultConfig,
packageFile;
2016-03-11 00:48:53 +00:00
2018-10-18 15:43:21 +00:00
const copyrightHeader = 'Copyright (c) Ascensio System SIA <%= grunt.template.today("yyyy") %>. All rights reserved'
var copyright = '/*!\n' +
2018-10-18 15:43:21 +00:00
' * ' + (process.env['APP_COPYRIGHT'] || copyrightHeader) + '\n' +
2017-01-13 15:35:56 +00:00
' *\n' +
2018-11-16 14:31:38 +00:00
' * <%= pkg.homepage %> \n' +
2017-01-13 15:35:56 +00:00
' *\n' +
2017-01-25 16:30:08 +00:00
' * Version: <%= pkg.version %> (build:<%= pkg.build %>)\n' +
2017-01-13 15:35:56 +00:00
' */\n';
global.copyright = copyright;
2017-01-13 15:35:56 +00:00
let iconv_lite, encoding = process.env.SYSTEM_ENCODING;
2020-04-06 13:11:44 +00:00
grunt.log.writeln('platform: ' + process.platform.green);
if (process.platform == 'win32') {
const cmdencoding = require('child_process').execSync('chcp');
2020-04-06 13:11:44 +00:00
grunt.log.writeln(cmdencoding);
if ( !encoding ) {
if ( cmdencoding.includes('866') ) encoding = '1251'; else
if ( cmdencoding.includes('437') ) encoding = '1252'; else
if ( cmdencoding.includes('65001') ) encoding = 'utf8';
}
if ( !!encoding && !/utf-?8/i.test(encoding) ) {
iconv_lite = require('iconv-lite');
}
}
let _encode = (string) => {
return !!string && !!iconv_lite ? iconv_lite.encode(string,encoding) : string;
};
2022-01-18 08:22:44 +00:00
global.jsreplacements = [
2019-02-26 17:57:23 +00:00
{
from: /\{\{SUPPORT_EMAIL\}\}/g,
to: _encode(process.env.SUPPORT_EMAIL) || 'support@onlyoffice.com'
2019-02-26 17:57:23 +00:00
},{
from: /\{\{SUPPORT_URL\}\}/g,
to: _encode(process.env.SUPPORT_URL) || 'https://support.onlyoffice.com'
2019-02-26 17:57:23 +00:00
},{
from: /\{\{SALES_EMAIL\}\}/g,
to: _encode(process.env.SALES_EMAIL) || 'sales@onlyoffice.com'
2019-02-26 17:57:23 +00:00
},{
from: /\{\{PUBLISHER_URL\}\}/g,
to: _encode(process.env.PUBLISHER_URL) || 'https://www.onlyoffice.com'
2019-02-26 17:57:23 +00:00
},{
from: /\{\{PUBLISHER_PHONE\}\}/,
2020-03-18 14:29:29 +00:00
to: process.env['PUBLISHER_PHONE'] || '+371 633-99867'
2019-02-26 17:57:23 +00:00
},{
from: /\{\{PUBLISHER_NAME\}\}/g,
to: _encode(process.env.PUBLISHER_NAME) || 'Ascensio System SIA'
2019-02-26 17:57:23 +00:00
},{
from: /\{\{PUBLISHER_ADDRESS\}\}/,
to: _encode(process.env.PUBLISHER_ADDRESS) || '20A-12 Ernesta Birznieka-Upisha street, Riga, Latvia, EU, LV-1050'
2019-02-26 17:57:23 +00:00
},{
from: /\{\{API_URL_EDITING_CALLBACK\}\}/,
to: _encode(process.env.API_URL_EDITING_CALLBACK) || 'https://api.onlyoffice.com/editors/callback'
2019-02-26 17:57:23 +00:00
},{
from: /\{\{COMPANY_NAME\}\}/g,
to: _encode(process.env.COMPANY_NAME) || 'ONLYOFFICE'
2019-02-26 17:57:23 +00:00
}, {
from: /\{\{APP_TITLE_TEXT\}\}/g,
to: _encode(process.env.APP_TITLE_TEXT) || 'ONLYOFFICE'
2019-08-23 08:59:24 +00:00
}, {
from: /\{\{HELP_URL\}\}/g,
to: _encode(process.env.HELP_URL) || 'https://helpcenter.onlyoffice.com'
}, {
from: /\{\{DEFAULT_LANG\}\}/g,
to: _encode(process.env.DEFAULT_LANG) || 'en'
2019-05-22 14:22:50 +00:00
}];
var helpreplacements = [
{
from: /\{\{COEDITING_DESKTOP\}\}/g,
to: _encode(process.env.COEDITING_DESKTOP) || 'Подключиться к облаку'
2019-05-22 14:22:50 +00:00
},{
from: /\{\{PLUGIN_LINK\}\}/g,
to: _encode(process.env.PLUGIN_LINK) || 'https://api.onlyoffice.com/plugin/basic'
2019-05-22 14:22:50 +00:00
},{
from: /\{\{PLUGIN_LINK_MACROS\}\}/g,
to: _encode(process.env.PLUGIN_LINK_MACROS) || 'https://api.onlyoffice.com/plugin/macros'
2019-02-26 17:57:23 +00:00
}];
2016-03-11 00:48:53 +00:00
let path = require('path');
let addons = grunt.option('addon') || [];
if (!Array.isArray(addons))
addons = [addons];
2020-02-11 12:22:06 +00:00
addons.forEach((element,index,self) => self[index] = path.join('../..', element, '/build'));
addons = addons.filter(element => grunt.file.isDir(element));
require('./appforms')(grunt);
2016-03-11 00:48:53 +00:00
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
2018-04-09 12:02:13 +00:00
grunt.loadNpmTasks('grunt-json-minify');
2016-03-11 00:48:53 +00:00
grunt.loadNpmTasks('grunt-text-replace');
// grunt.loadNpmTasks('grunt-mocha');
2022-02-19 21:37:16 +00:00
grunt.loadNpmTasks('grunt-inline');
2017-07-17 11:57:12 +00:00
grunt.loadNpmTasks('grunt-svgmin');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-terser');
2016-03-11 00:48:53 +00:00
function doRegisterTask(name, callbackConfig) {
return grunt.registerTask(name + '-init', function() {
var additionalConfig = {},
initConfig = {};
if (_.isFunction(callbackConfig)) {
additionalConfig = callbackConfig.call(this, defaultConfig, packageFile);
}
if (!_.isUndefined(packageFile[name]['clean'])) {
initConfig['clean'] = {
options: {
force: true
},
files: packageFile[name]['clean']
}
}
if (!_.isUndefined(packageFile[name]['copy'])) {
initConfig['copy'] = packageFile[name]['copy'];
}
grunt.initConfig(_.assign(initConfig, additionalConfig || {}));
});
}
function doRegisterInitializeAppTask(name, appName, configFile) {
2020-02-03 16:27:01 +00:00
if (!!process.env['OO_BRANDING'] &&
grunt.file.exists('../../' + process.env['OO_BRANDING'] + '/web-apps-pro/build/' + configFile))
{
2020-02-03 16:27:01 +00:00
var _extConfig = require('../../' + process.env['OO_BRANDING'] + '/web-apps-pro/build/' + configFile);
2019-10-14 15:58:17 +00:00
}
function _merge(target, ...sources) {
if (!sources.length) return target;
const source = sources.shift();
if (_.isObject(target) && _.isObject(source)) {
for (const key in source) {
let targetkey = key;
if ( key[0] == '!' ) {
targetkey = key.substring(1);
if ( _.isArray(target[targetkey]) || _.isObject(target[targetkey]) )
target[targetkey] = undefined;
}
if (_.isObject(source[key]) && target[targetkey]) {
// if (!target[targetkey]) Object.assign(target, { [targetkey]: {} });
// else
if (_.isArray(source[key])) target[targetkey].push(...source[key]);
else _merge(target[targetkey], source[key]);
2019-10-14 15:58:17 +00:00
} else {
Object.assign(target, { [targetkey]: source[key] });
2019-10-14 15:58:17 +00:00
}
}
}
return _merge(target, ...sources);
}
2016-03-11 00:48:53 +00:00
return grunt.registerTask('init-build-' + name, 'Initialize build ' + appName, function(){
defaultConfig = configFile;
packageFile = require('./' + defaultConfig);
if (packageFile) {
2016-03-11 00:48:53 +00:00
grunt.log.ok(appName + ' config loaded successfully'.green);
addons.forEach(element => {
let _path = path.join(element,configFile);
if (grunt.file.exists(_path)) {
_merge(packageFile, require(_path));
grunt.log.ok('addon '.green + element + ' is merged successfully'.green);
}
});
if ( !!_extConfig && _extConfig.name == packageFile.name ) {
_merge(packageFile, _extConfig);
}
global.packageFile = packageFile;
} else grunt.log.error().writeln('Could not load config file'.red);
2016-03-11 00:48:53 +00:00
});
}
grunt.initConfig({
mocha: {
test: {
options: {
reporter: 'Spec'
},
src: [
'../test/common/index.html'
]
}
},
jshint: {
options: {
curly: true,
eqeqeq: true,
eqnull: true,
browser: true,
globals: {
jQuery: true
},
force: true
},
common: ['../apps/common/main/lib/**/*.js']
}
});
doRegisterTask('sdk');
doRegisterTask('api', function(defaultConfig, packageFile){
return {
pkg: packageFile,
replace: {
writeVersion: {
src: ['<%= pkg.api.copy.script.dest %>' + '/**/*.js'],
overwrite: true,
replacements: [{
from: /\{\{PRODUCT_VERSION\}\}/,
to: packageFile.version
2020-02-06 15:25:21 +00:00
},{
2020-02-19 17:04:10 +00:00
from: /\{\{APP_CUSTOMER_NAME\}\}/g,
to: process.env['APP_CUSTOMER_NAME'] || 'ONLYOFFICE'
2020-02-19 12:17:18 +00:00
},{
from: /\/\*\*[\s\S]+\.com\s+\*\//,
to: copyright
}]
}
}
}
2016-03-11 00:48:53 +00:00
});
doRegisterTask('apps-common', (defaultConfig, packageFile) => {
return {
imagemin: {
options: {
optimizationLevel: 3
},
dynamic: {
files: packageFile['apps-common']['imagemin']['images-common']
}
},
svgmin: {
options: {
plugins: [{
cleanupIDs: false
},
{
convertPathData: {
floatPrecision: 4
}
}]
},
dist: {
files: packageFile['apps-common'].svgicons.common
}
},
}
});
2016-03-11 00:48:53 +00:00
doRegisterTask('sockjs');
doRegisterTask('xregexp');
doRegisterTask('megapixel');
doRegisterTask('jquery');
doRegisterTask('underscore');
doRegisterTask('zeroclipboard');
doRegisterTask('bootstrap');
doRegisterTask('iscroll');
2019-05-22 14:40:10 +00:00
doRegisterTask('fetch');
doRegisterTask('es6-promise');
2016-03-11 00:48:53 +00:00
doRegisterTask('jszip');
doRegisterTask('jsziputils');
2021-10-24 21:32:35 +00:00
doRegisterTask('common-embed');
2016-03-11 00:48:53 +00:00
doRegisterTask('requirejs', function(defaultConfig, packageFile) {
return {
terser: {
2016-03-11 00:48:53 +00:00
options: {
format: {
preamble: '/** vim: et:ts=4:sw=4:sts=4\n' +
' * @license RequireJS 2.1.2 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.\n' +
' * Available via the MIT or new BSD license.\n' +
' * see: http://github.com/jrburke/requirejs for details\n' +
' */\n',
},
2016-03-11 00:48:53 +00:00
},
build: {
src: packageFile['requirejs']['min']['src'],
dest: packageFile['requirejs']['min']['dest']
}
}
}
});
grunt.registerTask('prebuild-icons-sprite', function() {
require('./sprites/Gruntfile.js')(grunt, '../');
grunt.task.run('all-icons-sprite');
});
2016-03-11 00:48:53 +00:00
grunt.registerTask('main-app-init', function() {
grunt.initConfig({
2017-01-25 16:30:08 +00:00
pkg: packageFile,
2016-03-11 00:48:53 +00:00
clean: {
options: {
force: true
},
2017-07-17 11:57:12 +00:00
prebuild: {
2021-05-24 12:39:26 +00:00
src: packageFile.main.clean.prebuild
2017-07-17 11:57:12 +00:00
},
postbuild: {
2021-05-24 12:39:26 +00:00
src: [...packageFile.main.svgicons.clean, ...packageFile.main.clean.postbuild]
2017-07-17 11:57:12 +00:00
}
2016-03-11 00:48:53 +00:00
},
less: {
production: {
options: {
compress: true,
2016-11-10 11:57:07 +00:00
ieCompat: false,
modifyVars: packageFile['main']['less']['vars'],
2016-03-11 00:48:53 +00:00
plugins: [
2016-11-10 11:57:07 +00:00
new (require('less-plugin-clean-css'))()
2016-03-11 00:48:53 +00:00
]
},
files: {
"<%= pkg.main.less.files.dest %>": packageFile['main']['less']['files']['src']
}
}
},
requirejs: {
options: {
optimize: "none",
},
2016-03-11 00:48:53 +00:00
compile: {
options: packageFile['main']['js']['requirejs']['options']
}
},
replace: {
2016-11-10 11:57:07 +00:00
writeVersion: {
src: ['<%= pkg.main.js.requirejs.options.out %>'],
2016-03-11 00:48:53 +00:00
overwrite: true,
2016-11-10 11:57:07 +00:00
replacements: [{
2019-10-07 12:47:56 +00:00
from: /\{\{PRODUCT_VERSION\}\}/g,
2022-01-30 21:54:36 +00:00
to: `${packageFile.version}.${packageFile.build}`
2022-01-18 08:22:44 +00:00
}, ...global.jsreplacements]
},
prepareHelp: {
src: ['<%= pkg.main.copy.help[0].dest %>/ru/**/*.htm*'],
overwrite: true,
2022-01-18 08:22:44 +00:00
replacements: [...helpreplacements]
2016-03-11 00:48:53 +00:00
}
},
concat: {
options: {
stripBanners: true,
2017-01-13 15:35:56 +00:00
banner: copyright
2016-03-11 00:48:53 +00:00
},
dist: {
src: [packageFile['main']['js']['requirejs']['options']['out']],
dest: packageFile['main']['js']['requirejs']['options']['out']
}
},
imagemin: {
options: {
optimizationLevel: 3
},
dynamic: {
files: []
.concat(packageFile['main']['imagemin']['images-app'])
.concat(packageFile['main']['imagemin']['images-common'])
}
},
2018-04-09 12:02:13 +00:00
'json-minify': {
build: {
files: packageFile['main']['jsonmin']['files']
}
},
2016-03-11 00:48:53 +00:00
copy: {
localization: {
files: packageFile['main']['copy']['localization']
},
2022-03-01 21:34:49 +00:00
help: {
files: packageFile['main']['copy']['help']
},
2020-07-30 20:58:14 +00:00
indexhtml: {
files: packageFile['main']['copy']['indexhtml']
2016-03-11 00:48:53 +00:00
}
2017-07-17 11:57:12 +00:00
},
inline: {
2020-07-30 20:58:14 +00:00
dist: {
src: '<%= pkg.main.copy.indexhtml[0].dest %>/*.html'
2017-07-17 11:57:12 +00:00
}
},
svgmin: {
options: {
plugins: [{
cleanupIDs: false
2019-07-29 10:04:43 +00:00
},
{
convertPathData: {
floatPrecision: 4
}
2017-07-17 11:57:12 +00:00
}]
},
dist: {
files: packageFile.main.svgicons.common
}
},
terser: {
options: {
format: {
comments: false,
preamble: "/* minified by terser */",
},
},
build: {
src: [packageFile['main']['js']['requirejs']['options']['out']],
dest: packageFile['main']['js']['requirejs']['options']['out']
},
},
2016-03-11 00:48:53 +00:00
});
2019-02-26 17:57:23 +00:00
2022-01-18 08:22:44 +00:00
// var replace = grunt.config.get('replace');
// replace.writeVersion.replacements.push(...global.jsreplacements);
// replace.prepareHelp.replacements.push(...helpreplacements);
// grunt.config.set('replace', replace);
2016-03-11 00:48:53 +00:00
});
grunt.registerTask('deploy-reporter', function(){
grunt.initConfig({
pkg: packageFile,
terser: {
options: {
format: {
comments: false,
preamble: copyright,
},
},
reporter: {
src: packageFile.main.reporter.uglify.src,
dest: packageFile.main.reporter.uglify.dest
},
},
copy: packageFile.main.reporter.copy
});
grunt.task.run(['terser', 'copy']);
});
2016-03-11 00:48:53 +00:00
grunt.registerTask('mobile-app-init', function() {
grunt.initConfig({
2017-01-25 16:30:08 +00:00
pkg: packageFile,
2016-03-11 00:48:53 +00:00
clean: {
options: {
force: true
},
'deploy': packageFile['mobile']['clean']['deploy'],
2017-01-13 15:35:56 +00:00
'template-backup': packageFile.mobile.copy['template-backup'][0].dest
},
2016-03-11 00:48:53 +00:00
2017-01-13 15:35:56 +00:00
concat: {
2016-03-11 00:48:53 +00:00
options: {
2017-01-13 15:35:56 +00:00
stripBanners: true,
banner: copyright
2016-03-11 00:48:53 +00:00
},
2017-01-13 15:35:56 +00:00
dist: {
src: packageFile.mobile.js.dest,
dest: packageFile.mobile.js.dest
2016-03-11 00:48:53 +00:00
}
},
cssmin: {
2017-02-02 15:04:42 +00:00
// options: {level: { 1: { roundingPrecision: 'all=3' }}}, // to round fw7 numbers in styles. need clean-css 4.0
target: {
2016-03-11 00:48:53 +00:00
files: {
"<%= pkg.mobile.css.ios.dist %>" : packageFile['mobile']['css']['ios']['src'],
"<%= pkg.mobile.css.material.dist %>" : packageFile['mobile']['css']['material']['src']
2016-03-11 00:48:53 +00:00
}
}
},
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true
},
files: packageFile['mobile']['htmlmin']['templates']
}
},
2018-04-09 12:02:13 +00:00
'json-minify': {
build: {
files: packageFile['mobile']['jsonmin']['files']
}
},
2016-03-11 00:48:53 +00:00
copy: {
'template-backup': {
files: packageFile['mobile']['copy']['template-backup']
},
'template-restore': {
files: packageFile['mobile']['copy']['template-restore']
},
'localization': {
2016-03-11 00:48:53 +00:00
files: packageFile['mobile']['copy']['localization']
},
'index-page': {
files: packageFile['mobile']['copy']['index-page']
},
'images-app': {
2018-03-28 12:40:38 +00:00
files:[]
.concat(packageFile['mobile']['copy']['images-app'])
.concat(packageFile['mobile']['copy']['images-common'])
},
'webpack-dist': {
files: packageFile.mobile.copy['assets']
},
2017-01-25 16:30:08 +00:00
},
// replace: {
// writeVersion: {
// src: ['<%= pkg.mobile.js.requirejs.options.out %>'],
// overwrite: true,
// replacements: [{
// from: /\{\{PRODUCT_VERSION\}\}/,
// to: packageFile.version
// }]
// },
// fixResourceUrl: {
// src: ['<%= pkg.mobile.js.requirejs.options.out %>',
// '<%= pkg.mobile.css.ios.dist %>',
// '<%= pkg.mobile.css.material.dist %>'],
// overwrite: true,
// replacements: [{
// from: /(?:\.{2}\/){4}common\/mobile\/resources\/img/g,
// to: '../img'
// },{
// from: /(?:\.{2}\/){2}common\/mobile/g,
// to: '../mobile'
// }]
// }
// },
exec: {
webpack_app_build: {
options: {
cwd: '../vendor/framework7-react',
env: {...process.env, ...{addon: grunt.option('addon')}},
},
cmd: function() {
const editor = packageFile.name == 'presentationeditor' ? 'slide' :
packageFile.name == 'spreadsheeteditor' ? 'cell' : 'word';
return `npm run deploy-${editor}`;
2021-08-02 18:31:49 +00:00
// const addon_path = `${packageFile.mobile.js.reactjs && !!packageFile.mobile.js.reactjs.features ? `ADDON_ENV=${packageFile.mobile.js.reactjs.features}` : ''}`;
// return `npx cross-env TARGET_EDITOR=${editor} NODE_ENV=production ${addon_path} node ./build/build.js`;
},
},
webpack_install: {
options: {
cwd: '../vendor/framework7-react',
},
2021-08-30 20:48:37 +00:00
cmd: 'npm i --include=dev --production=false',
},
2016-03-11 00:48:53 +00:00
}
});
2019-02-26 17:57:23 +00:00
// var replace = grunt.config.get('replace');
// replace.writeVersion.replacements.push(...jsreplacements);
// grunt.config.set('replace', replace);
2016-03-11 00:48:53 +00:00
});
grunt.registerTask('embed-app-init', function() {
grunt.initConfig({
2017-01-25 16:30:08 +00:00
pkg: packageFile,
2016-03-11 00:48:53 +00:00
clean: {
options: {
force: true
},
2016-11-08 12:22:15 +00:00
postbuild: packageFile['embed']['clean']['postbuild'],
prebuild: packageFile['embed']['clean']['prebuild']
2016-03-11 00:48:53 +00:00
},
terser: {
2016-03-11 00:48:53 +00:00
options: {
format: {
comments: false,
preamble: copyright,
},
2016-03-11 00:48:53 +00:00
},
build: {
src: packageFile['embed']['js']['src'],
dest: packageFile['embed']['js']['dist']
}
},
less: {
production: {
options: {
2016-11-08 12:22:15 +00:00
compress: true,
ieCompat: false
2016-03-11 00:48:53 +00:00
},
files: {
"<%= pkg.embed.less.files.dist %>": packageFile['embed']['less']['files']['src']
}
}
},
copy: {
localization: {
files: packageFile['embed']['copy']['localization']
},
2016-03-11 00:48:53 +00:00
'index-page': {
files: packageFile['embed']['copy']['index-page']
},
'images-app': {
files: packageFile['embed']['copy']['images-app']
}
}
});
});
grunt.registerTask('increment-build', function() {
var pkg = grunt.file.readJSON(defaultConfig);
pkg.build = parseInt(pkg.build) + 1;
2018-10-18 15:43:21 +00:00
packageFile.homepage = (process.env['PUBLISHER_URL'] || pkg.homepage);
2017-01-25 16:30:08 +00:00
packageFile.version = (process.env['PRODUCT_VERSION'] || pkg.version);
packageFile.build = (process.env['BUILD_NUMBER'] || pkg.build);
2016-03-11 00:48:53 +00:00
grunt.file.write(defaultConfig, JSON.stringify(pkg, null, 4));
});
//quick workaround for build desktop version
var copyTask = grunt.option('desktop')? "copy": "copy:script";
2016-03-11 00:48:53 +00:00
grunt.registerTask('deploy-api', ['api-init', 'clean', copyTask, 'replace:writeVersion']);
grunt.registerTask('deploy-apps-common', ['apps-common-init', 'clean', 'copy', 'imagemin', 'svgmin']);
grunt.registerTask('deploy-sdk', ['sdk-init', 'clean', copyTask]);
2016-03-11 00:48:53 +00:00
grunt.registerTask('deploy-sockjs', ['sockjs-init', 'clean', 'copy']);
grunt.registerTask('deploy-xregexp', ['xregexp-init', 'clean', 'copy']);
grunt.registerTask('deploy-megapixel', ['megapixel-init', 'clean', 'copy']);
grunt.registerTask('deploy-jquery', ['jquery-init', 'clean', 'copy']);
grunt.registerTask('deploy-underscore', ['underscore-init', 'clean', 'copy']);
grunt.registerTask('deploy-iscroll', ['iscroll-init', 'clean', 'copy']);
2019-05-22 14:40:10 +00:00
grunt.registerTask('deploy-fetch', ['fetch-init', 'clean', 'copy']);
2016-03-11 00:48:53 +00:00
grunt.registerTask('deploy-bootstrap', ['bootstrap-init', 'clean', 'copy']);
grunt.registerTask('deploy-jszip', ['jszip-init', 'clean', 'copy']);
grunt.registerTask('deploy-jsziputils', ['jsziputils-init', 'clean', 'copy']);
grunt.registerTask('deploy-requirejs', ['requirejs-init', 'clean', 'terser']);
grunt.registerTask('deploy-es6-promise', ['es6-promise-init', 'clean', 'copy']);
2021-10-24 21:32:35 +00:00
grunt.registerTask('deploy-common-embed', ['common-embed-init', 'clean', 'copy']);
2016-03-11 00:48:53 +00:00
grunt.registerTask('deploy-app-main', ['prebuild-icons-sprite', 'main-app-init', 'clean:prebuild', 'imagemin', 'less',
'requirejs', 'terser', 'concat', 'copy', 'svgmin', 'inline', 'json-minify',
2020-11-10 20:49:56 +00:00
'replace:writeVersion', 'replace:prepareHelp', 'clean:postbuild']);
2017-02-02 15:04:42 +00:00
grunt.registerTask('deploy-app-mobile', ['mobile-app-init', 'clean:deploy', /*'cssmin',*/ /*'copy:template-backup',*/
'htmlmin', /*'requirejs',*/ 'exec:webpack_install', 'exec:webpack_app_build', /*'copy:template-restore',*/
/*'clean:template-backup',*/ 'copy:localization', 'copy:index-page',
'copy:images-app', 'copy:webpack-dist', 'concat', 'json-minify'/*,*/
/*'replace:writeVersion', 'replace:fixResourceUrl'*/]);
2017-02-02 15:04:42 +00:00
grunt.registerTask('deploy-app-embed', ['embed-app-init', 'clean:prebuild', 'terser', 'less', 'copy', 'clean:postbuild']);
2016-03-11 00:48:53 +00:00
doRegisterInitializeAppTask('common', 'Common', 'common.json');
2016-03-11 00:48:53 +00:00
doRegisterInitializeAppTask('documenteditor', 'DocumentEditor', 'documenteditor.json');
doRegisterInitializeAppTask('spreadsheeteditor', 'SpreadsheetEditor', 'spreadsheeteditor.json');
doRegisterInitializeAppTask('presentationeditor', 'PresentationEditor', 'presentationeditor.json');
grunt.registerTask('deploy-app', 'Deploy application.', function(){
if (packageFile) {
if (packageFile['tasks']['deploy'])
grunt.task.run(packageFile['tasks']['deploy']);
else
grunt.log.error().writeln('Not found "deploy" task in configure'.red);
} else {
grunt.log.error().writeln('Is not load configure file.'.red);
}
});
grunt.registerTask('deploy-common-component', ['init-build-common', 'deploy-app']);
grunt.registerTask('deploy-documenteditor-component', ['init-build-documenteditor', 'deploy-app']);
grunt.registerTask('deploy-spreadsheeteditor-component', ['init-build-spreadsheeteditor', 'deploy-app']);
grunt.registerTask('deploy-presentationeditor-component', ['init-build-presentationeditor', 'deploy-app']);
// This task is called from the Makefile, don't delete it.
grunt.registerTask('deploy-documents-component', ['deploy-common-component']);
grunt.registerTask('deploy-documenteditor', ['deploy-common-component', 'deploy-documenteditor-component']);
grunt.registerTask('deploy-spreadsheeteditor', ['deploy-common-component', 'deploy-spreadsheeteditor-component']);
grunt.registerTask('deploy-presentationeditor', ['deploy-common-component', 'deploy-presentationeditor-component']);
grunt.registerTask('default', ['deploy-common-component',
'deploy-documenteditor-component',
'deploy-spreadsheeteditor-component',
'deploy-presentationeditor-component']);
};