Skip to content

Commit c4b899c

Browse files
author
Clément PREVOT
committed
build(publish-npm): prepare the NPM registry publishing
Polish the documentations. Add some docs files in the package. Also cleanup some unneeded files
1 parent 7efaade commit c4b899c

12 files changed

+239
-115
lines changed

CONTRIBUTING.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
# Contributing to LumX
22

3-
We'd love for you to contribute to our source code and to make it even better than it is today! Here are the guidelines we'd like you to follow:
3+
We'd love for you to contribute to our source code and to make it even better than it is today!
4+
5+
## Getting the source code
6+
7+
To be able to contribute, you will have to use the global LumX package from our [GitHub repository](https://github.com/lumapps/design-system). You won't be able to contribute from the distributed packages `@lumx/<angularjs/react>`, so be sure to clone the repository before starting contributing:
8+
9+
```bash
10+
git clone [email protected]:lumapps/design-system.git
11+
# Or with HTTPS
12+
git clone https://github.com/lumapps/design-system.git
13+
```
14+
15+
# Table of contents
16+
17+
Here are the guidelines we'd like you to follow.
418

519
- [Code of Conduct](#code-of-conduct)
620
- [Got a question or a problem?](#got-a-question-or-a-problem-)

LICENCE.md renamed to LICENSE.md

File renamed without changes.

README.md

+27-6
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ npm install @lumx/<angularjs|react>
1818
- Download the latest release for [AngularJS][angularjs-release] or [ReactJS][reactjs-release]
1919
- Clone the repository: `git clone https://github.com/lumapps/design-system.git`
2020

21-
You can then use the UMD, AMD or CommonJS bundle that suits your taste.
22-
See [examples](./dist/examples) for more information on how to use each bundle.
21+
See [examples](./dist/<angularjs|react>/examples) for more information on how to use each bundle.
2322

2423
## Documentation
2524

@@ -33,7 +32,7 @@ Please refer to our [contributing guidelines](CONTRIBUTING.md).
3332
## Project installation
3433

3534
[Yarn dependency manager](https://yarnpkg.com/) is recommended to launch the project. Check out the [official installation documentation](https://yarnpkg.com/en/docs/install) if not installed.
36-
You will need Yarn to execute the automatic setup script.
35+
You will need Yarn to execute the automatic setup script as well as for publishing the package.
3736

3837
### Install project dependencies
3938

@@ -80,20 +79,42 @@ You can then open your browser to [http://localhost:4001/](http://localhost:4001
8079
you can build LumX by using:
8180

8281
```bash
83-
yarn build[:<all|react[:<commonjs>]|angularjs]
82+
yarn build[:<all|angularjs|react]
8483
# Or
85-
npm run build:<react:commonjs|angularjs>
84+
npm run build:<all|angularjs|react>
8685
```
8786

8887
This will produce the target build for either AngularJS or ReactJS.
8988

89+
## How to run examples
90+
91+
In the `dist/<angularjs|react>` directory, run:
92+
93+
```bash
94+
yarn install
95+
# Or
96+
npm install
97+
```
98+
99+
This will install `http-server`, a simple HTTP server.
100+
101+
Then run:
102+
103+
```bash
104+
yarn serve
105+
# Or
106+
npm run serve
107+
```
108+
109+
Your browser should open automatically, otherwise, you can go to [http://localhost:8080](http://localhost:8080) for AngularJS example or [http://localhost:8081](http://localhost:8081) for ReactJS example.
110+
Then, click on the `examples` directory in the showing listing and you should land on the example page.
111+
90112
## Copyright and license
91113

92114
Code and documentation copyright 2019 LumApps. Code released under the [MIT license](LICENSE.md).
93115

94116
[angularjs]: https://angularjs.org/
95117
[reactjs]: https://reactjs.org/
96-
[local]: http://localhost:8888
97118
[material]: http://www.google.com/design/spec/material-design/introduction.html
98119
[angularjs-release]: https://www.npmjs.com/package/@lumx/angularjs
99120
[reactjs-release]: https://www.npmjs.com/package/@lumx/react

examples/README.md

-24
This file was deleted.

examples/package.json

-32
This file was deleted.

package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"babel-plugin-smart-webpack-import": "^1.4.2",
6666
"commitizen": "^3.0.7",
6767
"copy-webpack-plugin": "^5.0.0",
68+
"create-file-webpack": "^1.0.2",
6869
"css-loader": "^2.1.0",
6970
"enzyme": "^3.9.0",
7071
"enzyme-adapter-react-16": "^1.10.0",
@@ -153,10 +154,8 @@
153154
"ReactJS"
154155
],
155156
"license": "MIT",
156-
"main": "dist/index.js",
157-
"module": "dist/lumx.esm.js",
158157
"name": "@lumx/lumx",
159-
"private": false,
158+
"private": true,
160159
"repository": {
161160
"type": "git",
162161
"url": "git+https://github.com/lumapps/design-system.git"
@@ -166,6 +165,12 @@
166165
"build:all": "rm -Rf ./dist/ && npm -s run build:angularjs; npm -s run build:react",
167166
"build:angularjs": "rm -Rf ./dist/angularjs && webpack --config webpack/angularjs/webpack.umd.js",
168167
"build:react": "rm -Rf ./dist/react && webpack --config webpack/react/webpack.umd.js",
168+
"prebump:major": "cd src/icons && npm --no-git-tag-version version major && git add package.json && cd -",
169+
"bump:major": "npm version --force --message 'chore(release): release new major version %s' major",
170+
"prebump:minor": "cd src/icons && npm --no-git-tag-version version minor && git add package.json && cd -",
171+
"bump:minor": "npm version --force --message 'chore(release): release new minor version %s' minor",
172+
"prebump:patch": "cd src/icons && npm --no-git-tag-version version patch && git add package.json && cd -",
173+
"bump:patch": "npm version --force --message 'chore(release): release new patch version %s' patch",
169174
"commit": "git-cz",
170175
"co": "npm -s run commit",
171176
"cz": "npm -s run commit",

webpack/angularjs/webpack.umd.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
const merge = require('webpack-merge');
22

33
const { buildConfig } = require('../utils');
4-
const { MINIFY } = require('../constants');
4+
const { MINIFY: minify } = require('../constants');
55

66
const angularJSConfig = require('./webpack.config');
77

88
const UMDConfig = {};
99

10-
module.exports = buildConfig(
11-
merge.smartStrategy({
10+
module.exports = buildConfig({
11+
config: merge.smartStrategy({
1212
entry: 'append',
1313
'module.rules': 'append',
1414
plugins: 'replace',
1515
})(angularJSConfig, UMDConfig),
16-
'angularjs',
17-
'umd',
18-
MINIFY,
19-
);
16+
tech: 'angularjs',
17+
moduleType: 'umd',
18+
minify,
19+
});

webpack/common-utils.js

-15
This file was deleted.

webpack/constants.js

+31-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
const { getAbsolutePath } = require('./common-utils');
1+
const path = require('path');
2+
3+
/**
4+
* Gives an absolute path by resolving the provided relative path.
5+
*
6+
* @param {string} pathName The relative path.
7+
* @return {string} The resolved absolute path.
8+
*/
9+
function getAbsolutePath(pathName) {
10+
return path.resolve(__dirname, pathName);
11+
}
212

313
// Path relative constants.
414
const ROOT_PATH = getAbsolutePath('../');
15+
16+
const DEMO_PATH = `${ROOT_PATH}/demo`;
17+
const DIST_PATH = `${ROOT_PATH}/dist`;
18+
const EXAMPLES_PATH = `${ROOT_PATH}/examples`;
519
const NODE_MODULES_PATH = `${ROOT_PATH}/node_modules`;
6-
const SRC_PATH = getAbsolutePath('../src');
20+
const SRC_PATH = `${ROOT_PATH}/src`;
21+
722
const COMPONENTS_PATH = `${SRC_PATH}/components`;
823
const CORE_PATH = `${SRC_PATH}/core`;
9-
const DEMO_PATH = getAbsolutePath('../demo');
10-
const EXAMPLES_PATH = getAbsolutePath('../examples');
1124
const ICONS_PATH = `${SRC_PATH}/icons`;
25+
1226
const STYLES_PATH = `${CORE_PATH}/style`;
1327

1428
// Indicates if we want to minify the production bundle.
@@ -19,6 +33,16 @@ const TECH_PREFIX = {
1933
angularjs: 'angularjs',
2034
react: 'react',
2135
};
36+
const TECH_DESCRIPTIONS = {
37+
angularjs: 'The official LumApps Design System (LumX) for AngularJS applications',
38+
default: 'The official LumApps Design System (LumX)',
39+
react: 'The official LumApps Design System (LumX) for ReactJS applications',
40+
};
41+
const TECH_KEYWORDS = {
42+
angularjs: ['AngularJS'],
43+
default: ['Design System', 'LumApps', 'LumX'],
44+
react: ['ReactJS'],
45+
};
2246

2347
// Dev-server relative constants
2448
const DEFAULT_HOST = '0.0.0.0';
@@ -189,12 +213,15 @@ module.exports = {
189213
DEFAULT_HOST,
190214
DEFAULT_PORT,
191215
DEMO_PATH,
216+
DIST_PATH,
192217
EXAMPLES_PATH,
193218
ICONS_PATH,
194219
MINIFY,
195220
NODE_MODULES_PATH,
196221
ROOT_PATH,
197222
SRC_PATH,
198223
STYLES_PATH,
224+
TECH_DESCRIPTIONS,
225+
TECH_KEYWORDS,
199226
TECH_PREFIX,
200227
};

webpack/react/webpack.umd.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
const merge = require('webpack-merge');
22

33
const { buildConfig } = require('../utils');
4-
const { MINIFY } = require('../constants');
4+
const { MINIFY: minify } = require('../constants');
55

66
const reactConfig = require('./webpack.config');
77

88
const UMDConfig = {};
99

10-
module.exports = buildConfig(
11-
merge.smartStrategy({
10+
module.exports = buildConfig({
11+
config: merge.smartStrategy({
1212
entry: 'append',
1313
'module.rules': 'append',
1414
plugins: 'replace',
1515
})(reactConfig, UMDConfig),
16-
'react',
17-
'umd',
18-
MINIFY,
19-
);
16+
tech: 'react',
17+
moduleType: 'umd',
18+
minify,
19+
});

0 commit comments

Comments
 (0)