adapt-authoring-server 2.2.4 → 2.3.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.
|
@@ -1,32 +1,16 @@
|
|
|
1
1
|
name: Release
|
|
2
|
+
|
|
2
3
|
on:
|
|
3
4
|
push:
|
|
4
5
|
branches:
|
|
5
6
|
- master
|
|
6
7
|
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
issues: write
|
|
11
|
+
pull-requests: write
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
7
14
|
jobs:
|
|
8
15
|
release:
|
|
9
|
-
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
permissions:
|
|
12
|
-
contents: write # to be able to publish a GitHub release
|
|
13
|
-
issues: write # to be able to comment on released issues
|
|
14
|
-
pull-requests: write # to be able to comment on released pull requests
|
|
15
|
-
id-token: write # to enable use of OIDC for trusted publishing and npm provenance
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout
|
|
18
|
-
uses: actions/checkout@v3
|
|
19
|
-
with:
|
|
20
|
-
fetch-depth: 0
|
|
21
|
-
- name: Setup Node.js
|
|
22
|
-
uses: actions/setup-node@v3
|
|
23
|
-
with:
|
|
24
|
-
node-version: 'lts/*'
|
|
25
|
-
- name: Update npm
|
|
26
|
-
run: npm install -g npm@latest
|
|
27
|
-
- name: Install dependencies
|
|
28
|
-
run: npm install
|
|
29
|
-
- name: Release
|
|
30
|
-
env:
|
|
31
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
32
|
-
run: npx semantic-release
|
|
16
|
+
uses: adaptlearning/semantic-release-config/.github/workflows/release.yml@master
|
|
@@ -83,7 +83,8 @@ export async function loadRouteConfig (rootDir, target, options = {}) {
|
|
|
83
83
|
return { ...d, ...rest, handlers: { ...d.handlers, ...rest.handlers } }
|
|
84
84
|
})
|
|
85
85
|
const remaining = customRoutes.filter(r => !r.override || !matched.has(r.route))
|
|
86
|
-
|
|
86
|
+
// Custom routes must come before defaults so they take priority in Express's first-match routing
|
|
87
|
+
config.routes = [...remaining, ...mergedDefaults]
|
|
87
88
|
} else {
|
|
88
89
|
config.routes = customRoutes
|
|
89
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adapt-authoring-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Provides an Express application routing and more",
|
|
5
5
|
"homepage": "https://github.com/adapt-security/adapt-authoring-server",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -17,37 +17,11 @@
|
|
|
17
17
|
"lodash": "^4.17.21"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@semantic-release
|
|
21
|
-
"adapt-schemas": "^
|
|
22
|
-
"conventional-changelog-eslint": "^6.0.0",
|
|
23
|
-
"semantic-release": "^25.0.2",
|
|
20
|
+
"@adaptlearning/semantic-release-config": "^1.0.0",
|
|
21
|
+
"adapt-schemas": "^3.1.0",
|
|
24
22
|
"standard": "^17.1.0"
|
|
25
23
|
},
|
|
26
24
|
"release": {
|
|
27
|
-
"
|
|
28
|
-
[
|
|
29
|
-
"@semantic-release/commit-analyzer",
|
|
30
|
-
{
|
|
31
|
-
"preset": "eslint"
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
[
|
|
35
|
-
"@semantic-release/release-notes-generator",
|
|
36
|
-
{
|
|
37
|
-
"preset": "eslint"
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
"@semantic-release/npm",
|
|
41
|
-
"@semantic-release/github",
|
|
42
|
-
[
|
|
43
|
-
"@semantic-release/git",
|
|
44
|
-
{
|
|
45
|
-
"assets": [
|
|
46
|
-
"package.json"
|
|
47
|
-
],
|
|
48
|
-
"message": "Chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
]
|
|
25
|
+
"extends": "@adaptlearning/semantic-release-config"
|
|
52
26
|
}
|
|
53
27
|
}
|
|
@@ -34,9 +34,9 @@ describe('loadRouteConfig()', () => {
|
|
|
34
34
|
// Build shared schema registry with the server's base schemas, mirroring how
|
|
35
35
|
// adapt-authoring-jsonschema auto-discovers schema/ files from all dependencies at startup
|
|
36
36
|
schemas = new Schemas()
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
schemas.init()
|
|
38
|
+
schemas.registerSchema(path.join(SCHEMA_DIR, 'routes.schema.json'))
|
|
39
|
+
schemas.registerSchema(path.join(SCHEMA_DIR, 'routeitem.schema.json'))
|
|
40
40
|
|
|
41
41
|
// Mock App.instance.waitForModule so loadRouteConfig can resolve 'jsonschema'
|
|
42
42
|
// without a running app instance
|
|
@@ -150,7 +150,7 @@ describe('loadRouteConfig()', () => {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
})
|
|
153
|
-
|
|
153
|
+
schemas.registerSchema(schemaFile)
|
|
154
154
|
try {
|
|
155
155
|
const dir = path.join(tmpDir, 'consumer-fields')
|
|
156
156
|
await mkdir(dir, { recursive: true })
|
|
@@ -188,7 +188,7 @@ describe('loadRouteConfig()', () => {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
})
|
|
191
|
-
|
|
191
|
+
schemas.registerSchema(schemaFile)
|
|
192
192
|
try {
|
|
193
193
|
const dir = path.join(tmpDir, 'missing-route-field')
|
|
194
194
|
await mkdir(dir, { recursive: true })
|
|
@@ -217,7 +217,7 @@ describe('loadRouteConfig()', () => {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
})
|
|
220
|
-
|
|
220
|
+
schemas.registerSchema(schemaFile)
|
|
221
221
|
try {
|
|
222
222
|
const dir = path.join(tmpDir, 'missing-schemaname')
|
|
223
223
|
await mkdir(dir, { recursive: true })
|
|
@@ -270,7 +270,7 @@ describe('loadRouteConfig()', () => {
|
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
before(async () => {
|
|
273
|
-
|
|
273
|
+
schemas.registerSchema(await writeJson(path.join(tmpDir, 'perm-routes.schema.json'), permSchema))
|
|
274
274
|
})
|
|
275
275
|
|
|
276
276
|
after(() => schemas.deregisterSchema('perm-routes'))
|
|
@@ -301,7 +301,7 @@ describe('loadRouteConfig()', () => {
|
|
|
301
301
|
})
|
|
302
302
|
|
|
303
303
|
describe('defaults option', () => {
|
|
304
|
-
it('should
|
|
304
|
+
it('should place custom routes before default routes for correct Express matching', async () => {
|
|
305
305
|
const dir = path.join(tmpDir, 'with-defaults')
|
|
306
306
|
await mkdir(dir, { recursive: true })
|
|
307
307
|
await writeJson(path.join(dir, 'routes.json'), {
|
|
@@ -318,8 +318,8 @@ describe('loadRouteConfig()', () => {
|
|
|
318
318
|
}
|
|
319
319
|
const config = await loadRouteConfig(dir, target, { defaults: defaultsPath })
|
|
320
320
|
assert.equal(config.routes.length, 2)
|
|
321
|
-
assert.equal(config.routes[0].route, '/')
|
|
322
|
-
assert.equal(config.routes[1].route, '/
|
|
321
|
+
assert.equal(config.routes[0].route, '/custom')
|
|
322
|
+
assert.equal(config.routes[1].route, '/')
|
|
323
323
|
})
|
|
324
324
|
|
|
325
325
|
it('should resolve handler strings in default routes using handlerAliases', async () => {
|
|
@@ -450,8 +450,8 @@ describe('loadRouteConfig()', () => {
|
|
|
450
450
|
})
|
|
451
451
|
const config = await loadRouteConfig(dir, { myHandler: () => {} }, { defaults: defaultsPath })
|
|
452
452
|
assert.equal(config.routes.length, 2)
|
|
453
|
-
assert.equal(config.routes[0].route, '/')
|
|
454
|
-
assert.equal(config.routes[1].route, '/
|
|
453
|
+
assert.equal(config.routes[0].route, '/nomatch')
|
|
454
|
+
assert.equal(config.routes[1].route, '/')
|
|
455
455
|
})
|
|
456
456
|
|
|
457
457
|
it('should strip the override flag from merged route', async () => {
|