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

Update dependencies #78

Merged
merged 5 commits into from
Mar 23, 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
14 changes: 7 additions & 7 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"projectName": "babel-plugin-preval",
"projectOwner": "kentcdodds",
"imageSize": 100,
"commit": false,
"contributorsPerLine": 7,
"repoHost": "https://github.com",
"repoType": "github",
"skipCi": false,
"files": [
"README.md"
],
"imageSize": 100,
"commit": false,
"contributors": [
{
"login": "kentcdodds",
Expand Down Expand Up @@ -158,9 +162,5 @@
"doc"
]
}
],
"repoType": "github",
"repoHost": "https://github.com",
"contributorsPerLine": 7,
"skipCi": true
]
}
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* text=auto
*.js text eol=lf
* text=auto eol=lf
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
node_modules
coverage
dist
.opt-in
.opt-out
*.log
.DS_Store

# these cause more harm than good
# when working with contributors
package-lock.json
yarn.lock
1 change: 1 addition & 0 deletions .huskyrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('kcd-scripts/husky')
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
registry=http://registry.npmjs.org/
package-lock=false
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
coverage
dist
17 changes: 0 additions & 17 deletions .prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('kcd-scripts/prettier')
26 changes: 17 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
sudo: false
language: node_js
cache:
directories:
- ~/.npm
cache: npm
notifications:
email: false
node_js: '8'
node_js:
- 10.0.0
- 12
- node
install: npm install
script: npm run validate
after_success:
- kcd-scripts travis-after-success
script:
- npm run validate
- npx codecov@3
branches:
only: master
only:
- master
- beta

jobs:
include:
- stage: release
node_js: 12
script: kcd-scripts travis-release
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# CHANGELOG

