aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-08-27 10:43:48 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-08-27 10:44:12 +0530
commitf93bc9dc42088c8e910223c9de3f5e7bc6715ceb (patch)
treefaf1aec711031de3e27cccb4e42ec6c6777876bb /scripts
parentFix Screensharing with Discord (#625) (diff)
downloadferdium-recipes-f93bc9dc42088c8e910223c9de3f5e7bc6715ceb.tar.gz
ferdium-recipes-f93bc9dc42088c8e910223c9de3f5e7bc6715ceb.tar.zst
ferdium-recipes-f93bc9dc42088c8e910223c9de3f5e7bc6715ceb.zip
docs: fixed template file for creating recipe.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/create.js4
-rw-r--r--scripts/sample_recipe/package.json2
-rw-r--r--scripts/sample_recipe/webview.js15
3 files changed, 10 insertions, 11 deletions
diff --git a/scripts/create.js b/scripts/create.js
index b41d6d0..506364a 100644
--- a/scripts/create.js
+++ b/scripts/create.js
@@ -21,7 +21,7 @@ const recipeName = process.argv[2];
21const recipe = recipeName.toLowerCase().replace(/\s/g, '-'); 21const recipe = recipeName.toLowerCase().replace(/\s/g, '-');
22const cleanRecipeId = recipe.replace(/[^a-z]/g, ''); // Clean recipe ID only containing a-z, for usage as the JavaScript class name 22const cleanRecipeId = recipe.replace(/[^a-z]/g, ''); // Clean recipe ID only containing a-z, for usage as the JavaScript class name
23const folderName = process.argv[3] || 'Ferdi'; 23const folderName = process.argv[3] || 'Ferdi';
24const filesThatNeedTextReplace = ['package.json', 'index.js', 'README.md']; 24const filesThatNeedTextReplace = ['package.json', 'index.js', 'webview.js', 'README.md'];
25 25
26(async () => { 26(async () => {
27 // Folder paths 27 // Folder paths
@@ -49,7 +49,7 @@ const filesThatNeedTextReplace = ['package.json', 'index.js', 'README.md'];
49 await fs.copy(sampleRecipe, newRecipeFolder); 49 await fs.copy(sampleRecipe, newRecipeFolder);
50 console.log('[Info] Copied recipe'); 50 console.log('[Info] Copied recipe');
51 51
52 // Replace "SERVICE" with the service name 52 // Replace placeholders with the recipe-specific values
53 for (const file of filesThatNeedTextReplace) { 53 for (const file of filesThatNeedTextReplace) {
54 const filePath = path.join(newRecipeFolder, file); 54 const filePath = path.join(newRecipeFolder, file);
55 let contents = await fs.readFile(filePath, 'utf-8'); 55 let contents = await fs.readFile(filePath, 'utf-8');
diff --git a/scripts/sample_recipe/package.json b/scripts/sample_recipe/package.json
index 6481f95..e2eba15 100644
--- a/scripts/sample_recipe/package.json
+++ b/scripts/sample_recipe/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "SERVICE", 2 "id": "SERVICE",
3 "name": "SNAME", 3 "name": "SNAME",
4 "version": "1.0.1", 4 "version": "1.0.0",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://SERVICE.com" 7 "serviceURL": "https://SERVICE.com"
diff --git a/scripts/sample_recipe/webview.js b/scripts/sample_recipe/webview.js
index ddd0b40..53924f2 100644
--- a/scripts/sample_recipe/webview.js
+++ b/scripts/sample_recipe/webview.js
@@ -1,15 +1,14 @@
1"use strict"; 1var _path = _interopRequireDefault(require('path'));
2
3var _path = _interopRequireDefault(require("path"));
4 2
5function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 3function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6 4
7module.exports = Ferdi => { 5module.exports = Ferdi => {
8 const getMessages = function getMessages() { 6 // TODO: If your SNAME service has unread messages, uncomment these lines to implement the logic for updating the badges
9 // TODO: Insert your notification-finding code here 7 // const getMessages = function getMessages() {
10 Ferdi.setBadge(0, 0); 8 // // TODO: Insert your notification-finding code here
11 }; 9 // Ferdi.setBadge(0, 0);
10 // };
11 // Ferdi.loop(getMessages);
12 12
13 Ferdi.loop(getMessages);
14 Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); 13 Ferdi.injectCSS(_path.default.join(__dirname, 'service.css'));
15}; 14};