Skip to content

Commit 7d366c0

Browse files
committed
initial simple version
0 parents  commit 7d366c0

File tree

22 files changed

+4756
-0
lines changed

22 files changed

+4756
-0
lines changed

.github/workflows/demo.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy Example
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: 'pages'
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
- name: Setup Node
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20'
27+
cache: npm
28+
- name: Install dependencies
29+
run: |
30+
npm ci
31+
- name: Build
32+
run: |
33+
npm run example:build
34+
- name: Upload artifact
35+
uses: actions/upload-pages-artifact@v3
36+
with:
37+
path: ./example
38+
39+
# Deployment job
40+
deploy:
41+
environment:
42+
name: github-pages
43+
url: ${{ steps.deployment.outputs.page_url }}
44+
runs-on: ubuntu-latest
45+
needs: build
46+
steps:
47+
- name: Deploy to GitHub Pages
48+
id: deployment
49+
uses: actions/deploy-pages@v4

.github/workflows/e2e.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Cypress Tests
2+
3+
on: push
4+
5+
jobs:
6+
cypress-run:
7+
runs-on: ubuntu-22.04
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
- name: Cypress run
12+
uses: cypress-io/github-action@v6
13+
with:
14+
build: npm run example:build
15+
start: npm run example:dev

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- 'v*.*.*'
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: write
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version-file: .nvmrc
17+
registry-url: 'https://registry.npmjs.org'
18+
19+
- name: Install dependencies
20+
run: npm ci
21+
- name: Test
22+
run: npm run test
23+
- name: Compile
24+
run: npm run build
25+
- name: Get Package Version
26+
id: get-package-version
27+
uses: stevenbenitez/get-package-version-action@v1
28+
- name: Lint Package
29+
run: npm run package:lint
30+
31+
- name: Publish
32+
run: |
33+
npm publish --tag unsure
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
37+
- name: Tag Beta
38+
if: contains(steps.get-package-version.outputs.version, '-beta')
39+
run: |
40+
npm dist-tags add @preachjs/datepicker@${{ steps.get-package-version.outputs.version }} beta
41+
env:
42+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
44+
- name: PR Message
45+
uses: mshick/add-pr-comment@v2
46+
if: contains(steps.get-package-version.outputs.version, '-beta') && github.event_name == 'pull_request'
47+
with:
48+
message: |
49+
Published new beta release: ${{ steps.get-package-version.outputs.version }}
50+
51+
- name: Tag Release
52+
if: ${{ !contains(steps.get-package-version.outputs.version, '-beta') }}
53+
run: |
54+
npm dist-tags add @preachjs/datepicker@${{ steps.get-package-version.outputs.version }} latest
55+
env:
56+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
node_modules
3+
dist
4+
5+
cypress/results/*
6+
cypress/reports/*
7+
cypress/screenshots/*
8+
cypress/videos/*

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
npm i --silent
2+
npx nano-staged

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v18.17.0

CHANGELOG.md

Whitespace-only changes.

CONTRIBUTING.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Contribution Notes
2+
3+
## Basics
4+
5+
1. This packages ships it's source as is. There's no transpilation of the JSX,
6+
nor is there a build step for the final package.
7+
2. To develop and test, use the `example` that's in place as your playground
8+
3. Any changes made to the `example` need to go through the `e2e` tests again or
9+
simply put, if you change the example, sync the tests for the same.
10+
11+
## Development
12+
13+
1. You'll need `node>=18` to be able to run the example.
14+
15+
## PR Stratergy
16+
17+
1. We Squash the changes so don't worry so much about the commit messages on
18+
your branch.
19+
2. Make sure the PR themselves are very focused and not trying to change a wider
20+
scope of the project

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 reaper <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

build.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import esbuild from 'esbuild'
2+
3+
const args = process.argv.slice()
4+
const isDev = args.includes('--dev')
5+
6+
const ctx = await esbuild.context({
7+
entryPoints: ['./example/src/main.js'],
8+
format: 'esm',
9+
bundle: true,
10+
logLevel: 'info',
11+
platform: 'browser',
12+
outdir: 'example/dist',
13+
jsx: 'automatic',
14+
jsxImportSource: 'preact',
15+
loader: {
16+
'.js': 'jsx',
17+
},
18+
})
19+
20+
if (isDev) {
21+
await ctx.watch()
22+
setTimeout(() => {
23+
ctx.serve({
24+
port: 8000,
25+
servedir: './example',
26+
})
27+
}, 100)
28+
}
29+
30+
await ctx.rebuild()
31+
!isDev && process.exit(0)

0 commit comments

Comments
 (0)