Skip to content

Commit 1fcce89

Browse files
authored
Merge pull request #156 from LieutenantRoger/npm-package-and-cicd
make the navigation module npm packagable
2 parents 68d136a + e7ead0a commit 1fcce89

File tree

3 files changed

+94
-38
lines changed

3 files changed

+94
-38
lines changed

.circleci/config.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
defaults: &defaults
2+
docker:
3+
- image: circleci/node:8.11.2
4+
5+
version: 2
6+
jobs:
7+
test:
8+
<<: *defaults
9+
steps:
10+
- checkout
11+
- restore_cache:
12+
key: node-modules-{{ checksum "package-lock.json" }}
13+
- run: npm install
14+
- save_cache:
15+
key: node-modules-{{ checksum "package-lock.json" }}
16+
paths:
17+
- node_modules
18+
- run: npm test
19+
- run: npm run build
20+
- persist_to_workspace:
21+
root: .
22+
paths:
23+
- dist
24+
release:
25+
<<: *defaults
26+
steps:
27+
- checkout
28+
- attach_workspace:
29+
at: .
30+
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
31+
- run: npm publish
32+
33+
workflows:
34+
version: 2
35+
build:
36+
jobs:
37+
- test:
38+
filters:
39+
tags:
40+
only: /.*/
41+
- release:
42+
filters:
43+
branches:
44+
ignore: /.*/
45+
tags:
46+
only: /v[0-9]+(\.[0-9]+)*(-[0-9]+)?/
47+
requires:
48+
- test

README.md

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
1-
# Topcoder Navigation React
1+
# Topcoder Navigation React Component
22

3+
![Dev Build Status](https://img.shields.io/circleci/project/github/topcoder-platform/navigation-component/develop.svg?label=develop)
4+
![Master Build Status](https://img.shields.io/circleci/project/github/topcoder-platform/navigation-component/master.svg?label=master)
5+
![Latest NPM Release](https://img.shields.io/npm/v/navigation-component.svg)
6+
![NPM Downloads](https://img.shields.io/npm/dm/navigation-component.svg)
37

4-
### Build the components
5-
6-
Enter `navigation-component` and run:
7-
8-
- `npm install`
9-
- `npm run build`
10-
11-
Due to this repo is not npm package, so keep `dist` folder for other project use it
12-
13-
14-
## Getting Started
15-
16-
### Install
17-
18-
```
19-
npm install [email protected]:username/navigation-component.git#develop --save
20-
```
8+
The [Topcoder](https://www.topcoder.com) header navigation component.
219

2210
### Usage
11+
2312
- Example
2413
```
2514
import { TopNav } from 'navigation-component'
@@ -28,13 +17,14 @@ import { TopNav } from 'navigation-component'
2817
### Development
2918

3019
```shell
31-
Install dependencies
20+
# Install dependencies
3221
$ npm install
3322

3423
# Run build
3524
$ npm run build
3625

37-
#Go to other project which depends on the navigation-component, config its package.json so that the 'navigation-component' points to the local folder path of navigation-component:
26+
# Go to other project which depends on the navigation-component, config its package.json so
27+
# that the 'navigation-component' points to the local folder path of navigation-component:
3828

3929
# "dependencies": {
4030
# "navigation-component": "<local-path-to-navigation-component>",
@@ -44,3 +34,6 @@ $ npm run build
4434
# If you faced React Hook errors. Please remove 'node_modules', 'src' folder when you try it
4535

4636
```
37+
38+
### License
39+
UNLICENSED &mdash; for internal Topcoder projects.

package.json

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
11
{
2-
"name": "navigation-component",
3-
"version": "1.0.0",
4-
"description": "",
2+
"bugs": {
3+
"url": "https://github.com/topcoder-platform/navigation-component/issues"
4+
},
5+
"description": "Topcoder Navigation Component",
6+
"engines": {
7+
"node": "~8.11.2",
8+
"npm": "~5.6.0"
9+
},
10+
"homepage": "https://github.com/topcoder-platform/navigation-component#readme",
11+
"keywords": [
12+
"Topcoder",
13+
"React",
14+
"Component",
15+
"Navigation"
16+
],
17+
"license": "UNLICENSED",
518
"main": "index.js",
19+
"name": "navigation-component",
20+
"repository": {
21+
"type": "git",
22+
"url": "git+https://github.com/topcoder-platform/navigation-component.git"
23+
},
624
"scripts": {
725
"lint": "eslint src/",
826
"lint:fix": "eslint --fix src/",
@@ -11,6 +29,18 @@
1129
"build:prod": "./node_modules/.bin/webpack --env=production --progress --profile --colors --display-optimization-bailout",
1230
"clean": "rimraf dist"
1331
},
32+
"version": "1.0.0",
33+
"dependencies": {
34+
"classnames": "^2.2.6",
35+
"lodash": "^4.17.11",
36+
"moment": "^2.24.0",
37+
"prop-types": "^15.7.2",
38+
"react-resize-detector": "^4.1.3",
39+
"topcoder-react-utils": "^0.7.9"
40+
},
41+
"peerDependencies": {
42+
"react": "^16.8.6"
43+
},
1444
"devDependencies": {
1545
"@babel/core": "^7.4.4",
1646
"@babel/plugin-proposal-export-default-from": "^7.2.0",
@@ -51,20 +81,5 @@
5181
"url-loader": "^1.1.2",
5282
"webpack": "^4.32.2",
5383
"webpack-cli": "^3.3.2"
54-
},
55-
"peerDependencies": {
56-
"react": "^16.8.6"
57-
},
58-
"engines": {
59-
"node": "^8.11.2",
60-
"npm": "^5.6.0"
61-
},
62-
"dependencies": {
63-
"classnames": "^2.2.6",
64-
"lodash": "^4.17.11",
65-
"moment": "^2.24.0",
66-
"prop-types": "^15.7.2",
67-
"react-resize-detector": "^4.1.3",
68-
"topcoder-react-utils": "^0.7.9"
6984
}
7085
}

0 commit comments

Comments
 (0)