Skip to content

Commit

Permalink
build(module-scan): include module-scan in the pnpm workspace
Browse files Browse the repository at this point in the history
This required pinning typescript to v4.0.5 due to microsoft/TypeScript#42350. I don't yet understand why this bug manifested with pnpm and not with yarn, but it may get fixed in TS 4.3.0 or earlier.
  • Loading branch information
eventualbuddha committed Jan 19, 2021
1 parent 353fc9d commit 7f3ab22
Show file tree
Hide file tree
Showing 8 changed files with 770 additions and 7,031 deletions.
4 changes: 2 additions & 2 deletions apps/module-scan/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ else
endif

build: FORCE
yarn install
pnpm install

run:
yarn start
pnpm start

debug-dump:
git rev-parse HEAD > REVISION
Expand Down
18 changes: 9 additions & 9 deletions apps/module-scan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This web server component provides a web interface to a scanner

```sh
# install application packages
yarn install
pnpm install

# install external tools
make install
Expand All @@ -22,14 +22,14 @@ sudo apt-get install libpng-dev libjpeg-dev libx11-dev
## Run Tests

```sh
yarn test
pnpm test
```

## Start the Server

```sh
# use a real scanner
yarn start
pnpm start
```

## Mock Scanning
Expand All @@ -38,13 +38,13 @@ You can also scan directly from image files instead of using a real scanner:

```sh
# single batch with single sheet
MOCK_SCANNER_FILES=front.png,back.png yarn start
MOCK_SCANNER_FILES=front.png,back.png pnpm start

# single batch with multiple sheets
MOCK_SCANNER_FILES=front-01.png,back-01.png,front-02.png,back-02.png yarn start
MOCK_SCANNER_FILES=front-01.png,back-01.png,front-02.png,back-02.png pnpm start

# multiple batches with one sheet each (note ",," batch separator)
MOCK_SCANNER_FILES=front-01.png,back-01.png,,front-02.png,back-02.png yarn start
MOCK_SCANNER_FILES=front-01.png,back-01.png,,front-02.png,back-02.png pnpm start

# use a manifest file
cat <<EOS > manifest
Expand All @@ -56,11 +56,11 @@ back-01.png
front-02.png
back-02.png
EOS
MOCK_SCANNER_FILES=@manifest yarn start
MOCK_SCANNER_FILES=@manifest pnpm start

# scanning from an election backup file
./bin/extract-backup /path/to/election-backup.zip
MOCK_SCANNER_FILES=@/path/to/election-backup/manifest yarn start
MOCK_SCANNER_FILES=@/path/to/election-backup/manifest pnpm start
```

## Switching Workspaces
Expand All @@ -70,7 +70,7 @@ in the root of the folder when running this service. To choose another location,
set `MODULE_SCAN_WORKSPACE` to the path to another folder:

```sh
$ MODULE_SCAN_WORKSPACE=/path/to/workspace yarn start
$ MODULE_SCAN_WORKSPACE=/path/to/workspace pnpm start
```

## API Documentation
Expand Down
2 changes: 1 addition & 1 deletion apps/module-scan/bin/render-pages
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

yarn --silent ts-node --transpile-only "${DIR}/../src/cli/render-pages" "$@"
pnpx ts-node --transpile-only "${DIR}/../src/cli/render-pages" "$@"
2 changes: 1 addition & 1 deletion apps/module-scan/bin/retry-scan
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

yarn --silent ts-node --transpile-only "${DIR}/../src/cli/retry-scan/main" "$@"
pnpx ts-node --transpile-only "${DIR}/../src/cli/retry-scan/main" "$@"
10 changes: 6 additions & 4 deletions apps/module-scan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
]
},
"dependencies": {
"@votingworks/ballot-encoder": "^5.1.2",
"@votingworks/hmpb-interpreter": "^5.2.16",
"@votingworks/ballot-encoder": "workspace:*",
"@votingworks/hmpb-interpreter": "workspace:*",
"@votingworks/qrdetect": "^1.0.1",
"base64-js": "^1.5.1",
"body-parser": "^1.19.0",
Expand All @@ -55,6 +55,7 @@
},
"devDependencies": {
"@types/base64-js": "^1.3.0",
"@types/body-parser": "^1.19.0",
"@types/busboy": "^0.2.3",
"@types/debug": "^4.1.5",
"@types/express": "^4.16.1",
Expand All @@ -74,10 +75,11 @@
"chalk": "^4.1.0",
"eslint": "^7.17.0",
"eslint-config-prettier": "^7.1.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-cypress": "^2.11.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-no-array-sort-mutation": "../../libs/eslint-plugin-no-array-sort-mutation",
"eslint-plugin-no-array-sort-mutation": "workspace:*",
"eslint-plugin-prettier": "^3.3.1",
"husky": "^4.3.7",
"jest": "^26.6.3",
Expand All @@ -87,7 +89,7 @@
"supertest": "^6.0.1",
"ts-jest": "^26.4.4",
"ts-node": "^9.1.1",
"typescript": "^4.1.3",
"typescript": "4.0.5",
"yauzl": "^2.10.0",
"zod": "^1.11.11"
},
Expand Down
Loading

0 comments on commit 7f3ab22

Please sign in to comment.