@jjlmoya/utils-science 1.9.0 → 1.10.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 +62 -62
- package/src/tests/schemas_fulfillment.test.ts +23 -0
- package/src/tests/title_quality.test.ts +55 -0
- package/src/tool/asteroid-impact/component.astro +1 -1
- package/src/tool/cellular-renewal/i18n/fr.ts +1 -1
- package/src/tool/microwave-detector/i18n/fr.ts +1 -1
- package/src/tool/simulation-probability/i18n/fr.ts +1 -1
package/package.json
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
2
|
+
"name": "@jjlmoya/utils-science",
|
|
3
|
+
"version": "1.10.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./src/index.ts",
|
|
6
|
+
"types": "./src/index.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.ts",
|
|
9
|
+
"./data": "./src/data.ts"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"src"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "astro dev",
|
|
19
|
+
"start": "astro dev",
|
|
20
|
+
"build": "astro build",
|
|
21
|
+
"preview": "astro preview",
|
|
22
|
+
"astro": "astro",
|
|
23
|
+
"lint": "eslint src/ --max-warnings 0 && stylelint \"src/**/*.{css,astro}\"",
|
|
24
|
+
"check": "astro check",
|
|
25
|
+
"type-check": "astro check",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"preversion": "npm run lint && npm run test",
|
|
28
|
+
"postversion": "git push && git push --tags",
|
|
29
|
+
"patch": "npm version patch",
|
|
30
|
+
"minor": "npm version minor",
|
|
31
|
+
"major": "npm version major"
|
|
32
|
+
},
|
|
33
|
+
"lint-staged": {
|
|
34
|
+
"*.{ts,tsx,astro}": [
|
|
35
|
+
"eslint --fix"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@iconify-json/mdi": "^1.2.3",
|
|
40
|
+
"@jjlmoya/utils-shared": "1.2.0",
|
|
41
|
+
"astro": "^6.1.2",
|
|
42
|
+
"astro-icon": "^1.1.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"leaflet": "^1.9.4"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@astrojs/check": "^0.9.8",
|
|
49
|
+
"eslint": "^9.39.4",
|
|
50
|
+
"eslint-plugin-astro": "^1.6.0",
|
|
51
|
+
"eslint-plugin-no-comments": "^1.1.10",
|
|
52
|
+
"husky": "^9.1.7",
|
|
53
|
+
"leaflet": "^1.9.4",
|
|
54
|
+
"lint-staged": "^16.4.0",
|
|
55
|
+
"postcss-html": "^1.8.1",
|
|
56
|
+
"schema-dts": "^1.1.2",
|
|
57
|
+
"stylelint": "^17.6.0",
|
|
58
|
+
"stylelint-config-standard": "^40.0.0",
|
|
59
|
+
"stylelint-declaration-strict-value": "^1.11.1",
|
|
60
|
+
"typescript": "^5.4.0",
|
|
61
|
+
"typescript-eslint": "^8.58.0",
|
|
62
|
+
"vitest": "^4.1.2"
|
|
63
|
+
}
|
|
64
64
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { ALL_TOOLS } from '../tools';
|
|
3
|
+
import type { ToolLocaleContent } from '../types';
|
|
4
|
+
|
|
5
|
+
describe.skip('Schemas Fulfillment Validation', () => {
|
|
6
|
+
ALL_TOOLS.forEach((tool) => {
|
|
7
|
+
describe(`Tool: ${tool.entry.id}`, () => {
|
|
8
|
+
Object.keys(tool.entry.i18n).forEach((locale) => {
|
|
9
|
+
it(`Locale: ${locale} should have faqSchema, appSchema and howToSchema`, async () => {
|
|
10
|
+
const loader = tool.entry.i18n[locale as keyof typeof tool.entry.i18n];
|
|
11
|
+
if (!loader) return;
|
|
12
|
+
const content = (await loader()) as ToolLocaleContent;
|
|
13
|
+
|
|
14
|
+
const schemaTypes = content.schemas.map((s: any) => s['@type']);
|
|
15
|
+
|
|
16
|
+
expect(schemaTypes, `Tool "${tool.entry.id}" locale "${locale}" is missing FAQPage schema`).toContain('FAQPage');
|
|
17
|
+
expect(schemaTypes, `Tool "${tool.entry.id}" locale "${locale}" is missing SoftwareApplication schema`).toContain('SoftwareApplication');
|
|
18
|
+
expect(schemaTypes, `Tool "${tool.entry.id}" locale "${locale}" is missing HowTo schema`).toContain('HowTo');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { describe, it } from 'vitest';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
function getFiles(dir: string, ext: string[]): string[] {
|
|
6
|
+
const results: string[] = [];
|
|
7
|
+
if (!fs.existsSync(dir)) return results;
|
|
8
|
+
const list = fs.readdirSync(dir);
|
|
9
|
+
for (const file of list) {
|
|
10
|
+
const fullPath = path.join(dir, file);
|
|
11
|
+
const stat = fs.statSync(fullPath);
|
|
12
|
+
if (stat && stat.isDirectory()) {
|
|
13
|
+
results.push(...getFiles(fullPath, ext));
|
|
14
|
+
} else if (ext.some((e) => file.endsWith(e))) {
|
|
15
|
+
results.push(fullPath);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return results;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const SRC_DIR = path.join(process.cwd(), 'src');
|
|
22
|
+
|
|
23
|
+
describe('Project Titles - Separator Validation', () => {
|
|
24
|
+
const files = [
|
|
25
|
+
...getFiles(path.join(SRC_DIR, 'tool'), ['.ts']),
|
|
26
|
+
...getFiles(path.join(SRC_DIR, 'category'), ['.ts']),
|
|
27
|
+
].filter(f => f.includes('i18n'));
|
|
28
|
+
|
|
29
|
+
it.each(files)('Verify that titles in %s do not contain | or -', (filePath) => {
|
|
30
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
31
|
+
const relativePath = path.relative(process.cwd(), filePath);
|
|
32
|
+
|
|
33
|
+
const titlePatterns = [
|
|
34
|
+
/const\s+title\s*=\s*['"]([^'"]+)['"]/g,
|
|
35
|
+
/title\s*:\s*['"]([^'"]+)['"]/g,
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const findings: string[] = [];
|
|
39
|
+
|
|
40
|
+
for (const pattern of titlePatterns) {
|
|
41
|
+
let match;
|
|
42
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
43
|
+
const title = match[1];
|
|
44
|
+
if (title.includes('|') || title.includes('-')) {
|
|
45
|
+
findings.push(title);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (findings.length > 0) {
|
|
51
|
+
const list = findings.map((f) => ` - "${f}"`).join('\n');
|
|
52
|
+
throw new Error(`Forbidden separators (| or -) found in titles in ${relativePath}:\n${list}`);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -9,7 +9,6 @@ const { ui } = Astro.props;
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
|
12
|
-
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
|
13
12
|
|
|
14
13
|
<div class="asteroid-app" id="asteroid-app">
|
|
15
14
|
<div id="asteroid-game-map" class="asteroid-game-map" style="touch-action: none;"></div>
|
|
@@ -170,6 +169,7 @@ const { ui } = Astro.props;
|
|
|
170
169
|
</div>
|
|
171
170
|
|
|
172
171
|
<script>
|
|
172
|
+
import L from "leaflet";
|
|
173
173
|
import { ImpactPhysics, type Composition } from "./logic/impactPhysics";
|
|
174
174
|
import { VERDICT_CONFIGS } from "./constants";
|
|
175
175
|
import { getCompositionColor } from "./utils";
|
|
@@ -2,7 +2,7 @@ import type { ToolLocaleContent } from '../../../types';
|
|
|
2
2
|
|
|
3
3
|
export const content: ToolLocaleContent = {
|
|
4
4
|
slug: 'calculateur-renouvellement-cellulaire',
|
|
5
|
-
title: 'Calculateur de Renouvellement Cellulaire : Que reste
|
|
5
|
+
title: 'Calculateur de Renouvellement Cellulaire : Que reste t il du "vous" original ?',
|
|
6
6
|
description: 'Calculez le pourcentage de votre corps qui s\'est renouvelé depuis votre naissance. Estimation basée sur le taux de division cellulaire des organes, des os et des tissus. Le Paradoxe de Thésée rendu tangible.',
|
|
7
7
|
faqTitle: 'Questions Fréquemment Posées',
|
|
8
8
|
bibliographyTitle: 'Bibliographie',
|
|
@@ -2,7 +2,7 @@ import type { ToolLocaleContent } from '../../../types';
|
|
|
2
2
|
|
|
3
3
|
export const content: ToolLocaleContent = {
|
|
4
4
|
slug: 'detecteur-fuites-micro-ondes',
|
|
5
|
-
title: 'Détecteur de Fuites Micro
|
|
5
|
+
title: 'Détecteur de Fuites Micro ondes : Visualiseur d\'Interférences WiFi',
|
|
6
6
|
description: 'Analysez si votre micro-ondes perd des radiations en mesurant l\'interférence en temps réel sur votre réseau WiFi. Outil de sécurité scientifique.',
|
|
7
7
|
faqTitle: 'Questions Fréquemment Posées',
|
|
8
8
|
bibliographyTitle: 'Bibliographie',
|
|
@@ -2,7 +2,7 @@ import type { ToolLocaleContent } from '../../../types';
|
|
|
2
2
|
|
|
3
3
|
export const content: ToolLocaleContent = {
|
|
4
4
|
slug: 'calculateur-probabilite-simulation',
|
|
5
|
-
title: 'Calculateur de Probabilité de Simulation : Vivez
|
|
5
|
+
title: 'Calculateur de Probabilité de Simulation : Vivez vous dans un univers virtuel ?',
|
|
6
6
|
description: 'Analysez si notre réalité est une simulation en utilisant l\'argument du trilemme de Nick Bostrom. Calculez la probabilité existentielle avec 4 paramètres clés.',
|
|
7
7
|
faqTitle: 'Questions Fréquemment Posées',
|
|
8
8
|
bibliographyTitle: 'Bibliographie',
|