This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* eslint no-console: 0 */ | |
| const { fork, spawn } = require('child_process'); | |
| const web = fork(`${__dirname}/web.js`); | |
| web.on('close', code => process.exit(code)); | |
| if (process.env.NODE_ENV === 'development') { | |
| const api = spawn('nodemon', ['--watch', 'server', '--ext', 'js,gql,json', 'server/api.js']); | |
| api.stdout.on('data', data => process.stdout.write(data)); | |
| api.stderr.on('data', data => process.stderr.write(data)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const crypto = require('crypto'); | |
| function getId() { | |
| return crypto.randomBytes(12).toString('hex'); | |
| } | |
| //---------------- | |
| function adler32(str) { | |
| let s1 = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const crypto = require('crypto'); | |
| const { promisify } = require('util'); | |
| const express = require('express'); | |
| const asyncify = require('express-asyncify'); | |
| const session = require('express-session'); | |
| const createFileStore = require('session-file-store'); | |
| const nodemailer = require('nodemailer'); | |
| const nodemailerSendgrid = require('nodemailer-sendgrid'); | |
| const bodyParser = require('body-parser'); | |
| const pass = require('passport'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const asyncify = require('express-asyncify'); | |
| const session = require('express-session'); | |
| const createFileStore = require('session-file-store'); | |
| const bodyParser = require('body-parser'); | |
| const csurf = require('csurf') | |
| const templates = require('./templates'); | |
| const PORT = 5000; | |
| const SESSION_COOKIE_SECRET = 'minimum viable web auth secret'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| context: `${__dirname}/../js`, | |
| output: { | |
| pathinfo: true, | |
| filename: '[name].js', | |
| path: `${__dirname}/../dist` | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function.prototype.$asyncbind = function $asyncbind(self, catcher) { | |
| "use strict"; | |
| if (!Function.prototype.$asyncbind) { | |
| Object.defineProperty(Function.prototype, "$asyncbind", { | |
| value: $asyncbind, | |
| enumerable: false, | |
| configurable: true, | |
| writable: true | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const usedKeys = {}; | |
| const unusedPaths = []; | |
| const proxyData = new Proxy(data, { | |
| get(target, name) { | |
| usedKeys[name] = true; | |
| return target[name]; | |
| }, | |
| }); | |
| (function iterate(data, path) { | |
| Object.keys(data).forEach((key) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = (file, api, options) => { | |
| const j = api.jscodeshift; | |
| const printOptions = options.printOptions || {quote: 'single'}; | |
| const root = j(file.source); | |
| const requires = {}; | |
| const filterAndTransformRequires = path => { | |
| const varName = path.value.local.name; | |
| const scopeNode = path.parentPath.scope.node; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function (modules) { | |
| var installedModules = {}; | |
| function require(moduleId) { | |
| if (installedModules[moduleId]) return installedModules[moduleId].exports; | |
| var module = installedModules[moduleId] = {i: moduleId, l: false, exports: {}}; | |
| modules[moduleId].call(module.exports, module, module.exports, require); | |
| module.l = true; | |
| return module.exports; | |
| } | |
| require(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function loadScript(src, cb) { | |
| var doc = document, tag = 'script', el, firstScript; | |
| el = doc.createElement(tag); | |
| firstScript = doc.getElementsByTagName(tag)[0]; | |
| el.async = 1; | |
| el.src = src; | |
| el.onload = function() { cb(null); }; | |
| el.onerror = function() { cb(new Error('failed to load: ' + src)) }; | |
| firstScript.parentNode.insertBefore(el, firstScript); | |
| } |