Created
March 3, 2020 01:22
-
-
Save matthewstokeley/f8beae4e9a825a6cc909c246a8cc668a to your computer and use it in GitHub Desktop.
configuration file population, modular dependencies and modular task workflows
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/node | |
/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- | |
* Bootload a Transpiling Environment | |
* | |
* @version 0.0.2 | |
*/ | |
/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- | |
* Declare Modules | |
*/ | |
const config = require( './config' ) | |
const fs = require( 'fs' ) | |
const { exec, nextTick } = require( 'process' ) | |
const events = require( 'events' ) | |
const { spawn } = require('child_process') | |
const clc = require( 'cli-color' ) | |
/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- | |
* Handle the configuration file | |
*/ | |
const FILE_PATH = '' | |
const RESOURCE_PATH | |
let file_contents = '' | |
fs.access( PATH, fs.constants.F_OK | fs.constants.W_OK, ( err ) => { | |
if err throw error(err) | |
} ) | |
events.addEventListener( '', ( fileExists ) => { | |
if ( ! fileExists ) | |
fs.writeSync( PATH, '', ( err ) => { if err throw err } ) | |
// @todo replace with the http module | |
let exec = process.exec( 'curl ${ RESOURCE_PATH } >> ${ PATH } ' ) | |
exec.stdout.on( 'data', ( err, data ) => { | |
if err throw err | |
} ) | |
} | |
// populate from a .env file | |
// process.exec( "touch output.txt && sed -e '/^$/d" "$1" >> output.txt ) | |
// @todo | |
process.exec( "sed /awk '{print $1}' secret.env/awk '{print $2}' secret.env/ $FILE_PATH " ) | |
/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- | |
* Spawn out our installation task | |
*/ | |
let exec = spawn( 'npm install npm install @babel/core babel-loader @babel/preset-env @babel/preset-modules', | |
[ '--save-dev' ] ) | |
let err = ( status_code ) => { | |
console.log( "Error: " + status_code ) | |
} | |
exec.stdout.on( 'data', () => { | |
console.log( '' ) | |
} ) | |
exec.stderr.on( 'data', status_code ) | |
exec.on( 'close', () => {} ) | |
// Add Gulp Task | |
process.exec( 'touch gulpfile.js && echo "gulp.task( "transpile", () => { gulp.pipe("./app/").babel().dest() } )" >> gulpfile.json' ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment