Skip to content

B 22727 #15

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

Open
wants to merge 90 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
980093d
Bump @babel/traverse from 7.10.3 to 7.24.5
dependabot[bot] May 7, 2024
a688f3f
Merge pull request #1 from transcom/dependabot/npm_and_yarn/babel/tra…
deandreJones May 7, 2024
85abde8
update pdf-js
deandreJones May 7, 2024
0c13864
Merge branch 'main' of github.com:transcom/react-file-viewer
deandreJones May 7, 2024
30e29d4
name upated
deandreJones May 7, 2024
7a63bc6
update
deandreJones May 7, 2024
fc85a68
Create webpack.yml
deandreJones May 7, 2024
74065dc
fix vulnerabilities
deandreJones May 7, 2024
2a443ae
bump version
deandreJones May 7, 2024
3f997a4
add nodejs 18.20.2 to tool versions
cameroncaci May 29, 2024
a444535
remove deprecated node-sass and replace with dart sass
cameroncaci May 29, 2024
1a87112
update webpack cli
cameroncaci May 29, 2024
fe6443f
set build to legacy openssl and add production mode to webpack
cameroncaci May 29, 2024
1758c5a
conditionally set open ssl legacy
cameroncaci May 29, 2024
096a926
adjust pdfjs for latest version
cameroncaci May 29, 2024
6bc5588
added topLevelAwait to webpack config
cameroncaci May 29, 2024
00b3ab7
set analyzer to static for prod webpack plugin config
cameroncaci May 29, 2024
dd2257a
analyzermode disabled
cameroncaci May 29, 2024
31753b8
wrap in quotes
cameroncaci May 29, 2024
90f2563
bump version
cameroncaci May 29, 2024
3f7d791
update build script
cameroncaci May 30, 2024
3075ee1
Merge pull request #3 from transcom/I-12947-Node-Canvas
cameroncaci May 30, 2024
488bba3
add nodejs 18.20.2 to tool versions
cameroncaci May 29, 2024
1c3f343
implemented isEvalSupported workaround
cameroncaci May 31, 2024
1a2e4df
bump version
cameroncaci May 31, 2024
5d29b3b
Merge remote-tracking branch 'origin/main' into I-12947-Workaround
cameroncaci May 31, 2024
b5c8195
revert pdfjs-dist update
cameroncaci May 31, 2024
a24219f
Revert "Merge pull request #3 from transcom/I-12947-Node-Canvas"
cameroncaci May 31, 2024
549f5d9
Reapply "Merge pull request #3 from transcom/I-12947-Node-Canvas"
cameroncaci May 31, 2024
4cdeedc
updated webpack versions to satisfy build
cameroncaci May 31, 2024
8538258
typo fix
cameroncaci May 31, 2024
10017b3
Merge pull request #4 from transcom/I-12947-Workaround
cameroncaci May 31, 2024
630aa4d
made modifications to file viewer in support of new functionality req…
WeatherfordAaron Aug 15, 2024
9e9cfec
removing publicPath because it's causing issues
WeatherfordAaron Aug 20, 2024
1682d58
Update webpack.config.dev.js
WeatherfordAaron Aug 20, 2024
a2f8318
Update webpack.config.dev.js
WeatherfordAaron Aug 20, 2024
b7e17a7
reverting some unneeded changes
WeatherfordAaron Aug 20, 2024
bf0d18b
added null check
WeatherfordAaron Aug 20, 2024
9805d88
corrected operator
WeatherfordAaron Aug 20, 2024
8079569
corrected unneeded call
WeatherfordAaron Aug 20, 2024
18af219
bumped the ver number up 1
WeatherfordAaron Aug 20, 2024
b655051
had to revert back to 1.2.2 to see if that makes it so we can test
WeatherfordAaron Aug 20, 2024
005ecb9
Revert "corrected unneeded call"
WeatherfordAaron Aug 20, 2024
c1b0199
Revert "had to revert back to 1.2.2 to see if that makes it so we can…
WeatherfordAaron Aug 20, 2024
19be643
Merge pull request #5 from transcom/B20440-amw-zoom-rotate-capability…
taeJungCaci Aug 20, 2024
aaabb2f
performed a yarn build command
WeatherfordAaron Aug 21, 2024
dd27ed8
Merge pull request #6 from transcom/react-file-viewer-build-for-1.2.3
cameroncaci Aug 22, 2024
4752638
revision
WeatherfordAaron Aug 22, 2024
2680088
Merge branch 'main' into B20440-amw-zoom-rotate-capability-for-images…
WeatherfordAaron Aug 23, 2024
82fe4eb
Merge pull request #7 from transcom/B20440-amw-zoom-rotate-capability…
cameroncaci Aug 23, 2024
f61b907
updated to correct version as referenced elsewhere and added publicPa…
WeatherfordAaron Aug 26, 2024
cc7fc44
Merge branch 'main' into correct-publicPath-issues-in-production
WeatherfordAaron Aug 26, 2024
d4396dc
Merge pull request #8 from transcom/correct-publicPath-issues-in-prod…
taeJungCaci Aug 26, 2024
0949c1c
B-21049 use provided onError
stevengleason-caci Oct 9, 2024
9632cc3
upgrade pdfjs-dist
cameroncaci Oct 14, 2024
5eafc6d
prep production webpack bundle
cameroncaci Oct 14, 2024
d48ac1d
remove tmp debug use of devserver public webpack
cameroncaci Oct 14, 2024
7c288ca
fix threelib lint
cameroncaci Oct 14, 2024
c70ec21
pdf driver playwright test
cameroncaci Oct 14, 2024
76dfc65
redundant line
cameroncaci Oct 14, 2024
9bbc20e
Delete leftover
cameroncaci Oct 15, 2024
653c811
adjust node versions in webpack
cameroncaci Oct 15, 2024
3c6bd77
add babel dev dependency
cameroncaci Oct 15, 2024
4073f7c
add legacy provider
cameroncaci Oct 15, 2024
e721799
bump version
cameroncaci Oct 15, 2024
671fc15
B-21049 catch errors in pdf-viewer,
stevengleason-caci Oct 15, 2024
50c130c
B-21049 if onError isn't provided then throw
stevengleason-caci Oct 15, 2024
249ce5a
Merge pull request #9 from transcom/b-21228-update-pdfjs
cameroncaci Oct 16, 2024
fcf8556
B-21049 unit tests for pdf-viewer onError.
stevengleason-caci Oct 21, 2024
ba5b95d
Merge remote-tracking branch 'origin/main' into B-21049
stevengleason-caci Oct 22, 2024
3713399
B-21049 build dist/index.js,
stevengleason-caci Oct 22, 2024
4d9924a
B-21049 bump version to 1.2.5
stevengleason-caci Oct 23, 2024
a978de8
Merge branch 'B-21049-v1.2.5' into B-21049
stevengleason-caci Oct 23, 2024
92c0ce7
B-21049 increment to 1.4.0,
stevengleason-caci Oct 28, 2024
91e50f1
Merge pull request #11 from transcom/B-21049
cameroncaci Oct 28, 2024
cabdfaa
rebuild dist
cameroncaci Nov 11, 2024
d7a069a
webpack chunk adjustments
cameroncaci Nov 11, 2024
0db75e6
enhanced web worker and output support for milmove
cameroncaci Nov 13, 2024
f362821
updated docs
cameroncaci Nov 15, 2024
6d3ffcd
pdf worker enhancement, fixing canvas issues, adding rotation support…
cameroncaci Nov 15, 2024
c711659
docs update
cameroncaci Nov 15, 2024
f5c510c
downgrade node and adjust peer dependencies
cameroncaci Nov 18, 2024
86bd85c
adjust react and react dom
cameroncaci Nov 18, 2024
5e346bc
github action node support
cameroncaci Nov 18, 2024
161ef46
react and enzyme enhancements
cameroncaci Nov 18, 2024
e9641e3
revert 161ef46e3ce9f0e39919b58519e98474d67422cc 5e346bcf2bb6834ad81e8…
cameroncaci Nov 18, 2024
ac31f65
version bump
cameroncaci Nov 20, 2024
7c3da43
Merge pull request #12 from transcom/b-21230-resolve-dependencies
cameroncaci Nov 20, 2024
e42e61d
Updating xlsx to 0.20.3
CoryKleinjanCACI Apr 9, 2025
abcd028
updating version to 1.4.2
CoryKleinjanCACI Apr 9, 2025
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
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
"version": "detect"
},
"import/resolver": {
"webpack": "webpack.config.js"
"webpack": "webpack.config.js",
"node": {
"extensions": [".js", ".jsx"]
}
}
},
"extends": [
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/webpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: NodeJS with Webpack

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Build
run: |
if [ "${{ matrix.node-version }}" == "20.x" ]; then
export NODE_OPTIONS=--openssl-legacy-provider
fi
npm install
npx webpack
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.15.0
18.20.2
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.17.0
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Table of contents
- [Table of contents](#table-of-contents)
- [react-file-viewer](#react-file-viewer)
- [Supported file formats:](#supported-file-formats)
- [Usage](#usage)
- [Development](#development)
- [To start demo app](#to-start-demo-app)
- [Testing](#testing)
- [To run the linter](#to-run-the-linter)
- [Extending the file viewer](#extending-the-file-viewer)
- [Viewing local changes in a secondary repo](#viewing-local-changes-in-a-secondary-repo)
- [Testing locally against the mymove application](#testing-locally-against-the-mymove-application)
- [Roadmap](#roadmap)


# react-file-viewer

Extendable file viewer for web
Expand Down Expand Up @@ -72,11 +87,11 @@ purposes. It is by default served via webpack-dev-server.

### To start demo app

`yarn start` will start the demo app served by webpack-dev-server
`yarn serve:dev` will start the webpack analyzer and serve `app.js` for debugging and playwright.

### Testing

Tests use Jest and Enzyme.
Tests use Jest, Enzyme, and Playwright.

Run tests with:

Expand All @@ -95,6 +110,13 @@ To do this run:
yarn jest --updateSnapshot
```

```
yarn test:e2e
```

This runs the playwright tests for the drivers. As certain drivers now rely on modern web API, playwright must be used to
simulate a real browser environment as this is still experimental within Jest's JSDOM.

### To run the linter

`yarn lint`
Expand Down Expand Up @@ -131,6 +153,22 @@ If you are working on a feature branch and need to see changes introduced in tha

`"@trussworks/react-file-viewer": "git+https://github.com/trussworks react-file-viewer"`

### Testing locally against the mymove application
Testing locally against the mymove application can be done via yarn link, but for the purpose of being thorough it is recommended to manually test against the `/dist/` output. This verifies the webpack is successfully compiling/transpiling and that the mymove application is successfully serving chunks.

TODO: ENHANCE ME (This is supposed to work, but it doesn't. Fallback is still `rm -rf node_modules && yarn install && ./scripts/copy-react-file-viewer && make client_run`)
1. [OPTIONAL] Within this repository, navigate to `webpack.config.js`. This is the production webpack.
1. Find where ` plugins: [new BundleAnalyzerPlugin({ analyzerMode: 'disabled' })]` is located and remove/enable the analyzerMode attribute
2. This makes it so you can preview the chunks
2. Within this repository, run `yarn build`, it should output new files to `/dist/`
3. Within the [MyMove repository](https://github.com/transcom/mymove) update `package.json` and set `"@transcom/react-file-viewer"` to point to the local location of this repository: Such as `"file:../react-file-viewer"`
4. Within MyMove, run `yarn upgrade @transcom/react-file-viewer`
5. Within MyMove, run `./scripts/copy-react-file-viewer`

You should now successfully be testing the webpack build of react-file-viewer against MyMove. Each time you adjust react-file-viewer, repeat steps 2, 4, and 5 to reflect within MyMove.

The benefit of working this way over yarn link is that we can properly simulate MyMove serving the chunks from its `./scripts/copy-react-file-viewer`.

## Roadmap

- [ ] Remove ignored linting rules and fix them
Expand Down
5 changes: 5 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ module.exports = {
'@babel/preset-react',
],
plugins: [
'@babel/plugin-transform-runtime',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-syntax-import-meta',
'@babel/plugin-transform-class-static-block',
'@babel/plugin-transform-modules-commonjs',
],
}
1 change: 1 addition & 0 deletions dist/13.chunk.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/13.index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/28c58d40210ac28e2a3e.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions dist/840.index.js

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions dist/840.index.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* @licstart The following is the entire license notice for the
* JavaScript code in this page
*
* Copyright 2024 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* JavaScript code in this page
*/
18 changes: 18 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Html Webpack Plugin:
<pre>
Error: The loader "/Users/cameron.jewell_cn/Projects/react-file-viewer/node_modules/html-webpack-plugin/lib/loader.js!/Users/cameron.jewell_cn/Projects/react-file-viewer/node_modules/html-webpack-plugin/default_index.ejs" didn't return html.

- index.js:323 HtmlWebpackPlugin.evaluateCompilationResult
[react-file-viewer]/[html-webpack-plugin]/index.js:323:24

- index.js:230
[react-file-viewer]/[html-webpack-plugin]/index.js:230:22

- task_queues:95 process.processTicksAndRejections
node:internal/process/task_queues:95:5

- async Promise.all

- async Promise.all

</pre>
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license
* Copyright 2010-2022 Three.js Authors
* Copyright 2010-2024 Three.js Authors
* SPDX-License-Identifier: MIT
*/
2 changes: 2 additions & 0 deletions dist/pdfjs-dist-webpack.chunk.js

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions dist/pdfjs-dist-webpack.chunk.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* @licstart The following is the entire license notice for the
* JavaScript code in this page
*
* Copyright 2024 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* JavaScript code in this page
*/
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<meta charset="utf-8">
</head>
<body style="height: 100%">
<!--
I do not understand why this script fixes things, but it does and so here we are
Don't delete this script tag or things will break - see https://stackoverflow.com/a/46887516
-->
<script>var exports = {};</script>
<div id="app" style="height: 100%"></div>
</body>
</html>
Loading