Skip to content

Commit

Permalink
Revert "feat: create an nx monorepo (#196)"
Browse files Browse the repository at this point in the history
This reverts commit a3c05cd.
  • Loading branch information
danadajian committed Jun 6, 2023
1 parent 6a373e9 commit 425205e
Show file tree
Hide file tree
Showing 68 changed files with 37,235 additions and 13,517 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
.github
action
app/frontend/cypress
app/frontend/cypress.config.ts
comparadise-utils
cypress
dist
node_modules
*.md
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
comparadise-utils/types/
13 changes: 6 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
version: 2
updates:
# TODO: enable once dependabot supports pnpm
# - package-ecosystem: 'pnpm'
# directory: '/'
# schedule:
# interval: 'weekly'
# reviewers:
# - '@ExpediaGroup/comparadise-committers'
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
reviewers:
- '@ExpediaGroup/comparadise-committers'
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,30 @@ jobs:

publish-comparadise-utils:
runs-on: ubuntu-latest
defaults:
run:
working-directory: comparadise-utils
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Install
run: pnpm --filter comparadise-utils install
run: npm ci

- name: Set Version Environment Variable
run: |
VERSION_TAG=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
echo NEW_VERSION="${VERSION_TAG:1}" >> $GITHUB_ENV
- name: Build
run: npm run build

- name: Publish
run: |
echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} >> .npmrc
pnpm --filter comparadise-utils bump-version
pnpm --filter comparadise-utils publish --no-git-checks
npm config set _authToken=${{ secrets.NPM_TOKEN }}
VERSION_TAG=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
npm version "${VERSION_TAG:1}"
npm publish
publish-tags:
runs-on: ubuntu-latest
Expand Down
118 changes: 108 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,48 @@ on:
- main

concurrency:
group: ${{ github.workflow }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: All Tests
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}

- uses: nrwl/nx-set-shas@v3
- name: Validate package.json
uses: ExpediaGroup/package-json-validator@v1
with:
rules: ranges
dependency-types: |
dependencies
devDependencies
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Install
run: pnpm install
run: npm ci

- name: Test
run: pnpm nx affected --target=test
- name: Type Check
run: tsc

- name: Lint
run: npm run lint

- name: Format
run: npm run format

- name: Package
run: npm run package

- name: Check for any generated code that should be committed
run: |
Expand All @@ -45,3 +61,85 @@ jobs:
git push
exit 1
fi
backend:
name: Backend Tests
needs:
- lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Install
run: npm ci

- name: Test
run: npm run test:backend

frontend:
name: Frontend Tests
needs:
- lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Install and Test
uses: cypress-io/github-action@v5
with:
component: true

integration:
name: Integration Tests
needs:
- lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Install
run: npm ci

- name: Run Cypress Tests Against Docker Container
run: npm run test:integration

utils:
name: Utils Tests
needs:
- lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: comparadise-utils
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Install Dependencies
run: npm ci

- name: Build
run: npm run build
4 changes: 1 addition & 3 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
enable-pre-post-scripts=true
registry=https://registry.npmjs.org
use-node-version=18.16.0
registry = https://registry.npmjs.org
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.5.0
7 changes: 3 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
action/
app/
comparadise-utils/
shared/
dist/
utils/types/
node_modules/
19 changes: 15 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# Local App Development
# Local Development

1. Install `pnpm`
2. Run `pnpm install`
1. Run `nvm use`
2. Run `npm install`
3. Login to the AWS account containing the visual regression S3 bucket
4. Run `nx local app`
4. Run `npm run dev`
5. Application will be running at `http://localhost:5173`, and it will hot reload when you make changes.

You can also run the app using docker-compose using `npm run build:docker`!

Make sure you have a `secrets.json` file in the root of the project in order to test using application secrets.
This file should have the following format:

```json
{
"github_token": "MY_TOKEN"
}
```
15 changes: 6 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
FROM node:18.16.0-slim
FROM node:18-slim

WORKDIR /app

RUN apt-get update && apt-get -qq -y install curl
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm

RUN useradd -ms /bin/sh admin
RUN chown -R admin .
COPY --chown=admin . .
USER admin

RUN pnpm install --prod --ignore-scripts
RUN pnpm nx build frontend

ENV PORT 8080
CMD [ "pnpm", "nx", "start", "app" ]

RUN npm ci
RUN npm run build

CMD [ "npm", "run", "start:backend" ]
1 change: 0 additions & 1 deletion action/.prettierignore

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 425205e

Please sign in to comment.