Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Decouple USWDS packages from the library bundle #1337

Merged
merged 7 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import {
externalDatasetsAtom
} from '$components/exploration/atoms/datasetLayers';

import './styles/styles.scss';
// Include only the custom stylings for the VEDA components into the library build
import './styles/veda-components.scss';

// Adding .last property to array
/* eslint-disable-next-line fp/no-mutating-methods */
Expand Down
7 changes: 1 addition & 6 deletions app/scripts/styles/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,4 @@
@use 'usa-site-alert';
@use 'usa-banner';

// Custom VEDA UI styles should be added here, so that they can be
// picked up by Parcel and included in the final CSS bundle for the veda-ui library.
@use "../components/common/page-header/page-header.scss";
@use "../components/common/banner/banner.scss";
@use "../components/common/page-header/logo-container/logo-container.scss";
@use "../components/common/datepicker/datepicker.scss";
@use './veda-components';
6 changes: 6 additions & 0 deletions app/scripts/styles/veda-components.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Custom VEDA UI styles should be added here, so that they can be
// picked up by Parcel and included in the final CSS bundle for the veda-ui library.
@use "../components/common/page-header/page-header.scss";
@use "../components/common/page-header/logo-container/logo-container.scss";
@use "../components/common/banner/banner.scss";
@use "../components/common/datepicker/datepicker.scss";
9 changes: 5 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ process.env.APP_BUILD_TIME = Date.now();

const parcelCli = path.join(__dirname, './node_modules/parcel/lib/cli.js');
const parcelConfig = path.join(__dirname, '.parcelrc');
const parcelLibConfig = path.join(__dirname, '.parcelrc-lib');

// /////////////////////////////////////////////////////////////////////////////
// ----------------------- Watcher and custom tasks --------------------------//
Expand All @@ -51,7 +52,7 @@ function watcher() {

function clean() {
// Remove build cache and dist.
return del(['dist', '.parcel-cache']);
return del(['dist', 'lib', '.parcel-cache']);
}

// Simple task to copy the static files to the dist directory. The static
Expand Down Expand Up @@ -84,7 +85,7 @@ function parcelBuildLib(cb) {
'app/scripts/index.ts',
'--dist-dir=lib',
'--config',
'.parcelrc-lib'
parcelLibConfig
];

const pr = spawn('node', [parcelCli, ...args], {
Expand Down Expand Up @@ -183,8 +184,8 @@ const parallelTasks =

module.exports.buildlib = gulp.series(
clean,
copyUswdsAssetsToLibBundle,
parcelBuildLib
parcelBuildLib,
copyUswdsAssetsToLibBundle
);

// Task orchestration used during the production process.
Expand Down
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
"engines": {
"node": ">=18.0.0"
},
"peerDependencies": {
"@uswds/uswds": "^3.8.1"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/eslint-parser": "^7.16.0",
Expand Down Expand Up @@ -120,6 +123,8 @@
"stylelint": "^16.10.0",
"stylelint-config-recommended": "^14.0.1",
"stylelint-config-standard-scss": "^13.1.0",
"@uswds/compile": "^1.1.0",
"@uswds/uswds": "^3.8.1",
"ts-jest": "^29.2.5",
"typescript": "4.8.4"
},
Expand Down Expand Up @@ -156,7 +161,6 @@
"@tanstack/react-query-devtools": "^4.3.9",
"@tanstack/react-table": "^8.9.3",
"@tippyjs/react": "^4.2.6",
"@trussworks/react-uswds": "^9.0.0",
"@turf/area": "^6.5.0",
"@turf/bbox": "^6.5.0",
"@turf/bbox-polygon": "^6.5.0",
Expand All @@ -168,8 +172,12 @@
"@turf/intersect": "^6.5.0",
"@turf/simplify": "^6.5.0",
"@turf/union": "^6.5.0",
"@uswds/compile": "^1.1.0",
"@uswds/uswds": "^3.8.1",
"@types/geojson": "^7946.0.10",
"@types/he": "^1.2.3",
"@types/mdx": "^2.0.1",
"@types/react": "18.0.32",
"@types/react-dom": "18.0.11",
"@types/styled-components": "^5.1.26",
"autoprefixer": "^10.4.19",
"axios": "^0.25.0",
"clipboard": "^2.0.11",
Expand Down Expand Up @@ -235,6 +243,7 @@
"shpjs": "^4.0.4",
"styled-components": "^5.3.3",
"tippy.js": "^6.3.7",
"@trussworks/react-uswds": "^9.0.0",
"use-deep-compare": "^1.1.0",
"xlsx": "^0.18.5"
},
Expand Down
Loading