diff --git a/install/generator-cyphernode/generators/app/index.js b/install/generator-cyphernode/generators/app/index.js index ba91bbd..3a3e5d1 100644 --- a/install/generator-cyphernode/generators/app/index.js +++ b/install/generator-cyphernode/generators/app/index.js @@ -10,12 +10,43 @@ const coinstring = require('coinstring'); const uaCommentRegexp = /^[a-zA-Z0-9 \.,:_\-\?\/@]+$/; // TODO: look for spec of unsafe chars +const reset = '\u001B[u'; +const clear = '\u001Bc'; + + let prompters = []; -const normalizedPath = path.join(__dirname, "prompters"); -fs.readdirSync(normalizedPath).forEach(function(file) { - prompters.push(require(path.join(normalizedPath,file))); +fs.readdirSync(path.join(__dirname, "prompters")).forEach(function(file) { + prompters.push(require(path.join(__dirname, "prompters",file))); }); +const sleep = function(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +const splash = async function() { + let frames = []; + fs.readdirSync(path.join(__dirname,'splash')).forEach(function(file) { + frames.push(fs.readFileSync(path.join(__dirname,'splash',file))); + }); + + process.stdout.write(clear); + + process.stdout.write(reset); + process.stdout.write(frames[0]); + + await sleep(400); + + for( let frame of frames ) { + process.stdout.write(reset); + process.stdout.write(frame.toString()); + await sleep(33); + } + + await sleep(400); + + process.stdout.write('\n'); +} + module.exports = class extends Generator { constructor(args, opts) { @@ -44,16 +75,15 @@ module.exports = class extends Generator { } - prompting() { + async prompting() { if( this.recreate ) { // no prompts return; } - const splash = fs.readFileSync(this.templatePath('splash.txt')); - this.log(splash.toString()); + + await splash(); let prompts = []; - for( let m of prompters ) { prompts = prompts.concat(m.prompts(this)); } diff --git a/install/generator-cyphernode/generators/app/splash/01.png.txt b/install/generator-cyphernode/generators/app/splash/01.png.txt new file mode 100644 index 0000000..74e17cb --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/01.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/02.png.txt b/install/generator-cyphernode/generators/app/splash/02.png.txt new file mode 100644 index 0000000..dd52cfd --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/02.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/03.png.txt b/install/generator-cyphernode/generators/app/splash/03.png.txt new file mode 100644 index 0000000..02f1d96 --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/03.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/04.png.txt b/install/generator-cyphernode/generators/app/splash/04.png.txt new file mode 100644 index 0000000..33c66f4 --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/04.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/05.png.txt b/install/generator-cyphernode/generators/app/splash/05.png.txt new file mode 100644 index 0000000..162026e --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/05.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/06.png.txt b/install/generator-cyphernode/generators/app/splash/06.png.txt new file mode 100644 index 0000000..dd23868 --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/06.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/07.png.txt b/install/generator-cyphernode/generators/app/splash/07.png.txt new file mode 100644 index 0000000..93be9b3 --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/07.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/08.png.txt b/install/generator-cyphernode/generators/app/splash/08.png.txt new file mode 100644 index 0000000..f8990e0 --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/08.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/09.png.txt b/install/generator-cyphernode/generators/app/splash/09.png.txt new file mode 100644 index 0000000..e662e1b --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/09.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/10.png.txt b/install/generator-cyphernode/generators/app/splash/10.png.txt new file mode 100644 index 0000000..a56b5c7 --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/10.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/11.png.txt b/install/generator-cyphernode/generators/app/splash/11.png.txt new file mode 100644 index 0000000..386643d --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/11.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/12.png.txt b/install/generator-cyphernode/generators/app/splash/12.png.txt new file mode 100644 index 0000000..2d261ab --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/12.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/13.png.txt b/install/generator-cyphernode/generators/app/splash/13.png.txt new file mode 100644 index 0000000..ae6ffa7 --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/13.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/14.png.txt b/install/generator-cyphernode/generators/app/splash/14.png.txt new file mode 100644 index 0000000..7228c81 --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/14.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/splash/15.png.txt b/install/generator-cyphernode/generators/app/splash/15.png.txt new file mode 100644 index 0000000..74e17cb --- /dev/null +++ b/install/generator-cyphernode/generators/app/splash/15.png.txt @@ -0,0 +1,25 @@ +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          +                                          diff --git a/install/generator-cyphernode/generators/app/templates/splash.txt b/install/generator-cyphernode/generators/app/templates/splash.txt deleted file mode 100644 index 4250a2e..0000000 --- a/install/generator-cyphernode/generators/app/templates/splash.txt +++ /dev/null @@ -1,27 +0,0 @@ -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -                                            -