@fullstackunicorn/websites 1.0.7 → 1.0.10

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/modules/images.js CHANGED
@@ -27,25 +27,24 @@ class Images {
27
27
  getPicture = async ({ file, folder }) => {
28
28
 
29
29
  const picture = {}
30
- const pathParsed = path.parse(file.path)
30
+ const pathParsed = path.posix.parse(file.path)
31
31
 
32
- picture.dir = pathParsed.dir ? `${pathParsed.dir}/` : ''
32
+ picture.dir = pathParsed.dir || ''
33
33
 
34
34
  picture.original = pathParsed.base
35
35
  picture.ext = this.getExtension(pathParsed)
36
36
  picture.base = sharp(file.buffer)
37
37
  picture.name = pathParsed.name
38
- picture.src = `${folder}/${picture.dir}TS/${picture.name}${picture.ext}`
38
+ picture.src = path.posix.join(folder, picture.dir, 'TS', `${picture.name}${picture.ext}`)
39
39
 
40
- picture.pathJson = `${picture.dir}${picture.name}.json`.replace(/^\/+/, '')
41
- picture.pathImg = `${picture.dir}${picture.name}${picture.ext}`.replace(/^\/+/, '')
40
+ picture.pathJson = path.posix.join(picture.dir, `${picture.name}.json`)
41
+ picture.pathImg = path.posix.join(picture.dir, `${picture.name}${picture.ext}`)
42
42
 
43
43
  return picture
44
44
  }
45
45
 
46
46
  getPathThumbnail = ({ picture, entry }) => {
47
- const relPath = `${picture.dir}/${entry[0]}/${picture.name}${picture.ext}`.replace(/^\/+/, '')
48
- return relPath
47
+ return path.posix.join(picture.dir, entry[0], `${picture.name}${picture.ext}`)
49
48
  }
50
49
 
51
50
  getPictureData = async ({ picture }) => {
@@ -97,7 +96,7 @@ class Images {
97
96
  }
98
97
 
99
98
  generate = async ({ file, folder }) => {
100
-
99
+
101
100
  const picture = await this.getPicture({ file, folder })
102
101
  const pictureData = await this.getPictureData({ picture })
103
102
 
@@ -127,7 +126,7 @@ class Images {
127
126
  const thumbPath = this.getPathThumbnail({ picture, entry })
128
127
 
129
128
  let buffer
130
- if (pictureData.x === w) buffer = originalBuffer
129
+ if (pictureData.x === w) buffer = originalBuffer
131
130
  else buffer = await this.getBuffer({ picture, entry })
132
131
 
133
132
  this.appendFile(result, key, { path: thumbPath, file: buffer })
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.7",
2
+ "version": "1.0.10",
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",