diff --git a/packages/app/src/setupProxy.js b/packages/app/src/setupProxy.js deleted file mode 100644 index 68ab231e89..0000000000 --- a/packages/app/src/setupProxy.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2020 Spotify AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// eslint-disable-next-line -const createProxyMiddleware = require('http-proxy-middleware'); - -// FIXME: somehow get it from within the plugin itself? -const circleCIProxySettings = { - '/circleci/api': { - target: 'https://circleci.com/api/v1.1', - changeOrigin: true, - logLevel: 'debug', - pathRewrite: { - '^/circleci/api/': '/', - }, - }, -}; - -module.exports = (/** @type {import('express').Application} */ app) => - Object.entries(circleCIProxySettings).forEach(([url, settings]) => - app.use(url, createProxyMiddleware(settings)), - ); diff --git a/packages/cli/package.json b/packages/cli/package.json index c3d768eec2..56dd2febd7 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -83,6 +83,7 @@ "@types/diff": "^4.0.2", "@types/fs-extra": "^8.1.0", "@types/html-webpack-plugin": "^3.2.2", + "@types/http-proxy": "^1.17.4", "@types/inquirer": "^6.5.0", "@types/mini-css-extract-plugin": "^0.9.1", "@types/node": "^13.7.2", diff --git a/packages/cli/src/commands/app/serve.ts b/packages/cli/src/commands/app/serve.ts index 58e9e5fc16..416f8f0151 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'; 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..8abbd92440 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'; +import { serveBundle } from '../../lib/bundler'; 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();