Skip to content

Commit 977e3f9

Browse files
authored
Merge pull request #1 from jaebradley/setup
feat(example-component): initial example component build
2 parents 9225d49 + f7b2358 commit 977e3f9

File tree

13 files changed

+12608
-0
lines changed

13 files changed

+12608
-0
lines changed

.babelrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"modules": false
7+
}
8+
],
9+
"@babel/preset-react"
10+
],
11+
"ignore": [
12+
"node_modules"
13+
]
14+
}

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage/*
2+
build
3+
node_modules

.eslintrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": [
3+
"airbnb"
4+
],
5+
"env": {
6+
"jest": true
7+
}
8+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ typings/
5757
# dotenv environment variables file
5858
.env
5959

60+
build/

.npmignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.DS_Store
2+
.eslintcache
3+
node_modules
4+
npm-debug.log
5+
.travis.yml
6+
src/
7+
test/
8+
*.test.js
9+
coverage/
10+
*.stories.js
11+
*.stores.jsx

package-lock.json

Lines changed: 12419 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "example-react-component-npm-package",
3+
"version": "1.0.0",
4+
"description": "Example React Component for npm Publication",
5+
"main": "./build/index.js",
6+
"module": "./build/index.js",
7+
"files": [
8+
"./build"
9+
],
10+
"scripts": {
11+
"build": "rollup -c",
12+
"start": "rollup -c -w",
13+
"test": "jest --coverage --passWithNoTests"
14+
},
15+
"repository": {
16+
"type": "git",
17+
"url": "git+https://github.com/jaebradley/example-react-component-npm-package.git"
18+
},
19+
"keywords": [
20+
"rollup",
21+
"react",
22+
"react component",
23+
"rollup react",
24+
"component",
25+
"example react component",
26+
"example rollup react component"
27+
],
28+
"author": "jae.b.bradley@gmail.com",
29+
"license": "MIT",
30+
"bugs": {
31+
"url": "https://github.com/jaebradley/example-react-component-npm-package/issues"
32+
},
33+
"homepage": "https://github.com/jaebradley/example-react-component-npm-package#readme",
34+
"dependencies": {
35+
"prop-types": "^15.6.1",
36+
"react": "^16.3.1",
37+
"react-dom": "^16.3.1"
38+
},
39+
"devDependencies": {
40+
"@babel/cli": "^7.0.0-beta.44",
41+
"@babel/core": "^7.0.0-beta.44",
42+
"@babel/preset-env": "^7.0.0-beta.44",
43+
"@babel/preset-react": "^7.0.0-beta.44",
44+
"autoprefixer": "^8.2.0",
45+
"babel-core": "^7.0.0-bridge.0",
46+
"babel-jest": "^22.4.3",
47+
"babel-preset-minify": "^0.4.0",
48+
"enzyme": "^3.3.0",
49+
"eslint": "^4.19.1",
50+
"eslint-config-airbnb": "^16.1.0",
51+
"eslint-plugin-import": "^2.11.0",
52+
"eslint-plugin-jsx-a11y": "^6.0.3",
53+
"eslint-plugin-react": "^7.7.0",
54+
"husky": "^0.14.3",
55+
"jest": "^22.4.3",
56+
"node-sass": "^4.8.3",
57+
"postcss": "^6.0.21",
58+
"rollup": "^0.57.1",
59+
"rollup-plugin-babel": "^4.0.0-beta.4",
60+
"rollup-plugin-commonjs": "^9.1.0",
61+
"rollup-plugin-filesize": "^1.5.0",
62+
"rollup-plugin-local-resolve": "^1.0.7",
63+
"rollup-plugin-node-resolve": "^3.3.0",
64+
"rollup-plugin-peer-deps-external": "^2.1.0",
65+
"rollup-plugin-postcss": "^1.5.1"
66+
}
67+
}

rollup.config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import babel from 'rollup-plugin-babel';
2+
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
3+
import resolve from 'rollup-plugin-node-resolve';
4+
import commonjs from 'rollup-plugin-commonjs';
5+
import postcss from 'rollup-plugin-postcss';
6+
import filesize from 'rollup-plugin-filesize';
7+
import autoprefixer from 'autoprefixer';
8+
import localResolve from 'rollup-plugin-local-resolve';
9+
10+
import pkg from './package.json';
11+
12+
const config = {
13+
input: 'src/index.js',
14+
output: [
15+
{
16+
file: pkg.main,
17+
format: 'umd',
18+
name: 'Example',
19+
},
20+
],
21+
external: [
22+
'react',
23+
'react-dom',
24+
],
25+
plugins: [
26+
peerDepsExternal(),
27+
postcss({ extract: true, plugins: [autoprefixer] }),
28+
babel({
29+
exclude: 'node_modules/**',
30+
}),
31+
localResolve(),
32+
resolve(),
33+
commonjs(),
34+
filesize(),
35+
],
36+
};
37+
38+
export default config;

src/AnExample/AnExample.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.an-example {
2+
color: aquamarine
3+
}

src/AnExample/index.jsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
4+
import './AnExample.scss';
5+
6+
const AnExample = ({ name }) => <div className="an-example">This is an example by { name }</div>;
7+
8+
AnExample.propTypes = {
9+
name: PropTypes.string,
10+
};
11+
12+
AnExample.defaultProps = {
13+
name: 'jaebaebae',
14+
};
15+
16+
export default AnExample;

0 commit comments

Comments
 (0)