adapt-authoring-tags 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.
@@ -1,19 +1,15 @@
1
- name: Add to main project
1
+ # Calls the org-level reusable workflow to add PRs to the TODO Board
2
+
3
+ name: Add PR to Project
2
4
 
3
5
  on:
4
- issues:
5
- types:
6
- - opened
7
6
  pull_request:
8
7
  types:
9
8
  - opened
9
+ - reopened
10
10
 
11
11
  jobs:
12
12
  add-to-project:
13
- name: Add to main project
14
- runs-on: ubuntu-latest
15
- steps:
16
- - uses: actions/add-to-project@v0.1.0
17
- with:
18
- project-url: https://github.com/orgs/adapt-security/projects/5
19
- github-token: ${{ secrets.PROJECTS_SECRET }}
13
+ uses: adapt-security/.github/.github/workflows/new.yml@main
14
+ secrets:
15
+ PROJECTS_SECRET: ${{ secrets.PROJECTS_SECRET }}
@@ -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
- run: npx semantic-release
32
+ run: npx semantic-release
@@ -0,0 +1,13 @@
1
+ name: Standard.js formatting check
2
+ on: push
3
+ jobs:
4
+ default:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@master
8
+ - uses: actions/setup-node@master
9
+ with:
10
+ node-version: 'lts/*'
11
+ cache: 'npm'
12
+ - run: npm ci
13
+ - run: npx standard
package/lib/TagsModule.js CHANGED
@@ -81,22 +81,27 @@ class TagsModule extends AbstractApiModule {
81
81
  if (!mod.schemaName) {
82
82
  return this.log('warn', 'cannot register module, module doesn\'t define a schemaName')
83
83
  }
84
- await this.registerSchemas()
85
-
84
+ await this.registerSchema(mod)
85
+
86
86
  this.log('debug', `registered ${mod.name} for use with tags`)
87
87
  this.modules.push(mod)
88
88
  }
89
89
 
90
- /**
90
+ /**
91
+ * Register single module schema
92
+ */
93
+ async registerSchema (mod) {
94
+ try {
95
+ const jsonschema = await this.app.waitForModule('jsonschema')
96
+ jsonschema.extendSchema(mod.schemaName, this.schemaExtensionName)
97
+ } catch (e) {}
98
+ }
99
+
100
+ /**
91
101
  * Registers module schemas
92
102
  */
93
103
  async registerSchemas () {
94
- const jsonschema = await this.app.waitForModule('jsonschema')
95
- this.modules.forEach(mod => {
96
- try {
97
- jsonschema.extendSchema(mod.schemaName, this.schemaExtensionName)
98
- } catch(e) {}
99
- })
104
+ this.modules.forEach(mod => this.registerSchema(mod))
100
105
  }
101
106
 
102
107
  /**
@@ -128,15 +133,15 @@ class TagsModule extends AbstractApiModule {
128
133
  await Promise.all(this.modules.map(async m => {
129
134
  try {
130
135
  await m.updateMany({ tags: sourceId }, { $push: { tags: destId } }, { rawUpdate: true })
131
- if(req.apiData.query.deleteSourceTag !== 'true') await m.updateMany({ tags: sourceId }, { $pull: { tags: sourceId } }, { rawUpdate: true })
136
+ if (req.apiData.query.deleteSourceTag !== 'true') await m.updateMany({ tags: sourceId }, { $pull: { tags: sourceId } }, { rawUpdate: true })
132
137
  } catch (e) {
133
138
  this.log('warn', `Failed to transfer tag, ${e}`)
134
139
  }
135
140
  }))
136
- if(req.apiData.query.deleteSourceTag === 'true') {
141
+ if (req.apiData.query.deleteSourceTag === 'true') {
137
142
  await this.delete({ _id: sourceId })
138
143
  }
139
- } catch(e) {
144
+ } catch (e) {
140
145
  next(e)
141
146
  }
142
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adapt-authoring-tags",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Module for managing tags",
5
5
  "homepage": "https://github.com/adapt-security/adapt-authoring-tags",
6
6
  "license": "GPL-3.0",
@@ -13,16 +13,10 @@
13
13
  "adapt-authoring-mongodb": "github:adapt-security/adapt-authoring-mongodb"
14
14
  },
15
15
  "devDependencies": {
16
- "eslint": "^9.12.0",
17
- "standard": "^17.1.0",
18
- "@semantic-release/commit-analyzer": "^9.0.2",
19
16
  "@semantic-release/git": "^10.0.1",
20
- "@semantic-release/github": "^8.0.5",
21
- "@semantic-release/npm": "^9.0.1",
22
- "@semantic-release/release-notes-generator": "^10.0.3",
23
- "conventional-changelog-eslint": "^3.0.9",
24
- "semantic-release": "^21.0.1",
25
- "semantic-release-replace-plugin": "^1.2.7"
17
+ "conventional-changelog-eslint": "^6.0.0",
18
+ "semantic-release": "^25.0.2",
19
+ "standard": "^17.1.0"
26
20
  },
27
21
  "release": {
28
22
  "plugins": [
@@ -40,15 +34,7 @@
40
34
  ],
41
35
  "@semantic-release/npm",
42
36
  "@semantic-release/github",
43
- [
44
- "@semantic-release/git",
45
- {
46
- "assets": [
47
- "package.json"
48
- ],
49
- "message": "Chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
50
- }
51
- ]
37
+ "@semantic-release/git"
52
38
  ]
53
39
  }
54
40
  }
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- node_modules
package/.eslintrc DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "env": {
3
- "browser": false,
4
- "node": true,
5
- "commonjs": false,
6
- "es2020": true
7
- },
8
- "extends": [
9
- "standard"
10
- ],
11
- "parserOptions": {
12
- "ecmaVersion": 2020
13
- }
14
- }
@@ -1,16 +0,0 @@
1
- name: Add labelled PRs to project
2
-
3
- on:
4
- pull_request:
5
- types: [ labeled ]
6
-
7
- jobs:
8
- add-to-project:
9
- if: ${{ github.event.label.name == 'dependencies' }}
10
- name: Add to main project
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/add-to-project@v0.1.0
14
- with:
15
- project-url: https://github.com/orgs/adapt-security/projects/5
16
- github-token: ${{ secrets.PROJECTS_SECRET }}