diff --git a/data/concepts b/data/concepts new file mode 100644 index 0000000..3b155ce --- /dev/null +++ b/data/concepts @@ -0,0 +1,12 @@ +middleware +requests +responses +helpers +views +routes +apps +templates +static files +tests +models +controllers diff --git a/data/language-features b/data/language-features new file mode 100644 index 0000000..5a68da2 --- /dev/null +++ b/data/language-features @@ -0,0 +1,25 @@ +default parameters +template literals +destructuring assignment +arrow functions +promises +block-scoped variable declarations +classes +modules +async/await +decorators +the exponent operator +String.prototype.padStart +symbols +object spread +observables +Object.values +generators +getters and setters +WeakMap +proxies +dynamic import +pattern matching +partial application +closures +hoisting diff --git a/index.js b/index.js new file mode 100755 index 0000000..f67fdb1 --- /dev/null +++ b/index.js @@ -0,0 +1,28 @@ +#!/usr/bin/env node + +const { + resolve +} = require('path') + +const fs = require('fs') + +const { + promisify +} = require('util') + +const readFile = promisify(fs.readFile) + +const conceptsFile = resolve(__dirname, 'data', 'concepts') +const languageFeaturesFile = resolve(__dirname, 'data', 'language-features') + +const getRandomLine = filename => readFile(filename) + .then(buffer => buffer.toString()) + .then(file => file.split('\n')) + .then(lines => lines[Math.floor(Math.random() * (lines.length - 1))]) + +const concept = getRandomLine(conceptsFile) +const feature = getRandomLine(languageFeaturesFile) + +Promise.all([concept, feature]) + .then(([concept, feature]) => + console.log(`let's replace all our ${concept} with ${feature}`)) diff --git a/package.json b/package.json new file mode 100644 index 0000000..29ff01f --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "luka", + "version": "1.0.3", + "description": "generate good advice for building future-proof web applications", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "chee (https://snaek.org/)", + "license": "GPL-3.0+", + "bin": "index.js" +}