aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/package.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/package.js')
-rw-r--r--scripts/package.js20
1 files changed, 1 insertions, 19 deletions
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 };