Skip to content

Commit 0323b71

Browse files
committed
Merge Handsontable Pro features to Handsontable
This commit involves: * Copied all Handsontable Pro plugins to this repository; * Updated all npm scripts to test, build and publishing two modules; * Added separate files such as README and package.json files which are published depending on the released module; * Added commercial licenses for Pro plugins; * Updated README file for main repository; * Removed support for bower (removed `.bowerrc` and `bower.json` files); * Removed unnecessary `update.json` file; * Removed `handsontable.jquery.json` file; * From now the `dist/` dependency such as `moment`, `pikaday` etc. no longer will be published to npm; * Fixed TS definition file (Handsontable is exported as default, not as namespace); * HandsontablePro from now have the same TS definition file as CE; * Optimized UMD build by adding @babel/runtime; * Removed "browser" key from package.json file;
1 parent c515bed commit 0323b71

193 files changed

Lines changed: 4211 additions & 3899 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.babelrc

Lines changed: 0 additions & 158 deletions
This file was deleted.

.bowerrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.config/base.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
'use strict';
2-
31
const ExtractTextPlugin = require('extract-text-webpack-plugin');
42
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
53
const path = require('path');
64
const fs = require('fs');
75
const webpack = require('webpack');
86

9-
let licenseBody = fs.readFileSync(path.resolve(__dirname, '../LICENSE'), 'utf8');
7+
const isPro = process.env.HOT_PACKAGE_TYPE === 'pro';
8+
let licenseBody = fs.readFileSync(path.resolve(__dirname, `../licenses/${isPro ? 'Pro' : 'CE'}/LICENSE.txt`), 'utf8');
109

1110
licenseBody += '\nVersion: ' + process.env.HOT_VERSION;
1211
licenseBody += '\nRelease date: ' + process.env.HOT_RELEASE_DATE + ' (built at ' + process.env.HOT_BUILD_DATE + ')';

.config/development.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
'use strict';
2-
31
/**
4-
* Config responsible for building Handsontable `dist/` files:
2+
* Config responsible for building Handsontable `dist/` files. Depends on HOT_FILENAME env it produces, either PRO files:
3+
* - handsontable-pro.js
4+
* - handsontable-pro.css
5+
* - handsontable-pro.full.js
6+
* - handsontable-pro.full.css
7+
* or CE files:
58
* - handsontable.js
69
* - handsontable.css
710
* - handsontable.full.js
@@ -42,6 +45,12 @@ module.exports.create = function create(envArgs) {
4245
commonjs2: 'pikaday',
4346
commonjs: 'pikaday',
4447
amd: 'pikaday',
48+
},
49+
'hot-formula-parser': {
50+
root: 'formulaParser',
51+
commonjs2: 'hot-formula-parser',
52+
commonjs: 'hot-formula-parser',
53+
amd: 'hot-formula-parser',
4554
}
4655
};
4756
c.module.rules.unshift({

.config/languages-development.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
'use strict';
2-
31
/**
42
* Config responsible for building not minified Handsontable `languages/` files.
53
*/
64
const NEW_LINE_CHAR = '\n';
75
const SOURCE_LANGUAGES_DIRECTORY = 'src/i18n/languages';
86
const OUTPUT_LANGUAGES_DIRECTORY = 'languages';
7+
const PACKAGE_FILENAME = process.env.HOT_FILENAME;
98

109
const path = require('path');
1110
const StringReplacePlugin = require('string-replace-webpack-plugin');
@@ -41,7 +40,7 @@ const ruleForSnippetsInjection = {
4140
{
4241
pattern: /import.+constants.+/,
4342
replacement: function() {
44-
const snippet1 = `import Handsontable from '../../handsontable';`;
43+
const snippet1 = `import Handsontable from '../../${PACKAGE_FILENAME}';`;
4544
const snippet2 = `const C = Handsontable.languages.dictionaryKeys;`;
4645

4746
return `${snippet1}${NEW_LINE_CHAR.repeat(2)}${snippet2}`;
@@ -71,11 +70,11 @@ module.exports.create = function create() {
7170
umdNamedDefine: true
7271
},
7372
externals: {
74-
'../../handsontable': {
73+
[`../../${PACKAGE_FILENAME}`]: {
7574
root: 'Handsontable',
76-
commonjs2: '../../handsontable',
77-
commonjs: '../../handsontable',
78-
amd: '../../handsontable',
75+
commonjs2: `../../${PACKAGE_FILENAME}`,
76+
commonjs: `../../${PACKAGE_FILENAME}`,
77+
amd: `../../${PACKAGE_FILENAME}`,
7978
},
8079
},
8180
module: {

.config/languages-production.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
/**
42
* Config responsible for building minified Handsontable `dist/languages/` files.
53
*/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = function() {
2+
return {
3+
visitor: {
4+
ExportAllDeclaration: {
5+
enter: function enter(nodePath) {
6+
if (nodePath.node.source && nodePath.node.source.value === './pro-features' ) {
7+
nodePath.remove();
8+
}
9+
}
10+
}
11+
}
12+
};
13+
};

.config/production.js

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
'use strict';
2-
31
/**
4-
* Config responsible for building Handsontable `dist/` minified files:
2+
* Config responsible for building Handsontable `dist/` minified files. Depends on HOT_FILENAME env it produces, either PRO files:
3+
* - handsontable-pro.min.js
4+
* - handsontable-pro.min.css
5+
* - handsontable-pro.full.min.js
6+
* - handsontable-pro.full.min.css
7+
* or CE files:
58
* - handsontable.min.js
69
* - handsontable.min.css
710
* - handsontable.full.min.js
@@ -32,19 +35,19 @@ module.exports.create = function create(envArgs) {
3235
});
3336

3437
c.plugins.push(
35-
new UglifyJSPlugin({
36-
uglifyOptions: {
37-
compressor: {
38-
pure_getters: true,
39-
unsafe: true,
40-
unsafe_comps: true,
41-
warnings: false,
42-
},
43-
mangle: true,
44-
output: {
45-
comments: /^!|@preserve|@license|@cc_on/i,
46-
},
47-
}
38+
new webpack.optimize.UglifyJsPlugin({
39+
compressor: {
40+
pure_getters: true,
41+
warnings: false,
42+
screw_ie8: true,
43+
},
44+
mangle: {
45+
screw_ie8: true,
46+
},
47+
output: {
48+
comments: /^!|@preserve|@license|@cc_on/i,
49+
screw_ie8: true,
50+
},
4851
}),
4952
new ExtractTextPlugin(PACKAGE_FILENAME + (isFullBuild ? '.full' : '') + '.min.css'),
5053
new OptimizeCssAssetsPlugin({
@@ -56,6 +59,12 @@ module.exports.create = function create(envArgs) {
5659
if (isFullBuild) {
5760
c.plugins.push(
5861
new CopyWebpackPlugin([
62+
{ // hot-formula-parser
63+
from: {glob: 'node_modules/hot-formula-parser/LICENSE'}, to: 'hot-formula-parser', flatten: true
64+
},
65+
{
66+
from: {glob: 'node_modules/hot-formula-parser/dist/formula-parser.js'}, to: 'hot-formula-parser', flatten: true
67+
},
5968
{ // moment
6069
from: {glob: 'node_modules/moment/@(moment.js|LICENSE)'}, to: 'moment', flatten: true
6170
},

0 commit comments

Comments
 (0)