Skip to content
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

refactor(all): link internal apps to libs #147

Closed
wants to merge 1 commit into from
Closed
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
135 changes: 48 additions & 87 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,154 +13,85 @@ jobs:
executor: nodejs
resource_class: xlarge
steps:
- checkout
- restore_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "yarn.lock" }}
- run:
name: Setup Dependencies
command: yarn --cwd libs/ballot-encoder install --frozen-lockfile
- save_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "yarn.lock" }}
paths:
- node_modules
- libs/ballot-encoder/node_modules
- checkout-and-install
- run:
name: Run Linters
command: |
yarn --cwd libs/ballot-encoder lint
pnpm --dir libs/ballot-encoder lint
- run:
name: Run Front-End Test and Coverage
command: |
yarn --cwd libs/ballot-encoder test:coverage
pnpm --dir libs/ballot-encoder test:coverage

test-bas:
executor: nodejs-browsers
resource_class: xlarge
steps:
- checkout
- restore_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "apps/bas/yarn.lock" }}
- run:
name: Setup Dependencies
command: yarn --cwd apps/bas install --frozen-lockfile
- save_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "apps/bas/yarn.lock" }}
paths:
- apps/bas/node_modules
- checkout-and-install
- run:
name: Run Linters
command: |
yarn --cwd apps/bas lint
pnpm --dir apps/bas lint
- run:
name: Run Front-End Test and Coverage
command: |
yarn --cwd apps/bas test:coverage
pnpm --dir apps/bas test:coverage

test-bmd:
executor: nodejs-browsers
resource_class: xlarge
steps:
- checkout
- restore_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "yarn.lock" }}
- run:
name: Setup Dependencies
command: yarn --cwd apps/bmd install --frozen-lockfile
- save_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "yarn.lock" }}
paths:
- node_modules
- apps/bmd/node_modules
- checkout-and-install
- run:
name: Run Linters
command: |
yarn --cwd apps/bmd lint
pnpm --dir apps/bmd lint
- run:
name: Run Front-End Test and Coverage
command: |
yarn --cwd apps/bmd test:coverage
pnpm --dir apps/bmd test:coverage

test-bsd:
executor: nodejs-browsers
resource_class: xlarge
steps:
- checkout
- restore_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "apps/bsd/yarn.lock" }}
- run:
name: Setup Dependencies
command: yarn --cwd apps/bsd install --frozen-lockfile
- save_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "apps/bsd/yarn.lock" }}
paths:
- apps/bsd/node_modules
- checkout-and-install
- run:
name: Run Linters
command: |
yarn --cwd apps/bsd lint
pnpm --dir apps/bsd lint
- run:
name: Run Front-End Test and Coverage
command: |
yarn --cwd apps/bsd test:coverage
pnpm --dir apps/bsd test:coverage

test-election-manager:
executor: nodejs-browsers
resource_class: xlarge
steps:
- checkout
- restore_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "apps/election-manager/yarn.lock" }}
- run:
name: Setup Dependencies
command: yarn --cwd apps/election-manager install --frozen-lockfile
- save_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "apps/election-manager/yarn.lock" }}
paths:
- apps/election-manager/node_modules
- checkout-and-install
- run:
name: Run Linters
command: |
yarn --cwd apps/election-manager lint
pnpm --dir apps/election-manager lint
- run:
name: Run Front-End Test and Coverage
command: |
yarn --cwd apps/election-manager test:coverage
pnpm --dir apps/election-manager test:coverage

test-hmpb-interpreter:
executor: nodejs
resource_class: xlarge
steps:
- checkout
- restore_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "yarn.lock" }}
- run:
name: Setup Dependencies
command: yarn --cwd libs/hmpb-interpreter install --frozen-lockfile
- save_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "yarn.lock" }}
paths:
- node_modules
- libs/hmpb-interpreter/node_modules
- checkout-and-install
- run:
name: Run Linters
command: |
yarn --cwd libs/hmpb-interpreter lint
pnpm --dir libs/hmpb-interpreter lint
- run:
name: Run Tests with Coverage
command: |
yarn --cwd libs/hmpb-interpreter test:coverage
pnpm --dir libs/hmpb-interpreter test:coverage

test-module-scan:
executor: nodejs
Expand Down Expand Up @@ -218,3 +149,33 @@ workflows:
- test-hmpb-interpreter
- test-module-scan
- test-module-smartcards

commands:
checkout-and-install:
description: Get the code and install dependencies.
steps:
- run:
name: Install pnpm
command: |
curl -L https://unpkg.com/@pnpm/self-installer | sudo node
- checkout
- restore_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "pnpm-lock.yaml" }}
- run:
name: Setup Dependencies
command: pnpm install --frozen-lockfile
- save_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "pnpm-lock.yaml" }}
paths:
- node_modules
- apps/bas/node_modules
- apps/bmd/node_modules
- apps/bsd/node_modules
- apps/election-manager/node_modules
- libs/ballot-encoder/node_modules
- libs/eslint-plugin-no-array-sort-mutation/node_modules
- libs/hmpb-interpreter/node_modules
- libs/@types/jsfeat/node_modules
- libs/@types/node-quirc/node_modules
9 changes: 9 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Prevent packages from accessing anything they don't explicitly depend on. This
# is mostly here so that the `react-scripts` preflight check succeeds and does
# not find babel-eslint or babel-jest or any of the other packages it is afraid
# it might get the wrong version of.
hoist = false

