Skip to content

🪟 🔧 Add a start:cloud command to the webapp #19026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions airbyte-webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions airbyte-webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"prepare": "cd .. && husky install airbyte-webapp/.husky",
"prestart": "npm run generate-client",
"start": "craco start",
"prestart:cloud": "npm run generate-client",
"start:cloud": "AB_ENV=frontend-dev node -r ./scripts/environment.js ./node_modules/.bin/craco start",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Using AB_ENV here (we use AB across infra more commonly as an abbreviation of Airbyte), to not collide with the standardized ENV variable for production vs development.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow I had not yet realized what AB signified 😅

"prebuild": "npm run generate-client",
"build": "BUILD_PATH='./build/app' craco build",
"pretest": "npm run generate-client",
Expand Down Expand Up @@ -110,6 +112,7 @@
"@types/unist": "^2.0.5",
"@typescript-eslint/eslint-plugin": "^5.27.1",
"@typescript-eslint/parser": "^5.27.1",
"dotenv": "^16.0.3",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-css-modules": "^2.11.0",
Expand Down
25 changes: 25 additions & 0 deletions airbyte-webapp/scripts/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const fs = require("fs");
const path = require("path");

const dotenv = require("dotenv");

if (!process.env.AB_ENV) {
return;
}

const envFile = path.resolve(
__dirname,
"../../../airbyte-cloud/cloud-webapp/development",
`.env.${process.env.AB_ENV}`
);

if (!fs.existsSync(envFile)) {
console.error(
`~~~ This mode is for Airbyte employees only. ~~~\n` +
`Could not find .env file for environment ${process.env.AB_ENV} (looking at ${envFile}).\n` +
`Make sure you have the latest airbyte-cloud repository checked out in a directory directly next to the airbyte OSS repository.\n`
);
process.exit(42);
}

dotenv.config({ path: envFile });