Skip to content

Commit

Permalink
Merge branch 'main' into crysacarter-patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
FuhuXia authored Oct 28, 2024
2 parents 789f83d + 13460de commit d697835
Show file tree
Hide file tree
Showing 42 changed files with 6,956 additions and 16,904 deletions.
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
ignore:
- dependency-name: "gulp"
update-types: ["version-update:semver-major"]
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
20.14.0
25 changes: 2 additions & 23 deletions .snyk
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,17 @@
version: v1.25.0
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
SNYK-JS-ANSIREGEX-1583908:
- '*':
reason: >-
ansi-regex input is from trusted sources so a ReDoS attack is not a
concern. Not able to be upgraded at this time.
expires: 2024-03-30T00:00:00.000Z
created: 2022-12-05T19:21:40.652Z
SNYK-JS-GLOBPARENT-1016905:
- '*':
reason: >-
glob-parent input is from trusted sources so a ReDoS attack is not a
concern. Not able to be upgraded at this time.
expires: 2024-03-30T00:00:00.000Z
created: 2022-12-05T19:21:40.652Z
SNYK-JS-UNSETVALUE-2400660:
- '*':
reason: >-
unset function is from trusted sources so a Prototype Pollution is
not a concern. Not able to be upgraded at this time.
expires: 2024-03-30T00:00:00.000Z
created: 2022-12-05T19:21:40.652Z
SNYK-JS-INFLIGHT-6095116:
- '*':
reason: >-
this one should not affect the static site.
expires: 2024-03-30T21:09:27.109Z
expires: 2024-09-30T21:09:27.109Z
created: 2023-11-30T21:09:27.114Z
SNYK-JS-POSTCSS-5926692:
- '*':
reason: >-
the recommond version 8.4.31 is already in the package.json file,
so just wait for fixes from css-mqpacker and gulp-sourcemaps.
expires: 2024-01-30T21:10:57.140Z
expires: 2024-09-30T21:10:57.140Z
created: 2023-11-30T21:10:57.144Z
patch: {}
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
source "https://rubygems.org"

gem "jekyll", "~> 4.3.1"
gem "jekyll", "~> 4.3.2"

group :jekyll_plugins do
gem "jekyll-feed", "~> 0.15", ">= 0.15.1"
gem "jekyll-toc", "~> 0.17", ">= 0.17.1"
gem "jekyll-toc", "~> 0.18", ">= 0.18.0"
gem 'jekyll-redirect-from', '>= 0.16.0'
end

Expand All @@ -14,7 +14,7 @@ gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform?

gem "nokogiri", "~> 1.14"
gem "nokogiri", "~> 1.16"
gem "html-proofer", "~> 3.19", ">= 3.19.2"
gem "jekyll-sitemap", ">= 1.4.0"

