Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIXES #713 Remove 'use strict' strings brute force to enable module packaging #1664

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-string-replace');
grunt.loadNpmTasks('grunt-terser');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-copy');
Expand Down Expand Up @@ -53,7 +54,7 @@ module.exports = function(grunt) {
bundle: {
// keep the original source for source maps
src: ['./lib/exceljs.browser.js'],
dest: './dist/exceljs.js',
dest: './build/web/exceljs.browserify.js',
},
spec: {
options: {
Expand All @@ -65,6 +66,21 @@ module.exports = function(grunt) {
},
},

'string-replace': {
dist: {
options: {
replacements: [
{
pattern: /("use strict")|('use strict')/g,
replacement: '\'\'',
},
],
},
src: ['./build/web/exceljs.browserify.js'],
dest: './dist/exceljs.js',
},
},

terser: {
options: {
output: {
Expand Down Expand Up @@ -135,6 +151,6 @@ module.exports = function(grunt) {
},
});

grunt.registerTask('build', ['babel:dist', 'browserify', 'terser', 'exorcise', 'copy']);
grunt.registerTask('build', ['babel:dist', 'browserify', 'string-replace', 'terser', 'exorcise', 'copy']);
grunt.registerTask('ug', ['terser']);
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"grunt-contrib-jasmine": "^2.2.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-exorcise": "^2.1.1",
"grunt-string-replace": "^1.3.1",
"grunt-terser": "^1.0.0",
"husky": "^4.3.0",
"lint-staged": "^10.2.13",
Expand Down