Skip to content

Commit 86fbcdc

Browse files
Tim Roeslmossman
andauthored
🪟 🔧 Switch to pnpm for package managing (#22053)
* WIP * WIP * Adjust lockfile * Fix issues * Adjust github flows * More fixes * Adjust documentation * Remove unnecessary tsconfig entry * Cleanup .eslintrc * Update dependencies * Fix more issues * Correct TS * Make pnpm install run always via gradle * Install @storybook/react explicitaly * Update snapshots due to new libraries * Add node-fetch types * Add `url` package * Freeze react router version (due to useBlocker) * Fix typing issue * Update airbyte-webapp/src/components/ui/BarChart/BarChart.tsx Co-authored-by: Lake Mossman <[email protected]> * Rewrite README * Update e2e test library * Remove retry * Latest pnpm version * Revert removal of retry logic --------- Co-authored-by: Lake Mossman <[email protected]>
1 parent 7326731 commit 86fbcdc

File tree

31 files changed

+15969
-57995
lines changed

31 files changed

+15969
-57995
lines changed

.github/actions/cache-build-artifacts/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ runs:
3131
restore-keys: |
3232
${{ inputs.cache-key }}-npm-${{ runner.os }}-
3333
34+
- name: pnpm Caching
35+
uses: actions/cache@v3
36+
with:
37+
path: |
38+
~/.pnpm-store
39+
key: ${{ inputs.cache-key }}-pnpm-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
40+
restore-keys: |
41+
${{ inputs.cache-key }}-pnpm-${{ runner.os }}-
42+
3443
# this intentionally does not use restore-keys so we don't mess with gradle caching
3544
- name: Gradle and Python Caching
3645
uses: actions/cache@v3

airbyte-cdk/python/airbyte_cdk/sources/declarative/declarative_component_schema.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ definitions:
126126
- stream_slicers
127127
properties:
128128
type:
129+
type: string
129130
enum: [CartesianProductStreamSlicer]
130131
stream_slicers:
131132
type: array
@@ -746,6 +747,7 @@ definitions:
746747
- type
747748
properties:
748749
type:
750+
type: string
749751
enum: [JsonFileSchemaLoader, JsonSchema] # TODO As part of Beta, remove JsonSchema and update connectors to use JsonFileSchemaLoader
750752
file_path:
751753
type: string

airbyte-webapp-e2e-tests/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Steps:
1212
4) When running the connector builder tests, start the dummy API server: `npm run createdummyapi`
1313
5) Start the OSS backend: `BASIC_AUTH_USERNAME="" BASIC_AUTH_PASSWORD="" VERSION=dev docker compose --file ../docker-compose.yaml up`. If you want, follow this with `docker compose stop webapp` to turn off the dockerized frontend build; interactive cypress sessions don't use it.
1414
6) The following two commands will start a separate long-running server, so open another terminal window. In it, `cd` into the `airbyte-webapp/` directory.
15-
7) If you have not already done so, run `npm install` to install the frontend app's dependencies.
16-
8) Start the frontend development server with `npm start`.
15+
7) If you have not already done so, run `pnpm install` to install the frontend app's dependencies.
16+
8) Start the frontend development server with `pnpm start`.
1717
9) Back in the `airbyte-webapp-e2e-tests/` directory, start the cypress test runner with `npm run cypress:open`.
1818

1919
## Reproducing CI test results with `npm run cypress:ci` or `npm run cypress:ci:record`

