Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"lint-staged": "^10.1.4",
"nyc": "^15.0.1",
"remark-cli": "^8.0.0",
"remark-preset-github": "^1.0.0",
"remark-preset-github": "^2.0.0",
"supertest": "^4.0.2",
"xo": "^0.25.3"
},
Expand Down
29 changes: 15 additions & 14 deletions template/app/views/layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,21 @@ html(lang=locale).h-100
script.
window.API_URL = "#{config.urls.api}";

//- set the user and API key to be used by CabinJS
if user
script.
window.USER = {
id: "#{user.id}",
name: "#{user[config.passport.fields.displayName]}",
email: "#{user.email}"
};
window.API_TOKEN = "#{user[config.userFields.apiToken]}";
else
script.
window.USER = {
id: "#{ctx.sessionId}"
};
if config.env !== 'test'
//- set the user and API key to be used by CabinJS
if user
script.
window.USER = {
id: "#{user.id}",
name: "#{user[config.passport.fields.displayName]}",
email: "#{user.email}"
};
window.API_TOKEN = "#{user[config.userFields.apiToken]}";
else
script.
window.USER = {
id: "#{ctx.sessionId}"
};

//- build
if !isBot(ctx.get('User-Agent'))
Expand Down
20 changes: 1 addition & 19 deletions template/bull.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,14 @@ if (!module.parent) {
//
if (cluster.isMaster) {
const welcomeEmail = bull.queues.get('welcome-email');
const translateMarkdown = bull.queues.get('translate-markdown');
const translatePhrases = bull.queues.get('translate-phrases');

await Promise.all([
(async () => {
// <https://github.com/OptimalBits/bull/issues/870>
const failedEmailJobs = await bull.queues.get('email').getFailed();
await Promise.all(failedEmailJobs.map(job => job.retry()));
})(),
pSeries([() => welcomeEmail.empty(), () => welcomeEmail.add()]),
pSeries([
// clear any existing jobs
() => translateMarkdown.empty(),
// add the recurring job
() => translateMarkdown.add(),
// add an initial job when the process starts
() => translateMarkdown.add(null, { repeat: false })
]),
pSeries([
// clear any existing jobs
() => translatePhrases.empty(),
// add the recurring job
() => translatePhrases.add(),
// add an initial job when the process starts
() => translatePhrases.add(null, { repeat: false })
])
pSeries([() => welcomeEmail.empty(), () => welcomeEmail.add()])
]);

cluster.on('online', worker => {
Expand Down
5 changes: 4 additions & 1 deletion template/emails/welcome/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

We strictly support Mac and Ubuntu-based operating systems (Windows _might_ work).


## Requirements

Please ensure your operating system has the following software installed:
Expand Down Expand Up @@ -33,6 +34,7 @@ Please ensure your operating system has the following software installed:
sudo apt-get -y install redis-server
```


## Install

[npm][]:
Expand All @@ -47,6 +49,7 @@ npm install -g lad
yarn global add lad
```


## Usage

### Create a project
Expand Down Expand Up @@ -79,7 +82,7 @@ yarn start all
```


##
##

[github-git]: https://help.github.com/articles/set-up-git/

Expand Down
18 changes: 1 addition & 17 deletions template/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const path = require('path');
const fs = require('fs');

const Graceful = require('@ladjs/graceful');
const Mandarin = require('mandarin');
const RevAll = require('gulp-rev-all');
const babel = require('gulp-babel');
const browserify = require('browserify');
Expand Down Expand Up @@ -47,8 +45,6 @@ process.env.I18N_UPDATE_FILES = true;

const env = require('./config/env');
const config = require('./config');
const logger = require('./helpers/logger');
const i18n = require('./helpers/i18n');

const PROD = config.env === 'production';
const DEV = config.env === 'development';
Expand Down Expand Up @@ -244,13 +240,6 @@ function static() {
}).pipe(dest(config.buildBase));
}

async function markdown() {
const mandarin = new Mandarin({ i18n, logger });
const graceful = new Graceful({ redisClients: [mandarin.redisClient] });
await mandarin.markdown();
await graceful.stopRedisClients();
}

async function sri() {
await getStream(
src('build/**/*.{css,js}')
Expand Down Expand Up @@ -305,10 +294,7 @@ const build = series(
clean,
parallel(
...(TEST ? [] : [xo, remark]),
series(
parallel(img, static, markdown, series(fonts, scss, css), bundle),
sri
)
series(parallel(img, static, series(fonts, scss, css), bundle), sri)
)
);

Expand All @@ -317,11 +303,9 @@ module.exports = {
build,
bundle,
sri,
markdown,
watch: () => {
lr.listen(config.livereload);
watch(['**/*.js', '!assets/js/**/*.js'], xo);
watch(Mandarin.DEFAULT_PATTERNS, markdown);
watch('assets/img/**/*', img);
watch('assets/css/**/*.scss', series(fonts, scss, css));
watch('assets/js/**/*.js', series(xo, bundle));
Expand Down
Loading