Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking change: add snowpack build process, github actions, and fix for default start/end dates #103

Merged
merged 7 commits into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 24 additions & 26 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
module.exports = {
env: {
browser: true,
es6: true
env: {
browser: true,
es6: true,
'jest/globals': true,
},
// extends: 'eslint:recommended',
extends: 'airbnb-base/legacy',
ignorePatterns: ['src/index.js'],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['svelte3', 'jest'],
overrides: [
{
files: ['src/**/*.svelte'],
processor: 'svelte3/svelte3',
},
// extends: 'eslint:recommended',
extends: 'airbnb-base/legacy',
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module'
},
plugins: [
'svelte3'
],
overrides: [
{
files: ['src/**/*.svelte'],
processor: 'svelte3/svelte3'
}
],
rules: {

}
};
],
rules: {},
};
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI
on:
push:
branches-ignore:
- master
jobs:
release:
name: Lint
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run pretest
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release
on:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run pretest
- name: Github Pages
run: npm run build && cp -r build/ docs/
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.DS_Store
node_modules
package-lock.json
yarn.lock
build
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"trailingComma": "all",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"svelteSortOrder": "scripts-markup-styles",
"svelteBracketNewLine": true
}
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,28 @@

A small date picker built with Svelte 3. Demo available here: [demo page].

## Installation

```sh
npm i -D svelte-calendar
```

## Basic usage

```html
<script>
import Datepicker from 'svelte-calendar';
</script>

<Datepicker start={minDate} end={maxDate} />
```

## Props

prop name | type | default
---------------------|------------------------|-------------------------
`start` | `date` | `new Date(1987, 9, 29)`
`end` | `date` | `new Date(2020, 9, 29)`
`start` | `date` | one year in past
`end` | `date` | one year in future
`selected` | `date` | `today`
`formattedSelected` | `string` | `today`
`dateChosen` | `boolean` | `false`
Expand All @@ -24,7 +34,7 @@ prop name | type | default
`style` | `string` | ""

### `start` and `end`
These properties set the minimum and maximum dates that will be rendered by this calendar. It is **highly** recommended that you do not leave these as their defaults and supply values which suit your application's needs.
These properties set the minimum and maximum dates that will be rendered by this calendar. It is recommended that you do not leave these as their defaults and supply values which suit your application's needs.

### `selected` and `formattedSelected`
Bind to these properties to observe the selected date as either a date or a string. Use `selected` to set the day which is selected by default.
Expand All @@ -36,10 +46,10 @@ Bind to this property to observe whether a user has selected a day.
Provide a function which accepts a date and returns a boolean determining whether a day between `start` and `end` is selectable. For example, use this to prevent weekend days from being selected.

### `format`
Date formatting uses [`timeUtils`] formatting (MM/DD/YYYY by default). If you would like to use a different formatting library, supply a function which accepts a date and returns a string.
Date formatting uses [`timeUtils`] formatting (MM/DD/YYYY by default). If you would like to use a different formatting library, supply a function which accepts a date and returns a string.

### `daysOfWeek` and `monthsOfYear`
These two props are used to internationalize the calendar. The default values are:
These two props are used to internationalize the calendar. The default values are:

```javascript
export let daysOfWeek = [
Expand All @@ -51,6 +61,7 @@ export let daysOfWeek = [
['Friday', 'Fri'],
['Saturday', 'Sat']
];

export let monthsOfYear = [
['January', 'Jan'],
['February', 'Feb'],
Expand Down
7 changes: 0 additions & 7 deletions docs/bundle.css

This file was deleted.

Loading