airbyte-webapp/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
"plugin:jsx-a11y/recommended",
1010
"plugin:@airbyte/recommended",
1111
],
12-
plugins: ["react", "@typescript-eslint", "prettier", "unused-imports", "css-modules", "jsx-a11y", "@airbyte"],
12+
plugins: ["@typescript-eslint", "prettier", "unused-imports", "css-modules", "jsx-a11y", "@airbyte"],
1313
parserOptions: {
1414
ecmaVersion: 2020,
1515
sourceType: "module",

airbyte-webapp/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
engine-strict=true
2+
enable-pre-post-scripts=true

airbyte-webapp/README.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,26 @@
11
# airbyte-webapp
22

3-
This module contains the Airbyte Webapp. It is a React app written in TypeScript. It runs in a Docker container. A very lightweight nginx server runs in that Docker container and serves the webapp.
3+
This module contains the Airbyte Webapp. It is a React app written in TypeScript.
4+
The webapp compiles to static HTML, JavaScript and CSS, which is served (in OSS) via
5+
a nginx in the airbyte-webapp docker image. This nginx also serves as the reverse proxy
6+
for accessing the server APIs in other images.
47

5-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
8+
## Building the webapp
69

7-
## Available Scripts
10+
You can build the webapp using Gradle in the root of the repository:
811

9-
In the project directory, you can run:
12+
```sh
13+
# Only compile and build the docker webapp image:
14+
SUB_BUILD=PLATFORM ./gradlew :airbyte-webapp:assemble
15+
# Build the webapp and additional artifacts and run tests:
16+
SUB_BUILD=PLATFORM ./gradlew :airbyte-webapp:build
17+
```
1018

11-
### `npm start`
19+
## Developing the webapp
1220

13-
Runs the app in the development mode.<br />
14-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
21+
For an instruction how to develop on the webapp, please refer to our [documentation](https://docs.airbyte.com/contributing-to-airbyte/developing-locally/#develop-on-airbyte-webapp).
1522

16-
### `npm test`
23+
### Entrypoints
1724

18-
Launches the test runner in the interactive watch mode.<br />
19-
20-
### `npm run build`
21-
22-
Builds the app for production to the `build` folder.<br />
23-
24-
### VERSION=yourtag ./gradlew :airbyte-webapp:assemble
25-
26-
Builds the app and Docker image and tags the image with `yourtag`.
27-
Note: needs to be run from the root directory of the Airbyte project.
28-
29-
## Entrypoints
3025
* `airbyte-webapp/src/App.tsx` is the entrypoint into the OSS version of the webapp.
3126
* `airbyte-webapp/src/packages/cloud/App.tsx` is the entrypoint into the Cloud version of the webapp.

airbyte-webapp/build.gradle

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,49 @@
11
plugins {
22
id "base"
3-
id "com.github.node-gradle.node" version "3.3.0"
3+
id "com.github.node-gradle.node" version "3.4.0"
44
}
55

66
// Use the node version that's defined in the .nvmrc file
77
def nodeVersion = new File("${projectDir}/.nvmrc").text.trim();
88

9+
// Read pnpm version to use from package.json engines.pnpm entry
10+
def pnpmVer = new groovy.json.JsonSlurper().parse(new File("${projectDir}/package.json")).engines.pnpm.trim();
11+
912
// This array should contain a path to all configs that are common to most build tasks and
1013
// might affect them (i.e. if any of those files change we want to rerun most tasks)
1114
def commonConfigs = [
1215
'.env',
1316
'package.json',
14-
'package-lock.json',
17+
'pnpm-lock.yaml',
1518
'tsconfig.json',
1619
'.prettierrc.js'
1720
]
1821

1922
node {
2023
download = true
2124
version = nodeVersion
22-
npmInstallCommand = 'ci'
25+
pnpmVersion = pnpmVer
26+
}
27+
28+
task validateLockFiles {
29+
description "Validate only a pnpm-lock.yaml lock file exists"
30+
doLast {
31+
assert file("pnpm-lock.yaml").exists()
32+
assert !file("package-lock.json").exists()
33+
assert !file("yarn.lock").exists()
34+
}
2335
}
2436

25-
npm_run_build {
37+
pnpmInstall.dependsOn validateLockFiles
38+
// Make sure `pnpmInstall` always runs, since it's better at determining
39+
// whether it's needs to do anything than Gradle can
40+
pnpmInstall.outputs.upToDateWhen { false }
41+
42+
task pnpmBuild(type: PnpmTask) {
43+
dependsOn pnpmInstall
44+
45+
args = ['build']
46+
2647
inputs.files commonConfigs
2748
inputs.file '.eslintrc.js'
2849
inputs.dir 'public'
@@ -31,16 +52,16 @@ npm_run_build {
3152
outputs.dir 'build/app'
3253
}
3354

34-
task test(type: NpmTask) {
55+
task test(type: PnpmTask) {
3556
dependsOn assemble
3657

3758
args = ['run', 'test:ci']
3859
inputs.files commonConfigs
3960
inputs.dir 'src'
4061
}
4162

42-
task licenseCheck(type: NpmTask) {
43-
dependsOn npmInstall
63+
task licenseCheck(type: PnpmTask) {
64+
dependsOn pnpmInstall
4465

4566
args = ['run', 'license-check']
4667
inputs.files commonConfigs
@@ -51,8 +72,8 @@ task licenseCheck(type: NpmTask) {
5172
outputs.upToDateWhen { true }
5273
}
5374

54-
task validateLinks(type: NpmTask) {
55-
dependsOn npmInstall
75+
task validateLinks(type: PnpmTask) {
76+
dependsOn pnpmInstall
5677

5778
args = ['run', 'validate-links']
5879

@@ -61,8 +82,8 @@ task validateLinks(type: NpmTask) {
6182
outputs.upToDateWhen { false }
6283
}
6384

64-
task buildStorybook(type: NpmTask) {
65-
dependsOn npmInstall
85+
task buildStorybook(type: PnpmTask) {
86+
dependsOn pnpmInstall
6687
args = ['run', 'build:storybook']
6788

6889
inputs.files commonConfigs
@@ -78,7 +99,7 @@ task buildStorybook(type: NpmTask) {
7899
}
79100

80101
task copyBuildOutput(type: Copy) {
81-
dependsOn copyDocker, npm_run_build
102+
dependsOn copyDocker, pnpmBuild
82103

83104
from "${project.projectDir}/build/app"
84105
into 'build/docker/bin/build'

0 commit comments

Comments
 (0)