Skip to content

Commit

Permalink
Merge pull request #902 from ably/separate-webpack-builds
Browse files Browse the repository at this point in the history
Add scripts to run builds for specific platforms
  • Loading branch information
owenpearson authored Feb 25, 2022
2 parents f27b929 + b0995e5 commit 78ff8c2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
20 changes: 16 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ module.exports = function (grunt) {
dirs: dirs,
pkgVersion: grunt.file.readJSON('package.json').version,
webpack: {
config: webpackConfig
all: Object.values(webpackConfig),
node: webpackConfig.node,
browser: [webpackConfig.browser, webpackConfig.browserMin]
}
};

Expand Down Expand Up @@ -110,7 +112,17 @@ module.exports = function (grunt) {

grunt.registerTask('build', [
'checkGitSubmodules',
'webpack'
'webpack:all'
]);

grunt.registerTask('build:node', [
'checkGitSubmodules',
'webpack:node'
]);

grunt.registerTask('build:browser', [
'checkGitSubmodules',
'webpack:browser'
]);

grunt.registerTask('check-closure-compiler', [
Expand All @@ -126,12 +138,12 @@ module.exports = function (grunt) {
grunt.registerTask('test', ['test:node']);
grunt.registerTask('test:node',
'Build the library and run the node test suite\nOptions\n --test [tests] e.g. --test test/rest/auth.js',
['build', 'mocha']
['build:node', 'mocha']
);

grunt.registerTask('test:webserver',
'Launch the Mocha test web server on http://localhost:3000/',
['build', 'checkGitSubmodules', 'mocha:webserver']
['build:browser', 'checkGitSubmodules', 'mocha:webserver']
);

grunt.registerTask('release:refresh-pkgVersion',
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
"test:webserver": "grunt test:webserver",
"test:playwright": "node spec/support/runPlaywrightTests.js",
"concat": "grunt concat",
"build": "grunt build",
"build": "grunt build:all",
"build:node": "grunt build:node",
"build:browser": "grunt build:browser",
"requirejs": "grunt requirejs",
"lint": "eslint nodejs/**/*.js common/**/*.js browser/lib/**/*.js",
"lint:fix": "eslint --fix nodejs/**/*.js common/**/*.js browser/lib/**/*.js",
Expand Down
24 changes: 12 additions & 12 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,15 @@ const commonJsNoEncryptionConfig = {
},
};

module.exports = [
nodeConfig,
browserConfig,
browserMinConfig,
webworkerConfig,
nativeScriptConfig,
reactNativeConfig,
noEncryptionConfig,
noEncryptionMinConfig,
commonJsConfig,
commonJsNoEncryptionConfig,
];
module.exports = {
node: nodeConfig,
browser: browserConfig,
browserMin: browserMinConfig,
webworker: webworkerConfig,
nativeScript: nativeScriptConfig,
reactNative: reactNativeConfig,
noEncryption: noEncryptionConfig,
noEncryptionMin: noEncryptionMinConfig,
commonJs: commonJsConfig,
commonJsNoEncryption: commonJsNoEncryptionConfig,
};

0 comments on commit 78ff8c2

Please sign in to comment.