@fullstackunicorn/websites 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.dep.js +4 -4
- package/index.js +0 -1
- package/modules/images.js +16 -12
- package/package.json +3 -3
package/index.dep.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
// @FULLSTACKUNICORN
|
|
2
|
+
export { fsa } from '@fullstackunicorn/filesystem'
|
|
3
|
+
|
|
1
4
|
// NODE BUILT IN
|
|
2
5
|
export { default as path } from 'path'
|
|
3
6
|
|
|
4
|
-
//
|
|
5
|
-
export { fsa } from '@fullstackunicorn/filesystem'
|
|
6
|
-
|
|
7
|
-
// TOOLS
|
|
7
|
+
// PACKAGE
|
|
8
8
|
export * as blurhash from "blurhash"
|
|
9
9
|
export { default as sharp } from 'sharp'
|
package/index.js
CHANGED
package/modules/images.js
CHANGED
|
@@ -24,7 +24,7 @@ class Images {
|
|
|
24
24
|
return ext
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
getPicture = async ({ file,
|
|
27
|
+
getPicture = async ({ file, folder }) => {
|
|
28
28
|
|
|
29
29
|
const picture = {}
|
|
30
30
|
const pathParsed = path.parse(file.path)
|
|
@@ -35,7 +35,7 @@ class Images {
|
|
|
35
35
|
picture.ext = this.getExtension(pathParsed)
|
|
36
36
|
picture.base = sharp(file.buffer)
|
|
37
37
|
picture.name = pathParsed.name
|
|
38
|
-
picture.src = `${
|
|
38
|
+
picture.src = `${folder}/${picture.dir}TS/${picture.name}${picture.ext}`
|
|
39
39
|
|
|
40
40
|
picture.pathJson = `${picture.dir}${picture.name}.json`.replace(/^\/+/, '')
|
|
41
41
|
picture.pathImg = `${picture.dir}${picture.name}${picture.ext}`.replace(/^\/+/, '')
|
|
@@ -96,8 +96,9 @@ class Images {
|
|
|
96
96
|
return buffer
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
generate = async ({ file,
|
|
100
|
-
|
|
99
|
+
generate = async ({ file, folder }) => {
|
|
100
|
+
|
|
101
|
+
const picture = await this.getPicture({ file, folder })
|
|
101
102
|
const pictureData = await this.getPictureData({ picture })
|
|
102
103
|
|
|
103
104
|
const result = {}
|
|
@@ -117,17 +118,20 @@ class Images {
|
|
|
117
118
|
|
|
118
119
|
const created = []
|
|
119
120
|
for (const entry of Object.entries(this.widths)) {
|
|
120
|
-
if (pictureData.x <= entry[1]) continue
|
|
121
121
|
|
|
122
|
-
const
|
|
122
|
+
const key = entry[0]
|
|
123
|
+
const w = entry[1]
|
|
124
|
+
|
|
125
|
+
if (pictureData.x < w) continue
|
|
126
|
+
|
|
123
127
|
const thumbPath = this.getPathThumbnail({ picture, entry })
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
})
|
|
130
|
-
created.push(
|
|
129
|
+
let buffer
|
|
130
|
+
if (pictureData.x === w) buffer = originalBuffer
|
|
131
|
+
else buffer = await this.getBuffer({ picture, entry })
|
|
132
|
+
|
|
133
|
+
this.appendFile(result, key, { path: thumbPath, file: buffer })
|
|
134
|
+
created.push(key)
|
|
131
135
|
}
|
|
132
136
|
|
|
133
137
|
F3.logs('✅ Created: ', created.join(' '))
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.6",
|
|
3
3
|
"name": "@fullstackunicorn/websites",
|
|
4
4
|
"author": "lucanigido (https://fullstackunicorn.dev/author/lucanigido)",
|
|
5
5
|
"description": "A development utility for generating icons, favicons, thumbnails and all what is needed for websites",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"#@/*": "./*"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
|
-
"
|
|
33
|
-
"
|
|
32
|
+
"cmd": "chmod +x ./config.cmd.sh && ./config.cmd.sh",
|
|
33
|
+
"test": "exit 1"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@fullstackunicorn/filesystem": "^1.0.4",
|