Expand Down
65 changes: 34 additions & 31 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ GEM
specs:
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
bigdecimal (3.1.8)
colorator (1.1.0)
concurrent-ruby (1.1.10)
concurrent-ruby (1.3.3)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
Expand All @@ -13,9 +14,15 @@ GEM
eventmachine (1.2.7)
ffi (1.15.5)
forwardable-extended (2.6.0)
google-protobuf (3.21.12)
google-protobuf (3.21.12-x86_64-darwin)
google-protobuf (3.21.12-x86_64-linux)
google-protobuf (4.27.5)
bigdecimal
rake (>= 13)
google-protobuf (4.27.5-x86_64-darwin)
bigdecimal
rake (>= 13)
google-protobuf (4.27.5-x86_64-linux)
bigdecimal
rake (>= 13)
html-proofer (3.19.4)
addressable (~> 2.3)
mercenary (~> 0.3)
Expand All @@ -25,9 +32,9 @@ GEM
typhoeus (~> 1.3)
yell (~> 2.0)
http_parser.rb (0.8.0)
i18n (1.12.0)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
jekyll (4.3.1)
jekyll (4.3.3)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
Expand All @@ -51,54 +58,50 @@ GEM
sass-embedded (~> 1.54)
jekyll-sitemap (1.4.0)
jekyll (>= 3.7, < 5.0)
jekyll-toc (0.17.1)
jekyll-toc (0.19.0)
jekyll (>= 3.9)
nokogiri (~> 1.11)
nokogiri (~> 1.12)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.4)
listen (3.7.1)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
mini_portile2 (2.8.1)
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
mini_portile2 (2.8.7)
nokogiri (1.16.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.14.3-x86_64-darwin)
nokogiri (1.16.5-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.14.3-x86_64-linux)
nokogiri (1.16.5-x86_64-linux)
racc (~> 1.4)
parallel (1.22.1)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (5.0.1)
racc (1.6.2)
racc (1.8.0)
rainbow (3.1.1)
rake (13.0.6)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
rb-inotify (0.11.1)
ffi (~> 1.0)
rexml (3.2.5)
rouge (4.0.1)
rexml (3.3.9)
rouge (4.2.1)
safe_yaml (1.0.5)
sass-embedded (1.57.1)
google-protobuf (~> 3.21)
rake (>= 10.0.0)
sass-embedded (1.57.1-x86_64-darwin)
google-protobuf (~> 3.21)
sass-embedded (1.57.1-x86_64-linux-gnu)
google-protobuf (~> 3.21)
sass-embedded (1.77.5)
google-protobuf (>= 3.25, < 5.0)
rake (>= 13)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
typhoeus (1.4.0)
ethon (>= 0.9.0)
unicode-display_width (2.4.2)
webrick (1.7.0)
unicode-display_width (2.5.0)
webrick (1.8.2)
yell (2.2.2)

PLATFORMS
Expand All @@ -108,13 +111,13 @@ PLATFORMS

DEPENDENCIES
html-proofer (~> 3.19, >= 3.19.2)
jekyll (~> 4.3.1)
jekyll (~> 4.3.2)
jekyll-feed (~> 0.15, >= 0.15.1)
jekyll-redirect-from (>= 0.16.0)
jekyll-sitemap (>= 1.4.0)
jekyll-toc (~> 0.17, >= 0.17.1)
jekyll-toc (~> 0.18, >= 0.18.0)
liquid (~> 4.0, >= 4.0.4)
nokogiri (~> 1.14)
nokogiri (~> 1.16)
tzinfo-data

BUNDLED WITH
Expand Down
1 change: 0 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ github:
default_branch: main

scripts:
- assets/uswds/js/uswds.min.js
- assets/js/bundle.js

styles:
Expand Down
170 changes: 68 additions & 102 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,114 +1,80 @@
var autoprefixer = require('autoprefixer');
const csso = require('postcss-csso');
var gulp = require('gulp');
var mqpacker = require('css-mqpacker');
var path = require('path');
var pkg = require('./node_modules/uswds/package.json');
var postcss = require('gulp-postcss');
var rename = require('gulp-rename');
var replace = require('gulp-replace');
var sass = require('gulp-dart-sass');
var sourcemaps = require('gulp-sourcemaps');
var uswds = require('./node_modules/uswds-gulp/config/uswds');
const { src, pipe, dest, series, parallel, watch } = require('gulp');
const uswds = require("@uswds/compile");

var watchify = require('watchify');
var browserify = require('browserify');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify')
var gulpif = require('gulp-if');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var log = require('gulplog');
var assign = require('lodash.assign');

// Project Javascript source directory
const PROJECT_JS_SRC = './pages/_js';

// Javascript destination
const PROJECT_JS_DEST = './_site/assets/js';

// Project Sass source directory
const PROJECT_SASS_SRC = './pages/_scss';

// Images destination
const IMG_DEST = './_site/assets/uswds/img';

// Fonts destination
const FONTS_DEST = './_site/assets/uswds/fonts';

// Javascript destination
const JS_DEST = './_site/assets/uswds/js';

// Compiled CSS destination
const CSS_DEST = './_site/assets/uswds/css';

