Skip to content

Commit

Permalink
feat: ship transpiled code and only that
Browse files Browse the repository at this point in the history
Closes: #5, ref: #4.
  • Loading branch information
blackxored committed Dec 18, 2017
1 parent 4fc84cc commit 8005f2e
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 16 deletions.
8 changes: 8 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": "env",
"env": {
"cjs": {
"plugins": [["transform-es2015-modules-commonjs", { "loose": true }]]
}
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ yarn-error.log*
#Build generated
dist/
build/
es/
lib/


### SublimeText ###
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./**/__tests__/*.test.js
20 changes: 18 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,34 @@
"version": "0.0.0-development",
"description": "Logger for Apollo Link that uses a similar format to redux-logger. Includes performance information.",
"author": "Adrian Perez [email protected]",
"main": "src/index.js",
"module": "es/index.js",
"main": "lib/index.js",
"engines": {
"node": "> 4",
"npm": "> 3"
},

"files": [
"es",
"dist",
"lib"
],
"scripts": {
"start": "webpack",
"commit": "commit",
"precommit": "lint-staged",
"commitmsg": "commitlint -e $GIT_PARAMS",
"clean": "rimraf es/* src/* dist/* coverage/*",
"flow": "flow",
"lint": "eslint",
"add-contributor": "all-contributors add",
"generate-contributors": "all-contributors generate",
"build": "exit 0",
"build:es": "cross-env BABEL_ENV=es babel src -q -d es",
"build:cjs": "cross-env BABEL_ENV=cjs babel src -q -d lib",
"build": "npm run build:es && npm run build:cjs",
"test": "jest",
"prettier:js": "prettier --write --trailing-comma all --tab-width 2 --single-quote --parser flow --print-width 80 \"src/**/*.js\" \"!**/dist/**\"",
"prepare": "npm run build",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"lint-staged": {
Expand All @@ -35,6 +46,7 @@
}
},
"jest": {
"testMatch": ["<rootDir>/src/**/*.test.js"],
"collectCoverageFrom": [
"src/**/*.js",
"!**/node_modules/**",
Expand All @@ -48,10 +60,14 @@
"@commitlint/cli": "^4.2.2",
"@commitlint/config-angular": "^3.1.1",
"all-contributors-cli": "^4.6.0",
"babel-cli": "^6.0.0",
"babel-core": "^6.0.0",
"babel-eslint": "^7.2.3",
"babel-preset-env": "^1.6.0",
"babel-jest": "21.0.0",
"commitizen": "^2.9.6",
"cross-env": "^2.0.1",
"rimraf": "~2.3.2",
"eslint": "^4.6.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-config-prettier": "^2.4.0",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/formatMessage.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const formatMessage = require('../formatMessage');
import formatMessage from '../formatMessage';

describe('formatMessage', () => {
it('returns a list of strings suitable for console logging', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/formatMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ const formatMessage = (operationType, operation, ellapsed) => {
return [parts.join(' '), ...headerCss];
};

module.exports = formatMessage;
export default formatMessage;
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { ApolloLink } = require('apollo-link');
const formatMessage = require('./formatMessage');
const logging = require('./logging');
import { ApolloLink } from 'apollo-link';
import formatMessage from './formatMessage';
import logging from './logging';

const loggerLink = new ApolloLink((operation, forward) => {
const startTime = new Date().getTime();
Expand All @@ -21,4 +21,4 @@ const loggerLink = new ApolloLink((operation, forward) => {
});
});

module.exports = loggerLink;
export default loggerLink;
2 changes: 1 addition & 1 deletion src/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ const logging = (() => {
};
})();

module.exports = logging;
export default logging;
134 changes: 127 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ astral-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"

async-each@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"

async@^1.4.0:
version "1.5.2"
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
Expand All @@ -347,6 +351,27 @@ aws4@^1.2.1, aws4@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e"

babel-cli@^6.0.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-cli/-/babel-cli-6.26.0.tgz#502ab54874d7db88ad00b887a06383ce03d002f1"
dependencies:
babel-core "^6.26.0"
babel-polyfill "^6.26.0"
babel-register "^6.26.0"
babel-runtime "^6.26.0"
commander "^2.11.0"
convert-source-map "^1.5.0"
fs-readdir-recursive "^1.0.0"
glob "^7.1.2"
lodash "^4.17.4"
output-file-sync "^1.1.2"
path-is-absolute "^1.0.1"
slash "^1.0.0"
source-map "^0.5.6"
v8flags "^2.1.1"
optionalDependencies:
chokidar "^1.6.1"

babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
Expand Down Expand Up @@ -753,7 +778,7 @@ babel-plugin-transform-strict-mode@^6.24.1:
babel-runtime "^6.22.0"
babel-types "^6.24.1"

babel-polyfill@^6.23.0:
babel-polyfill@^6.23.0, babel-polyfill@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153"
dependencies:
Expand Down Expand Up @@ -869,6 +894,10 @@ bcrypt-pbkdf@^1.0.0:
dependencies:
tweetnacl "^0.14.3"

binary-extensions@^1.0.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205"

bl@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/bl/-/bl-1.1.2.tgz#fdca871a99713aa00d19e3bbba41c44787a65398"
Expand Down Expand Up @@ -899,7 +928,7 @@ [email protected]:
dependencies:
hoek "4.x.x"

brace-expansion@^1.1.7:
brace-expansion@^1.0.0, brace-expansion@^1.1.7:
version "1.1.8"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292"
dependencies:
Expand Down Expand Up @@ -1021,6 +1050,21 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0:
escape-string-regexp "^1.0.5"
supports-color "^4.0.0"

chokidar@^1.6.1:
version "1.7.0"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468"
dependencies:
anymatch "^1.3.0"
async-each "^1.0.0"
glob-parent "^2.0.0"
inherits "^2.0.1"
is-binary-path "^1.0.0"
is-glob "^2.0.0"
path-is-absolute "^1.0.0"
readdirp "^2.0.0"
optionalDependencies:
fsevents "^1.0.0"

ci-info@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.1.tgz#47b44df118c48d2597b56d342e7e25791060171a"
Expand Down Expand Up @@ -1261,6 +1305,20 @@ create-eslint-index@^1.0.0:
dependencies:
lodash.get "^4.3.0"

cross-env@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-2.0.1.tgz#f283b4039ea759ada9ab7e987ad3bddb241b79a6"
dependencies:
cross-spawn "^3.0.1"
lodash.assign "^3.2.0"

cross-spawn@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-3.0.1.tgz#1256037ecb9f0c5f79e3d6ef135e30770184b982"
dependencies:
lru-cache "^4.0.1"
which "^1.2.9"

cross-spawn@^5.0.1, cross-spawn@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
Expand Down Expand Up @@ -1920,11 +1978,15 @@ fs-extra@^4.0.2:
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-readdir-recursive@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27"

fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"

fsevents@^1.1.1:
fsevents@^1.0.0, fsevents@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.3.tgz#11f82318f5fe7bb2cd22965a108e9306208216d8"
dependencies:
Expand Down Expand Up @@ -2107,6 +2169,15 @@ [email protected]:
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^4.4.2:
version "4.5.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-4.5.3.tgz#c6cb73d3226c1efef04de3c56d012f03377ee15f"
dependencies:
inflight "^1.0.4"
inherits "2"
minimatch "^2.0.1"
once "^1.3.0"

glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
Expand Down Expand Up @@ -2149,7 +2220,7 @@ globby@^5.0.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"

graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"

Expand Down Expand Up @@ -2345,7 +2416,7 @@ inflight@^1.0.4:
once "^1.3.0"
wrappy "1"

inherits@2, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3:
inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"

Expand Down Expand Up @@ -2409,6 +2480,12 @@ is-arrayish@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"

is-binary-path@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898"
dependencies:
binary-extensions "^1.0.0"

is-buffer@^1.1.5:
version "1.1.6"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
Expand Down Expand Up @@ -3155,7 +3232,7 @@ lodash._reinterpolate@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"

lodash.assign@^3.0.0:
lodash.assign@^3.0.0, lodash.assign@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-3.2.0.tgz#3ce9f0234b4b2223e296b8fa0ac1fee8ebca64fa"
dependencies:
Expand Down Expand Up @@ -3346,6 +3423,12 @@ mimic-fn@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18"

minimatch@^2.0.1:
version "2.0.10"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-2.0.10.tgz#8d087c39c6b38c001b97fca7ce6d0e1e80afbac7"
dependencies:
brace-expansion "^1.0.0"

minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
Expand Down Expand Up @@ -3641,6 +3724,14 @@ osenv@^0.1.0, osenv@^0.1.4:
os-homedir "^1.0.0"
os-tmpdir "^1.0.0"

output-file-sync@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/output-file-sync/-/output-file-sync-1.1.2.tgz#d0a33eefe61a205facb90092e826598d5245ce76"
dependencies:
graceful-fs "^4.1.4"
mkdirp "^0.5.1"
object-assign "^4.1.0"

p-cancelable@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.3.0.tgz#b9e123800bcebb7ac13a479be195b507b98d30fa"
Expand Down Expand Up @@ -3910,7 +4001,7 @@ read-pkg@^2.0.0:
normalize-package-data "^2.3.2"
path-type "^2.0.0"

readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2:
readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2:
version "2.3.3"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c"
dependencies:
Expand All @@ -3933,6 +4024,15 @@ readable-stream@~2.0.5:
string_decoder "~0.10.x"
util-deprecate "~1.0.1"

readdirp@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78"
dependencies:
graceful-fs "^4.1.2"
minimatch "^3.0.2"
readable-stream "^2.0.2"
set-immediate-shim "^1.0.1"

rechoir@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
Expand Down Expand Up @@ -4178,6 +4278,12 @@ rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.5.2, rimraf@^2.6.1:
dependencies:
glob "^7.0.5"

rimraf@~2.3.2:
version "2.3.4"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.3.4.tgz#82d9bc1b2fcf31e205ac7b28138a025d08e9159a"
dependencies:
glob "^4.4.2"

run-async@^2.2.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0"
Expand Down Expand Up @@ -4266,6 +4372,10 @@ set-blocking@^2.0.0, set-blocking@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"

set-immediate-shim@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61"

shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
Expand Down Expand Up @@ -4697,6 +4807,10 @@ universalify@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7"

user-home@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190"

util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
Expand All @@ -4705,6 +4819,12 @@ uuid@^3.0.0, uuid@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"

v8flags@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4"
dependencies:
user-home "^1.1.1"

validate-npm-package-license@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc"
Expand Down

0 comments on commit 8005f2e

Please sign in to comment.