Skip to content

Commit

Permalink
Publish npm package (#2)
Browse files Browse the repository at this point in the history
* Add travis configuration to publish package

* Fix documentation and reorder package file list

* Add host and base env variables to generate docs

* Reorder get started menu

* Fix base env variable

* Add linting and documentation sections in the readme
  • Loading branch information
moelders authored Sep 7, 2018
1 parent 70774ca commit c99f9fb
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 10 deletions.
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ install:
script:
- npm run lint
- npm run build
- npm run doc
- HOST=//adidas.github.io/ BASE=/adidas-yarn-design-system/ npm run doc

deploy:
- provider: npm
skip_cleanup: true
email: [email protected]
api_key: $NPM_TOKEN
on:
branch: master
- provider: pages
skip-cleanup: true
local-dir: ./docs
Expand Down
42 changes: 38 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,28 @@ Both are independent and they have different scripts to run them.
npm run build:example
```
The example can be delivered as [SPA][single-page-application] using the script `npm run build:example:spa`, executed after building the library.
The library is compiled in the `dist` folder, whereas the example is created in the `docs` folder.
The library is compiled in the `dist` folder, while the example is created in the `docs` folder.
### Example as Single Page Application
The example can be delivered as [Single Page Application][single-page-application] using the script `npm run build:example:spa`, executed after building the library. It accepts two environment variables:
- `HOST`: host where the application will be deployed, the protocol should be omitted.
- `BASE`: path where the application will be available.
Example deploying the application in `https://name.domain:port/app`:
```
HOST=//name.domain:port BASE=app npm run build:example:spa
```
### Documentation
The documentation is generated using the script `doc`, which generates the example in [SPA][single-page-application] mode. It also accepts the environment variables.
```
HOST=//name.domain:port BASE=app npm run doc
```
## Development
Expand Down Expand Up @@ -250,6 +269,19 @@ The texts and documents are located in `example/locales` to be able to show the
languages. The `.md` files contain the content of full pages, while the `[lang].json` files have only
titles and common words.
### Code linting
The LESS and the Vue source code are linted using the adidas [stylelint][stylelint] and
[ESLint][eslint] linter configurations respectively.
There are separated scripts to lint the different sources and a global one to execute all together:
```
npm run lint
```
_Note:_ it is mandatory to fix all the issues before pushing the code.
## FAQ
### Maintainers
Expand All @@ -270,7 +302,7 @@ NOTICE: The software has been designed solely for the purpose of giving some CSS
If you want to contact adidas regarding the software, you can mail us at [email protected]_.
For further information open the [adidas terms and conditions][term-and-conditions] page.
For further information open the [adidas terms and conditions][terms-and-conditions] page.
### License
Expand All @@ -280,14 +312,16 @@ For further information open the [adidas terms and conditions][term-and-conditio
[bootstrap]: https://getbootstrap.com/docs/3.3/
[bem]: http://getbem.com/introduction/
[bem-naming]: http://getbem.com/naming/
[eslint]: https://eslint.org/
[node]: https://nodejs.org/
[nuxt]: https://nuxtjs.org/
[open-source-typefaces]: https://github.com/KyleAMathews/typefaces
[poppins]: https://fonts.google.com/specimen/Poppins
[roboto]: https://fonts.google.com/specimen/Roboto
[roboto-mono]: https://fonts.google.com/specimen/Roboto+Mono
[single-page-application]: https://en.wikipedia.org/wiki/Single-page_application
[term-and-conditions]: https://github.com/adidas/adidas-contribution-guidelines/wiki/Terms-and-conditions
[stylelint]: https://stylelint.io/
[terms-and-conditions]: https://github.com/adidas/adidas-contribution-guidelines/wiki/Terms-and-conditions
[vuejs]: https://vuejs.org/
[webpack]: https://webpack.js.org/
[webpack-hot-module-replacement]: https://webpack.js.org/concepts/hot-module-replacement/
2 changes: 1 addition & 1 deletion example/pages/overview/designer.meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"showInSidebar": true,
"sidebarPosition": 2,
"sidebarPosition": 1,
"displayName": "views.overview-designer.name"
}
2 changes: 1 addition & 1 deletion example/pages/overview/developer.meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"showInSidebar": true,
"sidebarPosition": 1,
"sidebarPosition": 2,
"displayName": "views.overview-developer.name"
}
10 changes: 8 additions & 2 deletions nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
const path = require('path');
const url = require('url');
const readMarkdownFiles = require('./scripts/markdown-files.js');

const { HOST = '/_nuxt/', BASE = '' } = process.env;
const _BASE = BASE ? `/${ path.basename(BASE) }/` : '';
const globalRoutes = [];

module.exports = {
srcDir: './example',
build: {
vendor: [],
plugins: []
plugins: [],
publicPath: url.resolve(HOST, _BASE)
},
head: {
title: 'adidas YARN Design System',
Expand All @@ -21,7 +26,7 @@ module.exports = {
{
rel: 'icon',
type: 'image/x-icon',
href: 'favicon.ico'
href: path.join(_BASE, '/favicon.ico')
}
]
},
Expand All @@ -36,6 +41,7 @@ module.exports = {
'~/plugins/i18n.js'
],
router: {
base: _BASE,
linkExactActiveClass: 'active',
extendRoutes(routes) {
routes.forEach((route) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
"less"
],
"files": [
"src",
"dist",
"src",
"README.md",
"CHANGELOG.md",
"LICENSE"
Expand Down

0 comments on commit c99f9fb

Please sign in to comment.