coh-content-db-homecoming 2.0.0-rc.4 → 2.0.0-rc.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/.github/workflows/release.yml +1 -0
- package/CHANGELOG.md +24 -0
- package/README.md +2 -1
- package/dist/bundle.head.json +1 -0
- package/dist/bundle.json +1 -1
- package/dist/coh-content-db-homecoming.d.ts +2 -2
- package/dist/coh-content-db-homecoming.js +18 -17
- package/dist/coh-content-db-homecoming.js.map +1 -1
- package/dist/coh-content-db-homecoming.mjs +18 -17
- package/dist/coh-content-db-homecoming.mjs.map +1 -1
- package/package.json +3 -2
- package/rollup.config.mjs +9 -1
- package/src/main/lint/eslint-local.config.js +1 -0
- package/src/main/lint/rules/no-neg-zero.ts +36 -0
- package/src/main/lint/rules.ts +2 -0
- package/src/main/lint/utils/bundle-version.ts +3 -0
- package/src/main/ts/contact/pay-phone.ts +1 -1
- package/src/main/ts/homecoming.ts +13 -10
- package/src/test/lint/rules/no-neg-zero.test.ts +35 -0
- package/src/test/ts/badge-fields.test.ts +8 -7
- package/src/test/ts/badge-markdown-fields.test.ts +8 -6
- package/src/test/ts/badge-requirements.test.ts +6 -5
- package/src/test/ts/homecoming.test.ts +20 -2
- package/src/test/ts/link-tests.test.ts +15 -14
- package/tsconfig.json +2 -1
- package/src/main/ts/changelog.ts +0 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coh-content-db-homecoming",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.6",
|
|
4
4
|
"description": "City of Heroes Homecoming Content Database",
|
|
5
5
|
"homepage": "https://github.com/n15g/coh-content-db-homecoming#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"upgrade:db": "npm install --save coh-content-db@latest"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
28
29
|
"@stylistic/eslint-plugin": "^3.1.0",
|
|
29
30
|
"@stylistic/eslint-plugin-ts": "^3.1.0",
|
|
30
31
|
"@types/jest": "^29.5.14",
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"valid-url": "^1.0.9"
|
|
48
49
|
},
|
|
49
50
|
"dependencies": {
|
|
50
|
-
"coh-content-db": "^2.0.0-rc.
|
|
51
|
+
"coh-content-db": "^2.0.0-rc.9"
|
|
51
52
|
},
|
|
52
53
|
"engines": {
|
|
53
54
|
"node": ">=22"
|
package/rollup.config.mjs
CHANGED
|
@@ -2,13 +2,18 @@ import esbuild from 'rollup-plugin-esbuild'
|
|
|
2
2
|
import { dts } from 'rollup-plugin-dts'
|
|
3
3
|
import { writeFileSync } from 'node:fs'
|
|
4
4
|
import path from 'node:path'
|
|
5
|
+
import json from '@rollup/plugin-json'
|
|
5
6
|
|
|
6
7
|
const name = 'coh-content-db-homecoming'
|
|
7
8
|
|
|
8
9
|
// noinspection JSUnusedGlobalSymbols
|
|
9
10
|
export default [{
|
|
10
11
|
input: 'src/main/ts/index.ts',
|
|
11
|
-
plugins: [
|
|
12
|
+
plugins: [
|
|
13
|
+
esbuild(), // TypeScript
|
|
14
|
+
json(), // Reading version from package.json
|
|
15
|
+
exportBundleJson(), // Exporting the bundle.json
|
|
16
|
+
],
|
|
12
17
|
output: [{
|
|
13
18
|
file: `dist/${name}.js`,
|
|
14
19
|
format: 'cjs',
|
|
@@ -34,8 +39,11 @@ function exportBundleJson() {
|
|
|
34
39
|
name: 'write-json',
|
|
35
40
|
async 'writeBundle'() {
|
|
36
41
|
const bundle = await import(`./dist/${name}.mjs`)
|
|
42
|
+
const headPath = path.resolve('dist', 'bundle.head.json')
|
|
37
43
|
const bundlePath = path.resolve('dist', 'bundle.json')
|
|
38
44
|
// noinspection JSUnresolvedReference
|
|
45
|
+
writeFileSync(headPath, JSON.stringify(bundle.HOMECOMING.header))
|
|
46
|
+
// noinspection JSUnresolvedReference
|
|
39
47
|
writeFileSync(bundlePath, JSON.stringify(bundle.HOMECOMING))
|
|
40
48
|
},
|
|
41
49
|
}
|
|
@@ -24,6 +24,7 @@ module.exports = {
|
|
|
24
24
|
'local/no-invalid-href-protocol': ['error'],
|
|
25
25
|
'local/no-invalid-href-url': ['error'],
|
|
26
26
|
'local/no-invalid-key': ['error'],
|
|
27
|
+
'local/no-neg-zero': ['error'],
|
|
27
28
|
'local/prefer-acquisition-period': ['error'],
|
|
28
29
|
'local/prefer-effect-period': ['error'],
|
|
29
30
|
'local/prefer-effect-start': ['error'],
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { TSESTree } from '@typescript-eslint/utils'
|
|
2
|
+
import { createRule } from '../utils/create-rule'
|
|
3
|
+
|
|
4
|
+
export const noNegZero = createRule({
|
|
5
|
+
name: 'no-neg-zero',
|
|
6
|
+
meta: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: 'Detects numeric literals with an unnecessary value of negative zero that will not serialize to JSON.',
|
|
9
|
+
},
|
|
10
|
+
messages: {
|
|
11
|
+
error: 'Negative zero is not allowed.',
|
|
12
|
+
},
|
|
13
|
+
type: 'problem',
|
|
14
|
+
schema: [],
|
|
15
|
+
fixable: 'code',
|
|
16
|
+
},
|
|
17
|
+
defaultOptions: [],
|
|
18
|
+
create(context) {
|
|
19
|
+
return {
|
|
20
|
+
'UnaryExpression'(node: TSESTree.UnaryExpression) {
|
|
21
|
+
const sourceCode = context.sourceCode
|
|
22
|
+
|
|
23
|
+
const text = sourceCode.getText(node)
|
|
24
|
+
if (text !== '-0') return
|
|
25
|
+
|
|
26
|
+
context.report({
|
|
27
|
+
node,
|
|
28
|
+
messageId: 'error',
|
|
29
|
+
fix(fixer) {
|
|
30
|
+
return fixer.replaceText(node, '0')
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
})
|
package/src/main/lint/rules.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { preferEffectPeriod } from './rules/prefer-effect-period'
|
|
|
10
10
|
import { preferEffectStart } from './rules/prefer-effect-start'
|
|
11
11
|
import { preferSimpleAlternate } from './rules/prefer-simple-alternate'
|
|
12
12
|
import { noInvalidHrefProtocol } from './rules/no-invalid-href-protocol'
|
|
13
|
+
import { noNegZero } from './rules/no-neg-zero'
|
|
13
14
|
|
|
14
15
|
export const rules = {
|
|
15
16
|
'migrate-contact-link-title': migrateContactLinkTitle,
|
|
@@ -20,6 +21,7 @@ export const rules = {
|
|
|
20
21
|
'no-invalid-href-protocol': noInvalidHrefProtocol,
|
|
21
22
|
'no-invalid-href-url': noInvalidHrefUrl,
|
|
22
23
|
'no-invalid-key': noInvalidKey,
|
|
24
|
+
'no-neg-zero': noNegZero,
|
|
23
25
|
'prefer-acquisition-period': preferAcquisitionPeriod,
|
|
24
26
|
'prefer-effect-period': preferEffectPeriod,
|
|
25
27
|
'prefer-effect-start': preferEffectStart,
|
|
@@ -6,7 +6,7 @@ export const PayPhone: ContactData = {
|
|
|
6
6
|
name: 'Pay Phone',
|
|
7
7
|
title: 'Outdated Tech',
|
|
8
8
|
morality: 'primal',
|
|
9
|
-
location: { zoneKey: RiktiWarZone.key, coords: [3229.5,
|
|
9
|
+
location: { zoneKey: RiktiWarZone.key, coords: [3229.5, 0, -513] },
|
|
10
10
|
levelRange: [40, 50],
|
|
11
11
|
links: [{ title: 'Pay Phone', href: 'https://homecoming.wiki/wiki/Pay_Phone' }],
|
|
12
12
|
}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BundleData } from 'coh-content-db'
|
|
2
2
|
import { ZONES } from './zone/_zones'
|
|
3
3
|
import { BADGES } from './badge/_badges'
|
|
4
|
-
import { CHANGELOG } from './changelog'
|
|
5
4
|
import { CONTACTS } from './contact/_contacts'
|
|
6
5
|
import { MISSIONS } from './mission/_missions'
|
|
6
|
+
import { BUNDLE_VERSION } from '../lint/utils/bundle-version'
|
|
7
7
|
|
|
8
|
-
export const HOMECOMING:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
export const HOMECOMING: BundleData = {
|
|
9
|
+
header: {
|
|
10
|
+
name: 'Homecoming',
|
|
11
|
+
description: 'Content data for the CoH: Homecoming server.',
|
|
12
|
+
repositoryUrl: 'https://github.com/n15g/coh-content-db-homecoming',
|
|
13
|
+
changelogUrl: 'https://github.com/n15g/coh-content-db-homecoming/blob/master/CHANGELOG.md',
|
|
14
|
+
links: [
|
|
15
|
+
{ title: 'Homecoming Forums', href: 'https://forums.homecomingservers.com/' },
|
|
16
|
+
],
|
|
17
|
+
version: BUNDLE_VERSION,
|
|
18
|
+
},
|
|
14
19
|
servers: ['Everlasting', 'Excelsior', 'Indomitable', 'Reunion', 'Torchbearer', 'Victory'],
|
|
15
|
-
repository: 'https://github.com/n15g/coh-content-db-homecoming',
|
|
16
20
|
archetypes: [
|
|
17
21
|
{ key: 'arachnos-soldier', name: 'Arachnos Soldier' },
|
|
18
22
|
{ key: 'arachnos-widow', name: 'Arachnos Widow' },
|
|
@@ -34,5 +38,4 @@ export const HOMECOMING: ContentBundle = {
|
|
|
34
38
|
contacts: [...CONTACTS],
|
|
35
39
|
missions: [...MISSIONS],
|
|
36
40
|
badges: [...BADGES],
|
|
37
|
-
changelog: CHANGELOG,
|
|
38
41
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ruleTester } from '../utils/rule-tester'
|
|
2
|
+
import { noNegZero } from '../../../main/lint/rules/no-neg-zero'
|
|
3
|
+
|
|
4
|
+
ruleTester.run('should ignore anything not relevant', noNegZero, {
|
|
5
|
+
valid: [
|
|
6
|
+
{ name: 'positive zero', code: `const x = 0` },
|
|
7
|
+
{ name: 'in a string', code: `const x = '-0'` },
|
|
8
|
+
{ name: 'not a zero', code: `const x = -1` },
|
|
9
|
+
],
|
|
10
|
+
invalid: [],
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
ruleTester.run('should migrate', noNegZero, {
|
|
14
|
+
valid: [],
|
|
15
|
+
invalid: [
|
|
16
|
+
{
|
|
17
|
+
name: 'in declaration',
|
|
18
|
+
code: `const x = -0`,
|
|
19
|
+
errors: [{ messageId: 'error' }],
|
|
20
|
+
output: `const x = 0`,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'in object',
|
|
24
|
+
code: `const x = { id: -0 }`,
|
|
25
|
+
errors: [{ messageId: 'error' }],
|
|
26
|
+
output: `const x = { id: 0 }`,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'in coords',
|
|
30
|
+
code: `const x = { coords: [-0, 12, -0] }`,
|
|
31
|
+
errors: [{ messageId: 'error' }, { messageId: 'error' }],
|
|
32
|
+
output: `const x = { coords: [0, 12, 0] }`,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
})
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { BADGES } from '../../main/ts/badge/_badges'
|
|
1
2
|
import { CohContentDatabase } from 'coh-content-db'
|
|
2
3
|
import { HOMECOMING } from '../../main/ts'
|
|
3
|
-
import { BADGES } from '../../main/ts/badge/_badges'
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const TEST_DATABASE = new CohContentDatabase()
|
|
6
|
+
TEST_DATABASE.load(HOMECOMING)
|
|
6
7
|
|
|
7
8
|
describe('Badge Fields', () => {
|
|
8
9
|
test('should have at least an acquisition or explicit requirements', () => {
|
|
9
10
|
const errors: string[] = []
|
|
10
11
|
|
|
11
|
-
for (const badge of
|
|
12
|
+
for (const badge of TEST_DATABASE.badges) {
|
|
12
13
|
if (!badge?.acquisition && !badge.requirements?.length) errors.push(`['${badge.key}'] lacks an acquisition, requirements or location.`)
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -49,7 +50,7 @@ describe('Badge Fields', () => {
|
|
|
49
50
|
test('should end with a period', () => {
|
|
50
51
|
const errors: string[] = []
|
|
51
52
|
|
|
52
|
-
for (const badge of
|
|
53
|
+
for (const badge of TEST_DATABASE.badges) {
|
|
53
54
|
if (badge.acquisition && !badge?.acquisition?.endsWith('.')) errors.push(`['${badge.key}'].acquisition does not end with a period.`)
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -63,7 +64,7 @@ describe('Badge Fields', () => {
|
|
|
63
64
|
test('should end with a period', () => {
|
|
64
65
|
const errors: string[] = []
|
|
65
66
|
|
|
66
|
-
for (const badge of
|
|
67
|
+
for (const badge of TEST_DATABASE.badges) {
|
|
67
68
|
if (badge.effect && !badge?.effect?.endsWith('.')) errors.push(`['${badge.key}'].effect does not end with a period.`)
|
|
68
69
|
}
|
|
69
70
|
|
|
@@ -75,7 +76,7 @@ describe('Badge Fields', () => {
|
|
|
75
76
|
test(`should start with 'Awards' or 'Unlocks'`, () => {
|
|
76
77
|
const errors: string[] = []
|
|
77
78
|
|
|
78
|
-
for (const badge of
|
|
79
|
+
for (const badge of TEST_DATABASE.badges) {
|
|
79
80
|
if (badge.effect && !badge?.effect?.startsWith('Awards') && !badge?.effect.startsWith('Unlocks')) errors.push(`['${badge.key}'].effect does not start with 'Awards' or 'Unlocks'.`)
|
|
80
81
|
}
|
|
81
82
|
|
|
@@ -89,7 +90,7 @@ describe('Badge Fields', () => {
|
|
|
89
90
|
test('should not contain any http links', () => {
|
|
90
91
|
const errors: string[] = []
|
|
91
92
|
|
|
92
|
-
for (const badge of
|
|
93
|
+
for (const badge of TEST_DATABASE.badges) {
|
|
93
94
|
for (const icon of badge.icon.canonical) {
|
|
94
95
|
if (new URL(icon.value).protocol === 'http:') errors.push(`['${badge.key}'].links['${icon.value}'] contains an insecure (http) link.`)
|
|
95
96
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { CohContentDatabase } from 'coh-content-db'
|
|
2
2
|
import { HOMECOMING } from '../../main/ts'
|
|
3
3
|
|
|
4
|
+
const TEST_DATABASE = new CohContentDatabase()
|
|
5
|
+
TEST_DATABASE.load(HOMECOMING)
|
|
6
|
+
|
|
4
7
|
const LINK_PATTERN = /\((badge|zone|contact|mission):\/\/([^)]*)\)/g
|
|
5
|
-
const database = new CohContentDatabase(HOMECOMING)
|
|
6
8
|
|
|
7
9
|
function validateLinks(field?: string): [string, string][] {
|
|
8
10
|
if (!field) return []
|
|
@@ -13,10 +15,10 @@ function validateLinks(field?: string): [string, string][] {
|
|
|
13
15
|
.map(match => [match[1], match[2]])
|
|
14
16
|
|
|
15
17
|
for (const [type, key] of links) {
|
|
16
|
-
if (type === 'badge' && !
|
|
17
|
-
if (type === 'contact' && !
|
|
18
|
-
if (type === 'zone' && !
|
|
19
|
-
if (type === 'mission' && !
|
|
18
|
+
if (type === 'badge' && !TEST_DATABASE.getBadge(key)) errors.push(['badge', key])
|
|
19
|
+
if (type === 'contact' && !TEST_DATABASE.getContact(key)) errors.push(['contact', key])
|
|
20
|
+
if (type === 'zone' && !TEST_DATABASE.getZone(key)) errors.push(['zone', key])
|
|
21
|
+
if (type === 'mission' && !TEST_DATABASE.getMission(key)) errors.push(['mission', key])
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
return errors
|
|
@@ -26,7 +28,7 @@ describe('Markdown Links', () => {
|
|
|
26
28
|
test('should all be links to valid entities', () => {
|
|
27
29
|
const errors: string[] = []
|
|
28
30
|
|
|
29
|
-
for (const badge of
|
|
31
|
+
for (const badge of TEST_DATABASE.badges) {
|
|
30
32
|
for (const error of validateLinks(badge.acquisition)) errors.push(`['${badge.key}'].acquisition - ['${error[0]}:${error[1]}']`)
|
|
31
33
|
for (const error of validateLinks(badge.effect)) errors.push(`['${badge.key}'].effect - ['${error[0]}:${error[1]}']`)
|
|
32
34
|
for (const error of validateLinks(badge.notes)) errors.push(`['${badge.key}'].notes - ['${error[0]}:${error[1]}']`)
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { CohContentDatabase } from 'coh-content-db'
|
|
2
2
|
import { HOMECOMING } from '../../main/ts'
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const TEST_DATABASE = new CohContentDatabase()
|
|
5
|
+
TEST_DATABASE.load(HOMECOMING)
|
|
5
6
|
|
|
6
7
|
describe('Badge Requirements', () => {
|
|
7
8
|
test('should only contain valid references', () => {
|
|
8
9
|
const errors: string[] = []
|
|
9
10
|
|
|
10
|
-
for (const badge of
|
|
11
|
+
for (const badge of TEST_DATABASE.badges) {
|
|
11
12
|
for (const requirement of badge.requirements ?? []) {
|
|
12
|
-
if (!!requirement.badgeKey && !
|
|
13
|
-
if (!!requirement.missionKey && !
|
|
13
|
+
if (!!requirement.badgeKey && !TEST_DATABASE.getBadge(requirement.badgeKey)) errors.push(`['${badge.key}:${requirement.key}'].badgeKey['${requirement.badgeKey}']`)
|
|
14
|
+
if (!!requirement.missionKey && !TEST_DATABASE.getMission(requirement.missionKey)) errors.push(`['${badge.key}:${requirement.key}'].missionKey['${requirement.missionKey}']`)
|
|
14
15
|
for (const [locationIndex, location] of requirement?.location?.entries() ?? []) {
|
|
15
|
-
if (!!location.zoneKey && !
|
|
16
|
+
if (!!location.zoneKey && !TEST_DATABASE.getZone(location.zoneKey)) errors.push(`['${badge.key}:${requirement.key}'].location[${locationIndex}].zoneKey['${location.zoneKey}']`)
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as homecoming from '../../main/ts/homecoming'
|
|
2
2
|
import { HOMECOMING } from '../../main/ts'
|
|
3
|
-
import { CohContentDatabase } from 'coh-content-db'
|
|
3
|
+
import { BundleData, CohContentDatabase } from 'coh-content-db'
|
|
4
4
|
|
|
5
5
|
describe('HOMECOMING', () => {
|
|
6
6
|
test('should be defined', () => {
|
|
@@ -12,6 +12,24 @@ describe('HOMECOMING', () => {
|
|
|
12
12
|
})
|
|
13
13
|
|
|
14
14
|
test('should load into the db correctly', () => {
|
|
15
|
-
new CohContentDatabase(
|
|
15
|
+
const database = new CohContentDatabase()
|
|
16
|
+
database.load(HOMECOMING)
|
|
17
|
+
|
|
18
|
+
expect(database.header?.name).toBe('Homecoming')
|
|
19
|
+
expect(database.getBadge('received-the-atlas-medallion')?.type).toBe('accolade')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('should support export and import via JSON', () => {
|
|
23
|
+
const jsonString = JSON.stringify(HOMECOMING)
|
|
24
|
+
|
|
25
|
+
expect(jsonString).not.toBeUndefined()
|
|
26
|
+
|
|
27
|
+
const fromJson = JSON.parse(jsonString) as BundleData
|
|
28
|
+
expect(fromJson).toStrictEqual(HOMECOMING)
|
|
29
|
+
|
|
30
|
+
const database = new CohContentDatabase()
|
|
31
|
+
database.load(fromJson)
|
|
32
|
+
expect(database.header?.name).toBe('Homecoming')
|
|
33
|
+
expect(database.getBadge('received-the-atlas-medallion')?.type).toBe('accolade')
|
|
16
34
|
})
|
|
17
35
|
})
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { isValidProtocol, isValidUrl } from '../../main/ts/utils/uri-utils'
|
|
1
2
|
import { CohContentDatabase } from 'coh-content-db'
|
|
2
3
|
import { HOMECOMING } from '../../main/ts'
|
|
3
|
-
import { isValidProtocol, isValidUrl } from '../../main/ts/utils/uri-utils'
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const TEST_DATABASE = new CohContentDatabase()
|
|
6
|
+
TEST_DATABASE.load(HOMECOMING)
|
|
6
7
|
|
|
7
8
|
describe('Metadata', () => {
|
|
8
9
|
test('should not contain any http links', () => {
|
|
9
10
|
const errors: string[] = []
|
|
10
11
|
|
|
11
|
-
for (const link of
|
|
12
|
+
for (const link of TEST_DATABASE.header?.links ?? []) {
|
|
12
13
|
if (new URL(link.href).protocol === 'http:') errors.push(`metadata.links['${link.title}'] contains an insecure (http) link.`)
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -20,7 +21,7 @@ describe('Metadata', () => {
|
|
|
20
21
|
test('should not contain any unsupported protocols', () => {
|
|
21
22
|
const errors: string[] = []
|
|
22
23
|
|
|
23
|
-
for (const link of
|
|
24
|
+
for (const link of TEST_DATABASE.header?.links ?? []) {
|
|
24
25
|
if (!isValidProtocol(link.href)) errors.push(`metadata.links['${link.href}'] contains an unsupported protocol.`)
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -32,7 +33,7 @@ describe('Metadata', () => {
|
|
|
32
33
|
test('should be URL encoded', () => {
|
|
33
34
|
const errors: string[] = []
|
|
34
35
|
|
|
35
|
-
for (const link of
|
|
36
|
+
for (const link of TEST_DATABASE.header?.links ?? []) {
|
|
36
37
|
if (new URL(link.href).protocol === 'http:') errors.push(`metadata.links['${link.title}'] contains an insecure (http) link.`)
|
|
37
38
|
if (!isValidUrl(link.href)) errors.push(`metadata.links['${link.href}'] contains an unsafe URL character`)
|
|
38
39
|
}
|
|
@@ -48,7 +49,7 @@ describe('Badge', () => {
|
|
|
48
49
|
test('should not contain any http links', () => {
|
|
49
50
|
const errors: string[] = []
|
|
50
51
|
|
|
51
|
-
for (const badge of
|
|
52
|
+
for (const badge of TEST_DATABASE.badges) {
|
|
52
53
|
for (const link of badge.links) {
|
|
53
54
|
if (new URL(link.href).protocol === 'http:') errors.push(`['${badge.key}'].links['${link.title}'] contains an insecure (http) link.`)
|
|
54
55
|
}
|
|
@@ -68,7 +69,7 @@ describe('Badge', () => {
|
|
|
68
69
|
test('should not contain any unsupported protocols', () => {
|
|
69
70
|
const errors: string[] = []
|
|
70
71
|
|
|
71
|
-
for (const badge of
|
|
72
|
+
for (const badge of TEST_DATABASE.badges) {
|
|
72
73
|
for (const link of badge.links) {
|
|
73
74
|
if (!isValidProtocol(link.href)) errors.push(`['${badge.key}'].links['${link.href}'] contains an unsupported protocol.`)
|
|
74
75
|
}
|
|
@@ -88,7 +89,7 @@ describe('Badge', () => {
|
|
|
88
89
|
test('should be URL encoded', () => {
|
|
89
90
|
const errors: string[] = []
|
|
90
91
|
|
|
91
|
-
for (const badge of
|
|
92
|
+
for (const badge of TEST_DATABASE.badges) {
|
|
92
93
|
for (const link of badge.links) {
|
|
93
94
|
if (!isValidUrl(link.href)) errors.push(`['${badge.key}'].links['${link.href}'] contains an unsafe URL character.`)
|
|
94
95
|
}
|
|
@@ -111,7 +112,7 @@ describe('Contact', () => {
|
|
|
111
112
|
test('should not contain any http links', () => {
|
|
112
113
|
const errors: string[] = []
|
|
113
114
|
|
|
114
|
-
for (const contact of
|
|
115
|
+
for (const contact of TEST_DATABASE.contacts) {
|
|
115
116
|
for (const link of contact.links) {
|
|
116
117
|
if (new URL(link.href).protocol === 'http:') errors.push(`['${contact.key}'].links['${link.title}'] contains an insecure (http) link.`)
|
|
117
118
|
}
|
|
@@ -125,7 +126,7 @@ describe('Contact', () => {
|
|
|
125
126
|
test('should not contain any http links', () => {
|
|
126
127
|
const errors: string[] = []
|
|
127
128
|
|
|
128
|
-
for (const contact of
|
|
129
|
+
for (const contact of TEST_DATABASE.contacts) {
|
|
129
130
|
for (const link of contact.links) {
|
|
130
131
|
if (!isValidProtocol(link.href)) errors.push(`links['${link.href}'] contains an unsupported protocol.`)
|
|
131
132
|
}
|
|
@@ -139,7 +140,7 @@ describe('Contact', () => {
|
|
|
139
140
|
test('should be URL encoded', () => {
|
|
140
141
|
const errors: string[] = []
|
|
141
142
|
|
|
142
|
-
for (const contact of
|
|
143
|
+
for (const contact of TEST_DATABASE.contacts) {
|
|
143
144
|
for (const link of contact.links) {
|
|
144
145
|
if (!isValidUrl(link.href)) errors.push(`['${contact.key}'].links['${link.href}'] contains an unsafe URL character.`)
|
|
145
146
|
}
|
|
@@ -155,7 +156,7 @@ describe('Zone', () => {
|
|
|
155
156
|
test('should not contain any http links', () => {
|
|
156
157
|
const errors: string[] = []
|
|
157
158
|
|
|
158
|
-
for (const zone of
|
|
159
|
+
for (const zone of TEST_DATABASE.zones) {
|
|
159
160
|
for (const link of zone.links) {
|
|
160
161
|
if (new URL(link.href).protocol === 'http:') errors.push(`['${zone.key}'].links['${link.href}'] contains an insecure (http) link.`)
|
|
161
162
|
}
|
|
@@ -169,7 +170,7 @@ describe('Zone', () => {
|
|
|
169
170
|
test('should not contain any unsupported protocols', () => {
|
|
170
171
|
const errors: string[] = []
|
|
171
172
|
|
|
172
|
-
for (const zone of
|
|
173
|
+
for (const zone of TEST_DATABASE.zones) {
|
|
173
174
|
for (const link of zone.links) {
|
|
174
175
|
if (!isValidUrl(link.href)) errors.push(`['${zone.key}'].links['${link.href}'] contains an unsafe URL character.`)
|
|
175
176
|
}
|
|
@@ -183,7 +184,7 @@ describe('Zone', () => {
|
|
|
183
184
|
test('should be URL encoded', () => {
|
|
184
185
|
const errors: string[] = []
|
|
185
186
|
|
|
186
|
-
for (const zone of
|
|
187
|
+
for (const zone of TEST_DATABASE.zones) {
|
|
187
188
|
for (const link of zone.links) {
|
|
188
189
|
if (!isValidUrl(link.href)) errors.push(`['${zone.key}'].links['${link.href}'] contains an unsafe URL character`)
|
|
189
190
|
}
|
package/tsconfig.json
CHANGED
package/src/main/ts/changelog.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Change } from 'coh-content-db'
|
|
2
|
-
|
|
3
|
-
export const CHANGELOG: Change[] = [
|
|
4
|
-
{
|
|
5
|
-
version: '2.0.0',
|
|
6
|
-
date: new Date('2025-03-12'),
|
|
7
|
-
description: ''
|
|
8
|
-
+ '* Updated to [coh-content-db:2.0.0](https://github.com/n15g/coh-content-db).\n'
|
|
9
|
-
+ '* Added Mission and Contact data.\n'
|
|
10
|
-
+ '* Bundle data now available as JSON export.\n'
|
|
11
|
-
+ '* Change from GNU to The Unlicense.\n'
|
|
12
|
-
+ '* Moved from webpack to rollup for packaging.\n'
|
|
13
|
-
+ '* Add eslint for linting.\n'
|
|
14
|
-
+ '* Add jest for unit tests.\n'
|
|
15
|
-
+ '* Added GitHub Actions for CI.\n',
|
|
16
|
-
},
|
|
17
|
-
]
|