1
0
Fork 0
mirror of https://github.com/Oreolek/pancakes-or-waffles.git synced 2024-04-30 16:09:31 +03:00
This commit is contained in:
Lau Skeeter 2018-01-28 01:17:19 +00:00
parent 57f7d5c747
commit 29ad78c649
10 changed files with 730 additions and 726 deletions

View file

@ -1,3 +0,0 @@
{
"plugins": ["transform-object-rest-spread"]
}

View file

@ -3,6 +3,7 @@
"node": true,
"es6" : true
},
"parser": "babel-eslint",
"extends": ["eslint:recommended"],
"parserOptions": {
"ecmaVersion": 2017,

View file

@ -13,14 +13,15 @@ const modules = [
'query-string',
'seedrandom',
'pluralize',
'number-to-text/converters/en-us.js',
'number-to-text'
'number2text'
];
try {
fs.mkdirSync(path.join(__dirname,'..','target'));
fs.mkdirSync(path.join(__dirname,'..','target','npm'));
} catch(e){}
} catch(e){
/**/
}
const webpackify = (module) => {
@ -37,12 +38,12 @@ const webpackify = (module) => {
webpack({
entry: entry,
output: {
output: {
path: path.resolve(path.join(__dirname,'..','target','npm')),
filename: `${module.replace('.js','')}.js`,
library: '_217878383_',
libraryTarget: "var",
},
libraryTarget: 'var',
},
plugins: [
new WrapperPlugin({
footer: 'export default _217878383_'
@ -50,13 +51,10 @@ const webpackify = (module) => {
]
}, (err, stats) => {
if (err || stats.hasErrors()) {
console.error(err, stats)
}
else {
console.info(stats);
console.error(err, stats);
}
});
}
};
modules.forEach(webpackify);

View file

@ -27,7 +27,7 @@ const render = (options={}) =>
<body>
</body>
${!options.test?
`<script type="module" src="/app/index.js"></script>`:''
'<script type="module" src="/app/index.js"></script>':''
}
${options.test===true?
`
@ -39,8 +39,9 @@ const render = (options={}) =>
(async () => {
const $script = document.createElement("script");
$script.url = '/test/test.js'
document.getElementsByTagName("head")[0].appendChild(script); })()
$script.src = '/test/test.js'
document.getElementsByTagName("head")[0].appendChild($script);
})()
</script>
<script>

1347
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -5,19 +5,16 @@
"author": "Laura mayhem",
"bugs": "https://github.com/walaura/pancakes-or-waffles/issues",
"dependencies": {
"babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-preset-stage-2": "^6.24.1",
"chalk": "^2.3.0",
"change-case": "^3.0.1",
"clean-webpack-plugin": "^0.1.15",
"concurrently": "^3.5.1",
"dotenv": "^4.0.0",
"eslint": "^4.2.0",
"express": "^4.16.2",
"js-yaml": "^3.10.0",
"mocha": "^5.0.0",
"number-to-text": "^0.3.2",
"number2text": "^1.1.0",
"pluralize": "^7.0.0",
"puppeteer": "^1.0.0",
"query-string": "^5.0.1",
@ -25,9 +22,7 @@
"rollup": "^0.55.1",
"seedrandom": "^2.4.2",
"spdy": "^3.4.7",
"twit": "^2.2.5",
"webpack": "^3.1.0",
"wrapper-webpack-plugin": "^1.0.0"
"twit": "^2.2.5"
},
"engines": {
"node": "^8.4.0"
@ -48,14 +43,16 @@
"scripts": {
"sign": "openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt -subj \"/C=US/ST=AZ/L=Bitter Springs/O=Pancakes/CN=www.example.com\"",
"esfix": "eslint --ignore-path .gitignore --fix .",
"webpack": "webpack --hide-modules",
"install": "npm run webpack && npm run sign",
"install": "node ./bin/webpack-node-modules.js && npm run sign",
"localpost": "node ./bin/screenshot.js && node ./bin/upload.js",
"shitpost": "node ./bin/screenshot.js && node ./bin/upload-twitter.js",
"watch": "open https://localhost:9191 && concurrently \"node ./bin/start-server.js\" \"webpack --watch\"",
"watch": "open https://localhost:9191 && node ./bin/start-server.js",
"test": "concurrently \"node ./bin/run-tests.js\" \"npm run localpost\""
},
"devDependencies": {
"babel-plugin-transform-object-rest-spread": "^6.26.0"
"babel-eslint": "^8.2.1",
"eslint": "^4.16.0",
"webpack": "^3.1.0",
"wrapper-webpack-plugin": "^1.0.0"
}
}

View file

@ -1,7 +1,6 @@
import abstractGetter from './abstract/abstract.js';
import numberToText from '/target/npm/number-to-text.js';
import numberToTextConv from '/target/npm/number-to-text/converters/en-us.js';
import numberToText from '/target/npm/number2text.js';
export default class PronounGetter extends abstractGetter {
@ -33,9 +32,7 @@ export default class PronounGetter extends abstractGetter {
}
if(pronoun === '_number_') {
const isLargeNumber = this.randomArray([true,false]);
pronoun = numberToText.convertToText(Math.ceil(Math.random()*(isLargeNumber?99:9)),{
case: 'lowerCase'
});
pronoun = numberToText(Math.ceil(Math.random()*(isLargeNumber?99:9)), 'English');
}
return await this.expandKeywordHelper(pronoun);

View file

@ -69,7 +69,7 @@ const transformChunk = async (chunk, replacer, context, seed) => {
import('../getter/thing.js'),
import('../getter/character.js'),
import('../getter/adjective.js')
]).then(stuff => stuff.map(imported => imported.default) )
]).then(stuff => stuff.map(imported => imported.default) );
const replacement = await getReplacement(replacer, context, seed);

View file

@ -78,3 +78,5 @@ window.describe('Initialization', function() {
});
}).timeout(5000);
});
mocha.reporter('spec').run((failures)=>{if(failures > 0){throw 0;}else{console.log('done');}});

View file

@ -1,48 +0,0 @@
const config = require('./.pancakerc');
const webpack = require('webpack');
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
entry: {
app: 'app'
},
plugins: [
new CleanWebpackPlugin(
[config.paths.build]
),
new webpack.SourceMapDevToolPlugin({
filename: '[file].map',
exclude: [/node_modules/]
})
],
module: {
rules: [
{
test: /\.js$/,
exclude: [
/node_modules/,
],
use: 'babel-loader'
}
]
},
output: {
filename: 'post.js',
path: path.resolve(__dirname, config.paths.build),
publicPath: '/',
library: 'Pancakes',
libraryTarget: 'umd'
},
resolve: {
alias: {
'corpus': path.resolve(__dirname,'corpus'),
'data': path.resolve(__dirname,'data')
},
modules: [
path.resolve(__dirname,'src'),
'node_modules'
]
}
};