generated from nichoth/template-ts-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 48e35fd
Showing
25 changed files
with
581 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dist/* | ||
public/* | ||
test/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"ignorePatterns": ["lib.es5.d.ts"], | ||
"parserOptions": { | ||
"requireConfigFile": false | ||
}, | ||
"extends": [ | ||
"standard", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
"argsIgnorePattern": "^_", | ||
"varsIgnorePattern": "^_", | ||
"caughtErrorsIgnorePattern": "^_" | ||
} | ||
], | ||
"operator-linebreak": ["off"], | ||
"multiline-ternary": "off", | ||
"@typescript-eslint/consistent-type-imports": [ | ||
"error", | ||
{ | ||
"prefer": "type-imports" | ||
} | ||
], | ||
"no-multiple-empty-lines": [ | ||
"error", | ||
{ | ||
"max": 1, | ||
"maxEOF": 1 | ||
} | ||
], | ||
"indent": ["error", 4, { | ||
"SwitchCase": 1, | ||
"ignoredNodes": ["TemplateLiteral *"] | ||
}], | ||
"comma-dangle": "off", | ||
"no-multi-spaces": ["error", { "ignoreEOLComments": true }] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 2 | ||
updates: | ||
# Enable version updates for npm | ||
- package-ecosystem: "npm" | ||
# Look for `package.json` and `lock` files in the `root` directory | ||
directory: "/" | ||
# Check the npm registry for updates every day (weekdays) | ||
schedule: | ||
interval: "daily" | ||
# Enable updates to github actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Sample workflow for building and deploying a Jekyll site to GitHub Pages | ||
name: GitHub Pages deploy | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
- name: Install | ||
run: npm install | ||
- name: Build | ||
run: npm run build-docs | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: docs/ | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Sample workflow for building and deploying a Jekyll site to GitHub Pages | ||
name: GitHub Pages deploy | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
- name: Install | ||
run: npm install | ||
- name: Build | ||
run: npm run build-example | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: public/ | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Node CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 5 | ||
|
||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: npm install, build | ||
run: | | ||
npm install | ||
npm run build --if-present | ||
npm run lint | ||
env: | ||
CI: true | ||
- name: Run tape tests | ||
run: | | ||
npm run build-tests | ||
xvfb-run --server-args="-screen 0 1920x1080x24" npm run test-tape-run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
node_modules | ||
bundle.js | ||
.DS_Store | ||
test/*.js | ||
dist | ||
.env | ||
public | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
!dist | ||
node_modules | ||
.env | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
THE MIT LICENSE (MIT) | ||
|
||
Copyright © 2024 Nick Thomas <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the “Software”), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# package name here | ||
![tests](https://github.com/bicycle-codes/crypto-util/actions/workflows/nodejs.yml/badge.svg) | ||
[![types](https://img.shields.io/npm/types/@substrate-system/icons?style=flat-square)](README.md) | ||
[![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md) | ||
[![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&style=flat-square)](https://semver.org/) | ||
[![Common Changelog](https://nichoth.github.io/badge/common-changelog.svg)](./CHANGELOG.md) | ||
[![install size](https://packagephobia.com/badge?p=@substrate-system/a11y)](https://packagephobia.com/result?p=@substrate-system/a11y) | ||
[![dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg?style=flat-square)](package.json) | ||
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) | ||
|
||
`<package description goes here>` | ||
|
||
[See a live demo](https://namespace.github.io/package-name/) | ||
|
||
<details><summary><h2>Contents</h2></summary> | ||
<!-- toc --> | ||
</details> | ||
|
||
## install | ||
|
||
Installation instructions | ||
|
||
```sh | ||
npm i -S @namespace/package | ||
``` | ||
|
||
## API | ||
|
||
This exposes ESM and common JS via [package.json `exports` field](https://nodejs.org/api/packages.html#exports). | ||
|
||
### ESM | ||
```js | ||
import '@namespace/package/module' | ||
``` | ||
|
||
### Common JS | ||
```js | ||
require('@namespace/package/module') | ||
``` | ||
|
||
## CSS | ||
|
||
### Import CSS | ||
|
||
```js | ||
import '@namespace/package-name/css' | ||
``` | ||
|
||
Or minified: | ||
```js | ||
import '@namespace/package-name/css/min' | ||
``` | ||
|
||
### Customize CSS via some variables | ||
|
||
```css | ||
component-name { | ||
--example: pink; | ||
} | ||
``` | ||
|
||
## use | ||
|
||
`usage instructions here` | ||
|
||
### JS | ||
```js | ||
import '@namespace/package/module' | ||
``` | ||
|
||
### pre-built JS | ||
This package exposes minified JS files too. Copy them to a location that is | ||
accessible to your web server, then link to them in HTML. | ||
|
||
#### copy | ||
```sh | ||
cp ./node_modules/@namespace/package/dist/module.min.js ./public | ||
``` | ||
|
||
#### HTML | ||
```html | ||
<script type="module" src="./module.min.js"></script> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# template ts browser | ||
|
||
A template for typescript *dependency* modules that run in a browser environment. | ||
Uses `tape-run` for tests in a browser. See [template-ts](https://github.com/nichoth/template-ts) for the same thing but targeting Node. | ||
|
||
## use | ||
1. Use the template button in github. Or clone this then | ||
`rm -rf .git && git init`. Then `npm i && npm init`. | ||
|
||
2. Edit the source code in `src/index.ts`. | ||
|
||
3. Delete either `.github/workflows/gh-pages-docs.yml` or `.github/workflows/gh-pages.yml`, depending on whether you want to deploy an example or docs to github pages. | ||
|
||
4. __Edit things__ | ||
* Use `./README.example.md` as a starter for docs: | ||
```sh | ||
cp ./README.example.md ./README.md | ||
``` | ||
* edit the [build-example](https://github.com/nichoth/template-web-component/blob/c580636f1c912fe2633f7c2478f28b11729c9b80/package.json#L20) command in `package.json` so that it has the right | ||
namespace for github pages | ||
|
||
## featuring | ||
|
||
* compile the source to both ESM and CJS format, and put compiled files in `dist`. | ||
* ignore `dist` and `*.js` in git, but don't ignore them in npm. That way we | ||
don't commit any compiled code to git, but it is available to consumers. | ||
* use npm's `prepublishOnly` hook to compile the code before publishing to npm. | ||
* use [exports](./package.json#L41) field in `package.json` to make sure the right format is used | ||
by consumers. | ||
* `preversion` npm hook -- lint | ||
* `postversion` npm hook -- `git push --follow-tags && npm publish` | ||
* eslint -- `npm run lint` | ||
* tests run in a browser environment via `tape-run` -- see [`npm test`](./package.json#L12). | ||
Includes `tap` testing tools -- [tapzero](https://github.com/bicycle-codes/tapzero) | ||
and [tap-spec](https://www.npmjs.com/package/tap-spec) | ||
* CI via github actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# set for all pages | ||
# https://docs.netlify.com/routing/headers/#syntax-for-the-headers-file | ||
/* | ||
X-Robots-Tag: noindex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# https://www.robotstxt.org/robotstxt.html | ||
User-agent: * | ||
Disallow: / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Example</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="./index.ts"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.