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

Migrate client-admin from gulp to webpack #1242

Merged
merged 40 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
50c7af9
First-pass gulp-to-webpack conversion.
patcon Dec 6, 2021
3ff0b6c
Update webpack-cli, and create prod/dev logic.
patcon Dec 6, 2021
7b0dd8f
Messy: leave uncompressed files in dev mode build.
patcon Dec 6, 2021
916a24d
Shut off compression in dev mode more elegantly.
patcon Dec 6, 2021
bf25149
Get docker build working.
patcon Dec 6, 2021
bc48153
Fixed bundlewatch path to find client-admin files.
patcon Dec 6, 2021
562b9cf
Get rid of old webpack build scripts.
patcon Dec 6, 2021
5f03c3b
Don't minify for dev build.
patcon Dec 6, 2021
246f313
Removed dep pkgs for s3 deploy.
patcon Dec 6, 2021
eb02c29
Added ability to use bundle analyzer plugin.
patcon Dec 6, 2021
7e4c587
Removed all unneeded files.
patcon Dec 6, 2021
3ce8dec
Fixed up eslint issue with upgraded packages.
patcon Dec 6, 2021
c04184d
Fixed bundlewatch CI script.
patcon Dec 6, 2021
7370aef
Keep new client-admin bundle consistently named.
patcon Dec 7, 2021
46722d0
Try running e2e tests against sslip.io instead of localhost.
patcon Dec 7, 2021
a4e1052
Escape the domainWhitelist strings as it was done before.
patcon Dec 7, 2021
a413d67
Revert "Try running e2e tests against sslip.io instead of localhost."
patcon Dec 7, 2021
af5c73f
Oops. Inversed the boolean for configs.
patcon Dec 7, 2021
9b95b8d
Trying to debug index_admin.html issue.
patcon Dec 7, 2021
f16b162
Added upterm for remote debugging.
patcon Dec 7, 2021
3f3bc1d
Ensure upterm runs on failures.
patcon Dec 7, 2021
343f9f0
Added publicPath to make script link absolute.
patcon Dec 7, 2021
ace4713
Drop the embed.html test file into new home.
patcon Dec 7, 2021
c443388
Ensuring dev mode builds and dev server use same simplifications.
patcon Dec 7, 2021
bc8f68c
Set up all routes to point to index.html. Added mention of future proxy.
patcon Dec 7, 2021
0f8e9f8
Removed debugging step from github actions.
patcon Dec 7, 2021
96f1234
Tiny fixups to clean up PR.
patcon Dec 7, 2021
dd4f5fc
Only write headerJson files during prod build.
patcon Dec 7, 2021
14ee30a
Migrate from dist to more build as before.
patcon Dec 7, 2021
40168f8
Removed unneeded config vars.
patcon Dec 7, 2021
598c784
Cleaned up webpack dev-mode logic.
patcon Dec 7, 2021
15ab437
Went back to using dist folder to fix bundle-analyzer bug.
patcon Dec 7, 2021
ff79830
Updated client-admin README. Removed badges. Removed deployment refer…
patcon Dec 29, 2021
b86dea6
Cleaned up ignorefiles.
patcon Dec 29, 2021
2b03976
Mention where builds happen.
patcon Dec 29, 2021
86b7031
resolve merge conflicts with edge
metasoarous Dec 2, 2022
1421055
Use build instead of dist for client-admin build output
metasoarous Dec 2, 2022
a001045
switch to npm run build:prod in file-server/Dockerfile
metasoarous Dec 2, 2022
7065bb1
inject compiled js in html body for client-admin
metasoarous Dec 2, 2022
906d38f
add/update webpack versions
metasoarous Dec 2, 2022
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
2 changes: 1 addition & 1 deletion .bundlewatch.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
},
"files": [
{
"path": "client-admin/dist/*.js",
"path": "client-admin/dist/**/*.js",
"maxSize": "180 kB",
},
{
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/bundlewatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ jobs:
working-directory: client-admin
run: |
npm install
npm run build:webpack
cp polis.config.template.js polis.config.js
npm run build:prod
mv dist/static/js/admin_bundle.*.js dist/static/js/admin_bundle.xxxxxxxx.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is xxxxxxxx a placeholder for something else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patcon Do you remember what the intention here was? Or was this just stubbed out and not revisited?

I know that in some places we timestamp file paths for caching, so I'm not sure if this was intended to fit into that scheme, or if it's something that didn't get finished.

Thanks

Copy link
Contributor Author

@patcon patcon Sep 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, sorry to leave this hanging! I was thinking the xxxxx was permanent solution.

It was because the bundlesize tool depends on files having the same filename between runs. So this just removes to the dynamic hash. This helps compare them and offer helpful feedback about changes:

console log with link: https://github.com/compdemocracy/polis/actions/runs/3079836348/jobs/4976514743#step:9:17
Screen Shot 2022-09-30 at 4 54 40 PMlink to page

The link to the above page is only visible in CI logs when creating PRs from repo forks. But when PRs are created off branches in the upstream repo instead of forks, it gets a more clear link the the "checks" section of the PR.

tl;dr - without the xxxxx change, the bundlewatch tool can't know the change in size

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting back to us on this @patcon.

Am I correct in understanding that that this only affects the bundlewatch workflow, and not the production builds? I see the value of being able to present diffs with bundlewatch, but not at the expense of our current caching strategy.

One way or the other, we should have this documented in comments to avoid confusion in the future.

Thanks again

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no prob! but yes, this only happens in the bash line of the workflow, and nowhere else. so no effect on prod builds :)

This should be confirmed with git grep .xxxxxxxx.js and that should be the only place it happens

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK; Great. Thank you for confirming. I'd appreciate a line comment about this so future devs know why it's happening, but otherwise looks good.


- name: "Install & Build: client-participation"
working-directory: client-participation
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
echo EMAIL_TRANSPORT_TYPES=mailgun,aws-ses,nonexistent,maildev >> server/docker-dev.env

- name: Ensure embed test html is served
run: cp e2e/cypress/fixtures/html/embed.html client-admin/embed.html
run: cp e2e/cypress/fixtures/html/embed.html client-admin/public/embed.html

- name: Serve app via docker-compose
run: docker-compose up --detach
Expand Down
2 changes: 1 addition & 1 deletion client-admin/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }],
["@babel/plugin-proposal-class-properties"],
"lodash",
"@babel/plugin-transform-runtime"
]
Expand Down
24 changes: 0 additions & 24 deletions client-admin/.codeclimate.yml

