profile
viewpoint
John Resig jeresig @Khan Brooklyn, NY https://johnresig.com/ Principal Architect at @Khan

jeresig/dromaeo 71

JavaScript Performance Test Suite

jeresig/elasticsearch-orm 33

An ORM, like Mongoose, for Elasticsearch.

jeresig/begin-app 5

Begin app

jeresig/brooklynjs.github.io 1

The world's most popular programming language, in New York's most popular borough

jeresig/dokku-bower-grunt-build-plugin 1

Add build steps for bower and grunt

jeresig/dokku-elasticsearch 1

Forked from: https://bitbucket.org/foldr/dokku-elasticsearch-plugin

pull request commentKhan/wonder-blocks

build(deps-dev): bump storybook-chromatic from 3.5.1 to 3.5.2

Deploy preview for wonder-blocks ready!

Built with commit 25b4b277954934305d7d6ad7e638290efa55c121

https://deploy-preview-822--wonder-blocks.netlify.com

dependabot-preview[bot]

comment created time in 13 hours

pull request commentKhan/wonder-blocks

Fix netlify.toml

Deploy preview for wonder-blocks ready!

Built with commit 497290468a422a0cd67c0e6093f7cfdc62fcc5c3

https://deploy-preview-823--wonder-blocks.netlify.com

kevinbarabash

comment created time in 17 hours

Pull request review commentKhan/react-loadable

Add withForLoad and areAllLoaded methods

 .idea node_modules *.log-lib

Because lib is what's shipped as part of the package on NPM. Since we're now importing it directly from Github we need to have these built files available to us.

jeresig

comment created time in 2 days

Pull request review commentKhan/react-loadable

Add withForLoad and areAllLoaded methods

 Loadable.preloadReady = () => {   }); }; +Loadable.waitForLoad = () => {

Done!

jeresig

comment created time in 2 days

Pull request review commentKhan/react-loadable

Add withForLoad and areAllLoaded methods

+'use strict';++function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }++var fs = require('fs');+var path = require('path');+var url = require('url');++function buildManifest(compiler, compilation) {+  var context = compiler.options.context;+  var manifest = {};++  compilation.chunks.forEach(function (chunk) {+    chunk.files.forEach(function (file) {+      chunk.forEachModule(function (module) {+        var id = module.id;+        var name = typeof module.libIdent === 'function' ? module.libIdent({ context: context }) : null;+        var publicPath = url.resolve(compilation.outputOptions.publicPath || '', file);++        var currentModule = module;+        if (module.constructor.name === 'ConcatenatedModule') {+          currentModule = module.rootModule;+        }+        if (!manifest[currentModule.rawRequest]) {+          manifest[currentModule.rawRequest] = [];+        }++        manifest[currentModule.rawRequest].push({ id: id, name: name, file: file, publicPath: publicPath });+      });+    });+  });++  return manifest;+}++var ReactLoadablePlugin = function () {+  function ReactLoadablePlugin() {+    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};++    _classCallCheck(this, ReactLoadablePlugin);++    this.filename = opts.filename;+  }++  ReactLoadablePlugin.prototype.apply = function apply(compiler) {+    var _this = this;++    compiler.plugin('emit', function (compilation, callback) {+      var manifest = buildManifest(compiler, compilation);+      var json = JSON.stringify(manifest, null, 2);+      var outputDirectory = path.dirname(_this.filename);+      try {+        fs.mkdirSync(outputDirectory);+      } catch (err) {+        if (err.code !== 'EEXIST') {+          throw err;+        }+      }+      fs.writeFileSync(_this.filename, json);+      callback();+    });+  };++  return ReactLoadablePlugin;+}();++function getBundles(manifest, moduleIds) {+  return moduleIds.reduce(function (bundles, moduleId) {+    return bundles.concat(manifest[moduleId]);+  }, []);+}++exports.ReactLoadablePlugin = ReactLoadablePlugin;+exports.getBundles = getBundles;

Nope! (See above)

jeresig

comment created time in 2 days

Pull request review commentKhan/react-loadable

Add withForLoad and areAllLoaded methods

+'use strict';++exports.__esModule = true;++exports.default = function (_ref) {+  var t = _ref.types,+      template = _ref.template;++  return {+    visitor: {+      ImportDeclaration: function ImportDeclaration(path) {+        var source = path.node.source.value;+        if (source !== 'react-loadable') return;++        var defaultSpecifier = path.get('specifiers').find(function (specifier) {+          return specifier.isImportDefaultSpecifier();+        });++        if (!defaultSpecifier) return;++        var bindingName = defaultSpecifier.node.local.name;+        var binding = path.scope.getBinding(bindingName);++        binding.referencePaths.forEach(function (refPath) {+          var callExpression = refPath.parentPath;++          if (callExpression.isMemberExpression() && callExpression.node.computed === false && callExpression.get('property').isIdentifier({ name: 'Map' })) {+            callExpression = callExpression.parentPath;+          }++          if (!callExpression.isCallExpression()) return;++          var args = callExpression.get('arguments');+          if (args.length !== 1) throw callExpression.error;++          var options = args[0];+          if (!options.isObjectExpression()) return;++          var properties = options.get('properties');+          var propertiesMap = {};++          properties.forEach(function (property) {+            var key = property.get('key');+            propertiesMap[key.node.name] = property;+          });++          if (propertiesMap.webpack) {+            return;+          }++          var loaderMethod = propertiesMap.loader.get('value');+          var dynamicImports = [];++          loaderMethod.traverse({+            Import: function Import(path) {+              dynamicImports.push(path.parentPath);+            }+          });++          if (!dynamicImports.length) return;++          propertiesMap.loader.insertAfter(t.objectProperty(t.identifier('webpack'), t.arrowFunctionExpression([], t.arrayExpression(dynamicImports.map(function (dynamicImport) {+            return t.callExpression(t.memberExpression(t.identifier('require'), t.identifier('resolveWeak')), [dynamicImport.get('arguments')[0].node]);+          })))));++          propertiesMap.loader.insertAfter(t.objectProperty(t.identifier('modules'), t.arrayExpression(dynamicImports.map(function (dynamicImport) {+            return dynamicImport.get('arguments')[0].node;+          }))));+        });+      }+    }+  };+};

