diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/create.js | 6 | ||||
-rw-r--r-- | scripts/package.js | 20 | ||||
-rw-r--r-- | scripts/sample_recipe/icon.png | bin | 21037 -> 0 bytes |
3 files changed, 4 insertions, 22 deletions
diff --git a/scripts/create.js b/scripts/create.js index 12b0c15..b41d6d0 100644 --- a/scripts/create.js +++ b/scripts/create.js | |||
@@ -41,7 +41,7 @@ const filesThatNeedTextReplace = ['package.json', 'index.js', 'README.md']; | |||
41 | if (await fs.exists(newRecipeFolder)) { | 41 | if (await fs.exists(newRecipeFolder)) { |
42 | console.log('⚠️ Recipe already exists'); | 42 | console.log('⚠️ Recipe already exists'); |
43 | return; | 43 | return; |
44 | } | 44 | } |
45 | 45 | ||
46 | console.log('[Info] Passed pre-checks'); | 46 | console.log('[Info] Passed pre-checks'); |
47 | 47 | ||
@@ -62,9 +62,9 @@ const filesThatNeedTextReplace = ['package.json', 'index.js', 'README.md']; | |||
62 | 62 | ||
63 | open(newRecipeFolder); | 63 | open(newRecipeFolder); |
64 | console.log(`✅ Successfully created your recipe. | 64 | console.log(`✅ Successfully created your recipe. |
65 | 65 | ||
66 | What's next? | 66 | What's next? |
67 | - Make sure you restart Ferdi in order for the recipe to show up | 67 | - Make sure you restart Ferdi in order for the recipe to show up |
68 | - Customise "webview.js", "package.json", "icon.svg" and "icon.png (see https://github.com/getferdi/recipes/blob/master/docs/integration.md#recipe-structure) | 68 | - Customise "webview.js", "package.json" and "icon.svg" (see https://github.com/getferdi/recipes/blob/master/docs/integration.md#recipe-structure) |
69 | - Publish your recipe (see https://github.com/getferdi/recipes/blob/master/docs/integration.md#publishing)`); | 69 | - Publish your recipe (see https://github.com/getferdi/recipes/blob/master/docs/integration.md#publishing)`); |
70 | })(); | 70 | })(); |
diff --git a/scripts/package.js b/scripts/package.js index a6c23ca..36f6a4a 100644 --- a/scripts/package.js +++ b/scripts/package.js | |||
@@ -62,7 +62,6 @@ const compress = (src, dest) => new Promise((resolve, reject) => { | |||
62 | const recipeSrc = path.join(recipesFolder, recipe); | 62 | const recipeSrc = path.join(recipesFolder, recipe); |
63 | const packageJson = path.join(recipeSrc, 'package.json'); | 63 | const packageJson = path.join(recipeSrc, 'package.json'); |
64 | const svgIcon = path.join(recipeSrc, 'icon.svg'); | 64 | const svgIcon = path.join(recipeSrc, 'icon.svg'); |
65 | const pngIcon = path.join(recipeSrc, 'icon.png'); | ||
66 | 65 | ||
67 | // Check that package.json exists | 66 | // Check that package.json exists |
68 | if (!await fs.pathExists(packageJson)) { | 67 | if (!await fs.pathExists(packageJson)) { |
@@ -73,18 +72,10 @@ const compress = (src, dest) => new Promise((resolve, reject) => { | |||
73 | 72 | ||
74 | // Check that icons exist | 73 | // Check that icons exist |
75 | const hasSvg = await fs.pathExists(svgIcon); | 74 | const hasSvg = await fs.pathExists(svgIcon); |
76 | const hasPng = await fs.pathExists(pngIcon); | 75 | if (!hasSvg) { |
77 | if (!hasSvg && !hasPng) { | ||
78 | console.log(`⚠️ Couldn't package "${recipe}": Recipe doesn't contain an icon SVG and PNG`); | ||
79 | unsuccessful++; | ||
80 | } else if (!hasSvg) { | ||
81 | console.log(`⚠️ Couldn't package "${recipe}": Recipe doesn't contain an icon SVG`); | 76 | console.log(`⚠️ Couldn't package "${recipe}": Recipe doesn't contain an icon SVG`); |
82 | unsuccessful++; | 77 | unsuccessful++; |
83 | continue; | 78 | continue; |
84 | } else if (!hasPng) { | ||
85 | console.log(`⚠️ Couldn't package "${recipe}": Recipe doesn't contain an icon PNG`); | ||
86 | unsuccessful++; | ||
87 | continue; | ||
88 | } | 79 | } |
89 | 80 | ||
90 | // Check icons sizes | 81 | // Check icons sizes |
@@ -96,14 +87,6 @@ const compress = (src, dest) => new Promise((resolve, reject) => { | |||
96 | continue; | 87 | continue; |
97 | } | 88 | } |
98 | 89 | ||
99 | const pngSize = sizeOf(pngIcon); | ||
100 | const pngHasRightSize = pngSize.width === 1024 && pngSize.height === 1024; | ||
101 | if (!pngHasRightSize) { | ||
102 | console.log(`⚠️ Couldn't package "${recipe}": Recipe PNG icon dimensions should be 1024x1024`); | ||
103 | unsuccessful++; | ||
104 | continue; | ||
105 | } | ||
106 | |||
107 | // Read package.json | 90 | // Read package.json |
108 | const config = await fs.readJson(packageJson) | 91 | const config = await fs.readJson(packageJson) |
109 | 92 | ||
@@ -181,7 +164,6 @@ const compress = (src, dest) => new Promise((resolve, reject) => { | |||
181 | "name": config.name, | 164 | "name": config.name, |
182 | "version": config.version, | 165 | "version": config.version, |
183 | "icons": { | 166 | "icons": { |
184 | "png": `${repo}${config.id}/icon.png`, | ||
185 | "svg": `${repo}${config.id}/icon.svg`, | 167 | "svg": `${repo}${config.id}/icon.svg`, |
186 | }, | 168 | }, |
187 | }; | 169 | }; |
diff --git a/scripts/sample_recipe/icon.png b/scripts/sample_recipe/icon.png deleted file mode 100644 index dec90e0..0000000 --- a/scripts/sample_recipe/icon.png +++ /dev/null | |||
Binary files differ | |||