Skip to content

Commit

Permalink
0.8.9 release: small MEMSERVER const to let for fastboot
Browse files Browse the repository at this point in the history
  • Loading branch information
izelnakri committed Nov 10, 2017
1 parent 838f232 commit fb8c952
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const modelFixtureTree = modelFileNames.reduce((tree, fileName) => {
});
}, {});

const MEMSERVER = require('./mem-server-cjs.js');
let MEMSERVER = require('./mem-server-cjs.js');
const Server = require(`${process.cwd()}/memserver/server`).default;
const initializer_path = `${process.cwd()}/memserver/initializer.js`;
const initializer = fs.existsSync(initializer_path) ? require(initializer_path).default : () => {};
Expand Down
6 changes: 4 additions & 2 deletions lib/mem-server-cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function getDefaultStatusCode(verb) {

// HACK: Pretender REST defaults hack: For better UX
['get', 'put', 'post', 'delete'].forEach((verb) => {
window.Pretender.prototype[verb] = function (path, handler, async) {
window.Pretender.prototype[verb] = function(path, handler, async) {
const fullPath = (this.urlPrefix || '') + (this.namespace ? ('/' + this.namespace) : '') + path;
const targetHandler = handler || getDefaultRouteHandler(verb.toUpperCase(), fullPath);
const timing = async ? async.timing || this.timing : this.timing;
Expand Down Expand Up @@ -272,7 +272,9 @@ function getDefaultRouteHandler(verb, path) {
const ENVIRONMENT_IS_NODE = typeof global === 'object';
const targetNamespace = ENVIRONMENT_IS_NODE ? global : window;

global.self = window.self;
if (ENVIRONMENT_IS_NODE) {
global.self = window.self;
}

window.FakeXMLHttpRequest = FakeXMLHttpRequest;
window.RouteRecognizer = RouteRecognizer;
Expand Down
4 changes: 3 additions & 1 deletion lib/mem-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { primaryKeyTypeSafetyCheck } from './utils';
const ENVIRONMENT_IS_NODE = typeof global === 'object';
const targetNamespace = ENVIRONMENT_IS_NODE ? global : window;

global.self = window.self;
if (ENVIRONMENT_IS_NODE) {
global.self = window.self;
}

import FakeXMLHttpRequest from 'fake-xml-http-request';
import RouteRecognizer from 'route-recognizer';
Expand Down
2 changes: 1 addition & 1 deletion lib/pretender-hacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function getDefaultStatusCode(verb) {

// HACK: Pretender REST defaults hack: For better UX
['get', 'put', 'post', 'delete'].forEach((verb) => {
window.Pretender.prototype[verb] = function (path, handler, async) {
window.Pretender.prototype[verb] = function(path, handler, async) {
const fullPath = (this.urlPrefix || '') + (this.namespace ? ('/' + this.namespace) : '') + path;
const targetHandler = handler || getDefaultRouteHandler(verb.toUpperCase(), fullPath);
const timing = async ? async.timing || this.timing : this.timing;
Expand Down
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"name": "memserver",
"version": "0.8.8",
"version": "0.8.9",
"description": "in-memory database/ORM and http mock server you can run in-browser and node environments. Built for large frontend teams, fast tests and rapid prototyping",
"main": "lib/index.js",
"license": "ISC",
"scripts": {
"test": "sh run-tests.sh",
"bin": "node cli.js",
"build-browser": "rollup -c --environment BUILD:development",
"prepublish": "rollup -i ./lib/model.js -o model.js -f cjs && rollup -i ./lib/response.js -o response.js -f cjs && rollup -i ./lib/mem-server.js -o ./lib/mem-server-cjs.js -f cjs"
"build:browser": "rollup -c --environment BUILD:development",
"build:model": "rollup -i ./lib/model.js -o model.js -f cjs",
"build:model-iife": "rollup -i ./lib/model.js -o model.js -f cjs",
"build:response": "rollup -i ./lib/response.js -o response.js -f cjs",
"build:memserver-cjs": "rollup -i ./lib/mem-server.js -o ./lib/mem-server-cjs.js -f cjs",
"prepublish": "npm run build:model && npm run build:response && npm run build:memserver-cjs"
},
"bin": {
"memserver": "cli.js"
Expand Down

0 comments on commit fb8c952

Please sign in to comment.