The changelog is automatically updated using [semantic-release](https://github.com/semantic-release/semantic-release).
You can see it on the [releases page](../../releases).
The changelog is automatically updated using
[semantic-release](https://github.com/semantic-release/semantic-release). You
can see it on the [releases page](../../releases).
17 changes: 9 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ series [How to Contribute to an Open Source Project on GitHub][egghead]

## Project setup

1. Fork and clone the repo
2. `$ npm install` to install dependencies
3. `$ npm run validate` to validate you've got it working
4. Create a branch for your PR
1. Fork and clone the repo
2. `$ npm install` to install dependencies
3. `$ npm run validate` to validate you've got it working
4. Create a branch for your PR

> Tip: Keep your `master` branch pointing at the original repository and make
> pull requests from branches on your fork. To do this, run:
>
> ```
> git remote add upstream https://github.com/kentcdodds/babel-plugin-preval.git
> git remote add upstream https://github.com/kentcdodds/babel-plugin-preval
> git fetch upstream
> git branch --set-upstream-to=upstream/master master
> ```
Expand All @@ -40,7 +40,8 @@ Please checkout the [the open issues][issues]
Also, please watch the repo and respond to questions/bug reports/feature
requests! Thanks!

[egghead]:
https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github
[all-contributors]: https://github.com/kentcdodds/all-contributors
<!-- prettier-ignore-start -->
[egghead]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github
[all-contributors]: https://github.com/all-contributors/all-contributors
[issues]: https://github.com/kentcdodds/babel-plugin-preval/issues
<!-- prettier-ignore-end -->
74 changes: 43 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
<div align="center">
<h1>babel-plugin-preval</h1>

Pre-evaluate code at build-time

<p>Pre-evaluate code at build-time</p>
</div>

<hr />
---

<!-- prettier-ignore-start -->

[![Build Status][build-badge]][build]
[![Code Coverage][coverage-badge]][coverage]
[![version][version-badge]][package]
[![downloads][downloads-badge]][npmtrends]
[![MIT License][license-badge]][license]

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-15-orange.svg?style=flat-square)](#contributors)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
[![PRs Welcome][prs-badge]][prs]
[![Code of Conduct][coc-badge]][coc]
[![Babel Macro][macros-badge]][babel-plugin-macros]
[![Examples][examples-badge]][examples]

[![Watch on GitHub][github-watch-badge]][github-watch]
[![Star on GitHub][github-star-badge]][github-star]
[![Tweet][twitter-badge]][twitter]

<!-- prettier-ignore-end -->

## The problem
Expand Down Expand Up @@ -87,6 +82,7 @@ See more below.
- [import comment](#import-comment)
- [preval.require](#prevalrequire)
- [preval file comment (`// @preval`)](#preval-file-comment--preval)
- [Exporting a function](#exporting-a-function)
- [Configure with Babel](#configure-with-babel)
- [Via `.babelrc` (Recommended)](#via-babelrc-recommended)
- [Via CLI](#via-cli)
Expand All @@ -100,7 +96,10 @@ See more below.
- [Inspiration](#inspiration)
- [Related Projects](#related-projects)
- [Other Solutions](#other-solutions)
- [Contributors](#contributors)
- [Issues](#issues)
- [🐛 Bugs](#-bugs)
- [💡 Feature Requests](#-feature-requests)
- [Contributors ✨](#contributors-)
- [LICENSE](#license)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
Expand Down Expand Up @@ -245,11 +244,7 @@ const compose = (...fns) => fns.reduce((f, g) => a => f(g(a)))
const double = a => a * 2
const square = a => a * a

module.exports = compose(
square,
id,
double,
)(one)
module.exports = compose(square, id, double)(one)
```

**After**:
Expand All @@ -261,8 +256,8 @@ module.exports = 4
## Exporting a function

If you export a function from a module that you're prevaling (whether using
`preval.require` or the import comment), then that function will be called
and whatever is returned will be the prevaled value.
`preval.require` or the import comment), then that function will be called and
whatever is returned will be the prevaled value.

It's important to know this if you want to have the prevaled value itself be a
function:
Expand Down Expand Up @@ -411,7 +406,25 @@ I was inspired by the [val-loader][val-loader] from webpack.
I'm not aware of any, if you are please [make a pull request][prs] and add it
here!

## Contributors
## Issues

_Looking to contribute? Look for the [Good First Issue][good-first-issue]
label._

### 🐛 Bugs

Please file an issue for bugs, missing documentation, or unexpected behavior.

[**See Bugs**][bugs]

### 💡 Feature Requests

Please file an issue to suggest new features. Vote on feature requests by adding
a 👍. This helps maintainers prioritize what to work on.

[**See Feature Requests**][requests]

## Contributors ✨

Thanks goes to these people ([emoji key][emojis]):

Expand Down Expand Up @@ -445,6 +458,7 @@ Thanks goes to these people ([emoji key][emojis]):

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors][all-contributors] specification.
Expand All @@ -454,7 +468,8 @@ Contributions of any kind welcome!

MIT

[npm]: https://www.npmjs.com/
<!-- prettier-ignore-start -->
[npm]: https://www.npmjs.com
[node]: https://nodejs.org
[build-badge]: https://img.shields.io/travis/kentcdodds/babel-plugin-preval.svg?style=flat-square
[build]: https://travis-ci.org/kentcdodds/babel-plugin-preval
Expand All @@ -468,24 +483,21 @@ MIT
[license]: https://github.com/kentcdodds/babel-plugin-preval/blob/master/LICENSE
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs]: http://makeapullrequest.com
[donate-badge]: https://img.shields.io/badge/$-support-green.svg?style=flat-square
[donate]: http://kcd.im/donate
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
[coc]: https://github.com/kentcdodds/babel-plugin-preval/blob/master/other/CODE_OF_CONDUCT.md
[macros-badge]: https://img.shields.io/badge/babel--macro-%F0%9F%8E%A3-f5da55.svg?style=flat-square
[babel-plugin-macros]: https://github.com/kentcdodds/babel-plugin-macros
[examples-badge]: https://img.shields.io/badge/%F0%9F%92%A1-examples-8C8E93.svg?style=flat-square
[examples]: https://github.com/kentcdodds/babel-plugin-preval/blob/master/other/EXAMPLES.md
[github-watch-badge]: https://img.shields.io/github/watchers/kentcdodds/babel-plugin-preval.svg?style=social
[github-watch]: https://github.com/kentcdodds/babel-plugin-preval/watchers
[github-star-badge]: https://img.shields.io/github/stars/kentcdodds/babel-plugin-preval.svg?style=social
[github-star]: https://github.com/kentcdodds/babel-plugin-preval/stargazers
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20babel-plugin-preval!%20https://github.com/kentcdodds/babel-plugin-preval%20%F0%9F%91%8D
[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/kentcdodds/babel-plugin-preval.svg?style=social
[emojis]: https://github.com/kentcdodds/all-contributors#emoji-key
[all-contributors]: https://github.com/kentcdodds/all-contributors
[emojis]: https://github.com/all-contributors/all-contributors#emoji-key
[all-contributors]: https://github.com/all-contributors/all-contributors
[bugs]: https://github.com/kentcdodds/babel-plugin-preval/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Acreated-desc+label%3Abug
[requests]: https://github.com/kentcdodds/babel-plugin-preval/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3Aenhancement
[good-first-issue]: https://github.com/kentcdodds/babel-plugin-preval/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3Aenhancement+label%3A%22good+first+issue%22

[prepack]: https://github.com/facebook/prepack
[preval.macro]: https://github.com/kentcdodds/preval.macro
[webpack]: https://webpack.js.org/
[webpack-loaders]: https://webpack.js.org/concepts/loaders/
[webpack]: https://webpack.js.org
[webpack-loaders]: https://webpack.js.org/concepts/loaders
[val-loader]: https://github.com/webpack-contrib/val-loader
<!-- prettier-ignore-end -->
25 changes: 13 additions & 12 deletions other/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
size, disability, ethnicity, gender identity and expression, level of
experience, nationality, personal appearance, race, religion, or sexual identity
and orientation.

## Our Standards

Expand Down Expand Up @@ -37,11 +37,11 @@ Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.

## Scope

Expand All @@ -58,17 +58,18 @@ Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
obligated to maintain confidentiality with regard to the reporter of an
incident. Further details of specific enforcement policies may be posted
separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
10 changes: 8 additions & 2 deletions other/EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ function WhoAmI() {

### Code reuse with babel-plugin-preval (Especially useful with [Next.js](https://github.com/zeit/next.js))

A small `getPosts.js` node module that loads in markdown files in a "posts" directory.
A small `getPosts.js` node module that loads in markdown files in a "posts"
directory.

```js
const frontMatter = require('yaml-front-matter')
Expand All @@ -51,4 +52,9 @@ import preval from 'preval.macro'
export default preval`module.exports = require('./getPosts')`
```

Now you can import the above posts and use a module like [marked](https://github.com/chjj/marked) to convert your markdown into blog posts! The underlying `getPosts.js` module can also be used required in `next.config.js` to build the static list of routes for `next export`. See the full example in the [Next Static](https://github.com/infiniteluke/next-static) project.
Now you can import the above posts and use a module like
[marked](https://github.com/chjj/marked) to convert your markdown into blog
posts! The underlying `getPosts.js` module can also be used required in
`next.config.js` to build the static list of routes for `next export`. See the
full example in the [Next Static](https://github.com/infiniteluke/next-static)
project.
Loading