Skip to main content

Contributing to @social-embed/wc

Clone the repo

Repo: https://github.com/social-embed/social-embed

git clone https://github.com/social-embed/social-embed

Build

This sample uses the TypeScript compiler to produce JavaScript that runs in modern browsers.

To build the JavaScript version of your component:

yarn build

To watch files and rebuild when the files are modified, run the following command in a separate shell:

yarn build --watch

Testing

This sample uses web-test-runner and the open-wc test helpers for testing. See the open-wc testing documentation for more information.

Tests can be run with the test script:

yarn test

Note: On Ubuntu, you may need to download libraries:

sudo apt install libatk1.0-0 libatk-bridge2.0-0 libcups2 libxcomposite1
libxdamage1

Dev Server

via vite preview:

yarn serve

There is a development HTML file located at /index.html that you can view at http://localhost:4173/index.html.

Editing

If you use VS Code, we highly recommend the lit-plugin extension, which enables some extremely useful features for lit-html templates:

  • Syntax highlighting
  • Type-checking
  • Code completion
  • Hover-over docs
  • Jump to definition
  • Linting
  • Quick Fixes

The project is setup to recommend lit-plugin to VS Code users if they don't already have it installed.

Linting

Linting of TypeScript files is provided by ESLint and TypeScript ESLint. In addition, lit-analyzer is used to type-check and lint lit-html templates with the same engine and rules as lit-plugin.

The rules are mostly the recommended rules from each project, but some have been turned off to make LitElement usage easier. The recommended rules are pretty strict, so you may want to relax them by editing .eslintrc.json and tsconfig.json.

To lint the project run:

yarn lint

Formatting

Prettier is used for code formatting. It has been pre-configured according to the Polymer Project's style. You can change this in .prettierrc.json.