aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/load.js
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2020-02-02 17:35:22 +0100
committerLibravatar vantezzen <hello@vantezzen.io>2020-02-02 17:35:22 +0100
commit1e6e6aff48be8fa2470c383d1c459c3bf852b835 (patch)
tree9118e806f82629b0842b46e4594aad16c00cac3f /scripts/load.js
parentBump discord recipe version number (diff)
downloadferdium-recipes-1e6e6aff48be8fa2470c383d1c459c3bf852b835.tar.gz
ferdium-recipes-1e6e6aff48be8fa2470c383d1c459c3bf852b835.tar.zst
ferdium-recipes-1e6e6aff48be8fa2470c383d1c459c3bf852b835.zip
Add load recipe script
Diffstat (limited to 'scripts/load.js')
-rw-r--r--scripts/load.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/load.js b/scripts/load.js
new file mode 100644
index 0000000..3c11240
--- /dev/null
+++ b/scripts/load.js
@@ -0,0 +1,39 @@
1/**
2 * Load recipe into development folder
3 */
4const fs = require('fs-extra');
5const path = require('path');
6
7console.log('load: Load recipe into development folder');
8console.log('This command will empty the recipe_src folder. Please make sure that there are no important files in that directory.');
9
10const recipe = process.argv[2];
11if (!recipe) {
12 console.log('Usage: yarn load [recipe]');
13 return;
14}
15
16console.log(`Loading ${recipe}`);
17
18// Create paths to important files
19const recipeSrc = path.join(__dirname, 'recipe_src');
20const recipePkg = path.join(__dirname, '../', 'uncompressed', recipe);
21
22// Let us work in an async environment
23(async () => {
24 // Check that recipe folder exists
25 if (!await fs.pathExists(recipePkg)) {
26 console.log(`Error: Recipe ${recipe} does not exist.`);
27 return;
28 }
29
30 console.log('Emptying directory...');
31
32 await fs.emptyDir(recipeSrc);
33
34 console.log('Copying data...');
35
36 await fs.copy(recipePkg, recipeSrc);
37
38 console.log('Done');
39})(); \ No newline at end of file