@skillswaveca/nova-shared-libraries 5.0.0 → 5.1.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.
- package/.github/workflows/release.yml +11 -6
- package/docs-base/package-info.js +5 -5
- package/package.json +27 -11
- package/packages/drivers/package.json +1 -1
- package/packages/nova-middleware/package.json +1 -1
- package/packages/nova-model/package.json +1 -1
- package/packages/nova-router/package.json +1 -1
- package/packages/nova-utils/package.json +1 -1
- package/packages/nova-utils/src/config.js +27 -5
- package/packages/drivers/README.md +0 -5
- package/packages/nova-middleware/README.md +0 -5
- package/packages/nova-model/README.md +0 -5
- package/packages/nova-router/README.md +0 -5
- package/packages/nova-utils/README.md +0 -5
- package/scripts/create-library-template/README.md +0 -5
|
@@ -8,6 +8,9 @@ on:
|
|
|
8
8
|
jobs:
|
|
9
9
|
release:
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
id-token: write
|
|
11
14
|
|
|
12
15
|
steps:
|
|
13
16
|
- uses: pnpm/action-setup@v4
|
|
@@ -21,11 +24,14 @@ jobs:
|
|
|
21
24
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
22
25
|
|
|
23
26
|
- name: Set up Node.js
|
|
24
|
-
uses: actions/setup-node@
|
|
27
|
+
uses: actions/setup-node@v5
|
|
25
28
|
with:
|
|
26
29
|
node-version: 22
|
|
27
|
-
cache:
|
|
28
|
-
registry-url:
|
|
30
|
+
cache: "pnpm"
|
|
31
|
+
registry-url: "https://registry.npmjs.org/"
|
|
32
|
+
|
|
33
|
+
- name: Update npm for OIDC support
|
|
34
|
+
run: npm install -g npm@latest
|
|
29
35
|
|
|
30
36
|
- name: Install dependencies
|
|
31
37
|
run: pnpm install --frozen-lockfile
|
|
@@ -48,6 +54,7 @@ jobs:
|
|
|
48
54
|
git add .
|
|
49
55
|
if ! git diff-index --quiet HEAD --; then
|
|
50
56
|
git commit -m "chore: update changelog, docs, and index"
|
|
57
|
+
git pull --rebase origin main
|
|
51
58
|
git push --follow-tags origin main
|
|
52
59
|
else
|
|
53
60
|
echo "No changes to commit"
|
|
@@ -88,6 +95,4 @@ jobs:
|
|
|
88
95
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
89
96
|
|
|
90
97
|
- name: Publish to npm
|
|
91
|
-
|
|
92
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
93
|
-
run: pnpm -r publish --access public
|
|
98
|
+
run: npm publish --access public
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
export const packageInfo = [
|
|
2
2
|
{
|
|
3
3
|
"name": "@skillswaveca/nova-utils",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.1.0",
|
|
5
5
|
"description": "A collection of random utils used in nova repos",
|
|
6
6
|
"docsPath": "./nova-utils/index.html"
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
9
|
"name": "@skillswaveca/nova-router",
|
|
10
|
-
"version": "5.
|
|
10
|
+
"version": "5.1.0",
|
|
11
11
|
"description": "An extended Koa router that enables better validation",
|
|
12
12
|
"docsPath": "./nova-router/index.html"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "@skillswaveca/nova-model",
|
|
16
|
-
"version": "5.
|
|
16
|
+
"version": "5.1.0",
|
|
17
17
|
"description": "Nova model stuff",
|
|
18
18
|
"docsPath": "./nova-model/index.html"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "@skillswaveca/nova-middleware",
|
|
22
|
-
"version": "5.
|
|
22
|
+
"version": "5.1.0",
|
|
23
23
|
"description": "A collection of middleware used by nova projects",
|
|
24
24
|
"docsPath": "./nova-middleware/index.html"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"name": "@skillswaveca/nova-drivers",
|
|
28
|
-
"version": "5.
|
|
28
|
+
"version": "5.1.0",
|
|
29
29
|
"description": "Some helper drivers for AWS services",
|
|
30
30
|
"docsPath": "./drivers/index.html"
|
|
31
31
|
}
|
package/package.json
CHANGED
|
@@ -3,9 +3,22 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-shared-libraries",
|
|
4
4
|
"description": "A monorepo of shared libraries for Nova projects.",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "5.
|
|
6
|
+
"version": "5.1.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"workspaces": [
|
|
10
|
+
"packages/*"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"release": "pnpm run bump-version && pnpm run create-index",
|
|
14
|
+
"docs": "pnpm run aggregate-docs && npx sirv docs/drivers --dev --single",
|
|
15
|
+
"bump-version": "node scripts/bump-version.js",
|
|
16
|
+
"create-index": "node scripts/create-index.js",
|
|
17
|
+
"create-library": "node ./scripts/create-library.js",
|
|
18
|
+
"generate-docs": "echo \"Building docs\"",
|
|
19
|
+
"aggregate-docs": "pnpm recursive run generate-docs && node ./scripts/aggregate-docs.js && rollup -c",
|
|
20
|
+
"test": "echo \"Tests\""
|
|
21
|
+
},
|
|
9
22
|
"keywords": [],
|
|
10
23
|
"author": "SkillsWave",
|
|
11
24
|
"dependencies": {
|
|
@@ -41,7 +54,7 @@
|
|
|
41
54
|
"@semantic-release/npm": "^13.1.1",
|
|
42
55
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
43
56
|
"@typescript-eslint/parser": "^8.46.4",
|
|
44
|
-
"chai": "^
|
|
57
|
+
"chai": "^5.2.0",
|
|
45
58
|
"documentation": "^14.0.3",
|
|
46
59
|
"eslint": "^9.39.1",
|
|
47
60
|
"eslint-config-brightspace": "^2.11.0",
|
|
@@ -57,14 +70,17 @@
|
|
|
57
70
|
"sirv-cli": "^3.0.1",
|
|
58
71
|
"stylelint": "^16.25.0"
|
|
59
72
|
},
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
"pnpm": {
|
|
74
|
+
"overrides": {
|
|
75
|
+
"braces@<3.0.3": ">=3.0.3",
|
|
76
|
+
"cross-spawn@<7.0.5": ">=7.0.5",
|
|
77
|
+
"micromatch@<4.0.8": ">=4.0.8",
|
|
78
|
+
"brace-expansion@<1.1.11": "^1.1.11",
|
|
79
|
+
"brace-expansion@>=2.0.0 <2.0.2": "^2.0.2",
|
|
80
|
+
"vue-template-compiler@<2.7.16": ">=2.7.16",
|
|
81
|
+
"prismjs@<1.30.0": ">=1.30.0",
|
|
82
|
+
"nanoid@<3.3.8": ">=3.3.8",
|
|
83
|
+
"@babel/helpers@<7.26.10": ">=7.26.10"
|
|
84
|
+
}
|
|
69
85
|
}
|
|
70
86
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-drivers",
|
|
4
4
|
"description": "Some helper drivers for AWS services",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "5.
|
|
6
|
+
"version": "5.1.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-middleware",
|
|
4
4
|
"description": "A collection of middleware used by nova projects",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "5.
|
|
6
|
+
"version": "5.1.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-model",
|
|
4
4
|
"description": "Nova model stuff",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "5.
|
|
6
|
+
"version": "5.1.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-router",
|
|
4
4
|
"description": "An extended Koa router that enables better validation",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "5.
|
|
6
|
+
"version": "5.1.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-utils",
|
|
4
4
|
"description": "A collection of random utils used in nova repos",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "5.
|
|
6
|
+
"version": "5.1.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -28,7 +28,7 @@ export const deepMerge = (obj1, obj2) => {
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Flattens a nested object into a single-level object with underscore-separated keys.
|
|
31
|
-
*
|
|
31
|
+
* Arrays are flattened using numeric indices (e.g., items_0, items_1).
|
|
32
32
|
*
|
|
33
33
|
* @param {Object} data - The nested object to flatten.
|
|
34
34
|
* @param {string} prefix - The prefix to prepend to each key in the flattened object.
|
|
@@ -37,7 +37,17 @@ export const deepMerge = (obj1, obj2) => {
|
|
|
37
37
|
export const flattenConfig = (data, prefix = '') => {
|
|
38
38
|
return Object.keys(data).reduce((acc, key) => {
|
|
39
39
|
const fullPath = prefix.length ? `${prefix}_${key}` : key;
|
|
40
|
-
if (
|
|
40
|
+
if (Array.isArray(data[key])) {
|
|
41
|
+
// Flatten array elements with numeric indices
|
|
42
|
+
data[key].forEach((item, index) => {
|
|
43
|
+
const arrayPath = `${fullPath}_${index}`;
|
|
44
|
+
if (typeof item === 'object' && item !== null) {
|
|
45
|
+
Object.assign(acc, flattenConfig(item, arrayPath));
|
|
46
|
+
} else {
|
|
47
|
+
acc[arrayPath] = `${item}`;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
} else if (typeof data[key] === 'object' && data[key] !== null) {
|
|
41
51
|
Object.assign(acc, flattenConfig(data[key], fullPath));
|
|
42
52
|
} else {
|
|
43
53
|
acc[fullPath] = `${data[key]}`;
|
|
@@ -66,9 +76,16 @@ const convertToType = value => {
|
|
|
66
76
|
return value;
|
|
67
77
|
};
|
|
68
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Checks if a string represents a numeric array index.
|
|
81
|
+
* @param {string} str - The string to check.
|
|
82
|
+
* @returns {boolean} - True if the string is a valid numeric index.
|
|
83
|
+
*/
|
|
84
|
+
const isNumericIndex = str => /^\d+$/.test(str);
|
|
85
|
+
|
|
69
86
|
/**
|
|
70
87
|
* Unflattens a configuration object whose keys are paths (using underscores as separators),
|
|
71
|
-
* ignoring specific top-level attributes.
|
|
88
|
+
* ignoring specific top-level attributes. Properly reconstructs arrays when numeric indices are detected.
|
|
72
89
|
* @param {Object} flatConfig - The flat configuration object, defaulting to process.env.
|
|
73
90
|
* @param {Array} ignoreList - List of top-level attribute keys to ignore.
|
|
74
91
|
* @returns {Object} - The reconstructed nested configuration object.
|
|
@@ -91,8 +108,13 @@ export const unflattenConfig = (flatConfig = process.env, ignoreList = ['LAMBDA'
|
|
|
91
108
|
// If it's the last part, set the value
|
|
92
109
|
current[part] = convertToType(value);
|
|
93
110
|
} else {
|
|
94
|
-
//
|
|
95
|
-
|
|
111
|
+
// Look ahead to see if the next part is a numeric index
|
|
112
|
+
const nextPart = parts[i + 1];
|
|
113
|
+
const shouldBeArray = isNumericIndex(nextPart);
|
|
114
|
+
// Initialize as array or object based on the next part
|
|
115
|
+
if (current[part] === undefined) {
|
|
116
|
+
current[part] = shouldBeArray ? [] : {};
|
|
117
|
+
}
|
|
96
118
|
current = current[part];
|
|
97
119
|
}
|
|
98
120
|
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# Nova Drivers
|
|
2
|
-
|
|
3
|
-
## Description
|
|
4
|
-
Nova Drivers is a collection of helper drivers developed to make integration with third party systems simpler. This project is part of the larger Nova Shared Libraries monorepo. The drivers provided in this project aim to simplify and streamline the interaction with various third party services.
|
|
5
|
-
|