Skip to content

USWDS-Compile - Bug: copyAssets broken for older USWDS versions #156

@mdmower-csnw

Description

@mdmower-csnw

Describe the bug

As far as I understand it, @uswds/uswds-compile is meant to be backwards compatible with older @uswds/uswds releases. Release v1.3.0 didn't just add support for copying web component assets, it requires them to be available at ./node_modules/@uswds/uswds/dist/components. When I run updateUswds, it starts with copyAssets which in turn runs copy.components. Problem is components doesn't exist for the version of USWDS I use: v3.7.1 (while I haven't checked, it sounds like it isn't introduced until v3.13?)

[12:02:29] Using gulpfile ~\source\(sanitized)\gulpfile.js
[12:02:29] Starting 'updateUswds'...
[12:02:29] Starting 'fonts'...
Copy USWDS fonts: ./node_modules/@uswds/uswds/dist/fonts → ./assets/uswds/fonts
[12:02:31] Finished 'fonts' after 1.82 s
[12:02:31] Starting 'images'...
Copy USWDS images: ./node_modules/@uswds/uswds/dist/img →  ./assets/uswds/img
[12:02:59] Finished 'images' after 28 s
[12:02:59] Starting 'js'...
Copy USWDS compiled JS: ./node_modules/@uswds/uswds/dist/js →  ./assets/uswds/js
[12:03:00] Finished 'js' after 676 ms
[12:03:00] Starting 'components'...
Copy USWDS compiled Web Components: ./node_modules/@uswds/uswds/dist/components →  ./assets/uswds/js
[12:03:00] 'components' errored after 3.53 ms
[12:03:00] Error: ENOENT: no such file or directory, scandir 'C:\Users\(sanitized)\source\(sanitized)\node_modules\@uswds\uswds\dist\components'
[12:03:00] 'updateUswds' errored after 31 s

Steps to reproduce the bug

Run copyAssets gulp task with USWDS v3.7.1 (and possibly all the way up to v3.12.0).

Expected Behavior

Should not crash

Related code

uswds-compile/gulpfile.js

Lines 139 to 147 in 75194aa

components() {
log(
colors.blue,
`Copy USWDS compiled Web Components: ${getSrcFrom("components")}${paths.dist.js}`
);
return src(`${getSrcFrom("components")}/**/**`.replace("//", "/")).pipe(
dest(paths.dist.components)
);
},

Screenshots

No response

System setup

No response

Additional context

No response

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: ConfirmationWe need to confirm that this is an issueType: BugA problem in the code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions