Skip to content

Commit

Permalink
refactor: separate CJS and ES bundles to reduce bundle size
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
* Entry points have changed. This will affect UMD consumers. Now the file name is `workfront-api.umd.js` and `workfront-api.umd.min.js` respectfully.
* For Node users, the api class name has been changed to `NodeApi`. This is to prevent typing ambiguities.
```
const Workfront = require('workfront-api')
const api = new Workfront.NodeApi({/*...*/})
```
  • Loading branch information
citizensas committed Feb 5, 2019
1 parent 92ebf7a commit 9b7649a
Show file tree
Hide file tree
Showing 51 changed files with 7,740 additions and 449 deletions.
2 changes: 1 addition & 1 deletion examples/node/always-use-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: 'internal',
alwaysUseGet: true
Expand Down
2 changes: 1 addition & 1 deletion examples/node/call-acknowledge-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var Workfront = require('./../../');
var ApiConstants = require('workfront-api-constants');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: 'internal'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var Workfront = require('./../../');
var ApiConstants = require('workfront-api-constants');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/create-and-remove-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/create-edit-delete-group-pc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '5.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/create-edit-delete-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/create-new-project-and-share.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '5.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/create-new-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '5.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/create-project-copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '5.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/delete-projects-by-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var Workfront = require('./../../');
var ApiConstants = require('workfront-api-constants');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/get-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/get-multiple-tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/get-project-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/get-task-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/get-user-count.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var Workfront = require('./../../');
var ApiConstants = require('workfront-api-constants');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/get-user-details-using-api-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var Workfront = require('./../../');
var ApiConstants = require('workfront-api-constants');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '5.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/named-query.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/report-project-hours.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var Workfront = require('./../../');
var ApiConstants = require('workfront-api-constants');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/search-for-projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var Workfront = require('./../../');
var util = require('util');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/upload-an-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var util = require('util');
var fs = require('fs')
var stream = fs.createReadStream(__dirname + '/image.jpg');

var instance = new Workfront.Api({
var instance = new Workfront.NodeApi({
url: 'http://localhost:8080',
version: '7.0'
});
Expand Down
37 changes: 34 additions & 3 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ module.exports = function (config) {
// list of files / patterns to load in the browser
files: [
'node_modules/es6-promise/dist/es6-promise.auto.min.js',
'test/test-bundle.js'
'node_modules/whatwg-fetch/dist/fetch.umd.js',
'node_modules/fetch-mock/dist/es5/client-bundle.js',
'node_modules/should/should.js',
{
pattern: 'test/integration/*.spec.ts',
watched: false
}
],

proxies: {
Expand All @@ -29,10 +35,35 @@ module.exports = function (config) {
},

preprocessors: {
'test/test-bundle.js': ['webpack', 'sourcemap']
'test/integration/*.spec.ts': ['rollup', 'sourcemap']
},

mime: {
'text/x-typescript': ['ts']
},

webpack: require('./webpack.config'),
rollupPreprocessor: {
output: {
format: 'iife',
name: 'Workfront',
sourcemap: 'inline',
globals: {
'isomorphic-fetch': 'fetch',
'fetch-mock': 'fetchMock',
'should': 'should',
}
},
plugins: [
require('rollup-plugin-node-resolve')(),
require('rollup-plugin-json')(),
require('rollup-plugin-typescript')(),
],
external: [
'fetch-mock',
'should',
'isomorphic-fetch'
],
},

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
Expand Down
Loading

0 comments on commit 9b7649a

Please sign in to comment.