Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit dc6f65d

Browse files
committed
build: optimize npm package creation
Removes typescript declaration files for tests. Flattens npm package file structure.
1 parent 7c7c249 commit dc6f65d

File tree

8 files changed

+222
-65
lines changed

8 files changed

+222
-65
lines changed

.all-contributorsrc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"projectName": "react-semantics",
3+
"projectOwner": "csvenke",
4+
"repoType": "github",
5+
"repoHost": "https://github.com",
6+
"files": [
7+
"README.md"
8+
],
9+
"imageSize": 100,
10+
"commit": false,
11+
"contributors": [
12+
{
13+
"login": "bergelf",
14+
"name": "Leiv Fredrik Berge",
15+
"avatar_url": "https://avatars2.githubusercontent.com/u/41568251?v=4",
16+
"profile": "https://github.com/bergelf",
17+
"contributions": [
18+
"code",
19+
"test",
20+
"doc",
21+
"ideas"
22+
]
23+
}
24+
]
25+
}

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
language: node_js
2+
23
node_js:
34
- "node"
45
- "8"
6+
57
notifications:
68
email: false
9+
710
branches:
811
only:
912
- master
@@ -12,5 +15,6 @@ branches:
1215
script:
1316
- commitlint-travis
1417
- npm run test:prod && npm run build
18+
1519
after_success:
1620
- npm run report-coverage

README.md

Lines changed: 49 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<div align="center">
2+
23
<img src='./media/logo.png' width="20%" alt='logo' />
34

45
<h1>react-semantics</h1>
@@ -27,53 +28,24 @@
2728
</p>
2829

2930
<p>
30-
<a href="#installation">Installation</a> •
31+
<a href="#install">Install</a> •
3132
<a href="#example-usage">Example usage</a> •
33+
<a href="#why">Why?</a> •
3234
<a href="#documentation">Documentation</a> •
3335
<a href="#development-setup">Development setup</a> •
3436
<a href="#contributing">Contributing</a> •
37+
<a href="#contributors">Contributors</a> •
3538
<a href="#license">License</a>
3639
</p>
3740
</div>
3841

39-
Are you tired of your react components looking like an unreadable mess?
40-
Have you often asked yourself: "there must be a better way!"?
41-
Then look no further, because this library is just what you need!
42-
43-
Multiple studies from reputable anonymous sources have shown that projects using this library have 24% higher productivity and increased life satisfaction.
44-
Does this sound too good to be true?
45-
Do you start to see through this shallow pitch for yet another react component library?
46-
47-
Reject those thoughts and allow me to demonstrate the might of this library with a simple example below!
48-
49-
### Before
42+
## Install
5043

