This file contains 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
#! /usr/bin/env node | |
const { array, spawn: { sh } } = require('./utils'); | |
const { options } = require('./cli'); | |
const fs = require('fs'); | |
// Calls the async function that spawns the child process | |
async function getFiles(path) { | |
const { stdout } = await sh(path); | |
// A helper to shuffle the filenames inside the array, ensuring randomness |
This file contains 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 { spawn } = require('child_process'); | |
const readline = require('readline'); | |
async function sh(path) { | |
return new Promise(function (resolve, reject) { | |
// Creates a process that runs asynchronously | |
const result = spawn('find', [path, '-type', 'f']); | |
let lines = []; | |
const rl = readline.createInterface({ input: result.stdout }); |
This file contains 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 path = require('path'); | |
module.exports = { | |
mode: 'production', | |
entry: './src/index.js', | |
output: { | |
path: path.resolve('dist'), | |
filename: 'index.js', | |
libraryTarget: 'commonjs2', | |
}, |
This file contains 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 bool = () => Boolean(Math.round(Math.random())); | |
export default bool; |