From d15789ea4a2e5824027c050a90e805e7a0889a99 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 18 May 2020 17:27:22 +0200 Subject: [PATCH 1/3] build(deps-dev): bump ts-node from 8.8.1 to 8.10.1 (#896) Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.8.1 to 8.10.1. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v8.8.1...v8.10.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index c844afcb5a..103fb2ab9d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18182,10 +18182,10 @@ source-map-resolve@^0.5.0, source-map-resolve@^0.5.2: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.6, source-map-support@~0.5.12: - version "0.5.16" - resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" - integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== +source-map-support@^0.5.17, source-map-support@^0.5.6, source-map-support@~0.5.12: + version "0.5.19" + resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" + integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -19460,14 +19460,14 @@ ts-loader@^7.0.4: semver "^6.0.0" ts-node@^8.6.2: - version "8.8.1" - resolved "https://registry.npmjs.org/ts-node/-/ts-node-8.8.1.tgz#7c4d3e9ed33aa703b64b28d7f9d194768be5064d" - integrity sha512-10DE9ONho06QORKAaCBpPiFCdW+tZJuY/84tyypGtl6r+/C7Asq0dhqbRZURuUlLQtZxxDvT8eoj8cGW0ha6Bg== + version "8.10.1" + resolved "https://registry.npmjs.org/ts-node/-/ts-node-8.10.1.tgz#77da0366ff8afbe733596361d2df9a60fc9c9bd3" + integrity sha512-bdNz1L4ekHiJul6SHtZWs1ujEKERJnHs4HxN7rjTyyVOFf3HaJ6sLqe6aPG62XTzAB/63pKRh5jTSWL0D7bsvw== dependencies: arg "^4.1.0" diff "^4.0.1" make-error "^1.1.1" - source-map-support "^0.5.6" + source-map-support "^0.5.17" yn "3.1.1" ts-pnp@^1.1.2: From dd93bc9ced36525599b12247a56ead66d51701b8 Mon Sep 17 00:00:00 2001 From: Ivan Shmidt Date: Mon, 18 May 2020 17:56:36 +0200 Subject: [PATCH 2/3] feat: proxy Allowing to put a proxy field into a package.json for both app and plugin to use it with a wds build-in proxy --- packages/cli/src/commands/app/serve.ts | 8 +++++++- packages/cli/src/commands/plugin/serve.ts | 6 ++++++ packages/cli/src/lib/bundler/types.ts | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/app/serve.ts b/packages/cli/src/commands/app/serve.ts index 182e338287..58e9e5fc16 100644 --- a/packages/cli/src/commands/app/serve.ts +++ b/packages/cli/src/commands/app/serve.ts @@ -14,13 +14,19 @@ * limitations under the License. */ -import { serveBundle } from '../../lib/bundler'; +import fs from 'fs-extra'; import { Command } from 'commander'; +import { serveBundle } from '../../lib/bundler'; +import { paths } from '../../lib/paths'; export default async (cmd: Command) => { + const pkgPath = paths.resolveTarget('package.json'); + const pkg = await fs.readJson(pkgPath); + const waitForExit = await serveBundle({ entry: 'src/index', checksEnabled: cmd.check, + proxy: pkg.proxy, }); await waitForExit(); diff --git a/packages/cli/src/commands/plugin/serve.ts b/packages/cli/src/commands/plugin/serve.ts index 5700992644..f9768ec497 100644 --- a/packages/cli/src/commands/plugin/serve.ts +++ b/packages/cli/src/commands/plugin/serve.ts @@ -14,13 +14,19 @@ * limitations under the License. */ +import fs from 'fs-extra'; import { serveBundle } from '../../lib/bundler'; import { Command } from 'commander'; +import { paths } from '../../lib/paths'; export default async (cmd: Command) => { + const pkgPath = paths.resolveTarget('package.json'); + const pkg = await fs.readJson(pkgPath); + const waitForExit = await serveBundle({ entry: 'dev/index', checksEnabled: cmd.check, + proxy: pkg.proxy, }); await waitForExit(); diff --git a/packages/cli/src/lib/bundler/types.ts b/packages/cli/src/lib/bundler/types.ts index 4182226d69..5e14760574 100644 --- a/packages/cli/src/lib/bundler/types.ts +++ b/packages/cli/src/lib/bundler/types.ts @@ -15,6 +15,7 @@ */ import { BundlingPathsOptions } from './paths'; +import { ProxyConfigMap } from 'webpack-dev-server'; export type BundlingOptions = { checksEnabled: boolean; @@ -23,6 +24,7 @@ export type BundlingOptions = { export type ServeOptions = BundlingPathsOptions & { checksEnabled: boolean; + proxy?: ProxyConfigMap; }; export type BuildOptions = BundlingPathsOptions & { From aef288b6cbd27c3c70287dce2ea6bbc032017f4b Mon Sep 17 00:00:00 2001 From: Ivan Shmidt Date: Mon, 18 May 2020 18:19:56 +0200 Subject: [PATCH 3/3] refactor: move to serveBundle --- packages/cli/src/commands/app/serve.ts | 8 +------- packages/cli/src/commands/plugin/serve.ts | 6 ------ packages/cli/src/lib/bundler/server.ts | 4 ++++ packages/cli/src/lib/bundler/types.ts | 2 -- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/cli/src/commands/app/serve.ts b/packages/cli/src/commands/app/serve.ts index 58e9e5fc16..182e338287 100644 --- a/packages/cli/src/commands/app/serve.ts +++ b/packages/cli/src/commands/app/serve.ts @@ -14,19 +14,13 @@ * limitations under the License. */ -import fs from 'fs-extra'; -import { Command } from 'commander'; import { serveBundle } from '../../lib/bundler'; -import { paths } from '../../lib/paths'; +import { Command } from 'commander'; export default async (cmd: Command) => { - const pkgPath = paths.resolveTarget('package.json'); - const pkg = await fs.readJson(pkgPath); - const waitForExit = await serveBundle({ entry: 'src/index', checksEnabled: cmd.check, - proxy: pkg.proxy, }); await waitForExit(); diff --git a/packages/cli/src/commands/plugin/serve.ts b/packages/cli/src/commands/plugin/serve.ts index f9768ec497..5700992644 100644 --- a/packages/cli/src/commands/plugin/serve.ts +++ b/packages/cli/src/commands/plugin/serve.ts @@ -14,19 +14,13 @@ * limitations under the License. */ -import fs from 'fs-extra'; import { serveBundle } from '../../lib/bundler'; import { Command } from 'commander'; -import { paths } from '../../lib/paths'; export default async (cmd: Command) => { - const pkgPath = paths.resolveTarget('package.json'); - const pkg = await fs.readJson(pkgPath); - const waitForExit = await serveBundle({ entry: 'dev/index', checksEnabled: cmd.check, - proxy: pkg.proxy, }); await waitForExit(); diff --git a/packages/cli/src/lib/bundler/server.ts b/packages/cli/src/lib/bundler/server.ts index 3aaf5968f5..ca224fdd1c 100644 --- a/packages/cli/src/lib/bundler/server.ts +++ b/packages/cli/src/lib/bundler/server.ts @@ -14,6 +14,7 @@ * limitations under the License. */ +import fs from 'fs-extra'; import yn from 'yn'; import webpack from 'webpack'; import WebpackDevServer from 'webpack-dev-server'; @@ -36,6 +37,8 @@ export async function serveBundle(options: ServeOptions) { const urls = prepareUrls(protocol, host, port); const paths = resolveBundlingPaths(options); + const pkgPath = paths.targetPackageJson; + const pkg = await fs.readJson(pkgPath); const config = createConfig(paths, { ...options, isDev: true }); const compiler = webpack(config); @@ -48,6 +51,7 @@ export async function serveBundle(options: ServeOptions) { https: protocol === 'https', host, port, + proxy: pkg.proxy, }); await new Promise((resolve, reject) => { diff --git a/packages/cli/src/lib/bundler/types.ts b/packages/cli/src/lib/bundler/types.ts index 5e14760574..4182226d69 100644 --- a/packages/cli/src/lib/bundler/types.ts +++ b/packages/cli/src/lib/bundler/types.ts @@ -15,7 +15,6 @@ */ import { BundlingPathsOptions } from './paths'; -import { ProxyConfigMap } from 'webpack-dev-server'; export type BundlingOptions = { checksEnabled: boolean; @@ -24,7 +23,6 @@ export type BundlingOptions = { export type ServeOptions = BundlingPathsOptions & { checksEnabled: boolean; - proxy?: ProxyConfigMap; }; export type BuildOptions = BundlingPathsOptions & {