Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
25aed59
seems to be working
crkrenn Mar 26, 2021
32e220e
fixed sk.js
crkrenn Apr 18, 2021
7cb5741
Merge pull request #12 from compdemocracy/dev
crkrenn Jul 30, 2021
bc4acda
Merge branch 'compdemocracy:dev' into dev
crkrenn Nov 16, 2021
0485ae7
merged convict into current dev
Nov 16, 2021
0373dff
Merge branch 'compdemocracy:dev' into dev
crkrenn Dec 7, 2021
619364b
disabled mailserver; everything else seems to be working
crkrenn Dec 14, 2021
d63e02c
Changed process.env to config.get in app.js
Dec 15, 2021
06ea1b0
Fix usage of config in app.js
Dec 15, 2021
71083e5
Change process.env to config.get in server.js
Dec 16, 2021
4308da5
Fix server.js
Dec 16, 2021
f69b0ee
Change process.env to config.get where possible
Dec 17, 2021
edfcdf2
Migrate from polis.config.template.js to yaml
Dec 19, 2021
df7b2a0
Remove handling of polis.config.js in dockerfile
Dec 19, 2021
7401a36
Fix in build process
Dec 19, 2021
b0b0bd3
Fix import of config in gulpfiles
Dec 19, 2021
5639cf6
Added separate yaml config file to client-*
Dec 19, 2021
a477ba1
Fix in config file path in gulpfile
Dec 19, 2021
0038801
Added node-convict to package.json
Dec 19, 2021
1cbdb96
Added convict to package-lock.json
Dec 19, 2021
cb457c9
Added js-yaml to package.json
Dec 19, 2021
ebb4a40
Bug fixes in yaml config
Dec 19, 2021
e590c29
Fixes in yaml config files
Dec 19, 2021
c1c9f0c
Updated dependencies for client-admin
Dec 19, 2021
2f30f97
Fix in yaml config for client-amdin
Dec 19, 2021
a96fac8
Updated dependencies for client-report
Dec 19, 2021
7b8cd57
Fix in package-lock.json for client-report
Dec 19, 2021
eddbeb2
Updated dependencies for client-report
Dec 19, 2021
40961ed
Add config volume to client-*
Dec 21, 2021
019cb6b
Dependency for client-* updated to config
Dec 21, 2021
c9e551c
Fix for using the env variable in gulpfile.js
Dec 21, 2021
967df84
Fix issue with mounting config volume to client-*
Dec 27, 2021
a45eceb
Merge remote-tracking branch 'origin/dev' into feature/crkrenn/convic…
Dec 29, 2021
985f975
Merge branch 'crkrenn:dev' into dev
tamas-soos-toptal Dec 29, 2021
46bf4d9
Merge remote-tracking branch 'origin/dev' into feature/crkrenn/convic…
Dec 29, 2021
b62a30d
Resolved issue with build failure
Jan 4, 2022
3b05ed6
Merge pull request #18 from tamas-soos-toptal/feature/crkrenn/convict…
crkrenn Jan 12, 2022
5c170a9
remove readme-convict.md
crkrenn Jan 12, 2022
8899125
removed reference to polis.config.template.js
crkrenn Jan 13, 2022
46e976a
Update bundlewatch.yml
crkrenn Jan 16, 2022
7d3059d
reenabled maildev container
Jan 16, 2022
c32f201
Merge branch 'feature/convict-with-config-volume' of github.com:crkre…
Jan 16, 2022
f249ce9
Update README.md
crkrenn Jan 18, 2022
b3db99e
Use the image:tag format directly in the COPY
Jan 20, 2022
5e28de8
added manual dispatch
crkrenn Jan 26, 2022
7e6122f
added more workflow_dispatch options
crkrenn Jan 26, 2022
bbb33fe
added build:webpack to client-participation/package.json
crkrenn Jan 26, 2022
f872bd3
added npm run clean
crkrenn Jan 26, 2022
ab5c2e3
reverted back to develop build for client-participation
crkrenn Jan 26, 2022
3ae9c5e
reverted back to webpack bundlewatch build for client-participation
crkrenn Jan 26, 2022
ac32467
updating client-participation webpack
crkrenn Jan 26, 2022
6351125
merged features from client-admin webpack
Jan 26, 2022
6f8293d
added compression and lodash module plugins
Jan 26, 2022
8ea1524
Updated .bundlewatch.config.js
Jan 26, 2022
dbe34e3
Changed package-lock.json
Jan 27, 2022
4042392
removed headless cypress option
Jan 28, 2022
88fcb65
added python notebook and script to analyze env variables
Jan 29, 2022
72449e7
changed schema port to undefined. other small changes
Feb 1, 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
6 changes: 1 addition & 5 deletions .bundlewatch.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ module.exports = {
"maxSize": "180 kB",
},
{
"path": "client-participation/dist/cached/*/js/polis.js",
"maxSize": "150 kB",
},
{
"path": "client-participation/dist/cached/*/js/vis_bundle.js",
"path": "client-participation/dist/*.js",
Copy link
Member

Choose a reason for hiding this comment

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

to revert

"maxSize": "200 kB",
},
]
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/bundlewatch.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Bundlewatch Github Action"

