@ccp-nc/crystvis-js 0.5.0 → 0.6.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.
Files changed (179) hide show
  1. package/.github/dependabot.yml +69 -0
  2. package/.github/workflows/dependency-review.yml +91 -0
  3. package/.github/workflows/security-scan.yml +113 -0
  4. package/.github/workflows/test.yml +191 -0
  5. package/.github/workflows/update-dependencies.yml +214 -0
  6. package/CHANGELOG.md +36 -0
  7. package/LICENSE +0 -0
  8. package/README.html +0 -0
  9. package/README.md +5 -1
  10. package/audit.txt +37 -0
  11. package/changes.txt +27 -0
  12. package/docs/.nojekyll +0 -0
  13. package/docs/data/search.json +1 -0
  14. package/docs/fonts/Inconsolata-Regular.ttf +0 -0
  15. package/docs/fonts/OpenSans-Regular.ttf +0 -0
  16. package/docs/fonts/WorkSans-Bold.ttf +0 -0
  17. package/docs/index.html +10 -0
  18. package/docs/lib_model.module_js-AtomImage.html +3 -0
  19. package/docs/lib_model.module_js-BondImage.html +3 -0
  20. package/docs/lib_model.module_js-Model.html +3 -0
  21. package/docs/lib_model.module_js.html +3 -0
  22. package/docs/lib_modelview.module_js-ModelView.html +12 -0
  23. package/docs/lib_modelview.module_js.html +3 -0
  24. package/docs/lib_visualizer.module_js-CrystVis.html +3 -0
  25. package/docs/lib_visualizer.module_js.html +3 -0
  26. package/docs/model.js.html +2160 -0
  27. package/docs/modelview.js.html +449 -0
  28. package/docs/scripts/core.js +726 -0
  29. package/docs/scripts/core.min.js +23 -0
  30. package/docs/scripts/resize.js +90 -0
  31. package/docs/scripts/search.js +265 -0
  32. package/docs/scripts/search.min.js +6 -0
  33. package/docs/scripts/third-party/Apache-License-2.0.txt +202 -0
  34. package/docs/scripts/third-party/fuse.js +9 -0
  35. package/docs/scripts/third-party/hljs-line-num-original.js +369 -0
  36. package/docs/scripts/third-party/hljs-line-num.js +1 -0
  37. package/docs/scripts/third-party/hljs-original.js +5171 -0
  38. package/docs/scripts/third-party/hljs.js +1 -0
  39. package/docs/scripts/third-party/popper.js +5 -0
  40. package/docs/scripts/third-party/tippy.js +1 -0
  41. package/docs/scripts/third-party/tocbot.js +672 -0
  42. package/docs/scripts/third-party/tocbot.min.js +1 -0
  43. package/docs/styles/clean-jsdoc-theme-base.css +1159 -0
  44. package/docs/styles/clean-jsdoc-theme-dark.css +412 -0
  45. package/docs/styles/clean-jsdoc-theme-light.css +482 -0
  46. package/docs/styles/clean-jsdoc-theme-scrollbar.css +30 -0
  47. package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
  48. package/docs/styles/clean-jsdoc-theme.min.css +1 -0
  49. package/docs/tutorial-Events.html +13 -0
  50. package/docs/tutorial-Queries.html +16 -0
  51. package/docs/tutorial-ThreejsMigration.html +25 -0
  52. package/docs/visualizer.js.html +574 -0
  53. package/docs-tutorials/Events.md +0 -0
  54. package/docs-tutorials/Queries.md +0 -0
  55. package/docs-tutorials/ThreejsMigration.md +96 -0
  56. package/eslint.config.js +41 -0
  57. package/fonts/OpenSans/OFL.txt +0 -0
  58. package/fonts/OpenSans/OpenSans-Italic-VariableFont_wdth,wght.ttf +0 -0
  59. package/fonts/OpenSans/OpenSans-VariableFont_wdth,wght.ttf +0 -0
  60. package/fonts/OpenSans/README.txt +0 -0
  61. package/fonts/OpenSans/static/OpenSans/OpenSans-Bold.ttf +0 -0
  62. package/fonts/OpenSans/static/OpenSans/OpenSans-BoldItalic.ttf +0 -0
  63. package/fonts/OpenSans/static/OpenSans/OpenSans-ExtraBold.ttf +0 -0
  64. package/fonts/OpenSans/static/OpenSans/OpenSans-ExtraBoldItalic.ttf +0 -0
  65. package/fonts/OpenSans/static/OpenSans/OpenSans-Italic.ttf +0 -0
  66. package/fonts/OpenSans/static/OpenSans/OpenSans-Light.ttf +0 -0
  67. package/fonts/OpenSans/static/OpenSans/OpenSans-LightItalic.ttf +0 -0
  68. package/fonts/OpenSans/static/OpenSans/OpenSans-Medium.ttf +0 -0
  69. package/fonts/OpenSans/static/OpenSans/OpenSans-MediumItalic.ttf +0 -0
  70. package/fonts/OpenSans/static/OpenSans/OpenSans-Regular.ttf +0 -0
  71. package/fonts/OpenSans/static/OpenSans/OpenSans-SemiBold.ttf +0 -0
  72. package/fonts/OpenSans/static/OpenSans/OpenSans-SemiBoldItalic.ttf +0 -0
  73. package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-Bold.ttf +0 -0
  74. package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-BoldItalic.ttf +0 -0
  75. package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-ExtraBold.ttf +0 -0
  76. package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-ExtraBoldItalic.ttf +0 -0
  77. package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-Italic.ttf +0 -0
  78. package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-Light.ttf +0 -0
  79. package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-LightItalic.ttf +0 -0
  80. package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-Medium.ttf +0 -0
  81. package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-MediumItalic.ttf +0 -0
  82. package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-Regular.ttf +0 -0
  83. package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-SemiBold.ttf +0 -0
  84. package/fonts/OpenSans/static/OpenSans_Condensed/OpenSans_Condensed-SemiBoldItalic.ttf +0 -0
  85. package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-Bold.ttf +0 -0
  86. package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-BoldItalic.ttf +0 -0
  87. package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-ExtraBold.ttf +0 -0
  88. package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-ExtraBoldItalic.ttf +0 -0
  89. package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-Italic.ttf +0 -0
  90. package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-Light.ttf +0 -0
  91. package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-LightItalic.ttf +0 -0
  92. package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-Medium.ttf +0 -0
  93. package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-MediumItalic.ttf +0 -0
  94. package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-Regular.ttf +0 -0
  95. package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-SemiBold.ttf +0 -0
  96. package/fonts/OpenSans/static/OpenSans_SemiCondensed/OpenSans_SemiCondensed-SemiBoldItalic.ttf +0 -0
  97. package/fonts/Rubik/OFL.txt +0 -0
  98. package/fonts/Rubik/README.txt +0 -0
  99. package/fonts/Rubik/Rubik-Italic-VariableFont_wght.ttf +0 -0
  100. package/fonts/Rubik/Rubik-VariableFont_wght.ttf +0 -0
  101. package/fonts/Rubik/static/Rubik-Black.ttf +0 -0
  102. package/fonts/Rubik/static/Rubik-BlackItalic.ttf +0 -0
  103. package/fonts/Rubik/static/Rubik-Bold.ttf +0 -0
  104. package/fonts/Rubik/static/Rubik-BoldItalic.ttf +0 -0
  105. package/fonts/Rubik/static/Rubik-ExtraBold.ttf +0 -0
  106. package/fonts/Rubik/static/Rubik-ExtraBoldItalic.ttf +0 -0
  107. package/fonts/Rubik/static/Rubik-Italic.ttf +0 -0
  108. package/fonts/Rubik/static/Rubik-Light.ttf +0 -0
  109. package/fonts/Rubik/static/Rubik-LightItalic.ttf +0 -0
  110. package/fonts/Rubik/static/Rubik-Medium.ttf +0 -0
  111. package/fonts/Rubik/static/Rubik-MediumItalic.ttf +0 -0
  112. package/fonts/Rubik/static/Rubik-Regular.ttf +0 -0
  113. package/fonts/Rubik/static/Rubik-SemiBold.ttf +0 -0
  114. package/fonts/Rubik/static/Rubik-SemiBoldItalic.ttf +0 -0
  115. package/index.html +0 -0
  116. package/index.js +0 -0
  117. package/jsconf.json +0 -0
  118. package/lib/assets/fonts/bmpfonts.in.js +0 -0
  119. package/lib/assets/fonts/bmpfonts.js +0 -0
  120. package/lib/assets/fonts/font.js +33 -3
  121. package/lib/assets/fonts/index.js +0 -0
  122. package/lib/assets/fonts/threebmfont.js +2 -12
  123. package/lib/data.js +0 -0
  124. package/lib/formats/cell.js +0 -0
  125. package/lib/formats/cif.js +0 -0
  126. package/lib/formats/magres.js +0 -0
  127. package/lib/formats/xyz.js +149 -52
  128. package/lib/loader.js +28 -7
  129. package/lib/model.js +10 -3
  130. package/lib/modelview.js +30 -0
  131. package/lib/nmrdata.js +0 -0
  132. package/lib/orbit.js +77 -1
  133. package/lib/primitives/atoms.js +12 -7
  134. package/lib/primitives/cell.js +1 -1
  135. package/lib/primitives/dither.js +1 -1
  136. package/lib/primitives/ellipsoid.js +22 -8
  137. package/lib/primitives/geometries.js +3 -3
  138. package/lib/primitives/isosurface.js +2 -6
  139. package/lib/primitives/shapes.js +1 -1
  140. package/lib/primitives/sprites.js +9 -2
  141. package/lib/query.js +3 -28
  142. package/lib/render.js +40 -9
  143. package/lib/selbox.js +0 -0
  144. package/lib/shaders/aura.frag +0 -1
  145. package/lib/shaders/aura.vert +0 -1
  146. package/lib/shaders/dither.frag +0 -0
  147. package/lib/shaders/dither.vert +0 -0
  148. package/lib/shaders/index.in.js +0 -0
  149. package/lib/shaders/index.js +4 -4
  150. package/lib/shaders/msdf300.frag +0 -2
  151. package/lib/shaders/msdf300.vert +0 -2
  152. package/lib/tensor.js +0 -1
  153. package/lib/visualizer.js +5 -4
  154. package/outdated.txt +12 -0
  155. package/package.json +21 -22
  156. package/scripts/build-bundle.js +6 -2
  157. package/scripts/build-resources.js +0 -0
  158. package/scripts/plugins-shim.js +0 -0
  159. package/test/data/CHA.cif +0 -0
  160. package/test/data/H2O.xyz +0 -0
  161. package/test/data/H2_bound.xyz +0 -0
  162. package/test/data/bohr.cell +0 -0
  163. package/test/data/ethanol.cell +0 -0
  164. package/test/data/ethanol_with_tensors.xyz +33 -0
  165. package/test/data/example_single.cif +0 -0
  166. package/test/data/frac.cell +0 -0
  167. package/test/data/org.cif +0 -0
  168. package/test/data/pyridine.xyz +0 -0
  169. package/test/data/si8.xyz +0 -0
  170. package/test/loader.js +168 -8
  171. package/test/model.js +2 -4
  172. package/test/test-html/examples.js +0 -0
  173. package/test/test-html/index.html +0 -0
  174. package/tools/compile_colors.py +0 -0
  175. package/tools/compile_periodic.py +0 -0
  176. package/tools/ptable.json +0 -0
  177. package/tools/test +0 -0
  178. package/.eslintrc.json +0 -16
  179. package/.github/workflows/test-mocha.yml +0 -30
