{"id":30240430,"url":"https://github.com/hypothesis/frontend-build","last_synced_at":"2026-01-20T17:23:51.866Z","repository":{"id":37758722,"uuid":"418821550","full_name":"hypothesis/frontend-build","owner":"hypothesis","description":"Utilities for building Hypothesis frontend projects","archived":false,"fork":false,"pushed_at":"2025-08-12T13:19:37.000Z","size":3663,"stargazers_count":0,"open_issues_count":2,"forks_count":5,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-08-12T15:23:38.409Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hypothesis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-10-19T07:44:13.000Z","updated_at":"2025-08-12T13:19:40.000Z","dependencies_parsed_at":"2023-02-13T23:16:04.408Z","dependency_job_id":"c3bdf679-89ad-45a4-9ec6-860181b30bf8","html_url":"https://github.com/hypothesis/frontend-build","commit_stats":{"total_commits":310,"total_committers":5,"mean_commits":62.0,"dds":0.08709677419354833,"last_synced_commit":"6df7fb944fa762b2fcc78287810baa7caf511d99"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/hypothesis/frontend-build","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypothesis%2Ffrontend-build","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypothesis%2Ffrontend-build/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypothesis%2Ffrontend-build/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypothesis%2Ffrontend-build/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hypothesis","download_url":"https://codeload.github.com/hypothesis/frontend-build/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypothesis%2Ffrontend-build/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270524447,"owners_count":24600195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-15T04:38:33.414Z","updated_at":"2025-10-18T14:29:30.717Z","avatar_url":"https://github.com/hypothesis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @hypothesis/frontend-build\n\nThis package contains functions for building assets and running tests in\nHypothesis frontend projects, typically as part of [Gulp](https://gulpjs.com) tasks.\n\nIt assumes that the project is using our standard frontend tech stack and\nfollows certain conventions about the location and naming of files.\n\n## Prerequisites\n\nThis project assumes our standard tech stack for frontend projects:\n\n- [Gulp](https://gulpjs.com) for running tasks [1]\n- [Rollup](https://rollupjs.org/guide/en/) for building JavaScript bundles\n- [Tailwind](https://tailwindcss.com) or [Sass](https://sass-lang.com) for authoring styles\n- [Vitest](https://vitest.dev/) for running tests\n\n[1] Gulp is not required as the task runner, but is how most of our projects\nare currently set up.\n\n## Usage\n\nThe typical structure of a Hypothesis frontend project looks like:\n\n```sh\ngulpfile.mjs  # Gulp tasks\nvitest.config.js  # Vitest config file\n\nsrc/  # Source files (\"$PROJECT_NAME/static/scripts\" in Python projects)\n  tests/\n    bootstrap.js  # JS module that configures test environment\n\nrollup.config.mjs  # Rollup config that builds application/library bundles\nrollup-tests.config.mjs  # Rollup config that builds test bundle from `build/scripts/test-inputs.js`\n\nbuild/  # Compiled frontend assets\n  scripts/  # Generated JS bundles\n    some-app.bundle.js\n    some-app.bundle.js.map\n\n  styles/  # Generated CSS bundles\n    some-app.css\n    some-app.css.map\n```\n\nCompiling frontend assets from source files is handled by tasks defined in\n`gulpfile.mjs`.\n\nTo use this package, first add it as a dependency to the project:\n\n```js\nyarn add --dev @hypothesis/frontend-build\n```\n\nThen use the functions within Gulp tasks. For example:\n\n```js\nimport { buildCSS, buildJS, watchCSS, runTests } from '@hypothesis/frontend-build';\n\ngulp.task('build-js', () =\u003e buildJS('rollup.config.mjs'));\ngulp.task('watch-js', () =\u003e watchJS('rollup.config.mjs'));\ngulp.task('build-css', () =\u003e buildCSS(\n  ['src/my-app.css', 'src/other-app.css'],\n  { tailwind: true }\n));\ngulp.task('watch-css', () =\u003e gulp.watch('src/**/*.css', 'build-css'));\ngulp.task('watch', gulp.parallel('watch-js', 'watch-css'));\ngulp.task('test', () =\u003e runTests({\n  bootstrapFile: 'src/tests/bootstrap.js',\n  vitestConfig: 'vitest.config.js',\n  rollupConfig: 'rollup-tests.config.mjs',\n  testsPattern: '**/*-test.js',\n});\n\n// Project-specific tasks...\n```\n\nFunctions can be imported from the main export, or from individual ones if you\ndon't want to install all optional peer dependencies:\n\n```js\nimport { buildJS, watchJS } from '@hypothesis/frontend-build/rollup';\nimport { buildCSS } from '@hypothesis/frontend-build/sass';\nimport { runTests } from '@hypothesis/frontend-build/tests';\n\n```\n\n## API reference\n\nThis section provides an overview of the functions in this package. See the\nJSDoc comments for individual functions for full details.\n\n### Building asset bundles\n\n`buildJS(rollupConfig)` - Build one or more JavaScript bundles defined in a\nRollup config file. The Rollup config file must be an ES module.\n\n`watchJS(rollupConfig)` - Same as `buildJS`, but watches for updates to input files\nafter building the bundle and rebuilds if they change.\n\n`buildCSS(inputs, options = {})` - Build one or more CSS bundles from CSS or SASS\nentry points, with optional support for Tailwind.\n\n- `options.tailwind` : Enable [Tailwind](https://tailwindcss.com)\n\n`generateManifest(options)` - Generate a JSON asset manifest suitable for use\nwith the [h-assets](https://pypi.org/project/h-assets/) package used by Python\napps to serve static assets.\n\n### Running tests\n\n`runTests(config)` - Build a JavaScript bundle of tests from a set of input files\nand run them in Vitest.\n\nThe test bundle is created by first finding all test files that match the\n`testsPattern` argument and generating an entry point,\n`build/scripts/test-inputs.js`, which imports all of the test files. The\nbundle is then built by passing the config specified by `rollupConfig` to\nRollup. Once the bundle has been generated, Vitest is started using the config\nfile specified by `vitestConfig`, which should load the test bundle.\n\nThis command supports filtering which tests are run\nby using the `--grep \u003cfile pattern\u003e` CLI argument. If the `--live` CLI flag is\nset, the test runner watches for changes and rebuild and re-runs the tests if\nthe input files change.\n\n### Utilities\n\n`log.{info, warn, error}(message...)` - Log a message with a timestamp. This\nis a re-export of [fancy-log](https://www.npmjs.com/package/fancy-log)'s API.\n\n`run(command, args)` - Run a CLI command and forward the output to the terminal.\n\n## Additional documentation\n\n[Release guide](https://github.com/hypothesis/frontend-shared/blob/main/docs/releases.md). _Note this is in the frontend-shared repository. The process is the same for this one._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypothesis%2Ffrontend-build","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhypothesis%2Ffrontend-build","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypothesis%2Ffrontend-build/lists"}