adapt-authoring-server 2.2.4 → 2.2.5

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
- name: Release
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
- config.routes = [...mergedDefaults, ...remaining]
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.2.4",
3
+ "version": "2.2.5",
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/git": "^10.0.1",
20
+ "@adaptlearning/semantic-release-config": "^1.0.0",
21
21
  "adapt-schemas": "^1.1.0",
22
- "conventional-changelog-eslint": "^6.0.0",
23
- "semantic-release": "^25.0.2",
24
22
  "standard": "^17.1.0"
25
23
  },
26
24
  "release": {
27
- "plugins": [
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
  }
@@ -301,7 +301,7 @@ describe('loadRouteConfig()', () => {
301
301
  })
302
302
 
303
303
  describe('defaults option', () => {
304
- it('should prepend default routes from template when defaults path is provided', async () => {
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, '/custom')
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, '/nomatch')
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 () => {