mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-01-31 07:16:17 +00:00
eslint corrections
This commit is contained in:
parent
9f812176b3
commit
2ea8297dd5
@ -24,7 +24,6 @@
|
|||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
@ -36,16 +35,16 @@ var util = require('util');
|
|||||||
|
|
||||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||||
|
|
||||||
var stream__default = /*#__PURE__*/_interopDefaultLegacy(stream);
|
var stream__default = /* #__PURE__*/_interopDefaultLegacy(stream);
|
||||||
|
|
||||||
const pipeline = util.promisify(stream__default['default'].pipeline);
|
const pipeline = util.promisify(stream__default.default.pipeline);
|
||||||
const mkdir = (f, recursive = true) => fs.promises.mkdir(f, {
|
const mkdir = (f, recursive = true) => fs.promises.mkdir(f, {
|
||||||
recursive
|
recursive,
|
||||||
});
|
});
|
||||||
const exists = f => fs.promises.access(f).then(() => true, () => false);
|
const exists = (f) => fs.promises.access(f).then(() => true, () => false);
|
||||||
const stat = f => fs.promises.stat(f).catch(() => null);
|
const stat = (f) => fs.promises.stat(f).catch(() => null);
|
||||||
const linkStat = f => fs.promises.lstat(f).catch(() => null);
|
const linkStat = (f) => fs.promises.lstat(f).catch(() => null);
|
||||||
async function isWritable(file) {
|
async function isWritable (file) {
|
||||||
try {
|
try {
|
||||||
await fs.promises.access(file, fs.constants.F_OK | fs.constants.W_OK);
|
await fs.promises.access(file, fs.constants.F_OK | fs.constants.W_OK);
|
||||||
return true;
|
return true;
|
||||||
@ -57,7 +56,7 @@ async function isWritable(file) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function touch(file) {
|
async function touch (file) {
|
||||||
const stats = await linkStat(file);
|
const stats = await linkStat(file);
|
||||||
|
|
||||||
if (stats) {
|
if (stats) {
|
||||||
@ -69,34 +68,36 @@ async function touch(file) {
|
|||||||
if (!(await exists(path.dirname(file)))) await mkdir(path.dirname(file));
|
if (!(await exists(path.dirname(file)))) await mkdir(path.dirname(file));
|
||||||
await fs.promises.writeFile(file, '');
|
await fs.promises.writeFile(file, '');
|
||||||
}
|
}
|
||||||
async function remove(file) {
|
async function remove (file) {
|
||||||
const stats = await linkStat(file);
|
const stats = await linkStat(file);
|
||||||
if (!stats) return;
|
if (!stats) return;
|
||||||
if (stats.isDirectory()) return fs.promises.rmdir(file, {
|
if (stats.isDirectory()) {
|
||||||
recursive: true
|
return fs.promises.rmdir(file, {
|
||||||
|
recursive: true,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return fs.promises.unlink(file);
|
return fs.promises.unlink(file);
|
||||||
}
|
}
|
||||||
async function writeJson(file, object, options) {
|
async function writeJson (file, object, options) {
|
||||||
const {
|
const {
|
||||||
replacer,
|
replacer,
|
||||||
spaces,
|
spaces,
|
||||||
...ops
|
...ops
|
||||||
} = {
|
} = {
|
||||||
encoding: 'utf8',
|
encoding: 'utf8',
|
||||||
...options
|
...options,
|
||||||
};
|
};
|
||||||
await fs.promises.writeFile(file, `${JSON.stringify(object, replacer, spaces)}\n`, ops);
|
await fs.promises.writeFile(file, `${JSON.stringify(object, replacer, spaces)}\n`, ops);
|
||||||
}
|
}
|
||||||
const writeJSON = writeJson;
|
const writeJSON = writeJson;
|
||||||
async function readJson(file, options) {
|
async function readJson (file, options) {
|
||||||
const {
|
const {
|
||||||
reviver,
|
reviver,
|
||||||
quiet,
|
quiet,
|
||||||
...ops
|
...ops
|
||||||
} = {
|
} = {
|
||||||
encoding: 'utf8',
|
encoding: 'utf8',
|
||||||
...options
|
...options,
|
||||||
};
|
};
|
||||||
const content = await fs.promises.readFile(file, ops);
|
const content = await fs.promises.readFile(file, ops);
|
||||||
|
|
||||||
@ -109,7 +110,7 @@ async function readJson(file, options) {
|
|||||||
}
|
}
|
||||||
const readJSON = readJson;
|
const readJSON = readJson;
|
||||||
|
|
||||||
function stripBom(content) {
|
function stripBom (content) {
|
||||||
if (Buffer.isBuffer(content)) {
|
if (Buffer.isBuffer(content)) {
|
||||||
content = content.toString('utf8');
|
content = content.toString('utf8');
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ module.exports = exports = class Manifest {
|
|||||||
|
|
||||||
hash ({ action, input, output, ...task }) {
|
hash ({ action, input, output, ...task }) {
|
||||||
if (!isFunction(action)) {
|
if (!isFunction(action)) {
|
||||||
console.error({ action, input, output });
|
console.error({ action, input, output }); // eslint-disable-line
|
||||||
throw new Error('Task action is not a task action (function).');
|
throw new Error('Task action is not a task action (function).');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
* Portions of the MIT licensed date-fns library are bundled with this
|
* Portions of the MIT licensed date-fns library are bundled with this
|
||||||
* software. https://github.com/date-fns/date-fns#readme
|
* software. https://github.com/date-fns/date-fns#readme
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
|
|
||||||
module.exports = exports = {
|
module.exports = exports = {
|
||||||
extends: "twipped/browser",
|
extends: 'twipped/browser',
|
||||||
env: {es6: true, jquery: true},
|
env: { es6: true, jquery: true },
|
||||||
rules: {
|
rules: {
|
||||||
'indent': [ 2, 2, {
|
'indent': [ 2, 2, {
|
||||||
'MemberExpression': 1,
|
'MemberExpression': 1,
|
||||||
} ],
|
} ],
|
||||||
'prefer-arrow-callback': 0,
|
'prefer-arrow-callback': 0,
|
||||||
'object-shorthand': 0,
|
'object-shorthand': 0,
|
||||||
'node/no-unsupported-features/node-builtins': 0
|
'node/no-unsupported-features/node-builtins': 0,
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: '$*.jsx',
|
files: '$*.jsx',
|
||||||
extends: "twipped/react",
|
extends: 'twipped/react',
|
||||||
rules: {
|
rules: {
|
||||||
'react/jsx-indent': [2, 2, {checkAttributes: true}],
|
'react/jsx-indent': [ 2, 2, { checkAttributes: true } ],
|
||||||
"react/no-unknown-property": [2, { ignore: ['class'] }],
|
'react/no-unknown-property': [ 2, { ignore: [ 'class' ] } ],
|
||||||
'node/no-unpublished-import': 0,
|
'node/no-unpublished-import': 0,
|
||||||
"node/no-missing-import": ["error", {
|
'node/no-missing-import': [ 'error', {
|
||||||
"allowModules": ["svg", 'react']
|
'allowModules': [ 'svg', 'react' ],
|
||||||
}]
|
} ],
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Code for construction of the GenderDysphoria.fyi website",
|
"description": "Code for construction of the GenderDysphoria.fyi website",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "eslint ./ --fix"
|
"test": "eslint 'build/**/*.js' 'js/**/*.{js,jsx}' 'terraform/**/*.js' --fix",
|
||||||
|
"build": "gulp prod"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.14.0"
|
"node": ">=12.14.0"
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
/* eslint no-console:0 */
|
/* eslint no-console:0 */
|
||||||
/* global URLSearchParams */
|
|
||||||
|
|
||||||
const AWS = require('aws-sdk');
|
const AWS = require('aws-sdk');
|
||||||
const zlib = require('zlib');
|
const zlib = require('zlib');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const {URL} = require('url');
|
const { URL } = require('url');
|
||||||
const s3 = new AWS.S3();
|
const s3 = new AWS.S3();
|
||||||
const { parse: parseLog } = require('cloudfront-log-parser');
|
const { parse: parseLog } = require('cloudfront-log-parser');
|
||||||
const parseUA = require('ua-parser-js');
|
const parseUA = require('ua-parser-js');
|
||||||
@ -56,7 +55,6 @@ exports.handler = async (event) => {
|
|||||||
if (!query.start) return null;
|
if (!query.start) return null;
|
||||||
|
|
||||||
const useragent = parseUA(row.cs_user_agent);
|
const useragent = parseUA(row.cs_user_agent);
|
||||||
const { referer } = query;
|
|
||||||
|
|
||||||
const sessionStart = Number(query.start);
|
const sessionStart = Number(query.start);
|
||||||
const sessionEnd = query.end === 'null' ? 0 : Number(query.end);
|
const sessionEnd = query.end === 'null' ? 0 : Number(query.end);
|
||||||
|
94
terraform/files/decorate/package-lock.json
generated
94
terraform/files/decorate/package-lock.json
generated
@ -4,6 +4,37 @@
|
|||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"aws-sdk": {
|
||||||
|
"version": "2.975.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.975.0.tgz",
|
||||||
|
"integrity": "sha512-cmRcM+gU+rfW1RZjca3bdbRTQV6WHuCI6NuqnDgd5HoqufylCrNI/wtysPK1IMJLsAhrcsY0U0YRx+Y/hxQNoQ==",
|
||||||
|
"requires": {
|
||||||
|
"buffer": "4.9.2",
|
||||||
|
"events": "1.1.1",
|
||||||
|
"ieee754": "1.1.13",
|
||||||
|
"jmespath": "0.15.0",
|
||||||
|
"querystring": "0.2.0",
|
||||||
|
"sax": "1.2.1",
|
||||||
|
"url": "0.10.3",
|
||||||
|
"uuid": "3.3.2",
|
||||||
|
"xml2js": "0.4.19"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"base64-js": {
|
||||||
|
"version": "1.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||||
|
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||||
|
},
|
||||||
|
"buffer": {
|
||||||
|
"version": "4.9.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz",
|
||||||
|
"integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==",
|
||||||
|
"requires": {
|
||||||
|
"base64-js": "^1.0.2",
|
||||||
|
"ieee754": "^1.1.4",
|
||||||
|
"isarray": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"cloudfront-log-parser": {
|
"cloudfront-log-parser": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/cloudfront-log-parser/-/cloudfront-log-parser-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/cloudfront-log-parser/-/cloudfront-log-parser-1.1.0.tgz",
|
||||||
@ -14,10 +45,73 @@
|
|||||||
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.9.0.tgz",
|
||||||
"integrity": "sha512-khbFLu/MlzLjEzy9Gh8oY1hNt/Dvxw3J6Rbc28cVoYWQaC1S3YI4xwkF9ZWcjDLscbZlY9hISMr66RFzZagLsA=="
|
"integrity": "sha512-khbFLu/MlzLjEzy9Gh8oY1hNt/Dvxw3J6Rbc28cVoYWQaC1S3YI4xwkF9ZWcjDLscbZlY9hISMr66RFzZagLsA=="
|
||||||
},
|
},
|
||||||
|
"events": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz",
|
||||||
|
"integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ="
|
||||||
|
},
|
||||||
|
"ieee754": {
|
||||||
|
"version": "1.1.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
|
||||||
|
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
|
||||||
|
},
|
||||||
|
"isarray": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||||
|
},
|
||||||
|
"jmespath": {
|
||||||
|
"version": "0.15.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz",
|
||||||
|
"integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc="
|
||||||
|
},
|
||||||
|
"punycode": {
|
||||||
|
"version": "1.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
|
||||||
|
"integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0="
|
||||||
|
},
|
||||||
|
"querystring": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
|
||||||
|
"integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA="
|
||||||
|
},
|
||||||
|
"sax": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz",
|
||||||
|
"integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o="
|
||||||
|
},
|
||||||
"ua-parser-js": {
|
"ua-parser-js": {
|
||||||
"version": "0.7.21",
|
"version": "0.7.21",
|
||||||
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.21.tgz",
|
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.21.tgz",
|
||||||
"integrity": "sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ=="
|
"integrity": "sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ=="
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"version": "0.10.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz",
|
||||||
|
"integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=",
|
||||||
|
"requires": {
|
||||||
|
"punycode": "1.3.2",
|
||||||
|
"querystring": "0.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"uuid": {
|
||||||
|
"version": "3.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
|
||||||
|
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
|
||||||
|
},
|
||||||
|
"xml2js": {
|
||||||
|
"version": "0.4.19",
|
||||||
|
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
|
||||||
|
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
|
||||||
|
"requires": {
|
||||||
|
"sax": ">=0.6.0",
|
||||||
|
"xmlbuilder": "~9.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xmlbuilder": {
|
||||||
|
"version": "9.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
|
||||||
|
"integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"author": "Jocelyn Badgley <joc@twipped.com> (http://twipped.com/)",
|
"author": "Jocelyn Badgley <joc@twipped.com> (http://twipped.com/)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"aws-sdk": "~2.975.0",
|
||||||
"cloudfront-log-parser": "~1.1.0",
|
"cloudfront-log-parser": "~1.1.0",
|
||||||
"date-fns": "~2.9.0",
|
"date-fns": "~2.9.0",
|
||||||
"ua-parser-js": "~0.7.21"
|
"ua-parser-js": "~0.7.21"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// This should be deployed as a Lambda@Edge connected to the CloudFront Distribution
|
// This should be deployed as a Lambda@Edge connected to the CloudFront Distribution
|
||||||
// Only Node.js 10.x Runtime supports Lambda@Edge for right now, we have to wait for AWS to support 12x and beyond
|
// Only Node.js 10.x Runtime supports Lambda@Edge for right now, we have to wait for AWS to support 12x and beyond
|
||||||
|
|
||||||
exports.handler = async (event, context) => {
|
exports.handler = async (event) => {
|
||||||
/*
|
/*
|
||||||
* Expand S3 request to have index.html if it ends in /
|
* Expand S3 request to have index.html if it ends in /
|
||||||
*/
|
*/
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* eslint no-console: 0 */
|
||||||
|
|
||||||
const { gunzip } = require('zlib');
|
const { gunzip } = require('zlib');
|
||||||
const { promisify } = require('util');
|
const { promisify } = require('util');
|
||||||
const { S3 } = require('aws-sdk');
|
const { S3 } = require('aws-sdk');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const { CloudWatchLogs } = require('aws-sdk');
|
const { CloudWatchLogs } = require('aws-sdk');
|
||||||
|
|
||||||
// Split up ARN like "arn:aws:logs:eu-west-1:123456789012:log-group:example-group:*"
|
// Split up ARN like "arn:aws:logs:eu-west-1:123456789012:log-group:example-group:*"
|
||||||
const [,,, region,,, logGroupName] = process.env.CLOUDWATCH_LOGS_GROUP_ARN.split(':');
|
const [ ,,, region,,, logGroupName ] = process.env.CLOUDWATCH_LOGS_GROUP_ARN.split(':');
|
||||||
|
|
||||||
const cloudwatchlogs = new CloudWatchLogs({ region });
|
const cloudwatchlogs = new CloudWatchLogs({ region });
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user