# We _do_ try to hoist `@types` packages so that TS will not end up with type
# errors from comparing types from different versions of the same package.
public-hoist-pattern=['@types/*']
2 changes: 1 addition & 1 deletion apps/bas/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.tabSize": 2,
"eslint.packageManager": "yarn",
"eslint.packageManager": "pnpm",
"eslint.validate": [
"javascript",
"javascriptreact",
Expand Down
2 changes: 1 addition & 1 deletion apps/bas/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
FORCE:

build: FORCE
yarn install && yarn build && cd prodserver && yarn install
pnpm install && pnpm build

run:
cd prodserver && node index.js
16 changes: 8 additions & 8 deletions apps/bas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ demo url which can be found in the comments of the pull request.

## Install and Run App Locally

This assumes you have `git` and `yarn` installed.
This assumes you have `git` and `pnpm` installed.

1. Clone the repo:

Expand All @@ -20,13 +20,13 @@ This assumes you have `git` and `yarn` installed.
2. Install dependencies:

```
yarn install
pnpm install
```

3. Run the app in your local browser:

```
yarn start
pnpm start
```

## Contributing
Expand All @@ -35,11 +35,11 @@ TBD

## Local Development Scripts

- `yarn install` - Install the dependencies.
- `yarn start` - Run the app locally.
- `yarn test`- Run tests in interactive mode.
- `yarn lint` - lint and format JavaScript & TypeScript
- `yarn format` - format other files (non JavaScript & TypeScript files)
- `pnpm install` - Install the dependencies.
- `pnpm start` - Run the app locally.
- `pnpm test`- Run tests in interactive mode.
- `pnpm lint` - lint and format JavaScript & TypeScript
- `pnpm format` - format other files (non JavaScript & TypeScript files)

See `package.json` for all available scripts.

Expand Down
22 changes: 13 additions & 9 deletions apps/bas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
"version": "0.1.0",
"private": true,
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"test:coverage": "yarn test --coverage --watchAll=false",
"eject": "react-scripts eject",
"start": "script/react-scripts start",
"build": "script/react-scripts build",
"test": "script/react-scripts test",
"test:coverage": "pnpm test -- --coverage --watchAll=false",
"eject": "script/react-scripts eject",
"stylelint:run": "stylelint 'src/**/*.{js,jsx,ts,tsx}' && stylelint 'src/**/*.css' --config .stylelintrc-css.js",
"lint": "tsc --noEmit && eslint '*/**/*.{js,jsx,ts,tsx}' --quiet && yarn stylelint:run",
"stylelint:run:fix": "stylelint 'src/**/*.{js,jsx,ts,tsx}' --fix && stylelint 'src/**/*.css' --config .stylelintrc-css.js --fix",
"lint": "tsc --build && eslint '*/**/*.{js,jsx,ts,tsx}' --quiet --fix && pnpm stylelint:run",
"lint:fix": "tsc --build && eslint '*/**/*.{js,jsx,ts,tsx}' --quiet --fix && pnpm stylelint:run:fix",
"format": "prettier '**/*.+(css|graphql|json|less|md|mdx|sass|scss|yaml|yml)' --write"
},
"husky": {
Expand All @@ -20,7 +22,7 @@
"lint-staged": {
"linters": {
"*.+(js|jsx|ts|tsx)": [
"stylelint",
"stylelint --fix",
"eslint --quiet --fix",
"git add"
],
Expand Down Expand Up @@ -56,7 +58,7 @@
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/styled-components": "^4.1.14",
"http-proxy-middleware": "^0.19.1",
"http-proxy-middleware": "^1.0.0",
"normalize.css": "^8.0.1",
"pluralize": "^8.0.0",
"react": "^17.0.1",
Expand All @@ -66,14 +68,16 @@
"typescript": "^4.1.3"
},
"devDependencies": {
"@types/history": "^4.7.8",
"@typescript-eslint/eslint-plugin": "^4.11.0",
"@typescript-eslint/parser": "^4.11.0",
"eslint": "^7.17.0",
"eslint-config-prettier": "^6.15.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-no-array-sort-mutation": "../../libs/eslint-plugin-no-array-sort-mutation",
"eslint-plugin-no-array-sort-mutation": "workspace:*",
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.5",
Expand Down
3 changes: 1 addition & 2 deletions apps/bas/prodserver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"express": "^4.17.1",
"http-proxy-middleware": "^0.19.1"
"express": "^4.17.1"
}
}
Loading