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

build(all): switch from yarn to pnpm #146

Merged
merged 9 commits into from
Jan 20, 2021
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
156 changes: 55 additions & 101 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,179 +13,99 @@ 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
resource_class: xlarge
steps:
- checkout
- restore_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "apps/module-scan/yarn.lock" }}
- run:
name: Setup Dependencies
command: yarn --cwd apps/module-scan install --frozen-lockfile
- save_cache:
key:
dotcache-cache-{{checksum ".circleci/config.yml" }}-{{ checksum "apps/module-scan/yarn.lock" }}
paths:
- apps/module-scan/node_modules
- checkout-and-install
- run:
name: Run Linters
command: |
yarn --cwd apps/module-scan lint
pnpm --dir apps/module-scan lint
- run:
name: Run Tests with Coverage
command: |
yarn --cwd apps/module-scan test:coverage
pnpm --dir apps/module-scan test:coverage

test-module-smartcards:
docker:
Expand Down Expand Up @@ -218,3 +138,37 @@ 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
# Edit this comment somehow in order to invalidate the CircleCI cache.
# Since the contents of this file affect the cache key, editing only a
# comment will invalidate the cache without changing the behavior.
- 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
- apps/module-scan/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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
*.tsbuildinfo
*.tsbuildinfo
.eslintcache
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/*']
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# vxsuite

The VotingWorks in-person voting system.

## About

Includes software for a [ballot-marking device (BMD)](./apps/bmd), a
[ballot activation system (BAS)](./apps/bas), a
[ballot scanning device (BSD)](./apps/bsd), and an
[election manager](./apps/election-manager). See https://voting.works for more
information about VotingWorks.

## Development

Building VxSuite for development requires git, [NodeJS](https://nodejs.org/)
v12.19.0 and [pnpm](https://pnpm.js.org).

### Ubuntu Quickstart

This expects Ubuntu 18.0.4, though it may work on other versions. This installs
the right version of NodeJS manually. You can use a tool like
[nvm](https://github.com/nvm-sh/nvm) or [volta](https://volta.sh) to do this in
a nicer way.

```sh
# change this to wherever you want:
NODE_ROOT="${HOME}/usr/local/nodejs"

# download and install:
mkdir -p "$NODE_ROOT"
curl -sLo- https://nodejs.org/dist/v12.19.0/node-v12.19.0-linux-x64.tar.gz | \
tar xz --strip-components 1 -C "${NODE_ROOT}"

# configure your shell; this assumes bash:
echo "export PATH=\$PATH:${NODE_ROOT}/bin" >> ~/.bashrc
export PATH="${PATH}:${NODE_ROOT}"
node -v # should print "v12.19.0"

# install pnpm:
npm i -g pnpm

# clone the repository:
sudo apt install git -y # in case you don't have git
mkdir -p ~/src && cd ~/src
git clone https://github.com/votingworks/vxsuite.git

# install dependencies:
cd vxsuite
pnpm install

# try out BMD:
cd apps/bmd
pnpm start
# if it worked, go to http://localhost:3000/
```

See the individual README documents for more information on how to run the individual services.

## License

GPLv3
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
Loading