51-
Here you see two common use cases where you have to show something when a condition is true and map content from an array of data.
52-
This is normally solved by inline arrow functions that are hard to read and easily becomes unmanageable in more complex components.
53-
54-
```jsx
55-
const Menu = ({ showMenuItems }) => (
56-
<nav>
57-
<a href="/">Home</a>
58-
{showMenuItems ? (
59-
<ul>
60-
{['prices', 'contact', 'about'].map(m => (
61-
<li key={m}>
62-
<a href={`/${m}`}>{m}</a>
63-
</li>
64-
))}
65-
</ul>
66-
) : null}
67-
</nav>
68-
);
44+
```bash
45+
$ npm install react-semantics
6946
```
7047

71-
### After
72-
73-
Here you see all inline arrow functions replaced by semantic components that are easy to read and understand.
74-
What they do are intuitively obvious due to careful naming and all the noise from inline arrow functions are removed.
75-
76-
It's components all the way down.
48+
## Example usage
7749

7850
```jsx
7951
import { Show, List } from 'react-semantics';
@@ -97,26 +69,38 @@ const Menu = ({ showMenuItems }) => (
9769
);
9870
```
9971

100-
## Installation
72+
## Why?
10173

102-
```bash
103-
$ npm install react-semantics
104-
```
74+
In the example above you see two very common use cases where you have to show something when a condition is true and map content from an array of data.
75+
This is normally solved with inline arrow functions that are hard to read and easily becomes unmanageable in more complex components.
10576

106-
## Example usage
77+
Below you can see how it would look like with inline arrow functions.
10778

10879
```jsx
109-
import { Show } from 'react-semantics';
110-
111-
<Show when={true}>
112-
<div>Render me!</div>
113-
</Show>
80+
const Menu = ({ showMenuItems }) => (
81+
<nav>
82+
<a href="/">Home</a>
83+
{showMenuItems ? (
84+
<ul>
85+
{['prices', 'contact', 'about'].map(m => (
86+
<li key={m}>
87+
<a href={`/${m}`}>{m}</a>
88+
</li>
89+
))}
90+
</ul>
91+
) : null}
92+
</nav>
93+
)
11494
```
11595

116-
## Documentation
11796

118-
https://csvenke.github.io/react-semantics/
97+
The purpose of this library is to develop and maintain semantic helper components that removes the need for inline arrow functions in react components.
11998

99+
Do you have an idea about a component you think belong here? [Tell us here!](https://github.com/csvenke/react-semantics/issues/new)
100+
101+
## Documentation
102+
103+
For full list of components and how they are used, go to our [documentation](https://csvenke.github.io/react-semantics/).
120104

121105
## Development setup
122106

@@ -136,11 +120,23 @@ $ npm run build
136120

137121
## Contributing
138122

139-
1. Fork repository
140-
1. Create feature branch
141-
1. Commit changes
142-
1. Push to branch
143-
1. Create new pull request
123+
In lieu of a formal styleguide, take care to maintain the existing coding style.
124+
* Add unit tests for any new or changed functionality.
125+
* All library component props must be documented with jsdoc `/** */`, so that typescript definition files can be generated.
126+
* All library components must have `prop-types` that matches the component props interface.
127+
128+
### Commit style guide
129+
We use [conventional commits style](https://conventionalcommits.org/).
130+
Read up on it before doing your first commit.
131+
Don't worry about making a mistake, `commitlint` will stop you if you do, and you can try again.
132+
133+
## Contributors
134+
135+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
136+
<!-- prettier-ignore -->
137+
| [<img src="https://avatars2.githubusercontent.com/u/41568251?v=4" width="100px;"/><br /><sub><b>Leiv Fredrik Berge</b></sub>](https://github.com/bergelf)<br />[💻](https://github.com/csvenke/react-semantics/commits?author=bergelf "Code") [⚠️](https://github.com/csvenke/react-semantics/commits?author=bergelf "Tests") [📖](https://github.com/csvenke/react-semantics/commits?author=bergelf "Documentation") [🤔](#ideas-bergelf "Ideas, Planning, & Feedback") |
138+
| :---: |
139+
<!-- ALL-CONTRIBUTORS-LIST:END -->
144140

145141
## License
146142

package-lock.json

Lines changed: 122 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: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"name": "react-semantics",
33
"version": "0.5.2",
4-
"description": "Semantic helper components for working with React.",
4+
"description": "Blazing fast semantic helper components for working with React.",
55
"author": "Christian Svenkerud",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/csvenke/react-semantics.git"
99
},
10-
"main": "lib/index.min.js",
11-
"types": "lib/types/index.d.ts",
10+
"main": "index.min.js",
11+
"types": "types/index.d.ts",
1212
"files": [
13-
"lib/index.min.js",
14-
"lib/types/index.d.ts",
15-
"lib/types/components"
13+
"index.min.js",
14+
"types/index.d.ts",
15+
"types/components"
1616
],
1717
"private": false,
1818
"license": "MIT",
@@ -40,6 +40,7 @@
4040
"@types/prop-types": "^15.5.3",
4141
"@types/react-dom": "^16.0.6",
4242
"@types/react": "^16.4.6",
43+
"all-contributors-cli": "^5.3.0",
4344
"coveralls": "^3.0.2",
4445
"enzyme-adapter-react-16": "^1.1.1",
4546
"enzyme": "^3.3.0",
@@ -65,8 +66,11 @@
6566
"webpack": "^4.16.2"
6667
},
6768
"scripts": {
68-
"build": "npm run clean:build && rollup -c",
69+
"build": "npm run clean:build && rollup -c && npm run copy:build",
6970
"clean:build": "rimraf ./lib && rimraf ./build",
71+
"contributors:add": "all-contributors add",
72+
"contributors:generate": "all-contributors generate",
73+
"copy:build": "cp package.json lib/ && cp README.md lib/ && cp LICENSE lib/",
7074
"docs:server": "styleguidist server",
7175
"docs": "styleguidist build",
7276
"lint:fix": "npm run lint:write --fix \"src/**/*.{ts,tsx}\"",

rollup.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ const createConfig = ({ output } = {}) => ({
2424
export default [
2525
createConfig({
2626
output: {
27-
file: pkg.main,
27+
file: 'lib/index.min.js',
2828
format: 'cjs',
29+
exports: 'named',
2930
},
3031
}),
3132
];

0 commit comments

Comments
 (0)