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

fix(build): Update dependencies and build pipeline #51

Merged
merged 9 commits into from
Dec 28, 2018
Merged
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
25 changes: 16 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const rollupNodeResolve = require('rollup-plugin-node-resolve');
const rollupCommonjs = require('rollup-plugin-commonjs');
const rollupJson = require('rollup-plugin-json');
const rollupReplace = require('rollup-plugin-replace');
const rollupUglify = require('rollup-plugin-uglify');
const rollupTypescript = require('rollup-plugin-typescript');
const {uglify: rollupUglify} = require('rollup-plugin-uglify');

const FORMAT_ESM = 'esm';
const FORMAT_CJS = 'cjs';
Expand Down Expand Up @@ -109,6 +110,9 @@ const _genDist = ({minify = false} = {}) =>
// convert JSON files to ES6 modules, so they can be included in Rollup bundle
rollupJson(),

// gives rollup ability to read typescript files
rollupTypescript(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! How was this working before????

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not really sure about that. It was in out package.json so maybe it was implied.


// Locate modules using the Node resolution algorithm, for using third party modules in node_modules
rollupNodeResolve({
// use "module" field for ES6 module if possible
Expand Down Expand Up @@ -186,13 +190,16 @@ gulp.task('build:dist:min', () => _genDist({minify: true}));
gulp.task('build:lib:umd', () => _genUmd());
gulp.task('build:lib:umd:min', () => _genUmd({minify: true}));

gulp.task('build:lib', [
'build:lib:esm',
'build:lib:cjs',
'build:lib:umd',
'build:lib:umd:min',
]);
gulp.task(
'build:lib',
gulp.series(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh looks like gulp@4 introduced gulp.series? I'm guessing because there's also a parallel version...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I assumed we wanted to use series, but I am open to using parallel.

'build:lib:esm',
'build:lib:cjs',
'build:lib:umd',
'build:lib:umd:min'
)
);

gulp.task('build', ['build:lib', 'build:dist', 'build:dist:min']);
gulp.task('build', gulp.series('build:lib', 'build:dist', 'build:dist:min'));

gulp.task('default', ['build']);
gulp.task('default', gulp.series('build'));
1 change: 1 addition & 0 deletions jest-lint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ module.exports = Object.assign({}, baseConfig, {
runner: 'jest-runner-eslint',
displayName: 'lint',
testMatch: ['<rootDir>/src/**/*.(ts|js)'],
watchPlugins: ['jest-runner-eslint/watch-fix'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah! It was painful not having that. Very nice to have it as a watch option.

});
70 changes: 39 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,49 +56,52 @@
"babel-core": "^7.0.0-bridge.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0-beta.40",
"@babel/core": "^7.0.0-beta.40",
"@babel/plugin-external-helpers": "^7.0.0-beta.40",
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.40",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.40",
"@babel/plugin-transform-modules-umd": "^7.0.0-beta.40",
"@babel/preset-env": "^7.0.0-beta.40",
"@babel/preset-typescript": "^7.0.0-beta.40",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/plugin-external-helpers": "^7.2.0",
"@babel/plugin-proposal-class-properties": "^7.2.3",
"@babel/plugin-proposal-object-rest-spread": "^7.2.0",
"@babel/plugin-transform-modules-umd": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"@babel/preset-typescript": "^7.1.0",
"@types/isomorphic-fetch": "^0.0.34",
"@types/jest": "^22.1.3",
"@types/node": "^9.4.6",
"babel-eslint": "^7.0.0",
"@types/jest": "^23.3.10",
"@types/node": "^10.12.18",
"babel-eslint": "^10.0.1",
"bundlesize": "^0.17.0",
"eslint": "^3.0.0",
"eslint-config-eventbrite": "^4.1.0",
"eslint": "^5.11.1",
"eslint-config-eventbrite": "^5.0.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.0.0",
"eslint-plugin-typescript": "^0.9.0",
"gulp": "^3.9.1",
"gulp-babel": "^7.0.1",
"eslint-plugin-jest": "^22.1.2",
"eslint-plugin-typescript": "^0.14.0",
"gulp": "^4.0.0",
"gulp-babel": "^8.0.0",
"gulp-debug": "^4.0.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.6.1",
"gulp-replace": "^1.0.0",
"gulp-sourcemaps": "^2.6.4",
"gulp-uglify": "^3.0.0",
"husky": "^0.14.3",
"jest": "^22.4.0",
"jest-runner-eslint": "^0.4.0",
"gulp-util": "^3.0.8",
"husky": "^1.2.1",
"jest": "^23.6.0",
"jest-runner-eslint": "^0.7.1",
"jest-runner-tsc": "^1.2.0",
"lint-staged": "^6.1.0",
"node": "^8.9.2",
kwelch-eb marked this conversation as resolved.
Show resolved Hide resolved
"lint-staged": "^8.1.0",
"npm-run-all": "^4.1.2",
"prettier-eslint-cli": "^4.7.1",
"rollup": "^0.56.3",
"rollup-plugin-babel": "^4.0.0-beta.2",
"rollup-plugin-commonjs": "^8.3.0",
"rollup-plugin-json": "^2.3.0",
"rollup-plugin-node-resolve": "^3.0.3",
"rollup": "^0.68.2",
"rollup-plugin-babel": "^4.1.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-json": "^3.1.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-typescript": "^0.8.1",
"rollup-plugin-uglify": "^3.0.0",
"typescript": "^2.7.2",
"rollup-plugin-typescript": "^1.0.0",
"rollup-plugin-uglify": "^6.0.0",
"tslib": "^1.9.3",
"typescript": "~3.1.1",
"typescript-babel-jest": "^1.0.5",
"typescript-eslint-parser": "^14.0.0"
"typescript-eslint-parser": "^21.0.2"
},
"bundlesize": [
{
Expand All @@ -112,5 +115,10 @@
"jest-lint.config.js",
"jest-tsc.config.js"
]
},
"prettier": {
"tabWidth": 4,
"semi": true,
"singleQuote": true
}
}
10 changes: 5 additions & 5 deletions src/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import eventbrite from '../';
import eventbrite from '..';
import {
mockFetch,
getMockFetch,
restoreMockFetch,
getMockResponse
getMockResponse,
} from './utils';
import {MOCK_USERS_ME_RESPONSE_DATA} from './__fixtures__';

Expand All @@ -25,7 +25,7 @@ describe('request', () => {
restoreMockFetch();
});

it('makes request to API base url default w/ no token when no configuration is specified', async () => {
it('makes request to API base url default w/ no token when no configuration is specified', async() => {
const {request} = eventbrite();

await expect(request('/users/me/')).resolves.toEqual(
Expand All @@ -39,7 +39,7 @@ describe('request', () => {
);
});

it('makes request to API base url override w/ specified token', async () => {
it('makes request to API base url override w/ specified token', async() => {
const {request} = eventbrite({
token: MOCK_TOKEN,
baseUrl: MOCK_BASE_URL,
Expand All @@ -60,7 +60,7 @@ describe('request', () => {
);
});

it('properly specifies authorization header token when other header options are already specified', async () => {
it('properly specifies authorization header token when other header options are already specified', async() => {
const {request} = eventbrite({
token: MOCK_TOKEN,
});
Expand Down
24 changes: 12 additions & 12 deletions src/__tests__/request.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import {
mockFetch,
getMockFetch,
restoreMockFetch,
getMockResponse
getMockResponse,
} from './utils';
import {
MOCK_USERS_ME_RESPONSE_DATA,
MOCK_INTERNAL_ERROR_RESPONSE_DATA,
MOCK_ARGUMENTS_ERROR_RESPOSNE_DATA
MOCK_ARGUMENTS_ERROR_RESPOSNE_DATA,
} from './__fixtures__';

const TEST_URL = 'https://www.eventbriteapi.com/v3/users/me/';
Expand All @@ -29,7 +29,7 @@ describe('request', () => {
mockFetch(getSuccessfulCodeRes());
});

it('calls fetch and calls fetch with appropriate defaults', async () => {
it('calls fetch and calls fetch with appropriate defaults', async() => {
await request(TEST_URL);

expect(getMockFetch()).toHaveBeenCalledTimes(1);
Expand All @@ -41,7 +41,7 @@ describe('request', () => {
);
});

it('calls fetch and adds "application/json" content type when method is not GET', async () => {
it('calls fetch and adds "application/json" content type when method is not GET', async() => {
await request(TEST_URL, {method: 'POST', body: '{}'});

expect(getMockFetch()).toHaveBeenCalledTimes(1);
Expand All @@ -58,7 +58,7 @@ describe('request', () => {
);
});

it('calls should not send "application/json", if method is not passed', async () => {
it('calls should not send "application/json", if method is not passed', async() => {
await request(TEST_URL);

expect(getMockFetch()).toHaveBeenCalledTimes(1);
Expand All @@ -71,7 +71,7 @@ describe('request', () => {
);
});

it('calls fetch and respects overrides in options', async () => {
it('calls fetch and respects overrides in options', async() => {
await request(TEST_URL, {credentials: 'omit'});

expect(getMockFetch()).toHaveBeenCalledTimes(1);
Expand All @@ -83,7 +83,7 @@ describe('request', () => {
);
});

it('calls fetch and respects overrides in option headers', async () => {
it('calls fetch and respects overrides in option headers', async() => {
await request(TEST_URL, {
headers: {
'X-TEST': 'testHeader',
Expand All @@ -105,7 +105,7 @@ describe('request', () => {
);
});

it('calls fetch and merges overrides with defaults in option headers', async () => {
it('calls fetch and merges overrides with defaults in option headers', async() => {
await request(TEST_URL, {
headers: {
'X-TEST': 'testHeader',
Expand All @@ -129,7 +129,7 @@ describe('request', () => {
})
);
});
it('calls fetch and return parsed response JSON data', async () => {
it('calls fetch and return parsed response JSON data', async() => {
await expect(request(TEST_URL)).resolves.toEqual(
MOCK_USERS_ME_RESPONSE_DATA
);
Expand All @@ -139,7 +139,7 @@ describe('request', () => {
});

describe('error handling', () => {
it('should reject only with response when response is invalid JSON', async () => {
it('should reject only with response when response is invalid JSON', async() => {
const response = new Response('{sa;dfsdfi');

mockFetch(response);
Expand All @@ -149,7 +149,7 @@ describe('request', () => {
});
});

it('calls fetch and rejects with parsed error when there is a status error', async () => {
it('calls fetch and rejects with parsed error when there is a status error', async() => {
const response = getInternalErrorRes();

mockFetch(response);
Expand All @@ -166,7 +166,7 @@ describe('request', () => {
expect(getMockFetch()).toHaveBeenCalledTimes(1);
});

it('calls fetch and rejects with parsed argument errors when there is an ARGUMENT_ERROR', async () => {
it('calls fetch and rejects with parsed argument errors when there is an ARGUMENT_ERROR', async() => {
const response = getArgumentsErrorRes();

mockFetch(response);
Expand Down
Loading