Skip to content

Commit

Permalink
feat: initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
wKovacs64 committed Mar 9, 2019
0 parents commit a9d881c
Show file tree
Hide file tree
Showing 20 changed files with 8,152 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['babel-preset-gatsby-package'],
};
44 changes: 44 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: 2.1

defaults: &defaults
docker:
- image: circleci/node
working_directory: ~/repo

commands:
setup-repo:
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache

jobs:
validate:
<<: *defaults
steps:
- setup-repo
- run: yarn validate
release:
<<: *defaults
steps:
- setup-repo
- run: yarn semantic-release

workflows:
version: 2
validate_and_release:
jobs:
- validate
- release:
requires:
- validate
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gatsby-ssr.js
!src/gatsby-ssr.js
theme-hydration-script-tag.js
!src/theme-hydration-script-tag.js
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@wkovacs64/eslint-config-react'],
};
169 changes: 169 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
# Created by https://www.gitignore.io/api/osx,node,linux,windows,visualstudiocode

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

### OSX ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### VisualStudioCode ###
.vscode/*
# !.vscode/settings.json
# !.vscode/tasks.json
# !.vscode/launch.json
# !.vscode/extensions.json

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk


# End of https://www.gitignore.io/api/osx,node,linux,windows,visualstudiocode

# Build directory
/public

# npm
package-lock.json

# Netlify
.netlify

# build output
gatsby-ssr.js
!src/gatsby-ssr.js
theme-hydration-script-tag.js
!src/theme-hydration-script-tag.js
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package.json
gatsby-ssr.js
theme-hydration-script-tag.js
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Change Log

The changelog is automatically updated using
[semantic-release](https://github.com/semantic-release/semantic-release). You
can see it on the [releases page](../../releases).
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributing

If you would like to contribute code to this project, you can do so by forking
the repository and sending a pull request.

When submitting code, please make every effort to follow existing conventions
and style in order to keep the code as readable as possible. This project
roughly adheres to the [Airbnb][airbnb] code style (particularly for linting)
and is formatted using [prettier][prettier].

Thank you.

[airbnb]: https://github.com/airbnb/javascript
[prettier]: https://prettier.io
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2019 Justin R. Hall

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.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# [gatsby-plugin-use-dark-mode][home]

[![npm version][npm-image]][npm-url]

A [Gatsby][gatsby] plugin to prevent a flash of default styles when using the
[`use-dark-mode`][udm] hook if the user is not using the default theme.
Specifically, this plugin handles the injection of the
[`noflash.js`][udm-noflash] logic.

## Install

```sh
yarn add gatsby-plugin-use-dark-mode use-dark-mode
```

## Usage

Add the plugin to your `gatsby-config.js`.

```js
module.exports = {
plugins: ['gatsby-plugin-use-dark-mode'],
};
```

Follow the [`use-dark-mode`][udm] documentation for further instructions.

### Advanced Configuration

If you would like to specify the class names used (which you will also be
passing to [`useDarkMode`][udm-parameters]) or skip the script minification
process, you may do so through plugin options:

```js
// gatsby-config.js
module.exports = {
plugins: [
{
resolve: 'gatsby-plugin-use-dark-mode',
options: {
classNameDark: 'dark-mode',
classNameLight: 'light-mode',
minify: true,
},
},
],
};
```

## Limitations

[`useDarkMode`][udm] can be [configured][udm-parameters] to specify which DOM
element receives the class and to use an alternate storage provider if desired.
This plugin does not currently support those options, so it will only work if
you are using the defaults (`document.body` and `localStorage`).

[home]: https://github.com/wKovacs64/gatsby-plugin-use-dark-mode
[npm-image]:
https://img.shields.io/npm/v/gatsby-plugin-use-dark-mode.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/gatsby-plugin-use-dark-mode
[gatsby]: https://www.gatsbyjs.org
[udm]: https://github.com/donavon/use-dark-mode#readme
[udm-noflash]: https://github.com/donavon/use-dark-mode#that-flash
[udm-parameters]: https://github.com/donavon/use-dark-mode#parameters
4 changes: 4 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Releasing

This package is released automatically using
[semantic-release](https://github.com/semantic-release/semantic-release).
5 changes: 5 additions & 0 deletions husky.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
hooks: {
'pre-commit': 'lint-staged',
},
};
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// noop
4 changes: 4 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
'*.{js,ts,tsx}': ['prettier --write', 'eslint --fix', 'git add'],
'*.{json,md,yml}': ['prettier --write', 'git add'],
};
Loading

0 comments on commit a9d881c

Please sign in to comment.