/*
----------------------------------------
TASKS
----------------------------------------
*/

gulp.task('copy-uswds-fonts', () => {
return gulp.src(`${uswds}/fonts/**/**`).pipe(gulp.dest(`${FONTS_DEST}`));
});

gulp.task('copy-uswds-images', () => {
return gulp.src(`${uswds}/img/**/**`).pipe(gulp.dest(`${IMG_DEST}`));
});

gulp.task('copy-uswds-js', () => {
return gulp.src(`${uswds}/js/**/**`).pipe(gulp.dest(`${JS_DEST}`));
});

gulp.task('build-sass', function (done) {
var plugins = [
autoprefixer({
cascade: false,
grid: true,
}),
csso({ forceMediaMerge: false }),
];
return gulp
.src(`${PROJECT_SASS_SRC}/styles.scss`)
.pipe(sourcemaps.init({ largeFile: true }))
.pipe(
sass({
includePaths: [PROJECT_SASS_SRC, `${uswds}/scss`, `${uswds}/scss/packages`],
})
)
.pipe(replace(/\buswds @version\b/g, 'based on uswds v' + pkg.version))
.pipe(postcss(plugins))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(CSS_DEST));
});

var customOpts = {
entries: [`${PROJECT_JS_SRC}/index.js`],
};
var opts = assign({}, watchify.args, customOpts);
var b = function () {
return browserify(opts);
};
var w = watchify(b());

var bundle = function (pkg) {
return pkg
const isProd = process.env.NODE_ENV == 'production';

// file path vars
const paths = {
js: {
src: './pages/_js/index.js',
dest: 'assets/js/bundle.js'
}
}

function jsTask() {
return browserify(`${paths.js.src}`)
.transform('babelify', {
presets: ['@babel/preset-env'],
plugins: ['@babel/plugin-transform-runtime']
})
.bundle()
.on('error', log.error.bind(log, 'Browserify Error'))
.pipe(source('bundle.js'))
.pipe(source(paths.js.dest))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(PROJECT_JS_DEST));
.pipe(gulpif(isProd, uglify()))
.pipe(gulpif(!isProd, sourcemaps.init({ loadMaps: true })))
.pipe(gulpif(!isProd, sourcemaps.write('.')))
.pipe(dest("_site"));
};

gulp.task('build-js', bundle.bind(null, b()));
const defaultTask = parallel(
series(
jsTask,
uswds.copyAssets,
uswds.compile,
)
)

/*
***** TODO ********
JS watch task: if we want to recompile JS on change
we'll need to add a JS watch step.
for now, we don't need it...
*/

exports.default = defaultTask

gulp.task('default', gulp.series('copy-uswds-fonts', 'copy-uswds-images', 'copy-uswds-js', 'build-js', 'build-sass'));
// 3. Compile USWDS

gulp.task('watch-js', function () {
bundle(w);
w.on('update', bundle.bind(null, w));
w.on('log', log.info);
});
/**
* USWDS version
* Set the major version of USWDS you're using
* (Current options are the numbers 2 or 3)
*/
uswds.settings.version = 3;

gulp.task('watch-sass', function () {
gulp.watch(`${PROJECT_SASS_SRC}/**/*.scss`, gulp.series('build-sass'));
});
/**
* Path settings
* Set as many as you need
*/
uswds.paths.dist.css = './_site/assets/uswds/css';
uswds.paths.dist.js = './_site/assets/uswds/js';
uswds.paths.dist.img = './_site/assets/uswds/img';
uswds.paths.dist.fonts = './_site/assets/uswds/fonts';
uswds.paths.dist.theme = './pages/_scss';

/**
* Exports
* Add as many as you need
*/
exports.init = uswds.init;
exports.compile = uswds.compile;
exports.copyAll = uswds.copyAll;
exports.watch = uswds.watch;
exports.copyAssets = uswds.copyAssets;
Loading

0 comments on commit d697835

Please sign in to comment.