Skip to content

Commit

Permalink
extract tokens from electrode-react-webapp into @xarc/webapp for suba…
Browse files Browse the repository at this point in the history
…pp-server (#1681)

Co-authored-by: vn08447 <[email protected]>
  • Loading branch information
2 people authored and divyakarippath committed Jul 17, 2020
1 parent aef1ebd commit a7f768f
Show file tree
Hide file tree
Showing 17 changed files with 1,311 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/subapp-server/lib/register-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const assert = require("assert");
const _ = require("lodash");
const HttpStatus = require("./http-status");
const { ReactWebapp } = require("electrode-react-webapp");
const { ReactWebapp } = require("@xarc/webapp");
const { errorResponse, resolveChunkSelector, updateFullTemplate } = require("./utils");
const HttpStatusCodes = require("http-status-codes");

Expand Down
2 changes: 1 addition & 1 deletion packages/subapp-server/lib/setup-hapi-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Boom = require("@hapi/boom");
const HttpStatus = require("./http-status");
const readFile = util.promisify(Fs.readFile);
const xaa = require("xaa");
const { ReactWebapp } = require("electrode-react-webapp");
const { ReactWebapp } = require("@xarc/webapp");
const subAppUtil = require("subapp-util");
const registerRoutes = require("./register-routes");

Expand Down
8 changes: 5 additions & 3 deletions packages/subapp-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
],
"dependencies": {
"@hapi/boom": "^7.4.1",
"electrode-react-webapp": "^3.8.10",
"@xarc/webapp": "^1.0.0",
"@xarc/jsx-renderer": "^1.0.0",
"filter-scan-dir": "^1.0.9",
"http-status-codes": "^1.3.0",
"optional-require": "^1.0.0",
Expand All @@ -48,8 +49,9 @@
},
"fyn": {
"dependencies": {
"electrode-react-webapp": "../electrode-react-webapp",
"subapp-util": "../subapp-util"
"@xarc/webapp": "../xarc-webapp",
"subapp-util": "../subapp-util",
"@xarc/jsx-renderer": "../xarc-jsx-renderer"
}
},
"nyc": {
Expand Down
2 changes: 1 addition & 1 deletion packages/subapp-server/template.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"use strict";

module.exports = require("electrode-react-webapp/lib/jsx");
module.exports = require("@xarc/jsx-renderer");
2 changes: 1 addition & 1 deletion packages/subapp-server/test/spec/setup-hapi-routes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { setupSubAppHapiRoutes } = require("../../lib/setup-hapi-routes");
const Path = require("path");
const electrodeServer = require("electrode-server");
const sinon = require("sinon");
const { ReactWebapp } = require("electrode-react-webapp");
const { ReactWebapp } = require("@xarc/webapp");

describe("setupSubAppHapiRoutes", () => {
let server;
Expand Down
30 changes: 30 additions & 0 deletions packages/xarc-webapp/config/test/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use strict";

function tryRequire(path) {
try {
return require(path);
} catch {
return undefined;
}
}

// Chai setup.
const chai = tryRequire("chai");
if (!chai) {
console.log(`
mocha setup: chai is not found. Not setting it up for mocha.
To setup chai for your mocha test, run 'clap mocha'.`);
} else {
const sinonChai = tryRequire("sinon-chai");

if (!sinonChai) {
console.log(`
mocha setup: sinon-chai is not found. Not setting it up for mocha.
To setup sinon-chai for your mocha test, run 'clap mocha'.`);
} else {
chai.use(sinonChai);
}

// Exports
global.expect = chai.expect;
}
44 changes: 44 additions & 0 deletions packages/xarc-webapp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "xarc-webapp",
"version": "1.0.1",
"description": "",
"main": "dist/index.js",
"directories": {
"lib": "lib",
"test": "test"
},
"dependencies": {
"mocha": "^8.0.1",
"@xarc/jsx-renderer": "file:../xarc-jsx-renderer",
"ts-node": "^8.10.2",
"typescript": "^3.9.5",
"xclap": "^0.2.51"
},
"devDependencies": {
"@types/chai": "^4.2.11",
"@types/mocha": "^7.0.2",
"@types/sinon": "^9.0.0",
"@types/sinon-chai": "^3.2.4",
"babel-eslint": "^10.1.0",
"chai": "^4.2.0",
"eslint": "^6.8.0",
"eslint-config-walmart": "^2.2.1",
"eslint-plugin-filenames": "^1.1.0",
"eslint-plugin-jsdoc": "^21.0.0",
"mocha": "^7.1.0",
"nyc": "^15.0.0",
"sinon": "^7.2.6",
"sinon-chai": "^3.3.0"
},
"scripts": {
"test": "mocha"
},
"author": "",
"license": "ISC",
"mocha": {
"require": [
"./config/test/setup.js"
],
"recursive": true
}
}
Loading

0 comments on commit a7f768f

Please sign in to comment.