Skip to content

Commit

Permalink
React upgrade fixes (#148)
Browse files Browse the repository at this point in the history
* microbundle-crl replaced with microbundle to address the microbundle-crl vulnerabilities

* gulp-sri replaced with gulp-hashsum and through2

---------

Co-authored-by: Celestial <celestial@CELSYSNCR000216.local>
  • Loading branch information
rawana90 and Celestial authored Nov 14, 2024
1 parent 80a0be0 commit b28e080
Show file tree
Hide file tree
Showing 4 changed files with 1,280 additions and 4,155 deletions.
28 changes: 15 additions & 13 deletions Gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* eslint-disable */
const gulp = require('gulp');
const sri = require('gulp-sri');
const hashsum = require('gulp-hashsum');
const through = require('through2');
const fs = require('fs');
const path = require('path');
const git = require('git-rev-sync');
const pkg = require('./package.json');
const { upload } = require('gulp-s3-publish');
Expand Down Expand Up @@ -118,19 +121,18 @@ const canBeDeployedProd = async () => {

// GENERATE SRI TAG
gulp.task('sri', () => {
return gulp.src(sourceSRI)
.pipe(sri({
fileName: 'dist/manifest.json',
transform: (o) => {
let newOb = {};
for (const el in o) {
newOb[el.replace('dist/', '')] = { sri: o[el] };
};

return newOb;
}
const manifest = {};

return gulp.src(sourceSRI) // adjust to your `sourceSRI`
.pipe(hashsum({ hash: 'sha384', json: false }))
.pipe(through.obj((file, _, cb) => {
const fileName = path.relative('dist', file.relative);
manifest[fileName] = { sri: file.contents.toString() };
cb(null, file);
}))
.pipe(gulp.dest('.'));
.on('end', () => {
fs.writeFileSync('dist/manifest.json', JSON.stringify(manifest, null, 2));
});
});

// DEPLOYMENTS
Expand Down
Loading

0 comments on commit b28e080

Please sign in to comment.