Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@internetarchive/democracys-library

Package Overview
Dependencies
Maintainers
18
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internetarchive/democracys-library

A web component that highlights Democracy's Library

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15
increased by114.29%
Maintainers
18
Weekly downloads
 
Created
Source

Build Status codecov

A web component that highlights documents across various governments found on archive.org

Demo App: https://internetarchive.github.io/iaux-democracys-library/main/demo/

Usage

yarn install && yarn start

Local Demo with web-dev-server

yarn start

To run a local development server that serves the basic demo located in demo/index.html

Testing with Web Test Runner

To run the suite of Web Test Runner tests, run

yarn run test

To run the tests in watch mode (for <abbr title="test driven development">TDD</abbr>, for example), run

yarn run test:watch

Linting with ESLint, Prettier, and Types

To scan the project for linting errors, run

yarn run lint

You can lint with ESLint and Prettier individually as well

yarn run lint:eslint
yarn run lint:prettier

To automatically fix many linting errors, run

yarn run format

You can format using ESLint and Prettier individually as well

yarn run format:eslint
yarn run format:prettier

Tooling configs

For most of the tools, the configuration is in the package.json to reduce the amount of files in your project.

If you customize the configuration a lot, you can consider moving them to individual files.

Add Codecov

  • after forking, add your repo to the authorized codecov list: https://github.com/organizations/internetarchive/settings/installations/1268216
  • then, go to the badge maker page for your repo: https://app.codecov.io/gh/internetarchive/<repo-name>/settings/badge
  • copy link & paste into top of README.md

Steps to setup gh-pages static site generator

Let's start with creating a gh-pages branch.

This branch is where Github will look for the index.html to be hosted

git checkout --orphan gh-pages &&
git reset --hard &&
git commit --allow-empty -m "Initializing gh-pages branch" &&
git push origin gh-pages

Additional setup

  • Go to repo Settings -> sidebar Pages
  • In the Source drop-down, choose the branch where you want to host your Github Pages and the directory where it was hosted
    • We'll use gh-pages branch for this but you can use other branch name for this
    • Just make sure that's the branch where the index.html that you want to host lives in

Github Pages Settings

Manual Deploy using gh-pages

You can update the current Github Page without pushing a commit by running:

yarn run ghpages:publish

This build script does the following, see package.json:

  • ghpages:publish

  • ghpages:prepare

    • This executes ghpages:build that builds the project dependencies and generates vite build from it
    • We use vite to bundle and generate the static assets that we host in Github Pages
      • See vite.config.ts related to this
  • ghpages:generate

    • This executes gh-pages npm package command to publish/upload the generated files from our vite build files
    • Upon executing this command:
      • This generates a commit message formatted from the most recent commit message of the branch
      • Push the commit to gh-pages branch that we setup earlier

The live demo app URL from current branch will look something like this: https://<organization_name_or_username>.github.io/<repo_name>/<branch_name>/demo

Automatic Deploy of Demo App

Things that trigger automatic site generation:

  • a merge to main

    • See workflow: gh-pages-main.yml
    • Example: https://<organization_name_or_username>.github.io/<repo_name>/main
  • a pull request against main

    • See workflow: pr-preview.yml
      • The URL for your Pull Request will be deleted after merging to main but you can update that in the config
    • When you create a Pull Request, if your code passes codecov unit tests, it will be always served live at base URL/pull request number.
    • Example: https://<organization_name_or_username>.github.io/<repo_name>/pr/<pr-number>/demo
      • Note that demo is another directory where the index.html lives in
      • You are free to playaround with it and set your desired file directory/structure on your end

Another thing to note: pushing a branch up alone will not trigger site creation.

Happy devving ^_^ 🥳 🎉

FAQs

Package last updated on 17 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc