{"id":20705240,"url":"https://github.com/berkeley-gif/caladapt-website-2021","last_synced_at":"2026-01-26T08:33:22.275Z","repository":{"id":38185324,"uuid":"353113354","full_name":"berkeley-gif/caladapt-website-2021","owner":"berkeley-gif","description":"Redesign and rewrite of the website for Cal-Adapt.org","archived":false,"fork":false,"pushed_at":"2024-10-11T19:58:09.000Z","size":66435,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-27T09:39:11.345Z","etag":null,"topics":["cal-adapt","california","climate-change","climate-models","data-visualization","svelte"],"latest_commit_sha":null,"homepage":"","language":"Svelte","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/berkeley-gif.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-03-30T19:08:57.000Z","updated_at":"2024-10-11T19:58:10.000Z","dependencies_parsed_at":"2023-01-25T23:16:55.909Z","dependency_job_id":"8b8651d0-78da-4dd7-8eef-a3bb2df8c41d","html_url":"https://github.com/berkeley-gif/caladapt-website-2021","commit_stats":{"total_commits":397,"total_committers":6,"mean_commits":66.16666666666667,"dds":0.6372795969773299,"last_synced_commit":"79d626f5a99a48e2669e45d7bf3001e894149a61"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/berkeley-gif/caladapt-website-2021","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berkeley-gif%2Fcaladapt-website-2021","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berkeley-gif%2Fcaladapt-website-2021/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berkeley-gif%2Fcaladapt-website-2021/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berkeley-gif%2Fcaladapt-website-2021/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berkeley-gif","download_url":"https://codeload.github.com/berkeley-gif/caladapt-website-2021/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berkeley-gif%2Fcaladapt-website-2021/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28770834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T07:45:00.504Z","status":"ssl_error","status_checked_at":"2026-01-26T07:45:00.070Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cal-adapt","california","climate-change","climate-models","data-visualization","svelte"],"created_at":"2024-11-17T01:16:51.840Z","updated_at":"2026-01-26T08:33:22.248Z","avatar_url":"https://github.com/berkeley-gif.png","language":"Svelte","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cal-Adapt Website 2021\n\nSource code for the 2021 redesign of [cal-adapt.org](https://cal-adapt.org).\n\nThis project was bootstrapped with the [Sapper framework](https://sapper.svelte.dev/) for [SvelteJS](https://svelte.dev).\n\n## Node version\n\nThis project uses Node 14. Run the following command before installing or running your development environment:\n\n```\nnvm use 14\n```\n\n## Running the project\n\nOnce you have cloned the project, install dependencies and run the project in development mode:\n\n```bash\ncd cal-adapt-website-2021\nnpm install # or yarn\nnpm run dev\n```\n\nThe project should be viewable in your browser at `http://localhost:3000`.\n\n## Deploying\n\nFirst, make the [`deploy`](./scripts/deploy.mjs) script is executable in your environment:\n\n```bash\n# on unix systems:\nchmod +x scripts/deploy.mjs\n```\n\nThen run the appropriate deploy script for the environment on which you would like to deploy to:\n\n```bash\n# e.g. for dev.cal-adapt.org\nnpm run deploy-dev\n```\n\nThis will first run `sapper export` and then transfer the output to the appropriate location on the Cal-Adapt webserver.\n\n### Deploying to Netlify\n\nYou may deploy a local build to be hosted on [Netlify](https://netlify.com) for sharing a new feature or bug fix in isolation.\n\nFirst install the [Netlify CLI tools](https://cli.netlify.com/):\n\n```bash\nnpm install netlify-cli -g\n```\n\nThen log-in to Netlify:\n\n```bash\nnetlify login\n```\n\nSet the appropriate environment variables prior to running the deploy script:\n\n```bash\n# the netlify personal access token:\nexport NETLIFY_AUTH_TOKEN=\"xxxxxxxxx\"\n# the subdomain for the deployment, e.g.\nexport NETLIFY_ALIAS=\"bug-fix-abc\"\n```\n\nAnd then deploy as follows:\n\n```\nnpm run deploy-netlify\n```\n\n### Viewing the build locally prior to deploying\n\nIf you would like to view the build locally prior to deploying, first create the build without transfering it to the server:\n\n```bash\nnpm run deploy-dev -- --transfer=false\n```\n\nThen run a local server that will serve the contents of `__sapper__/export`:\n\n```bash\nnpm run start:export\n```\n\nYou may then view the built site on `http://localhost:5000`.\n\nThis can be useful when debugging issues for the production environment.\n\n## Running Tests\n\n### Unit Tests\n\nUnit tests are run using [Jest](https://www.npmjs.com/package/jest) and [@testing-library/svelte](https://www.npmjs.com/package/@testing-library/svelte).\n\nTo run all tests:\n\n```bash\nnpm run test\n```\n\nTo run tests in watch mode:\n\n```bash\nnpm run test:watch\n```\n\nTo run tests for a specific file:\n\n```bash\nnpm run test -- \u003cpattern\u003e\n```\n\n...where `\u003cpattern\u003e` is a regex for a specific file or test name.\n\nFor help on writing tests for Svelte components see the following resources:\n\n- [Svelte Society: Unit Testing Svelte Components](https://sveltesociety.dev/recipes/testing-and-debugging/unit-testing-svelte-component/)\n- [@testing-library docs](https://testing-library.com/docs/)\n- [jest docs](https://jestjs.io/docs/getting-started)\n\n## Feature Flags\n\nThe [`featureFlags`](./featureFlags.json) JSON document contains environment variables that are used to enable or disable various features or routes of the website. For client-side code these varaibles are accessible under `process.env` and in server side code (e.g. Sapper's preloading) they are accessible under `process.cal_adapt_features`. They differ due to how `process.env` is handled by browser (client) and NodeJS (server side) environments with Webpack.\n\nNote that the values of feature flags will differ depending on the deploy environment that is set when deploying the app (e.g. the location being deployed to such as `dev.cal-adapt.org`, `beta.cal-adapt.org`, or `cal-adapt.org`). The [deploy script](./scripts/deploy.mjs) sets an environment variable `DEPLOY` which is used in the [`webpack.config.js`](./webpack.config.js) to set the values of feature flags. During local development the value of the `DEPLOY` env variable will fallback to `dev` (the same as deploying to `dev.cal-adapt.org`).\n\n## Bundle Analyzer\n\nTo inspect the bundled JavaScript code first run the `dev` script:\n\n```bash\nnpm run dev\n```\n\nThen open your browser to `http://127.0.0.1:8888` or whatever address is outputted by Webpack Bundle Analyzer in the terminal.\n\n## Directory structure\n\n### src\n\nThe [src](src) directory contains the entry points for the app — `client.js`, `server.js` and (optionally) a `service-worker.js` — along with a `template.html` file and a `routes` directory.\n\n#### src/routes\n\nThis is the heart of the app. There are two kinds of routes — _pages_, and _server routes_.\n\n**Pages** are Svelte components written in `.svelte` files. When a user first visits the application, they will be served a server-rendered version of the route in question, plus some JavaScript that 'hydrates' the page and initialises a client-side router. From that point forward, navigating to other pages is handled entirely on the client for a fast, app-like feel. (Sapper will preload and cache the code for these subsequent pages, so that navigation is instantaneous.)\n\n**Server routes** are modules written in `.js` files, that export functions corresponding to HTTP methods. Each function receives Express `request` and `response` objects as arguments, plus a `next` function. This is useful for creating a JSON API, for example.\n\nThere are three simple rules for naming the files that define your routes:\n\n- A file called `src/routes/about.svelte` corresponds to the `/about` route. A file called `src/routes/blog/[slug].svelte` corresponds to the `/blog/:slug` route, in which case `params.slug` is available to the route\n- The file `src/routes/index.svelte` (or `src/routes/index.js`) corresponds to the root of your app. `src/routes/about/index.svelte` is treated the same as `src/routes/about.svelte`.\n- Files and directories with a leading underscore do _not_ create routes. This allows you to colocate helper modules and components with the routes that depend on them — for example you could have a file called `src/routes/_helpers/datetime.js` and it would _not_ create a `/_helpers/datetime` route.\n\n#### src/node_modules/@sapper\n\nThis directory is managed by Sapper and generated when building. It contains all the code you import from `@sapper` modules.\n\n### static\n\nThe [static](static) directory contains static assets that should be served publicly. Files in this directory will be available directly under the root URL, e.g. an `image.jpg` will be available as `/image.jpg`.\n\nThe default [service-worker.js](src/service-worker.js) will preload and cache these files, by retrieving a list of `files` from the generated manifest:\n\n```js\nimport { files } from \"@sapper/service-worker\";\n```\n\nIf you have static files you do not want to cache, you should exclude them from this list after importing it (and before passing it to `cache.addAll`).\n\nStatic files are served using [sirv](https://github.com/lukeed/sirv).\n\n### files\n\nThe `files` directory is used to host pdfs, Word docs or other files that CEC wants Cal-Adapt to host and are typically not accessible elsewhere on the web. This directory which would normally be in the `static` directory (similar to the `static/img` or `static/data`) is not checked into this github repo.\n\nFiles that need to be hosted are directly copied to the Cal-Adapt server at `/var/www/cal-adapt.org/files`. These files can be linked on blogs/events/other content pages as needed e.g. `/files/01_Memo_Evaluation_of_Downscaled_GCMs_Using_WRF_CEC_final.pdf`. **Note:** Filenames should not have blank spaces.\n\n## Bundler configuration\n\nWebpack is used to provide code-splitting and dynamic imports, as well as compiling Svelte components.\n\n## Using external components\n\nWhen using Svelte components installed from npm, such as [@sveltejs/svelte-virtual-list](https://github.com/sveltejs/svelte-virtual-list), Svelte needs the original component source (rather than any precompiled JavaScript that ships with the component). This allows the component to be rendered server-side, and also keeps your client-side app smaller.\n\nBecause of that, it's essential that the bundler doesn't treat the package as an _external dependency_. Install the package to `devDependencies` rather than `dependencies`, which will cause it to get bundled (and therefore compiled) with your app:\n\n```bash\nnpm install -D @sveltejs/svelte-virtual-list\n```\n\n## Code Credits\n\nThis project began as a [Svelte Sapper template](https://github.com/sveltejs/sapper-template) and borrows some code from both the [Svelte](https://svelte.dev/docs) and [Sapper](https://sapper.svelte.dev/docs) documentation, both of which are copyright 2016 – present, [Svelte](https://github.com/sveltejs/svelte/graphs/contributors) and [Sapper](https://github.com/sveltejs/sapper/graphs/contributors) contributors under the MIT License.\n\nSome code relating to [Charting components](./src/components/tools/Charts/) for the dashboards has been borrowed from the [Svelte Layer Cake library](https://layercake.graphics), copyright 2021 Michael Keller under the MIT License.\n\nSome code relating to the [Map Legend component](./src/components/tools/Map/Legend.svelte) was borrowed from the ObservableHQ [Color-Legend](https://observablehq.com/@d3/color-legend) developed by Mike Bostock, copyright 2019–2020 Observable, Inc. under the ISC License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberkeley-gif%2Fcaladapt-website-2021","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberkeley-gif%2Fcaladapt-website-2021","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberkeley-gif%2Fcaladapt-website-2021/lists"}