@jjlmoya/landings 0.4.0 → 0.5.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jjlmoya/landings",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -3,7 +3,9 @@ import { dirname, join } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
 
5
5
  const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
6
- const consumerRoot = process.env.INIT_CWD || process.cwd();
6
+ const consumerRoot = packageRoot.includes("node_modules")
7
+ ? join(packageRoot, "../../..")
8
+ : packageRoot;
7
9
  const publicRoot = join(consumerRoot, "public", "landings", "team");
8
10
  const styleFiles = [
9
11
  "team-landing.css",
@@ -0,0 +1,42 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { describe, expect, it } from 'vitest';
4
+ import { getFiles, relativePath } from './landing-test-helpers';
5
+
6
+ describe('Image format constraints', () => {
7
+ const srcDir = path.join(process.cwd(), 'src');
8
+ const allFiles = getFiles(srcDir);
9
+
10
+ it('should not contain any PNG or JPG files', () => {
11
+ const forbiddenExtensions = ['.png', '.jpg', '.jpeg', '.gif'];
12
+ const forbiddenFiles = allFiles.filter((file) =>
13
+ forbiddenExtensions.some((ext) => file.toLowerCase().endsWith(ext))
14
+ );
15
+
16
+ expect(
17
+ forbiddenFiles.map(relativePath),
18
+ 'Found non-webp image files in the project. Use only WebP format.'
19
+ ).toEqual([]);
20
+ });
21
+
22
+ it('should not reference non-webp image formats in source code', () => {
23
+ const codeFiles = allFiles.filter((file) =>
24
+ ['.ts', '.tsx', '.js', '.jsx', '.astro', '.css'].some((ext) => file.endsWith(ext))
25
+ );
26
+
27
+ const forbiddenPattern = /\.(png|jpg|jpeg|gif)\b/i;
28
+ const violations: string[] = [];
29
+
30
+ for (const file of codeFiles) {
31
+ const content = fs.readFileSync(file, 'utf-8');
32
+ if (forbiddenPattern.test(content)) {
33
+ violations.push(relativePath(file));
34
+ }
35
+ }
36
+
37
+ expect(
38
+ violations,
39
+ 'Code files referencing forbidden image extensions (.png, .jpg, .jpeg, .gif). Convert to WebP and update references.'
40
+ ).toEqual([]);
41
+ });
42
+ });