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

chore: sync ladsh changes #392

Merged
merged 2 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Next Next commit
chore: sync ladsh changes
  • Loading branch information
shaunwarman committed May 11, 2020
commit 08fb017f5ee807cdbdcb27115b9fcb102c326454
1 change: 1 addition & 0 deletions template/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[
"@babel/env", {
"debug": true,
"useBuiltIns": "usage",
"targets": {
"browsers": "extends @ladjs/browserslist-config"
}
Expand Down
1 change: 0 additions & 1 deletion template/.env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ CODECOV_TOKEN=
AWS_PROFILE=
AWS_S3_BUCKET=
AWS_CLOUDFRONT_DOMAIN=
AWS_CLOUDFRONT_DISTRIBUTION_ID=

#############
## mongodb ##
Expand Down
1 change: 0 additions & 1 deletion template/.env.schema
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ CODECOV_TOKEN=
AWS_PROFILE=
AWS_S3_BUCKET=
AWS_CLOUDFRONT_DOMAIN=
AWS_CLOUDFRONT_DISTRIBUTION_ID=

#############
## mongodb ##
Expand Down
7 changes: 1 addition & 6 deletions template/app/controllers/web/otp/recovery.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
const config = require('../../../../config');

async function recovery(ctx) {
let redirectTo = `/${ctx.locale}/otp/recovery/verify`;
if (ctx.session && ctx.session.returnTo) {
redirectTo = ctx.session.returnTo;
delete ctx.session.returnTo;
}
const redirectTo = `/${ctx.locale}/otp/recovery/verify`;

ctx.state.redirectTo = redirectTo;

Expand All @@ -29,7 +25,6 @@ async function recovery(ctx) {
return;
}

redirectTo = `/${ctx.locale}/otp/recovery/verify`;
if (ctx.accepts('html')) {
ctx.redirect(redirectTo);
} else {
Expand Down
4 changes: 2 additions & 2 deletions template/app/controllers/web/otp/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function verify(ctx) {

// if it's a GET request then render the page
if (ctx.method === 'GET' && !isSANB(ctx.query.pin))
return ctx.render('otp/verify');
return ctx.render('verify');

// if it's a POST request then ensure the user entered the 6 digit pin
// otherwise if it's a GET request then use the ctx.query.pin
Expand Down Expand Up @@ -93,7 +93,7 @@ async function verify(ctx) {
ctx.logger.debug('created inquiry', inquiry);

const job = await bull.add('email', {
template: 'inquiry',
template: 'recovery',
message: {
to: ctx.state.user.email,
cc: config.email.message.from
Expand Down
8 changes: 4 additions & 4 deletions template/app/views/_register-or-login.pug
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ mixin registerOrLogin(verb, isModal = false)
form.ajax-form(action=ctx.session.redirectTo ? l(action) : `${l(action)}?redirect_to=${l(config.passportCallbackOptions.successReturnToOrRedirect)}`, method="POST")
input(type="hidden", name="_csrf", value=ctx.csrf)
.form-group.floating-label
input#input-email.form-control.form-control-lg(type="email", required, name="email", placeholder="name@example.com")
label(for="input-email")= t('Email address')
input.form-control.form-control-lg(id=`input-email-${dashify(verb)}`, type="email", required, name="email", placeholder="name@example.com", autocomplete='email')
label(for=`input-email-${dashify(verb)}`)= t('Email address')
.form-group.floating-label
input#input-password.form-control.form-control-lg(type="password", required, name="password", placeholder=" ")
label(for="input-password")= t('Password')
input.form-control.form-control-lg(id=`input-password-${dashify(verb)}`, type="password", required, name="password", placeholder=" ", autocomplete=verb === 'sign up' ? 'off' : 'current-password')
label(for=`input-password-${dashify(verb)}`)= t('Password')
if verb === 'sign in'
.form-group
small.form-text.text-right: a(href=l('/forgot-password')).text-secondary= t('Forget your password?')
Expand Down
3 changes: 0 additions & 3 deletions template/app/views/layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ html(lang=locale).h-100
id: "#{ctx.sessionId}"
};

//- polyfill environment
script(src=`https://polyfill.io/v3/polyfill${config.env === 'production' ? '.min' : ''}.js?features=${polyfills.join(',')}`)

//- factor bundle (common shared assets across all files)
script(src=manifest('js/factor-bundle.js') integrity=manifest('js/factor-bundle.js', 'integrity') crossorigin="anonymous")

Expand Down
6 changes: 3 additions & 3 deletions template/app/views/my-account/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ block body
.modal-body
if user[config.userFields.hasSetPassword]
.form-group.floating-label
input#input-old-password(type='password', name='old_password', required).form-control
input#input-old-password(type='password', name='old_password', required, autocomplete='off').form-control
label(for='input-old-password')= t('Confirm old password')
.form-group.floating-label
input#input-password(type='password', name='password', required, placeholder=" ").form-control
input#input-password(type='password', name='password', required, placeholder=" ", autocomplete='new-password').form-control
label(for='input-password')= t('Set new password')
.form-group.floating-label
input#input-confirm-password(type='password', name='confirm_password', required, placeholder=" ").form-control
input#input-confirm-password(type='password', name='confirm_password', required, placeholder=" ", autocomplete='new-password').form-control
label(for='input-confirm-password')= t('Confirm new password')
.modal-footer.text-right
button(type='button', data-dismiss='modal', aria-label=t('Cancel')).btn.btn-secondary= t('Cancel')
Expand Down
19 changes: 0 additions & 19 deletions template/app/views/otp/verify.pug

This file was deleted.

7 changes: 1 addition & 6 deletions template/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const i18n = require('./i18n');
const loggerConfig = require('./logger');
const meta = require('./meta');
const phrases = require('./phrases');
const polyfills = require('./polyfills');
const utilities = require('./utilities');

const config = {
Expand Down Expand Up @@ -90,7 +89,6 @@ const config = {
// debug: env.NODE_ENV === 'development',
// compileDebug: env.NODE_ENV === 'development',
...utilities,
polyfills,
filters
}
},
Expand Down Expand Up @@ -219,10 +217,7 @@ const logger = new Axe(config.logger);
config.manifest = path.join(config.buildDir, 'rev-manifest.json');
config.srimanifest = path.join(config.buildDir, 'sri-manifest.json');
config.views.locals.manifest = manifestRev({
prepend:
env.AWS_CLOUDFRONT_DOMAIN && env.NODE_ENV === 'production'
? `//${env.AWS_CLOUDFRONT_DOMAIN}/`
: '/',
prepend: '/',
manifest: config.srimanifest
});

Expand Down
34 changes: 0 additions & 34 deletions template/config/polyfills.js

This file was deleted.

2 changes: 1 addition & 1 deletion template/ecosystem.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"ref": "origin/master",
"repo": "git@github.com:<%= repo.replace('https://github.com/', '') %>.git",
"path": "/var/www/production",
"post-deploy": "yarn && NODE_ENV=production yarn start build && yarn start publish-assets && pm2 startOrGracefulReload ecosystem.json --env production --update-env"
"post-deploy": "yarn && NODE_ENV=production yarn start build && pm2 startOrGracefulReload ecosystem.json --env production --update-env"
}
}
}
13 changes: 13 additions & 0 deletions template/emails/recovery/html.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

extends ../layout

block content
.container.mt-3
.row
.col-12
.card.d-block.text-center
h5.card-header= t('Account recovery')
.card-body
.card-text
p= t('You have successfully verified your account for recovery. We will be in touch soon.')
.card-footer: small.text-muted= t('If you did not submit this request, then please reply to let us know.')
1 change: 1 addition & 0 deletions template/emails/recovery/subject.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= t('Account recovery process started')
42 changes: 3 additions & 39 deletions template/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
const path = require('path');
const fs = require('fs');

const AWS = require('aws-sdk');
const Graceful = require('@ladjs/graceful');
const Mandarin = require('mandarin');
const _ = require('lodash');
const awscloudfront = require('gulp-awspublish-cloudfront');
const awspublish = require('gulp-awspublish');
const babel = require('babelify');
const browserify = require('browserify');
const collapser = require('bundle-collapser/plugin');
const cssnano = require('cssnano');
Expand All @@ -22,21 +19,20 @@ const gulpif = require('gulp-if');
const imagemin = require('gulp-imagemin');
const lr = require('gulp-livereload');
const makeDir = require('make-dir');
const ms = require('ms');
const nodeSass = require('node-sass');
const pngquant = require('imagemin-pngquant');
const postcss = require('gulp-postcss');
const postcssPresetEnv = require('postcss-preset-env');
const pugLinter = require('gulp-pug-linter');
const reporter = require('postcss-reporter');
const rev = require('gulp-rev');
const revSri = require('gulp-rev-sri');
const sass = require('gulp-sass');
const scssParser = require('postcss-scss');
const sourcemaps = require('gulp-sourcemaps');
const stylelint = require('stylelint');
const terser = require('gulp-terser');
const unassert = require('gulp-unassert');
const revSri = require('gulp-rev-sri');
const { lastRun, watch, series, parallel, src, dest } = require('gulp');

// explicitly set the compiler in case it were to change to dart
Expand Down Expand Up @@ -67,38 +63,6 @@ const manifestOptions = {
base: config.buildBase
};

// set aws logger
AWS.config.logger = logger;

function publish() {
// create a new publisher
const publisher = awspublish.create(
_.merge(config.aws, {
params: {
Bucket: env.AWS_S3_BUCKET
}
})
);
return (
src([`${config.buildBase}/**/*`, `!${config.manifest}`])
// gzip, Set Content-Encoding headers and add .gz extension
.pipe(awspublish.gzip())
// publisher will add Content-Length, Content-Type
// and headers specified below
// If not specified it will set x-amz-acl to public-read by default
.pipe(
publisher.publish({
'Cache-Control': `public, max-age=${ms('1yr')}`
})
)
// create a cache file to speed up consecutive uploads
.pipe(publisher.cache())
// print upload updates to console
.pipe(awspublish.reporter())
.pipe(awscloudfront(env.AWS_CLOUDFRONT_DISTRIBUTION_ID))
);
}

function pug() {
return src('app/views/**/*.pug', { since: lastRun(pug) })
.pipe(pugLinter({ reporter: 'default', failAfterError: true }))
Expand Down Expand Up @@ -191,6 +155,7 @@ async function bundle() {
debug: true
});
return b
.transform(babel)
.plugin(collapser)
.plugin('factor-bundle', {
outputs: paths.map(string => path.join(config.buildBase, 'js', string))
Expand Down Expand Up @@ -256,7 +221,6 @@ const build = series(
module.exports = {
build,
bundle,
publish,
markdown,
watch: () => {
lr.listen(config.livereload);
Expand Down
1 change: 0 additions & 1 deletion template/package-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module.exports = {
watch: 'gulp watch',
clean: 'gulp clean',
build: 'gulp build',
publishAssets: 'gulp publish',

lint: series('gulp xo', 'gulp eslint', 'gulp remark', 'gulp pug'),

Expand Down
Loading