@@ -0,0 +1,69 @@
1
+ version: 2
2
+ updates:
3
+ # Enable npm dependency updates
4
+ - package-ecosystem: "npm"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "weekly"
8
+ day: "monday"
9
+ time: "09:00"
10
+ timezone: "UTC"
11
+ # Group updates by type (non-overlapping)
12
+ groups:
13
+ # Group all patch updates together
14
+ patch-updates:
15
+ patterns:
16
+ - "*"
17
+ update-types:
18
+ - "patch"
19
+ # Group production dependency minor updates
20
+ production-minor:
21
+ patterns:
22
+ - "*"
23
+ dependency-type: "production"
24
+ update-types:
25
+ - "minor"
26
+ # Group development dependency minor updates
27
+ development-minor:
28
+ patterns:
29
+ - "*"
30
+ dependency-type: "development"
31
+ update-types:
32
+ - "minor"
33
+ # Customize PR settings
34
+ open-pull-requests-limit: 5
35
+ reviewers:
36
+ - "jkshenton"
37
+ assignees:
38
+ - "jkshenton"
39
+ labels:
40
+ - "dependencies"
41
+ - "automated"
42
+ commit-message:
43
+ prefix: "deps"
44
+ include: "scope"
45
+ # Version strategy
46
+ versioning-strategy: auto
47
+ # Allow specific updates
48
+ allow:
49
+ - dependency-type: "all"
50
+ # Ignore major version updates for critical packages
51
+ # (handle these manually with thorough testing)
52
+ ignore:
53
+ - dependency-name: "three"
54
+ update-types: ["version-update:semver-major"]
55
+ - dependency-name: "mathjs"
56
+ update-types: ["version-update:semver-major"]
57
+ - dependency-name: "jquery"
58
+ update-types: ["version-update:semver-major"]
59
+ - dependency-name: "esbuild"
60
+ update-types: ["version-update:semver-major"]
61
+
62
+ # Monitor GitHub Actions
63
+ - package-ecosystem: "github-actions"
64
+ directory: "/"
65
+ schedule:
66
+ interval: "monthly"
67
+ labels:
68
+ - "dependencies"
69
+ - "github-actions"
@@ -0,0 +1,91 @@
1
+ name: Dependency Review
2
+
3
+ on:
4
+ pull_request:
5
+ paths:
6
+ - 'package.json'
7
+ - 'package-lock.json'
8
+
9
+ permissions:
10
+ contents: read
11
+ pull-requests: write
12
+
13
+ jobs:
14
+ dependency-review:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout repository
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Dependency Review
22
+ uses: actions/dependency-review-action@v4
23
+ with:
24
+ fail-on-severity: moderate
25
+ comment-summary-in-pr: always
26
+
27
+ test-updates:
28
+ runs-on: ubuntu-latest
29
+
30
+ steps:
31
+ - name: Checkout repository
32
+ uses: actions/checkout@v4
33
+
34
+ - name: Setup Node.js
35
+ uses: actions/setup-node@v4
36
+ with:
37
+ node-version: '20'
38
+ cache: 'npm'
39
+
40
+ - name: Install dependencies
41
+ run: npm ci
42
+
43
+ - name: Build resources
44
+ run: npm run build-resources
45
+
46
+ - name: Build demo
47
+ run: npm run build-demo
48
+
49
+ - name: Build test files
50
+ run: npm run build-html-test
51
+
52
+ - name: Run tests
53
+ run: npm test
54
+
55
+ - name: Security audit
56
+ run: npm audit --audit-level=moderate
57
+ continue-on-error: true
58
+
59
+ - name: Check bundle size
60
+ run: |
61
+ if [ -f demo/demo.js ]; then
62
+ DEMO_SIZE=$(du -h demo/demo.js | cut -f1)
63
+ echo "Demo bundle size: $DEMO_SIZE"
64
+ fi
65
+
66
+ if [ -f test/test-html/testbuild.js ]; then
67
+ TEST_SIZE=$(du -h test/test-html/testbuild.js | cut -f1)
68
+ echo "Test bundle size: $TEST_SIZE"
69
+ fi
70
+
71
+ - name: Comment PR with results
72
+ uses: actions/github-script@v7
73
+ if: always()
74
+ with:
75
+ script: |
76
+ const fs = require('fs');
77
+
78
+ let comment = '## Dependency Update Test Results\n\n';
79
+ comment += '✅ All builds completed successfully\n';
80
+ comment += '✅ Test suite passed\n\n';
81
+ comment += '### Next Steps\n';
82
+ comment += '- [ ] Manual testing of demo\n';
83
+ comment += '- [ ] Visual regression testing\n';
84
+ comment += '- [ ] Browser compatibility check\n';
85
+
86
+ github.rest.issues.createComment({
87
+ issue_number: context.issue.number,
88
+ owner: context.repo.owner,
89
+ repo: context.repo.repo,
90
+ body: comment
91
+ });
@@ -0,0 +1,113 @@
1
+ name: Security Scan
2
+
3
+ on:
4
+ schedule:
5
+ # Run every day at midnight
6
+ - cron: '0 0 * * *'
7
+ workflow_dispatch:
8
+ push:
9
+ branches:
10
+ - main
11
+ - master
12
+ paths:
13
+ - 'package.json'
14
+ - 'package-lock.json'
15
+
16
+ jobs:
17
+ security-scan:
18
+ runs-on: ubuntu-latest
19
+ permissions:
20
+ contents: read
21
+ security-events: write
22
+ issues: write
23
+
24
+ steps:
25
+ - name: Checkout repository
26
+ uses: actions/checkout@v4
27
+
28
+ - name: Setup Node.js
29
+ uses: actions/setup-node@v4
30
+ with:
31
+ node-version: '20'
32
+ cache: 'npm'
33
+
34
+ - name: Install dependencies
35
+ run: npm ci
36
+
37
+ - name: Run npm audit
38
+ id: audit
39
+ run: |
40
+ npm audit --json > audit-results.json || true
41
+ npm audit --audit-level=moderate
42
+ continue-on-error: true
43
+
44
+ - name: Parse audit results
45
+ id: parse
46
+ run: |
47
+ if [ -f audit-results.json ]; then
48
+ VULNERABILITIES=$(jq '.metadata.vulnerabilities | to_entries | map("\(.key): \(.value)") | join(", ")' audit-results.json)
49
+ echo "vulnerabilities=$VULNERABILITIES" >> $GITHUB_OUTPUT
50
+ fi
51
+
52
+ - name: Create issue for vulnerabilities
53
+ if: failure()
54
+ uses: actions/github-script@v7
55
+ with:
56
+ script: |
57
+ const fs = require('fs');
58
+
59
+ let auditData = {};
60
+ try {
61
+ auditData = JSON.parse(fs.readFileSync('audit-results.json', 'utf8'));
62
+ } catch (e) {
63
+ console.log('Could not parse audit results');
64
+ }
65
+
66
+ const title = '🔒 Security vulnerabilities detected';
67
+ const body = `## Security Audit Alert
68
+
69
+ Security vulnerabilities have been detected in the project dependencies.
70
+
71
+ ### Summary
72
+ ${auditData.metadata ? JSON.stringify(auditData.metadata.vulnerabilities, null, 2) : 'See workflow logs for details'}
73
+
74
+ ### Action Required
75
+ 1. Review the security advisory
76
+ 2. Update affected packages
77
+ 3. Run tests to ensure compatibility
78
+ 4. Deploy fix as soon as possible
79
+
80
+ ### Workflow Run
81
+ [View Details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
82
+
83
+ ---
84
+ *This issue was automatically created by the Security Scan workflow.*
85
+ `;
86
+
87
+ // Check if issue already exists
88
+ const issues = await github.rest.issues.listForRepo({
89
+ owner: context.repo.owner,
90
+ repo: context.repo.repo,
91
+ state: 'open',
92
+ labels: 'security'
93
+ });
94
+
95
+ const existingIssue = issues.data.find(issue => issue.title === title);
96
+
97
+ if (!existingIssue) {
98
+ await github.rest.issues.create({
99
+ owner: context.repo.owner,
100
+ repo: context.repo.repo,
101
+ title: title,
102
+ body: body,
103
+ labels: ['security', 'dependencies']
104
+ });
105
+ }
106
+
107
+ - name: Upload audit results
108
+ if: always()
109
+ uses: actions/upload-artifact@v4
110
+ with:
111
+ name: security-audit-results
112
+ path: audit-results.json
113
+ retention-days: 30
@@ -0,0 +1,191 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - master
12
+ workflow_dispatch:
13
+
14
+ jobs:
15
+ test:
16
+ runs-on: ${{ matrix.os }}
17
+ strategy:
18
+ matrix:
19
+ os: [ubuntu-latest, macos-latest]
20
+ node-version: [20, 22]
21
+ fail-fast: false
22
+
23
+ steps:
24
+ - name: Checkout repository
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Setup Node.js ${{ matrix.node-version }}
28
+ uses: actions/setup-node@v4
29
+ with:
30
+ node-version: ${{ matrix.node-version }}
31
+ cache: 'npm'
32
+
33
+ - name: Install dependencies
34
+ run: npm ci
35
+
36
+ - name: Run linting (ESLint)
37
+ if: matrix.os == 'ubuntu-latest' && matrix.node-version == 20
38
+ run: npx eslint . --ext .js
39
+ continue-on-error: true
40
+
41
+ - name: Build resources
42
+ run: npm run build-resources
43
+
44
+ - name: Build demo
45
+ run: npm run build-demo
46
+
47
+ - name: Build HTML test
48
+ run: npm run build-html-test
49
+
50
+ - name: Run tests
51
+ run: npm test
52
+
53
+ - name: Check bundle sizes
54
+ if: matrix.os == 'ubuntu-latest' && matrix.node-version == 20
55
+ run: |
56
+ echo "## Bundle Sizes" >> $GITHUB_STEP_SUMMARY
57
+ echo "" >> $GITHUB_STEP_SUMMARY
58
+
59
+ if [ -f demo/demo.js ]; then
60
+ DEMO_SIZE=$(du -h demo/demo.js | cut -f1)
61
+ DEMO_BYTES=$(stat -c%s demo/demo.js 2>/dev/null || stat -f%z demo/demo.js)
62
+ echo "- Demo bundle: $DEMO_SIZE ($DEMO_BYTES bytes)" >> $GITHUB_STEP_SUMMARY
63
+ fi
64
+
65
+ if [ -f test/test-html/testbuild.js ]; then
66
+ TEST_SIZE=$(du -h test/test-html/testbuild.js | cut -f1)
67
+ TEST_BYTES=$(stat -c%s test/test-html/testbuild.js 2>/dev/null || stat -f%z test/test-html/testbuild.js)
68
+ echo "- Test bundle: $TEST_SIZE ($TEST_BYTES bytes)" >> $GITHUB_STEP_SUMMARY
69
+ fi
70
+
71
+ - name: Upload build artifacts
72
+ if: matrix.os == 'ubuntu-latest' && matrix.node-version == 20
73
+ uses: actions/upload-artifact@v4
74
+ with:
75
+ name: build-artifacts
76
+ path: |
77
+ demo/demo.js
78
+ test/test-html/testbuild.js
79
+ retention-days: 7
80
+
81
+ - name: Upload test results
82
+ if: always() && matrix.os == 'ubuntu-latest'
83
+ uses: actions/upload-artifact@v4
84
+ with:
85
+ name: test-results-node${{ matrix.node-version }}
86
+ path: test-results/
87
+ retention-days: 7
88
+ if-no-files-found: ignore
89
+
90
+ code-quality:
91
+ runs-on: ubuntu-latest
92
+
93
+ steps:
94
+ - name: Checkout repository
95
+ uses: actions/checkout@v4
96
+
97
+ - name: Setup Node.js
98
+ uses: actions/setup-node@v4
99
+ with:
100
+ node-version: 20
101
+ cache: 'npm'
102
+
103
+ - name: Install dependencies
104
+ run: npm ci
105
+
106
+ - name: Check package.json validity
107
+ run: |
108
+ if ! jq empty package.json; then
109
+ echo "❌ package.json is not valid JSON"
110
+ exit 1
111
+ fi
112
+ echo "✅ package.json is valid"
113
+
114
+ - name: Check for security vulnerabilities
115
+ run: npm audit --audit-level=high
116
+ continue-on-error: true
117
+
118
+ - name: Check outdated packages
119
+ run: |
120
+ echo "## Outdated Packages" >> $GITHUB_STEP_SUMMARY
121
+ npm outdated >> $GITHUB_STEP_SUMMARY || true
122
+ continue-on-error: true
123
+
124
+ - name: Verify dependencies integrity
125
+ run: npm ls
126
+ continue-on-error: true
127
+
128
+ build-check:
129
+ runs-on: ubuntu-latest
130
+
131
+ steps:
132
+ - name: Checkout repository
133
+ uses: actions/checkout@v4
134
+
135
+ - name: Setup Node.js
136
+ uses: actions/setup-node@v4
137
+ with:
138
+ node-version: 20
139
+ cache: 'npm'
140
+
141
+ - name: Clean install
142
+ run: |
143
+ rm -rf node_modules
144
+ npm ci
145
+
146
+ - name: Build all targets
147
+ run: |
148
+ npm run build-resources
149
+ npm run build-demo
150
+ npm run build-html-test
151
+
152
+ - name: Verify builds exist
153
+ run: |
154
+ test -f demo/demo.js || (echo "❌ demo.js not found" && exit 1)
155
+ test -f test/test-html/testbuild.js || (echo "❌ testbuild.js not found" && exit 1)
156
+ echo "✅ All build artifacts created successfully"
157
+
158
+ - name: Check for build warnings
159
+ run: |
160
+ echo "## Build Information" >> $GITHUB_STEP_SUMMARY
161
+ echo "✅ All builds completed without errors" >> $GITHUB_STEP_SUMMARY
162
+
163
+ test-summary:
164
+ runs-on: ubuntu-latest
165
+ needs: [test, code-quality, build-check]
166
+ if: always()
167
+
168
+ steps:
169
+ - name: Generate summary
170
+ uses: actions/github-script@v7
171
+ with:
172
+ script: |
173
+ const testJob = '${{ needs.test.result }}';
174
+ const qualityJob = '${{ needs.code-quality.result }}';
175
+ const buildJob = '${{ needs.build-check.result }}';
176
+
177
+ const icon = (status) => {
178
+ if (status === 'success') return '✅';
179
+ if (status === 'failure') return '❌';
180
+ return '⚠️';
181
+ };
182
+
183
+ core.summary
184
+ .addHeading('Test Results Summary')
185
+ .addTable([
186
+ [{data: 'Job', header: true}, {data: 'Status', header: true}],
187
+ ['Tests', `${icon(testJob)} ${testJob}`],
188
+ ['Code Quality', `${icon(qualityJob)} ${qualityJob}`],
189
+ ['Build Check', `${icon(buildJob)} ${buildJob}`]
190
+ ])
191
+ .write();
@@ -0,0 +1,214 @@
1
+ name: Update Dependencies
2
+
3
+ on:
4
+ # Run every Monday at 9 AM UTC
5
+ schedule:
6
+ - cron: '0 9 * * 1'
7
+ # Allow manual trigger
8
+ workflow_dispatch:
9
+ inputs:
10
+ update_type:
11
+ description: 'Update type'
12
+ required: true
13
+ default: 'patch'
14
+ type: choice
15
+ options:
16
+ - patch
17
+ - minor
18
+ - all
19
+
20
+ jobs:
21
+ update-dependencies:
22
+ runs-on: ubuntu-latest
23
+ permissions:
24
+ contents: write
25
+ pull-requests: write
26
+
27
+ steps:
28
+ - name: Checkout repository
29
+ uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 0
32
+
33
+ - name: Setup Node.js
34
+ uses: actions/setup-node@v4
35
+ with:
36
+ node-version: '20'
37
+ cache: 'npm'
38
+
39
+ - name: Configure Git
40
+ run: |
41
+ git config --global user.name 'github-actions[bot]'
42
+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
43
+
44
+ - name: Install dependencies
45
+ run: npm ci
46
+
47
+ - name: Check for outdated packages
48
+ id: outdated
49
+ run: |
50
+ echo "## Outdated Packages" > outdated.txt
51
+ npm outdated || true
52
+ npm outdated > outdated.txt 2>&1 || true
53
+ cat outdated.txt
54
+
55
+ - name: Update dependencies (patch only)
56
+ if: github.event.inputs.update_type == 'patch' || github.event.inputs.update_type == ''
57
+ run: |
58
+ echo "Updating patch versions only..."
59
+ npm update --save
60
+
61
+ - name: Update dependencies (minor)
62
+ if: github.event.inputs.update_type == 'minor'
63
+ run: |
64
+ echo "Updating to latest minor versions..."
65
+ npx npm-check-updates -u --target minor
66
+ npm install
67
+
68
+ - name: Update dependencies (all)
69
+ if: github.event.inputs.update_type == 'all'
70
+ run: |
71
+ echo "Updating to latest versions (including major)..."
72
+ npx npm-check-updates -u
73
+ npm install
74
+
75
+ - name: Run security audit
76
+ id: audit
77
+ run: |
78
+ echo "## Security Audit" > audit.txt
79
+ npm audit --audit-level=moderate >> audit.txt 2>&1 || true
80
+ cat audit.txt
81
+ continue-on-error: true
82
+
83
+ - name: Build project
84
+ run: |
85
+ npm run build-resources
86
+ npm run build-demo
87
+ npm run build-html-test
88
+
89
+ - name: Run tests
90
+ id: tests
91
+ run: npm test
92
+ continue-on-error: true
93
+
94
+ - name: Check for changes
95
+ id: changes
96
+ run: |
97
+ if git diff --quiet package.json package-lock.json; then
98
+ echo "has_changes=false" >> $GITHUB_OUTPUT
99
+ echo "No dependency updates available"
100
+ else
101
+ echo "has_changes=true" >> $GITHUB_OUTPUT
102
+ echo "Dependencies have been updated"
103
+ fi
104
+
105
+ - name: Get updated packages
106
+ if: steps.changes.outputs.has_changes == 'true'
107
+ id: packages
108
+ run: |
109
+ # Create a summary of changes
110
+ echo "## Updated Packages" > changes.txt
111
+ git diff package.json | grep '"' | grep -E '^\+|^\-' >> changes.txt || echo "See package.json diff for details" >> changes.txt
112
+ cat changes.txt
113
+
114
+ - name: Create Pull Request
115
+ if: steps.changes.outputs.has_changes == 'true'
116
+ uses: peter-evans/create-pull-request@v6
117
+ with:
118
+ token: ${{ secrets.GITHUB_TOKEN }}
119
+ commit-message: |
120
+ deps: update dependencies $(date +%Y-%m-%d)
121
+
122
+ Automated dependency update
123
+ Update type: ${{ github.event.inputs.update_type || 'patch' }}
124
+ branch: deps/automated-update-${{ github.run_number }}
125
+ delete-branch: true
126
+ title: 'deps: update dependencies $(date +%Y-%m-%d)'
127
+ body: |
128
+ ## Automated Dependency Update
129
+
130
+ **Update Type:** `${{ github.event.inputs.update_type || 'patch' }}`
131
+ **Date:** $(date +%Y-%m-%d)
132
+
133
+ ### Changes
134
+ This PR updates dependencies to their latest compatible versions.
135
+
136
+ ### Test Results
137
+ - Build: ✅ Successful
138
+ - Tests: ${{ steps.tests.outcome == 'success' && '✅ Passed' || '⚠️ Failed - Review Required' }}
139
+
140
+ ### Security Audit
141
+ See workflow logs for security audit results.
142
+
143
+ ### Manual Testing Required
144
+ Before merging, please:
145
+ 1. Review the dependency changes below
146
+ 2. Test the demo at `demo/index.html`
147
+ 3. Verify key features work correctly
148
+ 4. Check browser console for errors
149
+ 5. Test on multiple browsers if major updates included
150
+
151
+ ### Review Checklist
152
+ - [ ] All CI checks passing
153
+ - [ ] Manual testing completed
154
+ - [ ] Breaking changes reviewed
155
+ - [ ] Documentation updated if needed
156
+
157
+ ---
158
+
159
+ <details>
160
+ <summary>Updated Packages</summary>
161
+
162
+ ```
163
+ $(cat changes.txt || echo "Check diff for details")
164
+ ```
165
+ </details>
166
+
167
+ <details>
168
+ <summary>Security Audit</summary>
169
+
170
+ ```
171
+ $(cat audit.txt || echo "No audit information available")
172
+ ```
173
+ </details>
174
+
175
+ ---
176
+
177
+ **Note:** This PR was automatically created by GitHub Actions.
178
+ Review all changes carefully before merging.
179
+ labels: |
180
+ dependencies
181
+ automated
182
+ assignees: ${{ github.repository_owner }}
183
+
184
+ - name: Comment on failure
185
+ if: failure() && steps.changes.outputs.has_changes == 'true'
186
+ uses: peter-evans/create-or-update-comment@v4
187
+ with:
188
+ issue-number: ${{ steps.cpr.outputs.pull-request-number }}
189
+ body: |
190
+ ⚠️ **Warning:** Automated tests failed during dependency update.
191
+
192
+ Please review the workflow logs and test locally before merging.
193
+
194
+ security-audit:
195
+ runs-on: ubuntu-latest
196
+
197
+ steps:
198
+ - name: Checkout repository
199
+ uses: actions/checkout@v4
200
+
201
+ - name: Setup Node.js
202
+ uses: actions/setup-node@v4
203
+ with:
204
+ node-version: '20'
205
+ cache: 'npm'
206
+
207
+ - name: Install dependencies
208
+ run: npm ci
209
+
210
+ - name: Run security audit
211
+ run: npm audit --audit-level=moderate
212
+
213
+ - name: Check for vulnerabilities
214
+ run: npm audit --audit-level=high --production