Skip to content

Commit

Permalink
fix(dependencies): update dependencies (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaebradley authored Feb 13, 2020
1 parent c7a1bbd commit ec46d3b
Show file tree
Hide file tree
Showing 10 changed files with 12,676 additions and 8,554 deletions.
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"env": {
"test": {
"plugins": [
['@babel/plugin-transform-runtime', {
regenerator: true
}]
],
"presets": [
[
"@babel/preset-env",
Expand Down
7 changes: 7 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"hooks": {
"pre-commit": "npm run lint",
"commit-msg": "npm run commitmsg",
"pre-push": "npm run test"
}
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12.14.1
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ language: node_js
cache:
directories:
- ~/.npm
notifications:
email: true
install: npm install
node_js:
- 'node'
- 'lts/*'
before_install:
- npm install -g npm@5
- npm install -g greenkeeper-lockfile@1
jobs:
include:
Expand Down
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
collectCoverage: true,
testEnvironment: 'node',
testPathIgnorePatterns: [
'<rootDir>/build/',
'<rootDir>/node_modules/',
],
};
20,989 changes: 12,548 additions & 8,441 deletions package-lock.json

Large diffs are not rendered by default.

81 changes: 38 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,59 +26,54 @@
"url": "https://github.com/jaebradley/npms-client.git"
},
"scripts": {
"build": "rollup -c",
"build": "npx rollup -c",
"build:prod": "BABEL_ENV=production npm run build",
"codecov": "codecov",
"commitmsg": "commitlint -e $GIT_PARAMS",
"codecov": "npx codecov",
"commitmsg": "npx commitlint -e $GIT_PARAMS",
"deploy": "npm run travis-deploy-once 'npm run semantic-release'",
"gc": "commit",
"lint": "eslint --ext .js .",
"gc": "npx commit",
"lint": "npx eslint --ext .js .",
"prepare": "npm run build:prod",
"semantic-release": "semantic-release",
"test": "BABEL_ENV=test jest",
"travis-deploy-once": "travis-deploy-once"
"semantic-release": "npx semantic-release",
"test": "BABEL_ENV=test npx jest",
"travis-deploy-once": "npx travis-deploy-once"
},
"browser": "build/index.js",
"jest": {
"testEnvironment": "node",
"testPathIgnorePatterns": [
"<rootDir>/build/",
"<rootDir>/node_modules/"
],
"collectCoverage": true
},
"dependencies": {
"axios": "^0.18.0"
"axios": "^0.19.2"
},
"devDependencies": {
"@babel/cli": "^7.0.0-beta.42",
"@babel/core": "^7.0.0-beta.42",
"@babel/preset-env": "^7.0.0-beta.42",
"@commitlint/cli": "^7.0.0",
"@commitlint/config-angular": "^7.0.1",
"@commitlint/prompt": "^7.0.0",
"@commitlint/prompt-cli": "^7.0.0",
"ajv": "^6.5.1",
"babel-core": "^7.0.0-bridge.0",
"codecov": "^3.0.2",
"eslint": "^5.0.0",
"eslint-config-airbnb-base": "^13.0.0",
"eslint-plugin-import": "^2.9.0",
"husky": "^0.14.3",
"jest": "^23.2.0",
"rollup": "^0.64.0",
"rollup-plugin-babel": "^4.0.0-beta.4",
"rollup-plugin-babel-minify": "^5.0.0",
"rollup-plugin-commonjs": "^9.1.0",
"rollup-plugin-filesize": "^4.0.0",
"rollup-plugin-json": "^3.0.0",
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.4",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.8.4",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-angular": "^8.3.4",
"@commitlint/prompt": "^8.3.5",
"@commitlint/prompt-cli": "^8.3.5",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"ajv": "^6.11.0",
"bufferutil": "^4.0.1",
"canvas": "^2.6.1",
"codecov": "^3.6.5",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.20.1",
"husky": "^4.2.3",
"jest": "^25.1.0",
"rollup": "^1.31.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-babel-minify": "^9.1.1",
"rollup-plugin-filesize": "^6.2.1",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-local-resolve": "^1.0.7",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.2.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-terser": "^1.0.1",
"semantic-release": "^15.1.7",
"travis-deploy-once": "^5.0.0"
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-terser": "^5.2.0",
"semantic-release": "^17.0.3",
"travis-deploy-once": "^5.0.11",
"utf-8-validate": "^5.0.2"
},
"readme": "https://github.com/jaebradley/npms-client#readme"
}
110 changes: 58 additions & 52 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,63 +1,69 @@
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import localResolve from 'rollup-plugin-local-resolve';
import filesize from 'rollup-plugin-filesize';
import minify from 'rollup-plugin-babel-minify';
import json from 'rollup-plugin-json';
import globals from 'rollup-plugin-node-globals';
import builtins from 'rollup-plugin-node-builtins';
import { terser } from 'rollup-plugin-terser';

const config = {
input: 'src/index.js',
output: [
{
file: 'build/index.js',
format: 'umd',
name: 'npms-client',
globals: [
'axios',
],
},
{
file: 'build/index.cjs.js',
format: 'cjs',
name: 'npms-client',
globals: [
'axios',
],
},
{
file: 'build/index.esm.js',
format: 'es',
globals: [
'axios',
],
},
],
external: [
'axios',
],
plugins: [
globals(),
builtins(),
babel({ exclude: 'node_modules/**' }),
localResolve(),
json(),
resolve({
module: true,
jsnext: true,
main: true,
preferBuiltins: true,
browser: true,
modulesOnly: true,
}),
commonjs(),
minify(),
terser(),
filesize(),
],
import pkg from './package.json';

const INPUT_FILE_PATH = 'src/index.js';

const GLOBALS = {
axios: 'axios',
};

const EXTERNAL = ['axios'];


const PLUGINS = [
globals(),
builtins(),
babel({ exclude: 'node_modules/**' }),
localResolve(),
json(),
resolve({
module: true,
jsnext: true,
main: true,
preferBuiltins: true,
browser: true,
modulesOnly: true,
}),
commonjs(),
terser(),
filesize(),
];


const OUTPUT_DATA = [
{
file: pkg.browser,
format: 'umd',
},
{
file: pkg.main,
format: 'cjs',
},
{
file: pkg.module,
format: 'es',
},
];

const config = OUTPUT_DATA.map(({ file, format }) => ({
input: INPUT_FILE_PATH,
output: {
file,
format,
name: pkg.name,
globals: GLOBALS,
},
external: EXTERNAL,
plugins: PLUGINS,
}));

export default config;
8 changes: 4 additions & 4 deletions src/buildSearchQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const buildSearchQuery = ({

const keywords = [];
if (exclude && exclude.keywords && exclude.keywords.length > 0) {
exclude.keywords.forEach(keyword => keywords.push(`-${keyword}`));
exclude.keywords.forEach((keyword) => keywords.push(`-${keyword}`));
}

if (include && include.keywords && include.keywords.length > 0) {
include.keywords.forEach(keyword => keywords.push(keyword));
include.keywords.forEach((keyword) => keywords.push(keyword));
}

if (keywords.length > 0) {
Expand All @@ -48,13 +48,13 @@ const buildSearchQuery = ({

const excludePackageTypes = [];
if (exclude && exclude.packageTypes && exclude.packageTypes.length > 0) {
exclude.packageTypes.forEach(packageType => excludePackageTypes.push(packageType));
exclude.packageTypes.forEach((packageType) => excludePackageTypes.push(packageType));
queryTerms.push(`not:${excludePackageTypes.join(',')}`);
}

const includePackageTypes = [];
if (include && include.packageTypes && include.packageTypes.length > 0) {
include.packageTypes.forEach(packageType => includePackageTypes.push(packageType));
include.packageTypes.forEach((packageType) => includePackageTypes.push(packageType));
queryTerms.push(`is:${includePackageTypes.join(',')}`);
}

Expand Down
14 changes: 7 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const search = ({
}) => (
axios.get(`${NPMS_API_BASE_URL}/search`, {
// custom serializer because npms.io doesn't respect %2B (aka +) in q parameter
paramsSerializer: params => `q=${params.q}&${qs.stringify({ from: params.from, size: params.size })}`,
paramsSerializer: (params) => `q=${params.q}&${qs.stringify({ from: params.from, size: params.size })}`,
params: {
q: buildSearchQuery({
terms,
Expand All @@ -47,7 +47,7 @@ const search = ({
from,
size,
},
}).then(response => response.data)
}).then((response) => response.data)
);

const getSuggestions = ({
Expand All @@ -56,20 +56,20 @@ const getSuggestions = ({
}) => (
axios.get(`${NPMS_API_BASE_URL}/search/suggestions`, {
// custom serializer because npms.io doesn't respect %2B (aka +) in q parameter
paramsSerializer: params => `q=${params.q}&${qs.stringify({ size: params.size })}`,
paramsSerializer: (params) => `q=${params.q}&${qs.stringify({ size: params.size })}`,
params: {
q: terms.join('+'),
size,
},
}).then(response => response.data)
}).then((response) => response.data)
);

const getPackageInformation = packageName => axios.get(`${NPMS_API_BASE_URL}/package/${packageName}`).then(response => response.data);
const getPackageInformation = (packageName) => axios.get(`${NPMS_API_BASE_URL}/package/${packageName}`).then((response) => response.data);

const getPackagesInformation = packageNames => axios.post(
const getPackagesInformation = (packageNames) => axios.post(
`${NPMS_API_BASE_URL}/package/mget`,
packageNames,
).then(response => response.data);
).then((response) => response.data);

export {
search,
Expand Down

0 comments on commit ec46d3b

Please sign in to comment.