on:
workflow_dispatch:
Copy link
Member

Choose a reason for hiding this comment

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

revert before merge upstream?

push:
# Required so that baseline for comparison is pushed to bundlewatch service.
branches: ["dev"]
Expand Down Expand Up @@ -53,10 +54,15 @@ jobs:
working-directory: client-participation
run: |
npm install
cp polis.config.template.js polis.config.js
npm run deploy:prod
# So directory stays consistent between builds for comparison.
mv dist/cached/* dist/cached/xxxxxxxxx
npm run build:webpack

# - name: "Install & Build: client-participation"
# working-directory: client-participation
# run: |
# npm install
# npm run deploy:prod
# # So directory stays consistent between builds for comparison.
# mv dist/cached/* dist/cached/xxxxxxxxx

- name: Install Bundlewatch
run: npm install -g [email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: E2E Tests

on:
workflow_dispatch:
push:
branches:
- dev
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/depcheck.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: DepCheck
on:
workflow_dispatch:
pull_request:
types: ["opened", "reopened", "synchronize"]
paths:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-preprod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
on:
workflow_dispatch:
push:
branches:
- dev
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Lint

on:
workflow_dispatch:
pull_request:
types: ["opened", "reopened", "synchronize"]

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: Docker image builds

on:
workflow_dispatch:
push:
branches:
- main
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-clojure.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Test Math

on:
workflow_dispatch:
push:
branches: ["dev", "504-clj-tests"]
# Note: Only configured for client-admin right now.
Expand Down
5 changes: 3 additions & 2 deletions client-admin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ RUN apk add git --no-cache
COPY package*.json ./
RUN npm install

COPY polis.config.template.js polis.config.js
# If polis.config.js exists on host, will override template here.
COPY --from=polis_config /config/config.js /app/config/
COPY --from=polis_config /config/*.yaml /app/config/

COPY . .

ARG GIT_HASH
Expand Down
13 changes: 7 additions & 6 deletions client-admin/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ var request = require("request");
var app = express();
var compiler = webpack(config);

var polisConfig = require("./polis.config");
let POLIS_ROOT = process.env.POLIS_ROOT
var config = require(POLIS_ROOT + 'config/config.js');

app.use(
require("webpack-dev-middleware")(compiler, {
Expand All @@ -20,7 +21,7 @@ app.use(
})
);

const serviceUrl = polisConfig.SERVICE_URL ? polisConfig.SERVICE_URL : "https://pol.is";
const serviceUrl = config.get('service_url') ? config.get('service_url') : "https://pol.is";
console.log("SERVICE_URL:", serviceUrl);

function proxy(req, res) {
Expand Down Expand Up @@ -58,10 +59,10 @@ app.get(/^\/embed\/?$/, function (req, res) {
app.get("*", function (req, res) {
var html = fs.readFileSync(path.join(__dirname, "index.html"), { encoding: "utf8" });

html = html.replace("<%= fbAppId %>", polisConfig.FB_APP_ID);
html = html.replace("<%= useIntercom %>", !isTrue(polisConfig.DISABLE_INTERCOM));
html = html.replace("<%= usePlans %>", !isTrue(polisConfig.DISABLE_PLANS));
var domainWhitelist = '["' + polisConfig.domainWhitelist.join('","') + '"]';
html = html.replace("<%= fbAppId %>", config.get('fb_app_id'));
html = html.replace("<%= useIntercom %>", !isTrue(config.get('disable_intercom')));
html = html.replace("<%= usePlans %>", !isTrue(config.get('disable_plans')));
var domainWhitelist = '["' + config.get('domainWhitelist').join('","') + '"]';
html = html.replace("<%= domainWhitelist %>", domainWhitelist);

res.set({
Expand Down
39 changes: 20 additions & 19 deletions client-admin/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ var rimraf = require("rimraf");
var runSequence = require("run-sequence");
var scp = require("gulp-scp2");

var polisConfig = require("./polis.config");
let POLIS_ROOT = process.env.POLIS_ROOT
var config = require(POLIS_ROOT + 'config/config.js');

console.log("Uploader: " + polisConfig.UPLOADER);
console.log("Uploader: " + config.get('uploader'));

const staticFilesPrefix = "cached";
const baseDistRoot = "dist";
Expand Down Expand Up @@ -78,11 +79,11 @@ gulp.task("index", [], function () {
);
html = html.replace("NULL_VERSION", versionString);

html = html.replace("<%= fbAppId %>", polisConfig.FB_APP_ID);
html = html.replace("<%= useIntercom %>", !isTrue(polisConfig.DISABLE_INTERCOM));
html = html.replace("<%= usePlans %>", !isTrue(polisConfig.DISABLE_PLANS));
html = html.replace("<%= fbAppId %>", config.get('fb_app_id'));
html = html.replace("<%= useIntercom %>", !isTrue(config.get('disable_intercom')));
html = html.replace("<%= usePlans %>", !isTrue(config.get('disable_plans')));

var domainWhitelist = '["' + polisConfig.domainWhitelist.join('","') + '"]';
var domainWhitelist = '["' + config.get('domainWhitelist').join('","') + '"]';
html = html.replace("<%= domainWhitelist %>", domainWhitelist);

// index goes to the root of the dist folder.
Expand Down Expand Up @@ -129,8 +130,8 @@ gulp.task("404", [], function () {
gulp.task("preprodConfig", function () {
preprodMode = true;
minified = true;
scpSubdir = polisConfig.SCP_SUBDIR_PREPROD;
s3Subdir = polisConfig.S3_BUCKET_PREPROD;
scpSubdir = config.get('scp_subdir_preprod');
s3Subdir = config.get('s3_bucket_preprod');
});

gulp.task("unminifiedConfig", function () {
Expand All @@ -140,8 +141,8 @@ gulp.task("unminifiedConfig", function () {
gulp.task("prodConfig", function () {
prodMode = true;
minified = true;
scpSubdir = polisConfig.SCP_SUBDIR_PROD;
s3Subdir = polisConfig.S3_BUCKET_PROD;
scpSubdir = config.get('scp_subdir_prod');
s3Subdir = config.get('s3_bucket_prod');
});

gulp.task("configureForProduction", function (callback) {
Expand Down Expand Up @@ -220,12 +221,12 @@ gulp.task("dist", ["configureForProduction"], function (callback) {

gulp.task("deploy_TO_PRODUCTION", ["prodConfig", "dist"], function () {
var uploader;
if ("s3" === polisConfig.UPLOADER) {
if ("s3" === config.get('uploader')) {
uploader = s3uploader({
bucket: s3Subdir,
});
}
if ("scp" === polisConfig.UPLOADER) {
if ("scp" === config.get('uploader')) {
uploader = scpUploader({
// subdir: "cached",
watch: function (client) {
Expand All @@ -235,7 +236,7 @@ gulp.task("deploy_TO_PRODUCTION", ["prodConfig", "dist"], function () {
},
});
}
if ('local' === polisConfig.UPLOADER) {
if ('local' === config.get('uploader')) {
uploader = localUploader
uploader.needsHeadersJson = true
}
Expand All @@ -244,12 +245,12 @@ gulp.task("deploy_TO_PRODUCTION", ["prodConfig", "dist"], function () {

function doUpload() {
var uploader;
if ("s3" === polisConfig.UPLOADER) {
if ("s3" === config.get('uploader')) {
uploader = s3uploader({
bucket: s3Subdir,
});
}
if ("scp" === polisConfig.UPLOADER) {
if ("scp" === config.get('uploader')) {
uploader = scpUploader({
// subdir: "cached",
watch: function (client) {
Expand All @@ -259,7 +260,7 @@ function doUpload() {
},
});
}
if ('local' === polisConfig.UPLOADER) {
if ('local' === config.get('uploader')) {
uploader = localUploader
uploader.needsHeadersJson = true
}
Expand All @@ -272,19 +273,19 @@ gulp.task("deployPreprodUnminified", ["preprodConfig", "unminifiedConfig", "dist

gulp.task("fontsPreprod", ["preprodConfig"], function () {
return deployFonts({
bucket: polisConfig.S3_BUCKET_PREPROD,
bucket: config.get('s3_bucket_preprod'),
});
});

gulp.task("fontsProd", ["prodConfig"], function () {
return deployFonts({
bucket: polisConfig.S3_BUCKET_PROD,
bucket: config.get('s3_bucket_prod'),
});
});

function localUploader(params) {
params.subdir = params.subdir || ''
return gulp.dest(path.join(polisConfig.LOCAL_OUTPUT_PATH, params.subdir))
return gulp.dest(path.join(config.get('local_output_path'), params.subdir))
}

function s3uploader(params) {
Expand Down
51 changes: 40 additions & 11 deletions client-admin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion client-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build:webpack_unminified": "npm run clean && NODE_ENV=development webpack --config webpack.config.unminified.js",
"build": "npm run build:webpack",
"build-debug": "npm run build:webpack_unminified",
"deploy:prod": "node gulpfile.js deploy_TO_PRODUCTION",
"convict": "6.0.0",
"deploy:prod": "POLIS_ROOT=/app/ node gulpfile.js deploy_TO_PRODUCTION",
"deploy:preprod": "node gulpfile.js deployPreprod",
"start": "./x",
"lint": "eslint src",
Expand Down Expand Up @@ -58,8 +59,10 @@
},
"dependencies": {
"boolean": "^3.0.2",
"convict": "6.0.0",
"d3-scale": "^3.2.3",
"jquery": "^2.1.4",
"js-yaml": "3.14.0",
"lodash": "^4.17.21",
"prop-types": "^15.7.2",
"react": "^16.14.0",
Expand Down
Loading