From 68f09106e3beea413575eb21194db2d2a70c4391 Mon Sep 17 00:00:00 2001 From: Christian Lent Date: Wed, 15 Apr 2020 17:09:29 -0400 Subject: [PATCH 1/2] Fix subapp-manifests found in sub-directories --- packages/xarc-webpack/lib/partials/entry.js | 16 ++-- samples/poc-subapp/fyn-lock.yaml | 87 +++++++++++-------- .../src/{ => subapps}/03.bottom/bottom.jsx | 2 +- .../src/{ => subapps}/03.bottom/server.jsx | 0 .../03.bottom/subapp-manifest.js | 0 5 files changed, 57 insertions(+), 48 deletions(-) rename samples/poc-subapp/src/{ => subapps}/03.bottom/bottom.jsx (98%) rename samples/poc-subapp/src/{ => subapps}/03.bottom/server.jsx (100%) rename samples/poc-subapp/src/{ => subapps}/03.bottom/subapp-manifest.js (100%) diff --git a/packages/xarc-webpack/lib/partials/entry.js b/packages/xarc-webpack/lib/partials/entry.js index c5c991cb4..9af5178a5 100644 --- a/packages/xarc-webpack/lib/partials/entry.js +++ b/packages/xarc-webpack/lib/partials/entry.js @@ -16,7 +16,7 @@ const DEV_HMR_DIR = ".__dev_hmr"; function makeEntryPartial() { const partial = { - context: Path.resolve(AppMode.src.client) + context: Path.resolve(AppMode.src.client), }; // @@ -37,11 +37,11 @@ function makeEntryPartial() { const entryPath = Path.join(partial.context, "entry.config.js"); const entry = optionalRequire(entryPath, { - fail: err => { + fail: (err) => { logger.error(`Loading ${entryPath} failed`, err); process.exit(1); }, - notFound: () => logger.info(`No custom entry point configuration ${entryPath}`) + notFound: () => logger.info(`No custom entry point configuration ${entryPath}`), }); if (entry) { @@ -60,7 +60,7 @@ function makeEntryPartial() { return `./${subAppReq}`; } - const hmrEntry = `hmr-${manifest.subAppDir}.js`; + const hmrEntry = `hmr-${manifest.subAppDir.replace("/", "-")}.js`; subAppReq = `../${subAppReq}`; let reducerHmrCode = ""; @@ -134,7 +134,7 @@ if (module.hot) { } partial.context = Path.resolve(AppMode.src.dir); const entry = {}; - _.each(subApps, ma => { + _.each(subApps, (ma) => { const entryName = `${ma.name.toLowerCase()}`; const x1 = `${chalk.magenta("subapp")} ${chalk.blue(ma.name)}`; entry[entryName] = genSubAppHmrEntry(hmrDir, isDev, ma); @@ -161,7 +161,7 @@ if (module.hot) { // finally look for src/client/app.js or src/client/app.jsx or src/client/app.tsx const entries = ["./app.js", "./app.jsx", "./app.tsx"]; - const entry = entries.find(f => Fs.existsSync(Path.join(partial.context, f))) || "./app.jsx"; + const entry = entries.find((f) => Fs.existsSync(Path.join(partial.context, f))) || "./app.jsx"; logger.info( `Default to single app entry point using ${entry} under context ${partial.context}` ); @@ -172,9 +172,7 @@ if (module.hot) { function shouldPolyfill() { if (archetype.webpack.enableBabelPolyfill) { const hasMultipleTarget = - Object.keys(archetype.babel.envTargets) - .sort() - .join(",") !== "default,node"; + Object.keys(archetype.babel.envTargets).sort().join(",") !== "default,node"; if (hasMultipleTarget) { return archetype.babel.target === "default"; // for all other targets, disable polyfill diff --git a/samples/poc-subapp/fyn-lock.yaml b/samples/poc-subapp/fyn-lock.yaml index 3be05a513..f8c895a7f 100644 --- a/samples/poc-subapp/fyn-lock.yaml +++ b/samples/poc-subapp/fyn-lock.yaml @@ -1546,12 +1546,12 @@ '@hapi/boom': 7.x.x '@hapi/hoek': 8.x.x '@jchip/redbird': - _latest: 1.1.0-fynlocal_h + _latest: 1.1.0 _: - ../../../redbird: 1.1.0-fynlocal_h - 1.1.0-fynlocal_h: - $: local - _: ../../../redbird + ^1.1.0: 1.1.0 + 1.1.0: + $: sha512-P74xhJRyuegR/xp0fVuChTmBLPE79rF3DS3FCw70NmoePgK9rO7ybg/1CizWOqqqGQVcF7D3mbaicmUgY+c8EA== + _: 'https://npme.walmart.com/@jchip/redbird/-/redbird-1.1.0.tgz' dependencies: bluebird: '^2.11.0 || ^3.5.3' dolphin: '*' @@ -2088,10 +2088,10 @@ '@webassemblyjs/wast-parser': 1.8.5 '@xtuc/long': 4.2.2 '@xarc/app': - _latest: 8.0.15-fynlocal_h + _latest: 8.0.16-fynlocal_h _: - ../../packages/xarc-app: 8.0.15-fynlocal_h - 8.0.15-fynlocal_h: + ../../packages/xarc-app: 8.0.16-fynlocal_h + 8.0.16-fynlocal_h: top: 1 $: local _: ../../packages/xarc-app @@ -2101,12 +2101,12 @@ ignore-styles: ^5.0.1 isomorphic-loader: ^3.0.0 optional-require: ^1.0.0 - subapp-util: ^1.0.4 + subapp-util: ^1.0.5 '@xarc/app-dev': - _latest: 8.0.15-fynlocal_h + _latest: 8.0.16-fynlocal_h _: - ../../packages/xarc-app-dev: 8.0.15-fynlocal_h - 8.0.15-fynlocal_h: + ../../packages/xarc-app-dev: 8.0.16-fynlocal_h + 8.0.16-fynlocal_h: top: 1 $: local _: ../../packages/xarc-app-dev @@ -2156,8 +2156,9 @@ require-at: ^1.0.2 serve-index-fs: ^1.10.1 style-loader: ^0.20.1 - subapp-util: ^1.0.4 + subapp-util: ^1.0.5 sudo-prompt: ^8.2.5 + visual-logger: ^1.1.0 webpack-cli: ^3.3.9 webpack-dev-middleware: ^3.4.0 webpack-hot-middleware: ^2.22.2 @@ -4316,10 +4317,10 @@ electrode-node-resolver: dependencies: require-at: ^1.0.0 electrode-react-webapp: - _latest: 3.8.8-fynlocal_h + _latest: 3.8.9-fynlocal_h _: - ../electrode-react-webapp: 3.8.8-fynlocal_h - 3.8.8-fynlocal_h: + ../electrode-react-webapp: 3.8.9-fynlocal_h + 3.8.9-fynlocal_h: $: local _: ../../packages/electrode-react-webapp dependencies: @@ -10343,69 +10344,69 @@ stylehacks: postcss: ^7.0.0 postcss-selector-parser: ^3.0.0 subapp-react: - _latest: 0.0.14-fynlocal_h + _latest: 0.0.15-fynlocal_h _: - ../../packages/subapp-react: 0.0.14-fynlocal_h - 0.0.14-fynlocal_h: + ../../packages/subapp-react: 0.0.15-fynlocal_h + 0.0.15-fynlocal_h: top: 1 $: local _: ../../packages/subapp-react dependencies: '@babel/runtime': ^7.8.3 optional-require: ^1.0.0 - subapp-util: ^1.0.3 - subapp-web: ^1.0.23 + subapp-util: ^1.0.5 + subapp-web: ^1.0.24 peerDependencies: react: '*' react-dom: '*' subapp-redux: - _latest: 1.0.23-fynlocal_h + _latest: 1.0.24-fynlocal_h _: - ../../packages/subapp-redux: 1.0.23-fynlocal_h - 1.0.23-fynlocal_h: + ../../packages/subapp-redux: 1.0.24-fynlocal_h + 1.0.24-fynlocal_h: top: 1 $: local _: ../../packages/subapp-redux dependencies: optional-require: ^1.0.0 - subapp-util: ^1.0.3 - subapp-web: ^1.0.23 + subapp-util: ^1.0.5 + subapp-web: ^1.0.24 peerDependencies: react: '*' react-dom: '*' redux: '*' react-redux: '*' subapp-server: - _latest: 1.1.16-fynlocal_h + _latest: 1.1.17-fynlocal_h _: - ../../packages/subapp-server: 1.1.16-fynlocal_h - 1.1.16-fynlocal_h: + ../../packages/subapp-server: 1.1.17-fynlocal_h + 1.1.17-fynlocal_h: top: 1 $: local _: ../../packages/subapp-server dependencies: '@hapi/boom': ^7.4.1 - electrode-react-webapp: ^3.8.8 + electrode-react-webapp: ^3.8.9 filter-scan-dir: ^1.0.9 http-status-codes: ^1.3.0 optional-require: ^1.0.0 - subapp-util: ^1.0.4 + subapp-util: ^1.0.5 xaa: ^1.4.0 subapp-util: - _latest: 1.0.4-fynlocal_h + _latest: 1.0.5-fynlocal_h _: - ../subapp-util: 1.0.4-fynlocal_h - 1.0.4-fynlocal_h: + ../subapp-util: 1.0.5-fynlocal_h + 1.0.5-fynlocal_h: $: local _: ../../packages/subapp-util dependencies: filter-scan-dir: ^1.0.9 optional-require: ^1.0.0 subapp-web: - _latest: 1.0.23-fynlocal_h + _latest: 1.0.24-fynlocal_h _: - '../../packages/subapp-web,../subapp-web': 1.0.23-fynlocal_h - 1.0.23-fynlocal_h: + '../../packages/subapp-web,../subapp-web': 1.0.24-fynlocal_h + 1.0.24-fynlocal_h: top: 1 $: local _: ../../packages/subapp-web @@ -10417,7 +10418,7 @@ subapp-web: lodash: ^4.17.15 optional-require: ^1.0.0 request: ^2.88.0 - subapp-util: ^1.0.4 + subapp-util: ^1.0.5 xaa: ^1.4.0 sudo-prompt: _latest: 9.1.1 @@ -11019,6 +11020,16 @@ verror: assert-plus: ^1.0.0 core-util-is: 1.0.2 extsprintf: ^1.2.0 +visual-logger: + _latest: 1.1.1 + _: + ^1.1.0: 1.1.1 + 1.1.1: + $: sha512-fMqKlV5YqUVycfF5QxOpIlivBTvF1Fx/jwlNu3JSxFwyzVyi4P11i+R1+iVDNsU8AHHuUZqi1ONs1OpxAplMoA== + _: 'https://npme.walmart.com/visual-logger/-/visual-logger-1.1.1.tgz' + dependencies: + chalk: ^4.0.0 + log-update: ^4.0.0 vm-browserify: _latest: 1.1.2 _: diff --git a/samples/poc-subapp/src/03.bottom/bottom.jsx b/samples/poc-subapp/src/subapps/03.bottom/bottom.jsx similarity index 98% rename from samples/poc-subapp/src/03.bottom/bottom.jsx rename to samples/poc-subapp/src/subapps/03.bottom/bottom.jsx index 72dcb1aa6..864b252cf 100644 --- a/samples/poc-subapp/src/03.bottom/bottom.jsx +++ b/samples/poc-subapp/src/subapps/03.bottom/bottom.jsx @@ -5,7 +5,7 @@ import { Router, Route, Switch } from "react-router-dom"; import { createStore } from "redux"; import { connect } from "react-redux"; import PropTypes from "prop-types"; -import Large from "../components/large"; +import Large from "../../components/large"; // import AdvGridList from "../components/adv-grid"; diff --git a/samples/poc-subapp/src/03.bottom/server.jsx b/samples/poc-subapp/src/subapps/03.bottom/server.jsx similarity index 100% rename from samples/poc-subapp/src/03.bottom/server.jsx rename to samples/poc-subapp/src/subapps/03.bottom/server.jsx diff --git a/samples/poc-subapp/src/03.bottom/subapp-manifest.js b/samples/poc-subapp/src/subapps/03.bottom/subapp-manifest.js similarity index 100% rename from samples/poc-subapp/src/03.bottom/subapp-manifest.js rename to samples/poc-subapp/src/subapps/03.bottom/subapp-manifest.js From 4bc8952fd043126f8dd6ef9960b3d62f41f5967e Mon Sep 17 00:00:00 2001 From: Christian Lent Date: Thu, 16 Apr 2020 10:26:52 -0400 Subject: [PATCH 2/2] Unix/Windows agonistic --- packages/xarc-webpack/lib/partials/entry.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/xarc-webpack/lib/partials/entry.js b/packages/xarc-webpack/lib/partials/entry.js index 9af5178a5..45d55ebba 100644 --- a/packages/xarc-webpack/lib/partials/entry.js +++ b/packages/xarc-webpack/lib/partials/entry.js @@ -16,7 +16,7 @@ const DEV_HMR_DIR = ".__dev_hmr"; function makeEntryPartial() { const partial = { - context: Path.resolve(AppMode.src.client), + context: Path.resolve(AppMode.src.client) }; // @@ -37,11 +37,11 @@ function makeEntryPartial() { const entryPath = Path.join(partial.context, "entry.config.js"); const entry = optionalRequire(entryPath, { - fail: (err) => { + fail: err => { logger.error(`Loading ${entryPath} failed`, err); process.exit(1); }, - notFound: () => logger.info(`No custom entry point configuration ${entryPath}`), + notFound: () => logger.info(`No custom entry point configuration ${entryPath}`) }); if (entry) { @@ -60,7 +60,7 @@ function makeEntryPartial() { return `./${subAppReq}`; } - const hmrEntry = `hmr-${manifest.subAppDir.replace("/", "-")}.js`; + const hmrEntry = `hmr-${manifest.subAppDir.replace(/[\/\\]/g, "-")}.js`; subAppReq = `../${subAppReq}`; let reducerHmrCode = ""; @@ -134,7 +134,7 @@ if (module.hot) { } partial.context = Path.resolve(AppMode.src.dir); const entry = {}; - _.each(subApps, (ma) => { + _.each(subApps, ma => { const entryName = `${ma.name.toLowerCase()}`; const x1 = `${chalk.magenta("subapp")} ${chalk.blue(ma.name)}`; entry[entryName] = genSubAppHmrEntry(hmrDir, isDev, ma); @@ -161,7 +161,7 @@ if (module.hot) { // finally look for src/client/app.js or src/client/app.jsx or src/client/app.tsx const entries = ["./app.js", "./app.jsx", "./app.tsx"]; - const entry = entries.find((f) => Fs.existsSync(Path.join(partial.context, f))) || "./app.jsx"; + const entry = entries.find(f => Fs.existsSync(Path.join(partial.context, f))) || "./app.jsx"; logger.info( `Default to single app entry point using ${entry} under context ${partial.context}` ); @@ -172,7 +172,9 @@ if (module.hot) { function shouldPolyfill() { if (archetype.webpack.enableBabelPolyfill) { const hasMultipleTarget = - Object.keys(archetype.babel.envTargets).sort().join(",") !== "default,node"; + Object.keys(archetype.babel.envTargets) + .sort() + .join(",") !== "default,node"; if (hasMultipleTarget) { return archetype.babel.target === "default"; // for all other targets, disable polyfill