From f93bc9dc42088c8e910223c9de3f5e7bc6715ceb Mon Sep 17 00:00:00 2001 From: Vijay A Date: Fri, 27 Aug 2021 10:43:48 +0530 Subject: docs: fixed template file for creating recipe. --- scripts/create.js | 4 ++-- scripts/sample_recipe/package.json | 2 +- scripts/sample_recipe/webview.js | 15 +++++++-------- 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]; const recipe = recipeName.toLowerCase().replace(/\s/g, '-'); const cleanRecipeId = recipe.replace(/[^a-z]/g, ''); // Clean recipe ID only containing a-z, for usage as the JavaScript class name const folderName = process.argv[3] || 'Ferdi'; -const filesThatNeedTextReplace = ['package.json', 'index.js', 'README.md']; +const filesThatNeedTextReplace = ['package.json', 'index.js', 'webview.js', 'README.md']; (async () => { // Folder paths @@ -49,7 +49,7 @@ const filesThatNeedTextReplace = ['package.json', 'index.js', 'README.md']; await fs.copy(sampleRecipe, newRecipeFolder); console.log('[Info] Copied recipe'); - // Replace "SERVICE" with the service name + // Replace placeholders with the recipe-specific values for (const file of filesThatNeedTextReplace) { const filePath = path.join(newRecipeFolder, file); 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 @@ { "id": "SERVICE", "name": "SNAME", - "version": "1.0.1", + "version": "1.0.0", "license": "MIT", "config": { "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 @@ -"use strict"; - -var _path = _interopRequireDefault(require("path")); +var _path = _interopRequireDefault(require('path')); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } module.exports = Ferdi => { - const getMessages = function getMessages() { - // TODO: Insert your notification-finding code here - Ferdi.setBadge(0, 0); - }; + // TODO: If your SNAME service has unread messages, uncomment these lines to implement the logic for updating the badges + // const getMessages = function getMessages() { + // // TODO: Insert your notification-finding code here + // Ferdi.setBadge(0, 0); + // }; + // Ferdi.loop(getMessages); - Ferdi.loop(getMessages); Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); }; -- cgit v1.2.3-54-g00ecf