Nope! I can pull that in in a separate PR (and remove our cloned copy from Webapp).

jeresig

comment created time in 2 days

push eventKhan/react-loadable

John Resig

commit sha eeb9e59873937bae513ddf2ea2a851a23f69a98e

Add comments and fix logic bug when checking load.

view details

push time in 2 days

push eventjeresig/ehon-db

John Resig

commit sha 9cfc455cdea5f3364bb47ae5dab884eb1e11ecfc

Update mongaku.

view details

push time in 5 days

push eventmongaku/mongaku

John Resig

commit sha e22da8ac0b9174d2567eb8610453b6482f183068

Change default number of workers.

view details

push time in 5 days

push eventjeresig/ehon-db

John Resig

commit sha 70fd88c95c40c4c62b8f5aaee5c333a8b9c2f5fb

Update mongaku.

view details

push time in 5 days

push eventmongaku/mongaku

John Resig

commit sha 864e18ef9a212257d7e6586548b73188bbe1784b

Update existing sources if they already exist.

view details

push time in 5 days

startedlelandrichardson/react-primitives

started time in 5 days

push eventjeresig/ehon-db

John Resig

commit sha 3d4c8a2e41b7f8e807ccfd9ca136da9e9d00bee2

Update mongaku.

view details

push time in 6 days

push eventmongaku/mongaku

John Resig

commit sha 93e4be9ea92db7ef3bc58211df68289f79855c6e

Move Source logic back to admin.

view details

push time in 6 days

push eventjeresig/ehon-db

John Resig

commit sha 3f0ea5e6cfd5bf1c187aee38f6349bb5924d486a

Update mongaku.

view details

push time in 6 days

push eventmongaku/mongaku

John Resig

commit sha 5879dff95056bb758a725bda95922de7bc3c4d04

Upgrade babel-jsxgettext and fix issue with missing strings.

view details

push time in 6 days

push eventmongaku/mongaku

John Resig

commit sha 2868e2883ec46f169c1248cceb026a74f2eea9b3

Add bulk source add view, add new manage sources page, rework admin.

view details

push time in 6 days

startedVGraupera/1on1-questions

started time in 6 days

PR opened Khan/react-loadable

Reviewers
Add withForLoad and areAllLoaded methods

