[Build] Improve rendering, add fs parsing
FS parsing needs a lot of improvements (namely ignoring gitignore files). Probably gonna migrate to a library for this
This commit is contained in:
parent
bab328c2d3
commit
c2f38bc39a
@ -50,7 +50,7 @@ const build = ( wallpaper, lockpaper, theme ) => {
|
|||||||
console.log( view );
|
console.log( view );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fs.mkdir( path.join( __dirname + '../dist' ) );
|
fs.mkdir( path.join( __dirname, '/dist' ) );
|
||||||
} catch ( e ) {
|
} catch ( e ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -58,6 +58,7 @@ const build = ( wallpaper, lockpaper, theme ) => {
|
|||||||
// recursively index files from config directory -> Maybe add a file to each
|
// recursively index files from config directory -> Maybe add a file to each
|
||||||
// directory to indicate whether or not to index files in it?
|
// directory to indicate whether or not to index files in it?
|
||||||
const fileList = util.treeWalker( path.join( __dirname, '/../config/' ), '*' );
|
const fileList = util.treeWalker( path.join( __dirname, '/../config/' ), '*' );
|
||||||
|
console.log( fileList );
|
||||||
for (let index = 0; index < fileList; index++) {
|
for (let index = 0; index < fileList; index++) {
|
||||||
try {
|
try {
|
||||||
render( fileList[ index ], view );
|
render( fileList[ index ], view );
|
||||||
@ -65,7 +66,8 @@ const build = ( wallpaper, lockpaper, theme ) => {
|
|||||||
console.error( '=> Render failed for ' + fileList[ index ] );
|
console.error( '=> Render failed for ' + fileList[ index ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ).catch( () => {
|
} ).catch( e => {
|
||||||
|
console.error( e );
|
||||||
console.error( '\n=> Failed to load image or retrieve colour palette from it' );
|
console.error( '\n=> Failed to load image or retrieve colour palette from it' );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
@ -135,7 +137,13 @@ const yaziThemes = {
|
|||||||
const render = ( templatePath, view ) => {
|
const render = ( templatePath, view ) => {
|
||||||
// Load template from disk (all can be found in <project-root>/config)
|
// Load template from disk (all can be found in <project-root>/config)
|
||||||
const template = '' + fs.readFileSync( path.join( __dirname, '/../config/', templatePath ) );
|
const template = '' + fs.readFileSync( path.join( __dirname, '/../config/', templatePath ) );
|
||||||
const outPath = '';
|
const outPath = path.join( __dirname, 'dist', templatePath )
|
||||||
|
console.log( '=> Rendering to ' + outPath );
|
||||||
|
try {
|
||||||
|
fs.mkdir( path.dirname( outPath ) );
|
||||||
|
} catch ( _ ) {
|
||||||
|
|
||||||
|
}
|
||||||
fs.writeFileSync( outPath, mustache.render( template, view ) );
|
fs.writeFileSync( outPath, mustache.render( template, view ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
const convert = require( 'color-convert' );
|
const convert = require( 'color-convert' );
|
||||||
|
const fs = require( 'fs' );
|
||||||
|
const path = require( 'path' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively find all HTML files in a directory
|
* Recursively find all HTML files in a directory
|
||||||
@ -10,15 +12,18 @@ const treeWalker = ( dir, extension ) => {
|
|||||||
const ls = fs.readdirSync( dir );
|
const ls = fs.readdirSync( dir );
|
||||||
const fileList = [];
|
const fileList = [];
|
||||||
for ( let file in ls ) {
|
for ( let file in ls ) {
|
||||||
if ( !ls[ file ].includes( '.' ) ) {
|
if ( fs.statSync( path.join( dir, ls[ file ] ) ).isDirectory() ) {
|
||||||
const newFiles = treeWalker( dir + '/' + ls[ file ], extension );
|
const newFiles = treeWalker( path.join( dir, ls[ file ] ), extension );
|
||||||
|
// TODO: Ignore files in .gitignore, as well as .gitignore
|
||||||
|
if ( !newFiles.includes( '.configbuildignore' ) ) {
|
||||||
for ( let file in newFiles ) {
|
for ( let file in newFiles ) {
|
||||||
fileList.push( newFiles[ file ] );
|
fileList.push( newFiles[ file ] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if ( extension == '*' ) {
|
} else if ( extension == '*' ) {
|
||||||
fileList.push( dir + '/' + ls[ file ] );
|
fileList.push( path.join( dir, ls[ file ] ) );
|
||||||
} else if ( ls[ file ].includes( extension ) ) {
|
} else if ( ls[ file ].includes( extension ) ) {
|
||||||
fileList.push( dir + '/' + ls[ file ] );
|
fileList.push( path.join( dir, ls[ file ] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
# This file contains fish universal variable definitions.
|
|
||||||
# VERSION: 3.0
|
|
||||||
SETUVAR __fish_initialized:3800
|
|
||||||
SETUVAR fish_color_autosuggestion:555\x1ebrblack
|
|
||||||
SETUVAR fish_color_cancel:\x2dr
|
|
||||||
SETUVAR fish_color_command:blue
|
|
||||||
SETUVAR fish_color_comment:red
|
|
||||||
SETUVAR fish_color_cwd:green
|
|
||||||
SETUVAR fish_color_cwd_root:red
|
|
||||||
SETUVAR fish_color_end:green
|
|
||||||
SETUVAR fish_color_error:brred
|
|
||||||
SETUVAR fish_color_escape:brcyan
|
|
||||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
|
||||||
SETUVAR fish_color_host:normal
|
|
||||||
SETUVAR fish_color_host_remote:yellow
|
|
||||||
SETUVAR fish_color_normal:normal
|
|
||||||
SETUVAR fish_color_operator:brcyan
|
|
||||||
SETUVAR fish_color_param:cyan
|
|
||||||
SETUVAR fish_color_quote:yellow
|
|
||||||
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
|
|
||||||
SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack
|
|
||||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
|
||||||
SETUVAR fish_color_status:red
|
|
||||||
SETUVAR fish_color_user:brgreen
|
|
||||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
|
||||||
SETUVAR fish_greeting:\x1d
|
|
||||||
SETUVAR fish_key_bindings:fish_default_key_bindings
|
|
||||||
SETUVAR fish_pager_color_completion:normal
|
|
||||||
SETUVAR fish_pager_color_description:B3A06D\x1eyellow\x1e\x2di
|
|
||||||
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
|
||||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
|
||||||
SETUVAR fish_pager_color_selected_background:\x2dr
|
|
||||||
SETUVAR fish_user_paths:/usr/lib/python3\x2e11/site\x2dpackages\x1e/usr/lib/python3\x2e11\x1e/usr/lib/python3\x2e11/site\x2dpackages/\x1e/home/janis/\x2elocal/lib/python3\x2e11/site\x2dpackages/\x1e/home/janis/\x2elocal/lib/python3\x2e11/
|
|
Loading…
x
Reference in New Issue
Block a user