Skip to content

Commit

Permalink
ISSUE:#30 - Migrate client-admin to Webpack (#31)
Browse files Browse the repository at this point in the history
* Migrate client-admin from gulp to webpack (compdemocracy#1242)

* First-pass gulp-to-webpack conversion.

* Update webpack-cli, and create prod/dev logic.

* Messy: leave uncompressed files in dev mode build.

* Shut off compression in dev mode more elegantly.

* Get docker build working.

* Fixed bundlewatch path to find client-admin files.

* Get rid of old webpack build scripts.

* Don't minify for dev build.

* Removed dep pkgs for s3 deploy.

* Added ability to use bundle analyzer plugin.

* Removed all unneeded files.

* Fixed up eslint issue with upgraded packages.

* Fixed bundlewatch CI script.

* Keep new client-admin bundle consistently named.

* Try running e2e tests against sslip.io instead of localhost.

* Escape the domainWhitelist strings as it was done before.

* Revert "Try running e2e tests against sslip.io instead of localhost."

This reverts commit 46722d0.

* Oops. Inversed the boolean for configs.

* Trying to debug index_admin.html issue.

* Added upterm for remote debugging.

* Ensure upterm runs on failures.

* Added publicPath to make script link absolute.

* Drop the embed.html test file into new home.

* Ensuring dev mode builds and dev server use same simplifications.

* Set up all routes to point to index.html. Added mention of future proxy.

* Removed debugging step from github actions.

* Tiny fixups to clean up PR.

* Only write headerJson files during prod build.

* Migrate from dist to more build as before.

* Removed unneeded config vars.

* Cleaned up webpack dev-mode logic.

* Went back to using dist folder to fix bundle-analyzer bug.

* Updated client-admin README. Removed badges. Removed deployment references.

* Cleaned up ignorefiles.

* Mention where builds happen.

* Use build instead of dist for client-admin build output

* switch to npm run build:prod in file-server/Dockerfile

* inject compiled js in html body for client-admin

* add/update webpack versions

Co-authored-by: Christopher Small <metasoarous@gmail.com>

* Adding farsi translation (compdemocracy#1560)

* Adding farsi translation

* Update client-participation/js/strings.js

Co-authored-by: Patrick Connolly <patrick.c.connolly@gmail.com>

Co-authored-by: Colin Megill <colinmegill@gmail.com>
Co-authored-by: Patrick Connolly <patrick.c.connolly@gmail.com>

* German language editing (compdemocracy#1552)

* Bump node from 11.15.0-alpine to 18.9.0-alpine in /client-admin (compdemocracy#1523)

Bumps node from 11.15.0-alpine to 18.9.0-alpine.

---
updated-dependencies:
- dependency-name: node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump node from 11.15.0-alpine to 18.9.0-alpine in /client-report (compdemocracy#1525)

Bumps node from 11.15.0-alpine to 18.9.0-alpine.

---
updated-dependencies:
- dependency-name: node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump moment from 2.29.1 to 2.29.4 in /client-report (compdemocracy#1514)

Bumps [moment](https://github.com/moment/moment) from 2.29.1 to 2.29.4.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](moment/moment@2.29.1...2.29.4)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws from 7.4.2 to 7.5.7 in /client-admin (compdemocracy#1395)

Bumps [ws](https://github.com/websockets/ws) from 7.4.2 to 7.5.7.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](websockets/ws@7.4.2...7.5.7)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump got and nodemon in /server (compdemocracy#1539)

Removes [got](https://github.com/sindresorhus/got). It's no longer used after updating ancestor dependency [nodemon](https://github.com/remy/nodemon). These dependencies need to be updated together.


Removes `got`

Updates `nodemon` from 2.0.7 to 2.0.20
- [Release notes](https://github.com/remy/nodemon/releases)
- [Commits](remy/nodemon@v2.0.7...v2.0.20)

---
updated-dependencies:
- dependency-name: got
  dependency-type: indirect
- dependency-name: nodemon
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump y18n from 3.2.1 to 3.2.2 in /client-report (compdemocracy#932)

Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump minimist from 1.2.5 to 1.2.6 in /client-admin (compdemocracy#1384)

Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update de_de.js

Checked german language (native speaker). Corrected some inconsistencies and grammar errors.

* Update de_de.js

* Update de_de.js

* Revert "Bump node from 11.15.0-alpine to 18.9.0-alpine in /client-admin (compdemocracy#1523)"

This reverts commit 0d1242f.

* Revert "Bump node from 11.15.0-alpine to 18.9.0-alpine in /client-report (compdemocracy#1525)"

This reverts commit 54ed279.

* Revert "Bump moment from 2.29.1 to 2.29.4 in /client-report (compdemocracy#1514)"

This reverts commit 4e7dd51.

* Revert "Bump ws from 7.4.2 to 7.5.7 in /client-admin (compdemocracy#1395)"

This reverts commit 0224f8e.

* Revert "Bump got and nodemon in /server (compdemocracy#1539)"

This reverts commit 0c18e1e.

* Revert "Bump minimist from 1.2.5 to 1.2.6 in /client-admin (compdemocracy#1384)"

This reverts commit 0e8263b.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Small <metasoarous@gmail.com>

* Update CHANGELOG

* Remove boolean, DISABLE_PLANS and DISABLE_INTERCOM

* Tidied up package.json

* Remove advice on cache clear - not needed for NPM > 5

* Rebuilt package-lock for e2e to fix tests

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Patrick Connolly <patrick.c.connolly@gmail.com>
Co-authored-by: Christopher Small <metasoarous@gmail.com>
Co-authored-by: Hadjar Homaei <hadjar@gmail.com>
Co-authored-by: Colin Megill <colinmegill@gmail.com>
Co-authored-by: SvenSt-BIE <115692202+SvenSt-BIE@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
7 people authored Dec 11, 2022
1 parent 719da0d commit e6a18eb
Show file tree
Hide file tree
Showing 27 changed files with 17,083 additions and 28,174 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bugs

- [#30](https://github.com/DFE-Digital/polis-whitelabel/issues/30) Migrated client-admin from Gulp 3 to Webpack
- [#5](https://github.com/DFE-Digital/polis-whitelabel/issues/5) Restored Docker build process
- [#1](https://github.com/DFE-Digital/polis-whitelabel/issues/1) Fixed `authorUid is undefined` crash in `server`
- [#3](https://github.com/DFE-Digital/polis-whitelabel/issues/3) Fixed crash when `.headersJson` file not present for `file-server`
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
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: 4 additions & 3 deletions client-admin/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.polis_s3_creds_client.json
.tmp
build
coverage
dist
lib
node_modules
npm-debug.log
.env_dev
polis.config.js
68 changes: 24 additions & 44 deletions client-admin/README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,48 @@
# polis-client-admin
# Polis Admin Console

Polis Admin Console.
This is the front-end code for the administrators.

## Dependencies

* node `11.15.0`
* npm `7.0.15`
* node `18.12.1`
* npm `8.19.2`

## Setup

```sh
n 11.15.0
npm install -g npm@7.0
n 18.12.1
npm install
cp polis.config.template.js polis.config.js
npm run build:prod
```

## Common Problems
From here go to `file-server` and run `make` to copy the built files across.

If you having troubles with npm dependencies try run the commands below:
You can run `npm run build:dev` to get an unminified version which makes for easier in-browser debugging.

```sh
npm cache clear
npm install
```

## Building and Deploying for Production

To build static assets for a production deployment, run:
## Running Application

```sh
gulp dist
nvm use 14.14.0
npm start
```

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"}
```
## Running Tests

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

### Static, outide

- User can see home page at `/home`
- User is redirected to `/home` if not logged in
- User can sign in at `/signin`
- User can reset password at `/pwreset`
- User can `/createuser` and make a new account, login
- User can see `/privacy` policy
- User can see `/tos`
- User can see `/cookies`
- User can see `/accessibility`
```sh
# Doesn't work right now. Will need to reinstall jest.
npm test
```

### After login
## Building for Production

- User can get `/integrate` embed code for whole site
- User can see social linkage at `/account`
- User can see all of their conversations
To build static assets into `dist/` for a production deployment, run

## Icons from the Noun Project
```sh
npm run build:prod
```

* 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
Deployment is currently performed via Docker, and so no other deployment scripts are provided.
79 changes: 0 additions & 79 deletions client-admin/dev-server.js

This file was deleted.

Loading

0 comments on commit e6a18eb

Please sign in to comment.