These methods make it possible to better match our style of dependency loading (where we only want to load the dependencies that're actually needed as part of execution). If we were using a traditional model for SSR then using the normal pattern of react-loadable would be fine but since we re-download and execute all the JS on every request it makes more sense to only download as little as we have to!

I had to add the built files to the repo so that we can import this module using the commit SHA.

I'll have a separate diff with the changes to webapp.

+510 -1

0 comment

5 changed files

pr created time in 8 days

push eventKhan/react-loadable

John Resig

commit sha 96af48eef336d617c91f239d8b15dff74ecc5b2a

Add areAllLoaded.

view details

push time in 8 days

create barnchKhan/react-loadable

branch : wait-for-load

created branch time in 8 days

Pull request review commentKhan/react-render-server

[WEB-1795] Return meaningful error codes

 const logAndGetError = function(     }; }; -const respond400Error = (logging: Logger, res: $Response, error, value) => {+const respond400BadRequest = (+    logging: Logger,+    res: $Response,+    error,+    value,+) => {     logging.error(error);     return res.status(400).json({error, value}); }; +const isValidAbsoluteURL = (str: string): boolean =>+    typeof str === "string" && whatwgURL.parseURL(str) !== null;

I don't think you need to use whatwg-url for this, I think you can just use the native implementation: https://nodejs.org/api/url.html#url_the_whatwg_url_api

It was added as a global in v10 but for backwards compat you can do: const {URL} = require("url"); and then here do something like:

const isValidAbsoluteURL = (str: string): boolean => {
    try {
        new URL(str);
        return true;
    } catch(e) {
        return false;
    }
};

(graphql-gateway is already using URL)

somewhatabstract

comment created time in 11 days

push eventmongaku/mongaku

John Resig

commit sha c8aa67b68e95e856183c8aaf012d1b541f9c25b0

Remove some old files.

view details

John Resig

commit sha 4b549aa9f25a0904d5253b7c2fd0a33a526ff8ff

Update license.

view details

push time in 12 days

push eventmongaku/mongaku

John Resig

commit sha 16c7813b6853c5e1284fb0d0f9319c5402273689

Remove tx command.

view details

push time in 12 days

push eventmongaku/mongaku

John Resig

commit sha 5163c62973c87752223ab2be1de6e7ef20bf7e6a

Add details on ARC.

view details

push time in 12 days

push eventmongaku/mongaku

John Resig

commit sha f8b4b95b38a65f0c91378ab71ed3e4196749c592

Update messages.

view details

push time in 12 days

push eventmongaku/mongaku

John Resig

commit sha 8b9f629f749f4f200751e426229502cb5edadae3

Update i18n messages.

view details

push time in 12 days

push eventjeresig/ehon-db

John Resig

commit sha d9c8395b723cbafd92ebd97e8a62f57305769420

Update mongaku

view details

push time in 13 days

push eventmongaku/mongaku

John Resig

commit sha 67f4f233aace30bfe489c3629c4ebf698476f504

Make private sources the default.

view details

push time in 13 days

push eventjeresig/ehon-db

John Resig

commit sha 950668dc0ff1ffdda9987aa770d17ba0fc4677f6

Update monagku

view details

push time in 13 days

push eventmongaku/mongaku

John Resig

commit sha fcd8f9039d394c60e6d6a33a468a71d9bcd2e716

Remove sort-comp.

view details

push time in 13 days

push eventmongaku/mongaku

John Resig

commit sha 82c64a791ee81b105425d9decfe36f6caf1dfba5

Add logic for adding and updating sources.

view details

push time in 13 days

Pull request review commentKhan/react-render-server

Make sure we use the PORT env var that GAE provides for listening

 const parser = new argparse.ArgumentParser({ }); parser.addArgument(["-p", "--port"], {     type: "int",-    defaultValue: 8060,+    defaultValue: process.env.PORT || 8060,

Interesting that this default was 8060 but we were using 8080 above - is that ok?

somewhatabstract

comment created time in 16 days

Pull request review commentKhan/react-render-server

Add ability to scope logging to middleware request logger

 export async function makeRequestMiddleware( ): Promise<Middleware> {     // This is the logger that captures requests handled by our express server.     return args.dev-        ? (req: $Request, res: $Response, next: NextFunction) => {-              // $FlowIgnore: We make this up for google-              req.log = logger;-              next();-          }-        : await lw.express.makeMiddleware(logger);+        ? /**+           * If we're in dev, we're going to use the expressWinston logger+           */+          Promise.resolve(+              expressWinston.logger({+                  /**+                   * Specify the level that this logger logs at.+                   * (use a function to dynamically change level based on req and res)+                   *     `function(req, res) { return String; }`+                   */+                  level: "info",++                  /**+                   * Use the logger we already set up.+                   */+                  winstonInstance: logger,+                  expressFormat: true,+                  colorize: true,+                  meta: false,+              }),+          )+        : /**+           * Otherwise, we're using the Google middleware+           */+          await lw.express.makeMiddleware(logger);

To clarify: we're awaiting here - is the result of the await also a promise? Considering that we're returning a promise if we're not in dev it seems like the await is unnecessary (since it would just return a promise either way).

somewhatabstract

comment created time in 16 days

Pull request review commentKhan/react-render-server

Add ability to scope logging to middleware request logger

 app.use(             createdVmContext: false,         }: RequestStats); +        /**+         * Before we do any real work, we may have added the log middleware+         * and we'll want everything to use it. Rather than pass that around+         * or pass the request around, we can use our logging module and+         * tell it to scope logging to the request logger during the request.+         * NOTE: the $Request type doesn't have a log field, officially.+         * $FlowIgnore+         */+        const requestLog: Logger = req.log;

If requestLog can be undefined then the type probably shouldn't be Logger? Maybe ?Logger?

somewhatabstract

comment created time in 16 days

push eventjeresig/ehon-db

John Resig

commit sha 4d5fef1e2b171d53c57159c25bf70d8eae5a86f8

Update mongaku.

view details

push time in 20 days

push eventmongaku/mongaku

John Resig

commit sha a71c01b3f1d72080ab84dc68f9ead8fcd013de49

Add admin page for adding and updating users.

view details

John Resig

commit sha 919ced0ac17926fcfbfd29c1cc194c16d3df36fb

Fix up login screen formatting and error handling.

view details

push time in 20 days

Pull request review commentKhan/react-render-server

Get logging using the google middleware

 import stream from "stream"; import expressWinston from "express-winston"; import winston from "winston"; -import {LoggingWinston as StackdriverTransport} from "@google-cloud/logging-winston";+import * as lw from "@google-cloud/logging-winston";

nit: Would you be open to renaming "lw" to "loggingWinston" (or some such) to make its use a bit more obvious?

somewhatabstract

comment created time in 21 days

Pull request review commentKhan/react-render-server

Get logging using the google middleware

 function getTransports(isDev) {     return transports; } -type Loggers = {-    default: Logger,-    middleware: {-        requestLogger: Middleware,-        errorLogger: Middleware,-    },-};--function initLogging(logLevel: LogLevel, isDev: boolean): Loggers {+function initLogging(logLevel: LogLevel, isDev: boolean): Logger {     // This is the logger that we use to log general information in our app.     // Whereever one might use console, use this instead.     const winstonLogger = winston.createLogger<NpmLogLevels>({         level: logLevel,         transports: getTransports(isDev),     }); -    // This is the logger that captures requests handled by our express server.-    const requestLogger = expressWinston.logger({-        /**-         * Specify the level that this logger logs at.-         * (use a function to dynamically change level based on req and res)-         *     `function(req, res) { return String; }`-         */-        level: "info",--        /**-         * Use the logger we already set up.-         */-        winstonInstance: winstonLogger,-        expressFormat: true,-        colorize: isDev,-        meta: false,-    });--    // This is the logger that captures errors in our express server.-    const errorLogger = expressWinston.errorLogger({-        /**-         * Specify the level that this logger logs at.-         * (use a function to dynamically change level based on req, res and-         * err)-         *     `function(req, res, err) { return String; }`-         */-        level: "error",--        /**-         * Use the logger we already set up.-         */-        winstonInstance: winstonLogger,-    });-     winstonLogger.debug(         `Intialized logging with Level=${logLevel} DeveloperMode=${             isDev ? "true" : "false"         }`,     ); -    return {-        default: winstonLogger,-        middleware: {requestLogger, errorLogger},-    };+    return winstonLogger;+}++export function extractErrorInfo(error: any): string {+    if (typeof error === "string") {+        return error;+    }++    if (error.response && error.response.error) {+        return `${error.response.error}: ${error.stack}`;+    }++    if (error.error && error !== error.error) {+        return extractErrorInfo(error.error);+    }++    if (error.stack) {+        return error.stack;+    }++    return `${error}`;+}++export function makeErrorMiddleware(logger: Logger): Promise<Middleware> {+    // This is the logger that captures errors in our express server.+    return Promise.resolve(

Why do you have this return a promise? It doesn't seem like it's ever being used in an async manner so just returning the value should be ok (and easier to understand)!

somewhatabstract

comment created time in 21 days

startedScriptedAlchemy/webpack-external-import

started time in 22 days

Pull request review commentKhan/react-render-server

Update to latest flow

-[version]-0.114.0

Oh, we're removing this? I'm ok with that if we want!

somewhatabstract

comment created time in 22 days

push eventKhan/wonder-blocks

dependabot-preview[bot]

commit sha 056f6667d8b3525d0ad5c7baf4cf4d42fd62b1ed

build(deps-dev): bump rollup from 1.30.0 to 1.30.1 (#778)

view details

dependabot-preview[bot]

commit sha 13ce121e5397d6f723bdf13527e6b6d8475a2b12

build(deps-dev): bump eslint-config-prettier from 6.9.0 to 6.10.0 (#780)

view details

dependabot-preview[bot]

commit sha e848460d47bab4d438385be20bc87d75a8e7979b

build(deps-dev): bump storybook-chromatic from 3.4.1 to 3.5.0 (#779)

view details

dependabot-preview[bot]

commit sha ce6f041b85b69a0e7ba229c936c945b0efef61c2

build(deps-dev): bump lint-staged from 10.0.3 to 10.0.4 (#782)

view details

John Resig

commit sha 9f9f2aa5cf6c8be5a9b955ac86de9f8a2bfabbf9

Merge branch 'master' into checkbox-required

view details

push time in 24 days

startedcypress-io/github-action

started time in 24 days

Pull request review commentKhan/wonder-blocks

Use husky and lint-staged for pre-commit check

     "packages/*",     "build-settings"   ],-  "pre-commit": [-    "lint",-    "git-add-snapshot-tests",-    "test:fast",-    "pretty-quick"-  ]+  "husky": {+    "hooks": {+      "pre-commit": "lint-staged"+    }+  },+  "lint-staged": {+    "*.md": [

Ohh - this is really nice!

kevinbarabash

comment created time in a month

Pull request review commentKhan/wonder-blocks

Use husky and lint-staged for pre-commit check

 version: 2 jobs:   lint:     docker:-      - image: circleci/node:8-browsers+      - image: circleci/node:10-browsers

May be worth updating the commit message to make it clear that it includes this as well.

kevinbarabash

comment created time in a month

Pull request review commentKhan/wonder-blocks

Use husky and lint-staged for pre-commit check

     "packages/*",     "build-settings"   ],-  "pre-commit": [-    "lint",-    "git-add-snapshot-tests",-    "test:fast",-    "pretty-quick"-  ]+  "husky": {+    "hooks": {+      "pre-commit": "lint-staged"+    }+  },+  "lint-staged": {+    "*.md": [

Err - will this run gen-shapshot-tests once for all files or once for every file that was changed?

kevinbarabash

comment created time in a month

pull request commentKhan/wonder-blocks

run only related tests in the pre-commit hook

@kevinbarabash Husky allows you to hook in to any Git hook: https://git-scm.com/docs/githooks so we could change it to run on push, like we do currently for webapp.

kevinbarabash

comment created time in a month

Pull request review commentKhan/wonder-blocks

run only related tests in the pre-commit hook

     "start": "concurrently --kill-others-on-fail \"yarn run styleguidist\" \"webpack --config build-settings/webpack.config.js -w\" \"rollup -c build-settings/rollup.config.js -w\"",     "test:common": "yarn run build:all && yarn run lint && yarn run alex && yarn run gen-snapshot-tests && yarn run flow",     "test:coverage": "yarn run test:common && yarn run jest --coverage",+    "test:fast": "yarn build:cjs && yarn jest --findRelatedTests `git diff --cached --name-only --diff-filter=ACM | grep '\\.js$'`",

I feel like the likelihood of having an "R" match but no other of ACM match feels very unlikely to me.

kevinbarabash

comment created time in a month

pull request commentKhan/wonder-blocks

WB-835: Update withActionScheduler to match webapp's HOC pattern

@kevinbarabash ok, that's fine - thank you for checking! A minor version bump seems ok to me.

kevinbarabash

comment created time in a month

starteddosyago/22120

started time in a month

startedbabel/preset-modules

started time in a month

push eventjeresig/node-stream-playground

John Resig

commit sha 70b7ea238393db305b34544f8ce5be0eb072068d

Update README.md

view details

push time in a month

push eventjeresig/ehon-db

John Resig

commit sha e3294708814beca20e8b1cd9e14c22cca3747ad9

Update mongaku.

view details

push time in 2 months

push eventmongaku/mongaku

John Resig

commit sha 13f21d5b2b976678dc7f340b30b60191f0cbbc8a

Fix lint error.

view details

push time in 2 months

push eventjeresig/ehon-db

John Resig

commit sha 66acdf5b798342ddde6d212631c49031b851d736

Update mongaku.

view details

push time in 2 months

push eventmongaku/mongaku

John Resig

commit sha dd1f891e7c4433ad97cf95a7c9b643430c9fc4d7

Fix up allImagesImported logic.

view details

push time in 2 months

push eventjeresig/ehon-db

John Resig

commit sha 2fde43412c76f7d8dd599d56d6cd7932a1fa54d7

Update mongaku.

view details

push time in 2 months

push eventmongaku/mongaku

John Resig

commit sha 58f12e5063cc25f2c03fc56d764cb4572b85d1ad

Add in data index progress view.

view details

push time in 2 months

push eventjeresig/ehon-db

John Resig

commit sha b2fab1034aea5d6ea198d63e36faa9579ef7301c

Update mongaku.

view details

push time in 2 months

push eventmongaku/mongaku

John Resig

commit sha 453f13899ad9ef63d39f9136f20af6704c9d88a2

Fix errors for record view.

view details

push time in 2 months

push eventjeresig/ehon-db

John Resig

commit sha 92b5bf98e83d0d9d761dfcd61bb8a2eb8260d3d3

Update mongaku.

view details

push time in 2 months

push eventmongaku/mongaku

John Resig

commit sha 519ade3b229693a2a7134e454f84191ec12b5226

Fix logic for filtering out upload matches.

view details

push time in 2 months

push eventjeresig/ehon-db

John Resig

commit sha b8880ac417be4edfab9cc1b81210293c07ea33b8

Allow unknown genres.

view details

push time in 2 months

push eventjeresig/ehon-db

John Resig

commit sha d70cfcce7357b3332e7c6336c7955981790c85ec

Add a new convertor for handling all-in-one.json files.

view details

push time in 2 months

push eventjeresig/ehon-db

John Resig

commit sha 3f47a4c624ae162b3e14b61394d1bc61ad02fbe2

Update Mongaku.

view details

push time in 2 months

push eventmongaku/mongaku

John Resig

commit sha 244c826b6fe3aa56aae5c26dc70fcee3fd582e72

Fix missing images total in admin.

view details

John Resig

commit sha e2a325ad34cede004a2c11a94e6d57efa12018d9

Add Private button on home and record pages.

view details

John Resig

commit sha 57d35baf34c98da91a706db1e7062f73d7c4d4a7

Automatically sync similiarity to other images.

view details

John Resig

commit sha d65ac81b1a09ed2e91577c59713754e1dee1d7f6

Add a mechanism for updating the similarity of all the images for a source.

view details

push time in 2 months

push eventjeresig/ehon-db

John Resig

commit sha d562c8f8bf076aa2be43839c8152ae8d566f6094

Update Mongaku.

view details

push time in 2 months

push eventmongaku/mongaku

John Resig

commit sha fc26823fa044b203a8a8ed07a1c9b6384f6a3ae2

Fix a number of bugs and greatly reduce page size of admin pages.

view details

push time in 2 months

push eventjeresig/ehon-db

John Resig

commit sha 2435e56de6c2cf86342bf698dcb51fb80f1093c5

Update mongaku.

view details

push time in 2 months

push eventmongaku/mongaku

John Resig

commit sha 23bd6ed14fe862a1bce997e456117b54eba3a1d6

Switch to bcryptjs.

view details

push time in 2 months

push eventjeresig/ehon-db

John Resig

commit sha 683ebb908334af0c69812b648049c4212027b7be

Update Mongaku.

view details

push time in 2 months

push eventmongaku/mongaku

John Resig

commit sha 080d6875792bbd1dfc6ced1bc6f1df5594ebae16

Fix lint error.

view details

John Resig

commit sha 522a6212093e99031dcd49919f9dd566181e5057

Fix flow errors.

view details

John Resig

commit sha d06807f9b8f8c653ad4b92a29990a6a7aca10ef0

Fix up URL generation.

view details

push time in 2 months

push eventmongaku/mongaku

John Resig

commit sha 4753a3e1ebb51b5b52fa7157988ed3efb2874c49

Add support for private sources and better management for uploading images and data.

view details

John Resig

commit sha 5fcfcec1dee8b1ec6f302fb4d494d7ae3b72c778

Disable updating needsSimilarUpdate for all other images.

view details

John Resig

commit sha 960436802747e600a381dbecf7f16bf2307652c5

Filter out directories when we import images from a directory.

view details

push time in 2 months

startedoverlookmotel/react-async-ssr

started time in 2 months

startedoverlookmotel/react-lazy-ssr

started time in 2 months

startednfl/react-helmet

started time in 2 months

startedkangax/html-minifier

started time in 2 months

startedgregberge/loadable-components

started time in 2 months

started4Catalyzer/astroturf

started time in 2 months

push eventKhan/wonder-blocks

dependabot-preview[bot]

commit sha 72c3ccdfa48e0f6530068c95eb97213f9f8677da

build(deps-dev): bump enzyme from 3.10.0 to 3.11.0 (#668)

view details

dependabot-preview[bot]

commit sha e63cb77ef47a135f0b6de3a31f13e20a4bebbdac

build(deps-dev): bump enzyme-adapter-react-16 from 1.15.1 to 1.15.2 (#667)

view details

John Resig

commit sha 3de3d1cab05aa4973c968863bd7df646ed62c634

Merge branch 'master' into fixdataupdate

view details

push time in 2 months

starteddoczjs/docz

started time in 2 months

delete branch Khan/wonder-blocks

delete branch : dependabot/npm_and_yarn/react-docgen-5.0.0

delete time in 2 months

push eventKhan/wonder-blocks

dependabot-preview[bot]

commit sha 63d2d9842db9d79f49699f7c9764192cf6d7e9fb

build(deps-dev): bump react-docgen from 4.1.1 to 5.0.0 (#643) Bumps [react-docgen](https://github.com/reactjs/react-docgen) from 4.1.1 to 5.0.0. - [Release notes](https://github.com/reactjs/react-docgen/releases) - [Commits](https://github.com/reactjs/react-docgen/compare/v4.1.1...v5.0.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

view details

push time in 2 months

PR merged Khan/wonder-blocks

build(deps-dev): bump react-docgen from 4.1.1 to 5.0.0 dependencies

Bumps react-docgen from 4.1.1 to 5.0.0. <details> <summary>Release notes</summary>

Sourced from react-docgen's releases.

5.0.0

BREAKING CHANGES

  • The license changed to MIT. When updating ensure that MIT is one of the licenses allowed in your project.
  • The signature of resolvers has changed. It previously received the Program AST node as first param and recast as second param. The new signature receives the File AST node as first argument and the preconfigured parser as second argument. resolver(ast: ASTNode, parser: { parse: (string) => AST })
  • Node 8.10.0 or newer is required, older versions are not supported anymore
  • When we detect HOC react-docgen now assumes that the first argument to the HOC is the component. Previously we assumed the last argument is the component, but nearly all implementations of HOC which have multiple arguments have the component as the first argument.
  • React class components now require to extend another class in order to be detected as component. Previously any class having a render method was considered a react component.

New Features

  • Handle computed properties correctly and do not fail generation (#340) If you are using computed properties in your react props we will now include them in the output if we can. If the expression in the computed property is a literal (string, number) we will directly use this as the name otherwise if it is an identifier we will use this an prefix it with @computed#.
  • Fully support React.forwardRef (#350)
  • Add support for TypeScript (#348) We will now correctly parse TypeScript if the filename supplied to react-docgen has a TypeScript extension (.ts, .tsx). If you have babel already setup for TypeScript in your project then all you need to do is supply the filename via the parse options. In the output there will be a new property called tsType which will include the documentation extracted from TypeScript.
  • Add support for TSMappedType (#362)
  • Add support for Flow interfaces and Flow generic types (#348)
  • The default parse function can now receive a string or a Buffer.
  • Handlers now receive the preconfigured parser as 3rd argument. handler(documentation: Documentation, path: NodePath, parser: { parse: (string) => AST })
  • Support destructuring and aliased imports in react builtin call detection (#385) -Bbe more strict about detecting react class components (#397)

Performance

  • Remove recast and use ast-types directly (#349)

Bug Fixes

  • Add missing isReactForwardRefCall export (#351)
  • HOCs resolving intermediate values (#378)
  • Expand index types correctly (#369)
  • Type inference on forwardRef components (#392)
  • Support ts(x) file parsing using CLI (#391)
  • Assume HOC first param is Component not last (#343)
  • Detect components wrapped in HOC with all resolver (#344)
  • Bail when function returns are recursive instead of stack overflowing (#407)
  • Support type as expressions and type assertions (#408)

v5.0.0-beta.1

The first prerelease of yet another breaking version, but it comes with a lot of nice goodies and three massive changes.

  • We finally have TypeScript support thanks to the hard work of @​devongovett 🎉. If you are using React in combination with TypeScript we ask you to try this prerelease and report back if everything works as expected.
  • react-docgen v5 is now licensed under the MIT license 👏. Thanks to @​fkling for talking to the right people at Facebook to make this happen.
  • We improved the performance by removing the recast dependency and using babel directly for parsing the code. In our measurements we saw a 20% to 25% performance increase. If you are testing this new prerelease let us now if you see any improvement in your project.

And there are more helpful changes to come till the final. Stay tuned.

</tr></table> ... (truncated) </details> <details> <summary>Commits</summary>

  • 5e92f3f 5.0.0
  • 44f5e55 fix(typescript): Support type as expressions and type assertions
  • 13a8de9 fix: bail when function returns are recursive instead of stack overflowing
  • a2978e8 chore: update ast-types
  • 71e78b3 build(deps): bump mixin-deep from 1.3.1 to 1.3.2 in /website (#398)
  • b3601b6 fix: be more strict about detecting react class components (#397)
  • aa54200 Detect components wrapped in HOC with all resolver (#344)
  • c462692 build(deps): bump eslint-utils from 1.3.1 to 1.4.3 (#396)
  • 4305f9a Support destructuring and aliased imports in react builtin call detection (#385)
  • 387b331 Add node 13
  • Additional commits viewable in compare view </details> <br />

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

Dependabot will not automatically merge this PR because it includes a major update to a development dependency.


<details> <summary>Dependabot commands and options</summary> <br />

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
  • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot dashboard:

  • Update frequency (including time of day and day of week)
  • Pull request limits (per update run and/or open at any time)
  • Automerge options (never/patch/minor, and dev/runtime dependencies)
  • Out-of-range updates (receive only lockfile updates, if desired)
  • Security updates (receive only security updates, if desired)

</details>

+34 -14

2 comments

2 changed files

dependabot-preview[bot]

pr closed time in 2 months

delete branch Khan/wonder-blocks

delete branch : dependabot/npm_and_yarn/marked-0.8.0

delete time in 2 months

push eventKhan/wonder-blocks

dependabot-preview[bot]

commit sha 22473f578c813671760214489323a463833c348f

build(deps-dev): bump marked from 0.7.0 to 0.8.0 (#646) Bumps [marked](https://github.com/markedjs/marked) from 0.7.0 to 0.8.0. - [Release notes](https://github.com/markedjs/marked/releases) - [Commits](https://github.com/markedjs/marked/compare/v0.7.0...v0.8.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

view details

push time in 2 months

PR merged Khan/wonder-blocks

build(deps-dev): bump marked from 0.7.0 to 0.8.0 dependencies

Bumps marked from 0.7.0 to 0.8.0. <details> <summary>Release notes</summary>

Sourced from marked's releases.

0.8.0

Breaking changes

Fixes

  • Fix relative urls in baseUrl option #1526
  • Loose task list #1535
  • Fix image parentheses #1557
  • remove module field & update devDependencies #1581

Docs

  • Update examples with es6+ #1521
  • Fix link to USING_PRO.md page #1552
  • Fix typo in USING_ADVANCED.md #1558
  • Node worker threads are stable #1555

Dev Dependencies

  • Update deps #1516
  • Update eslint #1542
  • Update htmldiffer async matcher #1543 </details> <details> <summary>Commits</summary>

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

Dependabot will not automatically merge this PR because this dependency is pre-1.0.0.


<details> <summary>Dependabot commands and options</summary> <br />

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
  • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot dashboard:

  • Update frequency (including time of day and day of week)
  • Pull request limits (per update run and/or open at any time)
  • Automerge options (never/patch/minor, and dev/runtime dependencies)
  • Out-of-range updates (receive only lockfile updates, if desired)
  • Security updates (receive only security updates, if desired)

</details>

+5 -5

1 comment

2 changed files

dependabot-preview[bot]

pr closed time in 2 months

PR closed Khan/wonder-blocks

build(deps): bump react-popper from 1.3.6 to 1.3.7 dependencies

Bumps react-popper from 1.3.6 to 1.3.7. <details> <summary>Commits</summary>

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

If all status checks pass Dependabot will automatically merge this pull request.


<details> <summary>Dependabot commands and options</summary> <br />

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
  • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot dashboard:

  • Update frequency (including time of day and day of week)
  • Pull request limits (per update run and/or open at any time)
  • Automerge options (never/patch/minor, and dev/runtime dependencies)
  • Out-of-range updates (receive only lockfile updates, if desired)
  • Security updates (receive only security updates, if desired)

</details>

+64 -6

3 comments

1 changed file

dependabot-preview[bot]

pr closed time in 2 months

Pull request review commentKhan/wonder-blocks

WB-483: Add custom labels to MultiSelect

 export const SEPARATOR_ITEM_HEIGHT = 9;  export const SEARCH_ITEM_HEIGHT =     DROPDOWN_ITEM_HEIGHT + searchInputStyle.margin + searchInputStyle.marginTop;++// The default labels that will be used by different components+export const defaultLabels = {

Very nice!

jandrade

comment created time in 2 months

Pull request review commentKhan/wonder-blocks

WB-483: Add custom labels to MultiSelect

 import SearchTextInput from "./search-text-input.js"; import SelectOpener from "./select-opener.js"; import SeparatorItem from "./separator-item.js"; import {+    defaultLabels,     selectDropdownStyle,     filterableDropdownStyle, } from "../util/constants.js";  import typeof OptionItem from "./option-item.js"; import type {DropdownItem} from "../util/types.js"; -type Props = {|-    ...AriaProps,+export type Labels = {|+    /**+     * Label for describing the dismiss icon on the search filter.+     */+    clearSearch: string,      /**-     * The items in this select.+     * Label for the search placeholder.      */-    children?: Array<?(React.Element<OptionItem> | false)>,+    filter: string,      /**-     * Whether this component is disabled. A disabled dropdown may not be opened-     * and does not support interaction. Defaults to false.+     * Label for when the filter returns no results.      */-    disabled: boolean,+    noResults: string,      /**-     * Unique identifier attached to the field control. If used, we need to-     * guarantee that the ID is unique within everything rendered on a page.-     * Used to match `<label>` with `<button>` elements for screenreaders.+     * Label for the "select all" shortcut option.      */-    id?: string,+    selectAllLabel: (numOptions: number) => string,      /**-     * Callback for when the selection changes. Parameter is an updated array of-     * the values that are now selected.+     * Label for the "select none" shortcut option      */-    onChange: (selectedValues: Array<string>) => mixed,++    selectNoneLabel: string,      /**-     * Can be used to override the state of the ActionMenu by parent elements+     * Label for the opening component when there are no items selected.      */-    opened?: boolean,+    noneSelected: string,      /**-     * In controlled mode, use this prop in case the parent needs to be notified-     * when the menu opens/closes.+     * Label for the opening component when there are some items selected.      */-    onToggle?: (opened: boolean) => mixed,+    someSelected: (numOptions: number) => string,++    /**+     * Label for the opening component when all the items have been selected.+     */+    allSelected: string,+|};++type DefaultProps = {|+    /**+     * Whether this dropdown should be left-aligned or right-aligned with the+     * opener component. Defaults to left-aligned.+     */+    alignment: "left" | "right",++    /**+     * Whether this component is disabled. A disabled dropdown may not be opened+     * and does not support interaction. Defaults to false.+     */+    disabled: boolean,++    /**+     * Whether to display the "light" version of this component instead, for+     * use when the component is used on a dark background.+     */+    light: boolean,      /**      * The values of the items that are currently selected.      */     selectedValues: Array<string>,      /**-     * Type of the option.-     * For example, if selectItemType is "students" and there are two students-     * selected, the SelectOpener would display "2 students"+     * Whether to display shortcuts for Select All and Select None.+     */+    shortcuts: boolean,+|};++type Props = {|+    ...AriaProps,++    ...DefaultProps,++    /**+     * The items in this select.      */-    selectItemType: string,+    children?: Array<?(React.Element<OptionItem> | false)>,      /**-     * Optional placeholder for the opening component when there are no items-     * selected and not implicit all enabled.+     * Optional styling to add to the dropdown wrapper.      */-    placeholder?: string,+    dropdownStyle?: StyleType,++    /**+     * Unique identifier attached to the field control. If used, we need to+     * guarantee that the ID is unique within everything rendered on a page.+     * Used to match `<label>` with `<button>` elements for screenreaders.+     */+    id?: string,      /**-     * When this is true, the menu text shows "All {selectItemType}" when no-     * item is selected.+     * When this is true, the menu text shows "All items" when no item is+     * selected.

Might be worth mentioning which label this is, as well

jandrade

comment created time in 2 months

Pull request review commentKhan/wonder-blocks

WB-483: Add custom labels to MultiSelect

 export default class MultiSelect extends React.Component<Props, State> {         onChange([]);     }; -    // TODO(sophie): need to configure for i18n for the word "All" and-    // potentially the concept of plurals     getMenuText(children: Array<React.Element<OptionItem>>) {-        const {-            placeholder,-            implicitAllEnabled,-            selectItemType,-            selectedValues,-        } = this.props;-        const allSelectedText = `All ${selectItemType}`;+        const {implicitAllEnabled, selectedValues} = this.props;+        const {noneSelected, someSelected, allSelected} = this.labels; -        // When implicit all enabled, use the allSelectedText when no selection+        // When implicit all enabled, use the allSelected when no selection

*use allSelected

jandrade

comment created time in 2 months

Pull request review commentKhan/wonder-blocks

WB-483: Add custom labels to MultiSelect

 export default class MultiSelect extends React.Component<Props, State> {             searchText: "",             lastSelectedValues: [],         };+        // merge custom labels with the default ones+        this.labels = {...defaultLabels, ...props.labels};

Will this update if the props change later on?

jandrade

comment created time in 2 months

Pull request review commentKhan/wonder-blocks

WB-483: Add custom labels to MultiSelect

 export default class SearchTextInput extends React.Component<Props, State> {         );     } +    static defaultProps = {+        labels: {+            clearSearch: defaultLabels.clearSearch,+            filter: defaultLabels.filter,+        },+    };

I notice you're not doing this this.labels here, any reason?

jandrade

comment created time in 2 months

Pull request review commentKhan/wonder-blocks

WB-483: Add translated labels to MultiSelect

 import { import typeof OptionItem from "./option-item.js"; import type {DropdownItem} from "../util/types.js"; +type TranslatedLabels = {|

@jandrade So this is highlighting a problem with the implementation of this, as it stands - if someone wants to implement a replacement for the selectAll label - how would that work? They would need access to the numOptions as well. I think the label definitions would have to look like this:

selectAll: ({numOptions: number, itemType: string}) => string,
allSelected: ({numOptions: number, itemType: string}) => string,
...

We could pass in any other properties that we'd expect people to use, as well. But this way they will have full control over the strings and how they are rendered and what is included. It also means that we can safely move the default values outside of the inline place where they're located.

jandrade

comment created time in 2 months

Pull request review commentKhan/wonder-blocks

WB-483: Add translated labels to MultiSelect

 import { import typeof OptionItem from "./option-item.js"; import type {DropdownItem} from "../util/types.js"; +type TranslatedLabels = {|

I'd like to propose an alternative to what you've done here. What about if we just call this "labels" and make it so that people can use it for translations or just changing the text to something else.

Then it'd make the code a lot cleaner if we put all the strings in one location. For example in the constructor you can do something like: Object.assign(labels, {clearSearch: "Clear search", ...}, props.labels) - then later on you can just use the label directly.

Finally, if you do the above, you can make the type for the labels not only strict but also have all the labels be required: type Labels = {| clearSearch: string, ... |}; In order to provide a property for the user to specify labels you can do: $Shape<Labels>, which means that they don't have to provide them all, just some of them.

jandrade

comment created time in 2 months

delete branch Khan/react-render-server

delete branch : no-cache-errors

delete time in 2 months

push eventKhan/react-render-server

John Resig

commit sha 04f2a8a32e60b945dc5e3ce4ccde51288d5cfcbe

WEB-1759: Add tests verifying that superagent-cache-plugin works We were worried that it might be caching error responses, but that doesn't seem to be the case based on my testing. I ended up adding a bunch of tests anyway, might as well keep them! Issue: https://khanacademy.atlassian.net/browse/WEB-1759 Test plan: `npm test`

view details

John Resig

commit sha 8f5e38e3f7c8580287547383fa13437efcdd3dba

Add some more 4xx tests.

view details

John Resig

commit sha 18e72fcdbb1df589dbab687ae99d2706a49f1111

WEB-1759: Add tests verifying that superagent-cache-plugin works (#40) We were worried that it might be caching error responses, but that doesn't seem to be the case based on my testing. I ended up adding a bunch of tests anyway, might as well keep them! Issue: khanacademy.atlassian.net/browse/WEB-1759 Test plan: npm test

view details

push time in 2 months

PR merged Khan/react-render-server

WEB-1759: Add tests verifying that superagent-cache-plugin works

We were worried that it might be caching error responses, but that doesn't seem to be the case based on my testing. I ended up adding a bunch of tests anyway, might as well keep them!

Issue: https://khanacademy.atlassian.net/browse/WEB-1759

Test plan: npm test

+122 -1

0 comment

1 changed file

jeresig

pr closed time in 2 months

push eventKhan/react-render-server

John Resig

commit sha 8f5e38e3f7c8580287547383fa13437efcdd3dba

Add some more 4xx tests.

view details

push time in 2 months

Pull request review commentKhan/react-render-server

WEB-1759: Add tests verifying that superagent-cache-plugin works

 describe("fetchPackage", () => {         mockScope.done();     }); });++describe("fetchPackage with cache", () => {+    let mockScope;++    before(() => {+        nock.disableNetConnect();+        nock.enableNetConnect("127.0.0.1");+    });++    beforeEach(() => {+        global._fetched = undefined;+        mockScope = nock("https://www.ka.org");+        sinon.stub(args, "useCache").get(() => true);+    });++    afterEach(() => {+        flushCache();+        global._fetched = undefined;+        nock.cleanAll();+        sinon.restore();+    });++    it("should only fetch once for multiple requests", async () => {+        // Arrange+        mockScope.get("/ok.js").reply(200, "global._fetched = 'yay!';");+        mockScope.get("/ok.js").reply(200, "global._fetched = 'ignored';");++        // Act+        const result0 = await fetchPackage("https://www.ka.org/ok.js", "TEST");+        const result1 = await fetchPackage("https://www.ka.org/ok.js", "TEST");++        // Assert+        assert.equal(result0.content, result1.content);+        // We should still have pending mocks; the second request+        // should never have gotten sent.+        assert.notEqual(0, mockScope.pendingMocks().length);+    });++    it("should retry on 4xx even with cache", async () => {+        // Arrange+        mockScope.get("/ok.js").reply(404, "global._fetched = 'boo';");+        mockScope.get("/ok.js").reply(404, "global._fetched = 'boo';");+        mockScope.get("/ok.js").reply(404, "global._fetched = 'boo';");++        // Act+        try {+            await fetchPackage("https://www.ka.org/ok.js", "TEST");+        } catch (e) {+            // Assert+            assert.equal(404, e.response.status);+            assert.equal(0, mockScope.pendingMocks().length);+            mockScope.done();+            return;+        }+        throw new Error("Should have failed on 4xx");+    });++    it("should retry on 5xx", async () => {+        // Arrange+        mockScope.get("/ok.js").reply(500, "global._fetched = 'boo';");+        mockScope.get("/ok.js").reply(500, "global._fetched = 'boo';");+        mockScope.get("/ok.js").reply(500, "global._fetched = 'boo';");++        // Act+        try {+            await fetchPackage("https://www.ka.org/ok.js", "TEST");+        } catch (e) {+            // Assert+            assert.equal(500, e.response.status);+            assert.equal(0, mockScope.pendingMocks().length);+            mockScope.done();+            return;+        }++        throw new Error("Should have failed on 5xx");+    });++    it("should succeed on 5xx followed by 200", async () => {

Yeah, I'll add one!

jeresig

comment created time in 2 months

more