Skip to content

Commit

Permalink
update subapp samples (#1701)
Browse files Browse the repository at this point in the history
* subapps with latests xarc packages

* Update index.js

Co-authored-by: yisheng.jiang <[email protected]>
  • Loading branch information
2 people authored and divyakarippath committed Jul 17, 2020
1 parent bd98915 commit 787df48
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 96 deletions.
4 changes: 3 additions & 1 deletion packages/subapp-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@hapi/boom": "^7.4.1",
"@xarc/index-page": "^1.0.0",
"@xarc/jsx-renderer": "^1.0.0",
"@xarc/tag-renderer": "^1.0.0",
"filter-scan-dir": "^1.0.9",
"http-status-codes": "^1.3.0",
"optional-require": "^1.0.0",
Expand All @@ -51,7 +52,8 @@
"dependencies": {
"@xarc/index-page": "../xarc-index-page",
"subapp-util": "../subapp-util",
"@xarc/jsx-renderer": "../xarc-jsx-renderer"
"@xarc/jsx-renderer": "../xarc-jsx-renderer",
"@xarc/tag-renderer": "../xarc-tag-renderer"
}
},
"nyc": {
Expand Down
3 changes: 1 addition & 2 deletions packages/xarc-jsx-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@
},
"fyn": {
"dependencies": {
"@xarc/render-context": "../xarc-render-context",
"xaa": "../../../xaa"
"@xarc/render-context": "../xarc-render-context"
},
"devDependencies": {}
}
Expand Down
12 changes: 1 addition & 11 deletions samples/poc-subapp-min/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,9 @@ const portFromEnv = () => {

module.exports = {
plugins: {
"webpack-dev": {
module: "@xarc/app-dev/lib/webpack-dev-hapi",
"@xarc/app-dev": {
enable: process.env.WEBPACK_DEV === "true"
},
inert: {
enable: true
},
electrodeStaticPaths: {
enable: true,
options: {
pathPrefix: "dist"
}
},
"subapp-server": { options: { insertTokenIds: true } }
},
connections: {
Expand Down
6 changes: 2 additions & 4 deletions samples/poc-subapp-min/src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const electrodeConfippet = require("electrode-confippet");
const support = require("@xarc/app/support");

//
const staticPathsDecor = require("electrode-static-paths");
const electrodeServer = require("electrode-server");
const electrodeServer = require("@xarc/fastify-server");

//
// sample to show electrode server startup events
Expand All @@ -28,9 +27,8 @@ function setupElectrodeServerEvents(emitter) {
}

const startServer = config => {
const decor = staticPathsDecor();
if (!config.listener) config.listener = setupElectrodeServerEvents;
return electrodeServer(config, [decor]);
return electrodeServer(config, []);
};

//
Expand Down
9 changes: 0 additions & 9 deletions samples/poc-subapp-pbx/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ module.exports = {
"@xarc/app-dev": {
enable: process.env.WEBPACK_DEV === "true"
},
inert: {
enable: true
},
electrodeStaticPaths: {
enable: true,
options: {
pathPrefix: "dist"
}
},
"subapp-server": { options: { cdn: { enable: true }, insertTokenIds: true } }
},
connections: {
Expand Down
11 changes: 6 additions & 5 deletions samples/poc-subapp-pbx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@
"build": "clap build"
},
"dependencies": {
"@hapi/inert": "^5.2.2",
"@xarc/app": "^6.3.0",

"@xarc/app": "^8.1.6",
"@xarc/app-dev": "^8.1.6",
"@xarc/fastify-server": "^2.0.0",
"electrode-confippet": "^1.5.0",
"electrode-server": "^3.0.0",
"electrode-static-paths": "^3.0.0",
"electrode-archetype-opt-sass": "^2.0.0",
"preact": "^10.1.1",
"preact-render-to-string": "^5.1.3",
"redux": "^4.0.4",
Expand All @@ -48,7 +49,7 @@
"xaa": "^1.3.1"
},
"devDependencies": {
"@xarc/app-dev": "^6.3.0",
"@xarc/app-dev": "^8.1.6",
"electrode-archetype-opt-sass": "^2.0.0",
"prettier": "^1.19.1",
"tachyons-sass": "^4.9.5"
Expand Down
36 changes: 12 additions & 24 deletions samples/poc-subapp-pbx/src/server/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use strict";

const xaa = require("xaa");
/* eslint-disable global-require */

process.on("SIGINT", () => {
Expand All @@ -9,10 +8,10 @@ process.on("SIGINT", () => {

const electrodeConfippet = require("electrode-confippet");
const support = require("@xarc/app/support");
const xaa = require("xaa");

//
const staticPathsDecor = require("electrode-static-paths");
const electrodeServer = require("electrode-server");
const electrodeServer = require("@xarc/fastify-server");

//
// sample to show electrode server startup events
Expand All @@ -29,32 +28,21 @@ function setupElectrodeServerEvents(emitter) {
}

const startServer = config => {
const decor = staticPathsDecor();
if (!config.listener) config.listener = setupElectrodeServerEvents;
return electrodeServer(config, [decor]);
if (!config.listener) {
config.listener = setupElectrodeServerEvents;
}

const server = electrodeServer(config, []);
return server;
};

//

module.exports = async () => {
await support.load(); // loads runtime support

try {
const config = electrodeConfippet.config;
const server = await startServer(config);
server.route({
path: "/api/{delay}",
method: "get",
async handler(request, h) {
const delay = Number(request.params.delay);
await xaa.delay(delay);
return `hello ${request.query.msg} - delay ${delay}`;
}
});
} catch (err) {
console.log("start server failed -", err.message); // eslint-disable-line
process.exit(1);
}
await support.load();
const config = electrodeConfippet.config;
const server = await startServer(config);
return server;
};

if (require.main === module) {
Expand Down
9 changes: 0 additions & 9 deletions samples/poc-subapp-pmin/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ module.exports = {
"@xarc/app-dev": {
enable: process.env.WEBPACK_DEV === "true"
},
inert: {
enable: true
},
electrodeStaticPaths: {
enable: true,
options: {
pathPrefix: "dist"
}
},
"subapp-server": { options: { insertTokenIds: true } }
},
connections: {
Expand Down
23 changes: 9 additions & 14 deletions samples/poc-subapp-pmin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
"build": "clap build"
},
"dependencies": {
"@hapi/inert": "^5.2.2",
"@xarc/app": "^6.3.0",
"@xarc/app": "^8.1.6",
"@xarc/app-dev": "^8.1.6",
"@xarc/fastify-server": "^2.0.0",
"electrode-confippet": "^1.5.0",
"electrode-server": "^3.0.0",
"electrode-static-paths": "^3.0.0",
"preact": "^10.1.1",
"preact-render-to-string": "^5.1.3",
"redux": "^4.0.4",
Expand All @@ -47,22 +47,17 @@
"subapp-server": "../../packages/subapp-server"
},
"devDependencies": {
"@xarc/app-dev": "^6.3.0",
"electrode-archetype-opt-less": "../../packages/electrode-archetype-opt-less",
"electrode-archetype-opt-sass": "../../packages/electrode-archetype-opt-sass",
"electrode-archetype-opt-stylus": "../../packages/electrode-archetype-opt-stylus",
"tachyons-sass": "^4.9.5"
"@xarc/app-dev": "^8.1.6",
"tachyons-sass": "^4.9.5",
"electrode-archetype-opt-sass": "../../packages/electrode-archetype-opt-sass",
"electrode-archetype-opt-stylus": "../../packages/electrode-archetype-opt-stylus"
},
"fyn": {
"dependencies": {
"@xarc/app": "../../packages/xarc-app",
"electrode-archetype-opt-preact": "../../packages/electrode-archetype-opt-preact"
"@xarc/app": "../../packages/xarc-app"
},
"devDependencies": {
"@xarc/app-dev": "../../packages/xarc-app-dev",
"electrode-archetype-opt-less": "../../packages/electrode-archetype-opt-less",
"electrode-archetype-opt-sass": "../../packages/electrode-archetype-opt-sass",
"electrode-archetype-opt-stylus": "../../packages/electrode-archetype-opt-stylus"
"@xarc/app-dev": "../../packages/xarc-app-dev"
}
},
"optionalDependencies": {}
Expand Down
6 changes: 2 additions & 4 deletions samples/poc-subapp-pmin/src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const electrodeConfippet = require("electrode-confippet");
const support = require("@xarc/app/support");

//
const staticPathsDecor = require("electrode-static-paths");
const electrodeServer = require("electrode-server");
const electrodeServer = require("@xarc/fastify-server");

//
// sample to show electrode server startup events
Expand All @@ -28,9 +27,8 @@ function setupElectrodeServerEvents(emitter) {
}

const startServer = config => {
const decor = staticPathsDecor();
if (!config.listener) config.listener = setupElectrodeServerEvents;
return electrodeServer(config, [decor]);
return electrodeServer(config, []);
};

//
Expand Down
17 changes: 4 additions & 13 deletions samples/poc-subapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@
"test": "clap check",
"build": "clap build"
},
"dependencies": {
"dependencies": {
"@xarc/app": "^8.1.6",
"@xarc/app-dev": "^8.1.6",
"@xarc/fastify-server": "^2.0.0",
"electrode-archetype-opt-react": "^3.0.0",
"electrode-confippet": "^1.5.0",
"react": "^16.13.1",
"react-async-ssr": "^0.7.2",
Expand All @@ -52,24 +51,16 @@
"subapp-server": "^1.2.4",
"subapp-web": "^1.0.30"
},
"devDependencies": {
"@xarc/app-dev": "^8.1.6",
"electrode-archetype-opt-eslint": "^2.0.0",
"electrode-archetype-opt-jest": "^25.0.0"
},
"devDependencies":{
"@xarc/app-dev": "^8.1.6"
},
"fyn": {
"dependencies": {
"@xarc/app": "../../packages/xarc-app",
"electrode-archetype-opt-react": "../../packages/electrode-archetype-opt-react",
"subapp-react": "../../packages/subapp-react",
"subapp-redux": "../../packages/subapp-redux",
"subapp-server": "../../packages/subapp-server",
"subapp-web": "../../packages/subapp-web"
},
"devDependencies": {
"@xarc/app-dev": "../../packages/xarc-app-dev",
"electrode-archetype-opt-eslint": "../../packages/electrode-archetype-opt-eslint",
"electrode-archetype-opt-jest": "../../packages/electrode-archetype-opt-jest"
}
},
"prettier": {
Expand Down

0 comments on commit 787df48

Please sign in to comment.