{"id":13567936,"url":"https://github.com/cdnjs/static-website","last_synced_at":"2025-04-05T08:08:56.324Z","repository":{"id":37035947,"uuid":"182296063","full_name":"cdnjs/static-website","owner":"cdnjs","description":"🖥 New Vue/Nuxt website for cdnjs.com - The #1 free and open source CDN built to make life easier for developers. ","archived":false,"fork":false,"pushed_at":"2024-10-28T17:04:00.000Z","size":3695,"stargazers_count":77,"open_issues_count":8,"forks_count":51,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-30T00:55:24.348Z","etag":null,"topics":["cdnjs","css","css3","hacktoberfest","html","html-css","html5","nuxt","nuxtjs","test-website","testbed","web","website"],"latest_commit_sha":null,"homepage":"https://cdnjs.com","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cdnjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["MattIPv4"],"open_collective":"cdnjs","patreon":"cdnjs"}},"created_at":"2019-04-19T16:42:14.000Z","updated_at":"2024-10-28T16:48:06.000Z","dependencies_parsed_at":"2023-12-16T00:07:14.480Z","dependency_job_id":"edf446d6-a392-44ea-9011-916860a4211d","html_url":"https://github.com/cdnjs/static-website","commit_stats":{"total_commits":317,"total_committers":16,"mean_commits":19.8125,"dds":"0.18611987381703465","last_synced_commit":"4ada5150d402b9e07c8a322f2bb2a9d59148f592"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdnjs%2Fstatic-website","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdnjs%2Fstatic-website/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdnjs%2Fstatic-website/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdnjs%2Fstatic-website/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdnjs","download_url":"https://codeload.github.com/cdnjs/static-website/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305935,"owners_count":20917208,"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","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":["cdnjs","css","css3","hacktoberfest","html","html-css","html5","nuxt","nuxtjs","test-website","testbed","web","website"],"created_at":"2024-08-01T13:02:50.024Z","updated_at":"2025-04-05T08:08:56.302Z","avatar_url":"https://github.com/cdnjs.png","language":"Vue","readme":"\u003ch1 align=\"center\"\u003e\n    \u003ca href=\"https://cdnjs.com\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/cdnjs/brand/master/logo/standard/dark-512.png\" width=\"175px\" alt=\"\u003c cdnjs \u003e\"\u003e\u003c/a\u003e\n\u003c/h1\u003e\n\n\u003ch3 align=\"center\"\u003eThe #1 free and open source CDN built to make life easier for developers.\u003c/h3\u003e\n\n---\n\n## cdnjs Website\n\nWelcome to the cdnjs/static-website repository, the home of the new cdnjs website built with Vue \u0026\nNuxt, following the new cdnjs branding proposal from [cdnjs/brand](https://github.com/cdnjs/brand).\n\nThis website relies completely on the cdnjs API to operate, resulting in very low resource usage to\nserve the site and limited app logic to update data being used (only sitemaps have to be updated,\neverything else uses API calls when a page is loaded).\n\n## Getting Started\n\nThis project runs on [Node.js](https://nodejs.org). Please make sure you have a version installed\nthat matches our defined requirement in the [.nvmrc](.nvmrc) file for this project.\n\nIncluded with this project is a dependency lock file. This is used to ensure that all installations\nof the project are using the same version of dependencies for consistency.\n\nYou can install the Node dependencies following this lock file by running:\n\n```shell script\nnpm ci\n```\n\nOnce the dependencies are installed, the website is ready to run in development mode. To start Nuxt\nin development mode (without a custom server), run:\n\n```shell script\nnpm run dev\n```\n\n### Development in Windows\n\nBefore running `npm run dev`, add a global npm package to resolve the `'NODE_ENV' is not recognized\nas an internal or external command` issue:\n\n```shell script\nnpm install -g win-node-env\n```\n\n## Analyzing Bundle\n\nThe website is build using Nuxt and relies on Webpack to generate the client-side bundle used to\nrender the site and provide interactivity. Due to this, we can use Webpack's analyzer to better\nunderstand what is contributing to the size of the final bundle.\n\nTo run the analyzer, use the following package script:\n\n```shell script\nnpm run dev:analyze\n```\n\n## Environment Variables\n\n### Site Base\n\nWhen working with the site in development, using `npm run dev` or `npm run dev:analyze`, the\n`SITE_HOST` environment variable will be automatically set to be `http://localhost:3000/`, as this\nis where the site is made accessible by the dev script.\n\nWhen deploying this site to production using the `npm run build` and `npm run start` scripts, the\n`SITE_HOST` environment variable must be set and should be the canonical base for where the site\nwill be hosted. In production for us, this is set to `https://cdnjs.com/`.\n\n### Google Analytics\n\nTo enable Google Analytics for a deployment of the site, you should set the `GA_ID` environment\nvariable. This should be set to the unique Google Analytics ID for your property, in the form\n`UA-xxxxxxxxx-x`.\n\nGoogle Analytics is bundled with the site using the `@nuxtjs/google-analytics` module. If the\nenvironment variable is not specified, Google Analytics will not be bundled with the deployment.\n\n### Sentry Error Logging\n\nTo enable basic Sentry error logging, the `SENTRY_DSN` environment variable must be set with a valid\nDSN URL from Sentry.\n\nTo enable source maps \u0026 release tracking for error reporting in production, the `SENTRY_ORG` and\n`SENTRY_PROJECT` environment variables must be set with the correct Sentry project information, as\nwell as `SENTRY_AUTH_TOKEN` being set to a valid auth token from Sentry. Source maps are used as in\nproduction we use minified, bundled JavaScript, so the sourcemaps allow Sentry to show where an\nerror originated from in the source code.\n\n### Disallow in robots.txt\n\nBy default, during the build process a `robots.txt` file will be generated for the site that has\n`User-agent: *` and `Allow: *`. If you wish to have a more private instance of the site or want to\nprevent potential SEO contamination, you can set the `ROBOTS_DISALLOW` env var to be `1`. This will\nchange the `Allow: *` rule to be `Disallow: /`.\n\n### Sitemap generation\n\nTo enable sitemap generation for the site, `NODE_ENV` must be set to `production`. This will enable\nthe initial sitemap generation during build as well as the background task for regenerating the\nsitemap during `npm run start`, every 30 minutes.\n\nFurther, by having `NODE_ENV=production`, this will also tell the `robots.txt` generation script,\nreferenced above, to include a rule pointing to the sitemap index file, based on the provided\n`SITE_HOST` env var.\n\n(Note that for `npm run dev:analyze`, `npm run build` \u0026 `npm run start`, `NODE_ENV` will be\nautomatically set to `production`).\n\n## Production Deployment\n\nTo deploy this website to production, the following steps should be taken:\n\n- Install dependencies with `npm ci`\n- Build the site for production with `npm run build`\n- Start the custom Express server with `npm run start`\n\nFor deployments to some PaaS hosts, the installation of dependencies and building the app will\nautomatically be done, with `npm run start` being defined in the [`Procfile`](Procfile).\n\nTo change the port that the app binds to, set the `PORT` environment var when running the script.\n\nThe custom Express server is used to handle our sitemaps, as we have too many routes for Nuxt's\nsitemap offering to handle reliably. During the build step (`npm run build`) initial sitemaps will\nbe generated. The Express server will then regenerate these every 30 minutes using the cdnjs API. A\nlog containing the outcome of the last generation in Express is available at `/sitemap-log.txt` on\nthe website.\n\n## Linting\n\nOur full set of tests for linting can be run at any time with:\n\n```shell script\nnpm test\n```\n\nIncluded in this repository are an [eslint config file](.eslintrc.js) as well as a\n[sass-lint config file](.sasslintrc) to help with ensuring a consistent style in the codebase for\nthe JS/Vue and SCSS used in the app.\n\nTo help enforce this, we use both eslint and sass-lint in our testing. To run eslint at any time,\nwhich checks the code style of any JavaScript and Vue files, you can use:\n\n```shell script\nnpm run test:eslint\n```\n\neslint also provides automatic fixing capabilities, these can be run against the codebase with:\n\n```shell script\nnpm run test:eslint:fix\n```\n\nSimilarly, sass-lint can be run at any time to check the quality of all the SCSS files used in the\napp, by running:\n\n```shell script\nnpm run test:scss\n```\n\nA secondary package, sass-lint-auto-fix, is available to help with automatically fixing some of the\nerrors raised by sass-lint, which can be run with:\n\n```shell script\nnpm run test:scss:fix\n```\n\nLike with `npm test`, which runs both eslint \u0026 sass-lint, a shorter package script is available to\nautomatically attempt to fix issues from both linting packages, which can be used by running:\n\n```shell script\nnpm run test:fix\n```\n","funding_links":["https://github.com/sponsors/MattIPv4","https://opencollective.com/cdnjs","https://patreon.com/cdnjs"],"categories":["Vue"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdnjs%2Fstatic-website","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdnjs%2Fstatic-website","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdnjs%2Fstatic-website/lists"}