Skip to content

Commit

Permalink
switched to named exports
Browse files Browse the repository at this point in the history
  • Loading branch information
karmaniverous committed Dec 20, 2022
1 parent 58dd07d commit c2b1648
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 249 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"plugin:mocha/recommended",
"plugin:promise/recommended"
],
"ignorePatterns": ["/lib/**/*.*"],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": "latest",
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ features:
- One-button release to GitHub & publish to NPM with
[`release-it`](https://www.npmjs.com/package/release-it).

[Click here](https://karmanivero.us/blog/npm-package-template/) for full
documentation & instructions!
**[Click here](https://karmanivero.us/blog/npm-package-template/) for full
documentation & instructions!**

_If you want to create a React component in an NPM package, use my
[React Component NPM Package Template](https://github.com/karmaniverous/react-component-npm-package-template)
instead!_

# Command Line Interface

Expand All @@ -52,6 +56,10 @@ Options:

# API Documentation

```js
import { foo } from '@karmaniverous/block-refresh`;
```
<a name="foo"></a>
## foo(value) ⇒ <code>any</code>
Expand Down
3 changes: 2 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = (api) => {
api.cache.never();

return {
presets: ['@babel/preset-env', 'minify'],
presets: ['@babel/preset-env'],
plugins: [
'@babel/plugin-syntax-import-assertions',
'lodash',
Expand All @@ -23,5 +23,6 @@ module.exports = (api) => {
},
],
],
targets: { node: 'current' },
};
};
4 changes: 4 additions & 0 deletions doc/3-api.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# API Documentation

```js
import { foo } from '@karmaniverous/block-refresh`;
```
<a name="foo"></a>
## foo(value) ⇒ <code>any</code>
Expand Down
4 changes: 4 additions & 0 deletions doc/api-template.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# API Documentation

```js
import { foo } from '@karmaniverous/block-refresh`;
```

{{>main}}
240 changes: 0 additions & 240 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-module-extension": "^0.1.3",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"babel-preset-minify": "^0.5.2",
"chai": "^4.3.7",
"concat-md": "^0.5.0",
"dotenv-cli": "^6.0.0",
Expand Down
6 changes: 3 additions & 3 deletions src/export/foo/foo.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import _ from 'lodash';
* Returns whatever value is passed.
*
* @function foo
*
* @param {any} value - Any value.
*
* @returns {any} Whatever value it was passed.
*/
const foo = (value) => (_.isNil(value) ? 'nil' : value);

export default foo;
export const foo = (value) => (_.isNil(value) ? 'nil' : value);
2 changes: 1 addition & 1 deletion src/export/foo/foo.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import chai from 'chai';
chai.should();

// subject imports
import foo from './foo.mjs';
import { foo } from './foo.mjs';

describe('foo', function () {
it('returns default', function () {
Expand Down
2 changes: 1 addition & 1 deletion src/export/index.mjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as foo } from './foo/foo.mjs';
export { foo } from './foo/foo.mjs';

0 comments on commit c2b1648

Please sign in to comment.