Skip to content

Commit

Permalink
feat: track access with umami and update deps (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
stropitek committed Apr 15, 2024
1 parent b03a52a commit afe6785
Show file tree
Hide file tree
Showing 13 changed files with 3,226 additions and 10,119 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Node.js CI

on:
push:
branches:
branches:
- master
pull_request:

env:
NODE_VERSION: 16.x
NODE_VERSION: 20.x

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-slim
FROM node:20-slim

RUN apt-get update && apt-get install -y cron git

Expand Down
4 changes: 2 additions & 2 deletions bin/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ for (let i = 0; i < configs.length; i++) {
}

Promise.all(prom)
.then(function () {
.then(() => {
console.log('done build');
})
.catch(function (e) {
.catch((e) => {
console.error('Error building with flavor-builder', e, e.stack);
process.exit(1);
});
26 changes: 13 additions & 13 deletions bin/create-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ let generalPrompt = [
type: 'password',
required: false,
message: "What the couchdb user's password?",
when: function (answers) {
when: (answers) => {
return !!answers.couchUsername;
},
},
Expand Down Expand Up @@ -161,19 +161,19 @@ function main() {
.then(addFlavors)
.then(postProcess)
.then(writeConfig)
.catch(function (e) {
.catch((e) => {
console.error('error', e);
});
}

function general() {
return inquirer.prompt(generalPrompt).then(function (answer) {
return inquirer.prompt(generalPrompt).then((answer) => {
Object.assign(config, answer);
});
}

function overwrite() {
return inquirer.prompt(overwritePrompt).then(function (answer) {
return inquirer.prompt(overwritePrompt).then((answer) => {
if (!answer.overwrite) {
return filePath();
}
Expand All @@ -200,7 +200,7 @@ function createDirectory(dir, cb) {
name: 'createDir',
message: `The directory ${dir} does not exist, would you like to create it?`,
};
return inquirer.prompt(createDirectoryPrompt).then(function (answer) {
return inquirer.prompt(createDirectoryPrompt).then((answer) => {
if (answer.createDir) {
fs.mkdirpSync(dir);
} else {
Expand All @@ -211,7 +211,7 @@ function createDirectory(dir, cb) {

function dirPath(options) {
options = Object.assign({}, dirPathPrompt, options);
return inquirer.prompt(options).then(function (answer) {
return inquirer.prompt(options).then((answer) => {
let dir = path.resolve(process.cwd(), answer[options.name]);
config[options.name] = dir;
try {
Expand All @@ -223,7 +223,7 @@ function dirPath(options) {
}

function filePath() {
return inquirer.prompt(filePathPrompt).then(function (answer) {
return inquirer.prompt(filePathPrompt).then((answer) => {
configPath = path.resolve(process.cwd(), answer.configPath);
try {
fs.statSync(configPath);
Expand All @@ -247,11 +247,11 @@ function updateFlavorPrompt() {
}

function addFlavor() {
return inquirer.prompt(addFlavorPrompt).then(function (answer) {
return inquirer.prompt(addFlavorPrompt).then((answer) => {
let prom = Promise.resolve();
if (answer.login) {
prom = prom.then(() =>
inquirer.prompt(loginPrompt).then(function (ans) {
inquirer.prompt(loginPrompt).then((ans) => {
answer.login = ans;
return answer;
}),
Expand All @@ -260,11 +260,11 @@ function addFlavor() {
if (answer.layout === 'visualizer-on-tabs') {
prom = prom
.then(() => inquirer.prompt(visualizerOnTabsPrompt))
.then(function (ans) {
.then((ans) => {
answer.visualizerOnTabs = ans;
});
}
return prom.then(function () {
return prom.then(() => {
if (!answer.login) delete answer.login;
return answer;
});
Expand All @@ -279,9 +279,9 @@ function addFlavors() {
message: 'Would you like to add another flavor configuration?',
required: true,
})
.then(function (ans) {
.then((ans) => {
if (ans.continue) {
return addFlavor().then(function (answer) {
return addFlavor().then((answer) => {
config.flavors.push(answer);
return addFlavors();
});
Expand Down
2 changes: 1 addition & 1 deletion layout/includes/rocLogin.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var $auth = $('#roc-auth');
function checkSession() {
$.ajax(url + '/auth/session', {xhrFields: {withCredentials: true}, crossDomain: true})
.then(function (res) {
.then((res) => {
if(res.authenticated) {
$auth.html(res.username + '(<a href="#">Logout</a>)');
$auth.find('a').on('click', function () {
Expand Down
3 changes: 3 additions & 0 deletions layout/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<html>

<head>
{% if config.umamiTracking %}
<script defer src="{{config.umamiTracking.scriptSrc}}" data-website-id="{{config.umamiTracking.id}}"></script>
{% endif %}
<meta charset="utf-8">

{% if keywords %}
Expand Down
Loading

0 comments on commit afe6785

Please sign in to comment.