This file was deleted.

6 changes: 0 additions & 6 deletions client-admin/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,9 @@ Desktop.ini
$RECYCLE.BIN/

# App specific
build
dist
coverage
node_modules
bower_components
.tmp
lib
npm-debug.log
.polis_s3_creds_client.json
.env_dev

# VCS
Expand Down
2 changes: 0 additions & 2 deletions client-admin/.eslintignore

This file was deleted.

7 changes: 0 additions & 7 deletions client-admin/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,8 @@ Desktop.ini
$RECYCLE.BIN/

# App specific
build
dist
coverage
node_modules
bower_components
.tmp
lib
npm-debug.log
.polis_s3_creds_client.json
.env_dev
polis.config.js
polis.config
3 changes: 0 additions & 3 deletions client-admin/.jshintrc

This file was deleted.

Empty file removed client-admin/.npmignore
Empty file.
1 change: 0 additions & 1 deletion client-admin/.nvmrc

This file was deleted.

6 changes: 0 additions & 6 deletions client-admin/.travis.yml

This file was deleted.

5 changes: 2 additions & 3 deletions client-admin/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Gulp v3 stops us from upgrading beyond Node v11
FROM node:11.15.0-alpine
FROM node:14.14.0-alpine

WORKDIR /app

Expand All @@ -13,4 +12,4 @@ COPY polis.config.template.js polis.config.js
COPY . .

ARG GIT_HASH
RUN npm run deploy:prod
RUN npm run build:prod
46 changes: 10 additions & 36 deletions client-admin/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
[![Build Status](https://travis-ci.org/pol-is/polisClientAdmin.svg?branch=master)](https://travis-ci.org/pol-is/polisClientAdmin) [![Code Climate](https://codeclimate.com/github/pol-is/polisClientAdmin/badges/gpa.svg)](https://codeclimate.com/github/pol-is/polisClientAdmin) [![Test Coverage](https://codeclimate.com/github/pol-is/polisClientAdmin/badges/coverage.svg)](https://codeclimate.com/github/vital-edu/sala-de-espera/coverage)

Polis Admin Console
===================
# Polis Admin Console

The below instructions are no longer officially supported; if you'd like to use them as a reference, we suggest you check out the official [Dockerfile](Dockerfile) to understand the latest build process and specific package versions.

---

Configuration
-------------
## Configuration

Install the NVM following the instructions: [NVM Installation Guide](https://github.com/creationix/nvm#install-script).

Them run the commands below to install the correct Node.JS version and the application dependencies.

```sh
nvm install 8.17.0
nvm install 14.14.0
npm install
```

Expand All @@ -28,16 +24,14 @@ npm cache clear
npm install
```

Running Application
-------------------
## Running Application

```sh
nvm use 6.2.0
nvm use 14.14.0
npm start
```

Running Tests
-------------
## Running Tests

We aspire to use the Jest Testing Framework. We welcome contributors to help us write tests!

Expand All @@ -46,32 +40,12 @@ We aspire to use the Jest Testing Framework. We welcome contributors to help us
npm test
```

Building and Deploying for Production
-------------------------------------
## Building for Production

To build static assets for a production deployment, run
To build static assets into `dist/` for a production deployment, run

```sh
gulp dist
npm run build:prod
```

As a convenience, the `npm deploy:prod` is provided for deploying to AWS S3 or via SCP to a static file server.
For S3 deployment, place your AWS credentials in a JSON file at `.polis_s3_creds_client.json` that looks like this:

```json
{"key": "XXXXXXX", "secret": "YYYYYYY"}
```

---

### Icons from the Noun Project

* Checklist by David Courey from the Noun Project
* AI by mungang kim from the Noun Project
* Science by Akriti Bhusal from the Noun Project
* Success File by Ben Davis from the Noun Project

### Collections to look into

* https://thenounproject.com/vectorsmarket/collection/project-management-line-icon/?i=1326778

Deployment is currently performed via Docker, and so no other deployment scripts are provided.
80 changes: 0 additions & 80 deletions client-admin/dev-server.js

This file was deleted.

Loading