@01-edu/shared 1.0.0 → 1.0.2
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/bin/check-definitions.js +28 -0
- package/package.json +7 -6
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFile, stat } from 'node:fs/promises'
|
|
4
|
+
|
|
5
|
+
import { checkAndBuildDefinitions } from '../definitions-checker.js'
|
|
6
|
+
|
|
7
|
+
const auditValidation = validation => validation.type.endsWith('_audit')
|
|
8
|
+
const result = await checkAndBuildDefinitions(async key => {
|
|
9
|
+
const referencePath = `content${key ? `/${key}` : ''}/def.json`
|
|
10
|
+
const def = JSON.parse(await readFile(referencePath, 'utf8'))
|
|
11
|
+
def.attrs || (def.attrs = {})
|
|
12
|
+
def.referencePath = referencePath
|
|
13
|
+
switch (def.type) {
|
|
14
|
+
case 'project':
|
|
15
|
+
// biome-ignore lint/suspicious/noFallthroughSwitchClause: We want to fallthrough
|
|
16
|
+
case 'raid': {
|
|
17
|
+
await stat(`content/${key}/audit/README.md`)
|
|
18
|
+
}
|
|
19
|
+
case 'exercise': {
|
|
20
|
+
await stat(`content/${key}/README.md`)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return def
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Extra checks:
|
|
28
|
+
// - Orphan files (defs files not referenced anywhere)
|
package/package.json
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@01-edu/shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
+
"./bin/check-definitions.js",
|
|
10
11
|
"./event-utils.js",
|
|
12
|
+
"./event-utils.js",
|
|
13
|
+
"./lodash.deburr.js",
|
|
14
|
+
"./onboarding.js",
|
|
11
15
|
"./onboarding.js",
|
|
12
16
|
"./path.js",
|
|
13
17
|
"./programming-languages.js",
|
|
14
18
|
"./score.js",
|
|
15
19
|
"./skill-definitions.js",
|
|
16
|
-
"./toolbox.js"
|
|
17
|
-
"./event-utils.js",
|
|
18
|
-
"./lodash.deburr.js",
|
|
19
|
-
"./onboarding.js"
|
|
20
|
+
"./toolbox.js"
|
|
20
21
|
],
|
|
21
22
|
"license": "MIT",
|
|
22
23
|
"bin": {
|
|
23
|
-
"check-
|
|
24
|
+
"check-defs": "./bin/check-definitions.js"
|
|
24
25
|
},
|
|
25
26
|
"repository": {
|
|
26
27
|
"type": "git",
|