Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/haxtheweb/webcomponents

Monorepo of webcomponents and associated microservice apis
https://github.com/haxtheweb/webcomponents

hax haxcms htmlelement javascript litelement monorepo polymer webcomponents yarn

Last synced: 8 days ago
JSON representation

Monorepo of webcomponents and associated microservice apis

Awesome Lists containing this project

README

        

# webcomponents
Monorepo of all web components built as part of the HAX ecosystem

# HAX
The authoring experience of HAX and the ability to make fast, static file backed websites rapidly.
Get all the details you want on [HAX docs](https://oer.hax.psu.edu/bto108/sites/haxcellence/)!
HAX seeks to be the smallest possible back-end CMS to make HAX work and be able to build websites with it. Leveraging JSON Outline Schema, HAX is able to author multiple pages, which it then writes onto the file system. This way a slim server layer is just for basic authentication, knowing how to save files, and placing them in version control.

Watch and Read more about HAX here:
- Youtube channel - https://www.youtube.com/@haxtheweb
- HAXCellence https://oer.hax.psu.edu/bto108/sites/haxcellence/what-is-hax

# Issues / Support / Community
- Discord Channel - https://bit.ly/hax-discord
- Unified issue queue - https://github.com/haxtheweb/issues/issues
- Using Merlin directly in any HAX spaces and type "Issue" to jump start a report!

# Related links and tech

- [NPM Package list](https://www.npmjs.com/org/haxtheweb)
- [storybook](https://haxapi.vercel.app/)
- [HAX [dot] PSU](https://hax.psu.edu)
- [HAX doc site](https://oer.hax.psu.edu/bto108/sites/haxcellence/)
- [HAXcms](https://github.com/haxtheweb/haxcms)
- [HAX + 11ty](https://github.com/haxtheweb/hax11ty)

[![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)
[![Lit](https://img.shields.io/badge/-Lit-324fff?style=flat&logo=data:image/svg%2bxml;base64,PHN2ZyBmaWxsPSIjZmZmIiB2aWV3Qm94PSIwIDAgMTYwIDIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDA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EwMi4xOSAxMDAuNjEgMTAyLjE5IDExMi45MSAxMjcuMzYgMTEyLjkxIDEyNy4zNiAxMDAuNjEgMTM5Ljk1IDEwMC42MSAxMzkuOTUgODguMyAxNTIuNTQgODguMyAxNTIuNTQgNzYgMTY1LjcyIDc2IDE2NS43MiA2My43IDE1My4xMyA2My43Ii8+PHBvbHlnb24gcG9pbnRzPSIzMy4xMyA2My43IDMzLjEzIDUxLjM5IDQ1LjcyIDUxLjM5IDQ1LjcyIDM5LjA5IDU4LjMxIDM5LjA5IDU4LjMxIDI2Ljc5IDgzLjQ4IDI2Ljc5IDgzLjQ4IDM5LjA5IDcwLjg5IDM5LjA5IDcwLjg5IDUxLjM5IDU4LjMxIDUxLjM5IDU4LjMxIDYzLjcgNDUuNzIgNjMuNyA0NS43MiA3NiA1OC44OSA3NiA1OC44OSA4OC4zIDcxLjQ4IDg4LjMgNzEuNDggMTAwLjYxIDg0LjA3IDEwMC42MSA4NC4wNyAxMTIuOTEgNTguODkgMTEyLjkxIDU4Ljg5IDEwMC42MSA0Ni4zMSAxMDAuNjEgNDYuMzEgODguMyAzMy43MiA4OC4zIDMzLjcyIDc2IDIwLjU0IDc2IDIwLjU0IDYzLjcgMzMuMTMgNjMuNyIvPjwvc3ZnPg==)](https://haxtheweb.org/)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-f8bc45.svg)](https://github.com/prettier/prettier)

[![Published on npm](https://img.shields.io/npm/v/@haxtheweb/h-a-x?style=flat)](https://www.npmjs.com/search?q=%haxtheweb)
[![build](https://github.com/haxtheweb/webcomponents/workflows/build/badge.svg?branch=master)](https://github.com/haxtheweb/webcomponents/actions?query=branch%3Amaster)
[![Dependency Status](https://img.shields.io/david/haxtheweb/webcomponents.svg?style=flat)](https://david-dm.org/haxtheweb/webcomponents)
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/author/elmsln)
[![Twitter](https://img.shields.io/twitter/follow/haxtheweb.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=haxtheweb)

# Welcome to the haxtheweb project!
Web components that can work in just about anything, are very small (Vanila or Lit based) and have full on authoring solutions if you dig deeper; Enjoy!

![Logo](https://github.com/elmsln/elmsln-logos/blob/master/haxtheweb/2019-08-14_13-05-52.png)

## Quick start

*Notice: You will need to use [Node](https://nodejs.org/en/) version 6.0 or higher. Verify that you have yarn enabled — if not [install yarn globally](https://yarnpkg.com/lang/en/docs/install/). These web components are written in [ES6](http://es6-features.org/) and build routines compile to es5 to encompass legacy browsers.*

### Quick Install
```bash
curl -fsSL https://raw.githubusercontent.com/haxtheweb/webcomponents/master/scripts/haxthewebme.sh -o haxthewebme.sh && sh haxthewebme.sh
```

### Manual Install

```bash
git clone https://github.com/haxtheweb/webcomponents.git
cd webcomponents
npm install --global @haxtheweb/create
yarn global add polymer-cli
yarn global add @web/test-runner
yarn global add @web/test-runner-commands
yarn global add @web/test-runner-puppeteer
yarn global add @web/test-runner-playwright
yarn global add lerna
yarn global add web-component-analyzer
yarn install
```

### Syncing Your Fork
```
git remote add upstream https://github.com/haxtheweb/webcomponents.git
git fetch upstream
git pull
```

## Windows

[Git bash](https://git-scm.com/) should already be installed on your Windows machine and can be found by searching through your computer's applications or by right-clicking anywhere inside of the File Explorer.
[Cygwin command line](https://www.cygwin.com/) is lightly tested, but slower than a true Bash environment.

### Windows Install

To properly configure git endlines for Windows, run this configuration
```bash
git config --global core.autocrlf true
```

```bash
git clone https://github.com/haxtheweb/webcomponents.git
cd webcomponents
npm install --global @haxtheweb/create
yarn global add polymer-cli
yarn global add @web/test-runner
yarn global add @web/test-runner-commands
yarn global add @web/test-runner-puppeteer
yarn global add @web/test-runner-playwright
yarn global add lerna
yarn global add web-component-analyzer
yarn install
```

## To work on any element in our repo
```bash
cd elements/ELEMENTNAME
yarn start
```
Edit files in `lib/`, `src/`, `locales/` and `demo/` in order to modify the element to contribute back to us via PR.
## Scripts

- `hax create`
- Run HAX CLI to create a new web component
- `yarn test`
- Run tests on ALL webcomponents.
- `yarn run build`
- Run build on ALL webcomponents.
- `yarn run storybook`
- Run storybook
- `yarn run build-storybook`
- Build storybook for deployment
- `lerna publish`
- Publish ALL webcomponents' elements to npmjs.com

- `lerna run build --no-bail`
- Run `build` command in all projects in the repo, don't bail if there's an issue

## Web Component development

Because this is a monorepo, each web component will need to be independently built in order to actively work on and preview the changes. Every web component has its own Gulp file and Yarn/NPM script.

While still running `yarn start` in one terminal window (which runs the local server), you will need to open another terminal window, drill into the directory of the web component you'd like to work on, and execute the `yarn run dev` command. This command will use gulp tasks to watch the files within that web component directory and will automatically re-run the build command and refresh the browser when you make changes to the web component.

### Working on elements (new-element)
Run `wcf element` to make a new element. Go to the new element following the directions generated at the end of the element's creation. To work on the new-element run `yarn start` from it's directory. If you are pulling in another element to use, run `yarn add projectname --save`.

### Example development on a web component

```bash
cd /Sites/webcomponents
yarn start

# SHIFT + CTRL + T to open a new tab in Terminal

cd elements your-card # or any other web component
yarn run dev
```

Make a change to the web component and save. The gulpfile will handle transpiling the element down to ES5 and will bring in the HTML and Sass into the template in the web component.

## Test

To test all webcomponents, run `yarn test` from the root of the repo. If you only want to test the web component you're working on:

```bash
cd elements/your-card
yarn test
```

Also, if your tests are failing and you want access to a live browser to investigate why, the following flag will keep the browser open.

```bash
yarn test -- -p
```

Then open the URL that will be printed in the terminal. It looks something like this: `http://localhost:8081/components/@@haxtheweb/haxtheweb/generated-index.html?cli_browser_id=0`.

## Storybook

We've added [Storybook](https://storybook.js.org/) to webcomponents as a way to preview our web components as they are being developed. We'll also use Storybook to export a static site that will be the demo site for webcomponents.

To run storybook

```bash
yarn run storybook
```

This will start a web server on port 9001. Navigate in your browser to `http://localhost:9001` to see Storybook in action. Storybook will watch for file changes and reload the browser automatically for you. This is a little slow at the moment, but we'll look into speeding this up.

To export the storybook static site

```bash
yarn run build-storybook
```

This places a build of the storybook site in the .storybook_out directory.

### Known Issues with Storybook

For any web component that has a third-party dependency you will need to update the `/.storybook/webpack.config.js` file. You will need to create an alias for your depedency.

For example:

```js
"../../whatwg-fetch/fetch.js": path.join( // this is the third-party dependency in the webcomponents
__dirname,
"../node_modules/whatwg-fetch/fetch.js" // this is where it lives in node_modules
)
```

## Tech Stack

**Client:** JavaScript, LitElement, Lit(https://lit.dev/)

**Server:** Node.js

## Contributing

Contributions are always welcome!

## Active contributors

- [@btopro](https://www.github.com/btopro)
- [@cgldevel](https://www.github.com/cgldevel)

## Additional contributions
Past contributors, student and larger community, can be found here: https://github.com/haxtheweb/webcomponents/graphs/contributors