adapt-authoring-adaptframework 1.2.1 → 1.3.1

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.
@@ -3,10 +3,16 @@ on:
3
3
  push:
4
4
  branches:
5
5
  - master
6
+
6
7
  jobs:
7
8
  release:
8
9
  name: 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
10
16
  steps:
11
17
  - name: Checkout
12
18
  uses: actions/checkout@v3
@@ -16,10 +22,11 @@ jobs:
16
22
  uses: actions/setup-node@v3
17
23
  with:
18
24
  node-version: 'lts/*'
25
+ - name: Update npm
26
+ run: npm install -g npm@latest
19
27
  - name: Install dependencies
20
28
  run: npm ci
21
29
  - name: Release
22
30
  env:
23
31
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24
- NPM_TOKEN: ${{ secrets.AAT_NPM_TOKEN }}
25
32
  run: npx semantic-release
@@ -238,11 +238,9 @@ class AdaptFrameworkBuild {
238
238
  */
239
239
  async loadCourseData () {
240
240
  const content = await App.instance.waitForModule('content')
241
- const [course] = await content.find({ _id: this.courseId, _type: 'course' })
242
- if (!course) {
243
- throw App.instance.errors.NOT_FOUND.setData({ type: 'course', id: this.courseId })
244
- }
245
- const langDir = path.join(this.courseDir, 'en')
241
+ const course = await content.findOne({ _id: this.courseId, _type: 'course' })
242
+ const config = await content.findOne({ _courseId: this.courseId, _type: 'config' })
243
+ const langDir = path.join(this.courseDir, course._language ?? config._defaultLanguage ?? 'en')
246
244
  this.courseData = {
247
245
  course: { dir: langDir, fileName: 'course.json', data: undefined },
248
246
  config: { dir: this.courseDir, fileName: 'config.json', data: undefined },
@@ -463,11 +461,11 @@ class AdaptFrameworkBuild {
463
461
  await this.ensureDir(dir)
464
462
  const filepath = path.join(dir, fileName)
465
463
  const returnData = await FWUtils.writeJson(filepath, data)
466
- FWUtils.log('debug', 'WRITE', filepath)
464
+ FWUtils.log('verbose', 'WRITE', filepath)
467
465
  return returnData
468
466
  }))
469
467
  }
470
-
468
+
471
469
  /**
472
470
  * Creates a zip file containing all files relevant to the type of build being performed
473
471
  * @return {Promise}
@@ -65,11 +65,11 @@ class AdaptFrameworkUtils {
65
65
  static async readJson (filepath) {
66
66
  return JSON.parse(await fs.readFile(filepath))
67
67
  }
68
-
68
+
69
69
  static writeJson (filepath, data) {
70
70
  return fs.writeFile(filepath, (JSON.stringify(data, null, 2)))
71
71
  }
72
-
72
+
73
73
  /**
74
74
  * Infers the framework action to be executed from a given request URL
75
75
  * @param {external:ExpressRequest} req
@@ -225,7 +225,7 @@ class AdaptFrameworkUtils {
225
225
  }
226
226
  const filePath = path.resolve(buildData.location, req.path.slice(req.path.indexOf(id) + id.length + 1) || 'index.html')
227
227
  await res.sendFile(filePath, e => {
228
- if (e.code === 'ENOENT') e = App.instance.errors.NOT_FOUND.setData({ type: 'file', id: filePath })
228
+ if (e?.code === 'ENOENT') e = App.instance.errors.NOT_FOUND.setData({ type: 'file', id: filePath })
229
229
  next(e)
230
230
  })
231
231
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adapt-authoring-adaptframework",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
4
4
  "description": "Adapt framework integration for the Adapt authoring tool",
5
5
  "homepage": "https://github.com/adapt-security/adapt-authoring-adaptframework",
6
6
  "license": "GPL-3.0",
@@ -25,15 +25,15 @@
25
25
  "zipper": "github:adapt-security/zipper#v1.0.0"
26
26
  },
27
27
  "devDependencies": {
28
- "standard": "^17.1.0",
29
- "@semantic-release/commit-analyzer": "^9.0.2",
28
+ "@semantic-release/commit-analyzer": "^13.0.1",
30
29
  "@semantic-release/git": "^10.0.1",
31
- "@semantic-release/github": "^8.0.5",
32
- "@semantic-release/npm": "^9.0.1",
33
- "@semantic-release/release-notes-generator": "^10.0.3",
34
- "conventional-changelog-eslint": "^3.0.9",
35
- "semantic-release": "^21.0.1",
36
- "semantic-release-replace-plugin": "^1.2.7"
30
+ "@semantic-release/github": "^12.0.2",
31
+ "@semantic-release/npm": "^13.1.2",
32
+ "@semantic-release/release-notes-generator": "^14.1.0",
33
+ "conventional-changelog-eslint": "^6.0.0",
34
+ "semantic-release": "^25.0.2",
35
+ "semantic-release-replace-plugin": "^1.2.7",
36
+ "standard": "^17.1.0"
37
37
  },
38
38
  "release": {
39
39
  "plugins": [