Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

Commit 071b53a

Browse files
author
Bernhard Grünewaldt
committed
1.3.0 ready to publish to npmjs
1 parent ed086ee commit 071b53a

File tree

6 files changed

+152
-109
lines changed

6 files changed

+152
-109
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
*.iml
44
package-lock.json
55
coverage
6+
dist

DEVELOPMENT.md

Lines changed: 114 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,154 @@
11
# Development
22

3+
-----
34

4-
**Build**
5+
 
6+
7+
### Module Format - FESM
8+
9+
Each library comes as an tree-shakeable and AOT enabled flat ES2015 Module.
10+
See [YouTube Packaging Angular - Jason Aden - ng-conf 2017]()https://www.youtube.com/watch?v=unICbsPGFIA) for in depth explanation.
511

6-
See: https://github.com/cloukit/library-build-chain
12+
-----
713

814
 
915

10-
## Howto Link Lib during Development
16+
### Metadata for each Library
17+
18+
The library itself has `package.json` containing:
19+
20+
```json
21+
{
22+
"name": "@cloukit/multi-select",
23+
"moduleId": "multi-select",
24+
"version": "1.1.0",
25+
"dependencies": {
26+
27+
},
28+
"devDependencies": {
29+
"@cloukit/library-build-chain": "1.0.0"
30+
},
31+
"peerDependencies": {
32+
"@angular/core": "^4.0.1",
33+
"rxjs": "^5.3.0",
34+
"zone.js": "^0.8.5"
35+
}
36+
}
37+
```
38+
39+
which will then be transformed into `./dist/package.json`:
40+
41+
```json
42+
{
43+
"name": "@cloukit/multi-select",
44+
"author": "codeclou.io",
45+
"version": "1.1.0",
46+
"license": "MIT",
47+
"module": "cloukit-multi-select.es5.js",
48+
"es2015": "cloukit-multi-select.js",
49+
"typings": "cloukit-multi-select.d.ts",
50+
"dependencies": {
51+
52+
},
53+
"devDependencies": {
54+
"@cloukit/library-build-chain": "1.0.0"
55+
},
56+
"peerDependencies": {
57+
"@angular/core": "^4.0.1",
58+
"rxjs": "^5.3.0",
59+
"zone.js": "^0.8.5"
60+
}
61+
}
62+
```
63+
64+
-----
65+
66+
 
67+
68+
### Building a Library and Publishing to npmjs.com
69+
70+
Goto the component dir containing `package.json` and execute:
71+
72+
```bash
73+
yarn
74+
yarn build
75+
```
76+
77+
Now there will be a `./dist/` directory containing everything that can now be published to npmjs.com
78+
79+
:bangbang: Publishing is done by `jenkins.sh` via Jenkins on TAG-Job run.
80+
81+
Therefore tag you library like so
82+
83+
```bash
84+
git tag -a 1.0.2 -m "1.0.2"
85+
git push origin 1.0.2
86+
```
87+
88+
-----
89+
90+
 
91+
92+
### Setup for a Library
93+
94+
* (1) Create `package.json`
95+
* (2) Copy `.gitignore` from `@cloukit/toggle`
96+
* see example: https://github.com/cloukit/toggle/blob/master/.gitignore
97+
* (3) Main file with exports is expected to be `../src/index.ts`
98+
* see example: https://github.com/cloukit/toggle
99+
* (4) place `jenkins.sh` at root
100+
* see example: https://github.com/cloukit/toggle/blob/master/jenkins.sh
101+
* (5) add Webhook to codeclou.io jenkins
102+
* (6) Create Jenkins Job for project with convention "cloukit---COMPONENTNAME"
103+
104+
-----
105+
106+
107+
 
108+
109+
### Howto Link Lib during Development
11110

12111
(1) Go to component project and type to build the component
13112

14113
```
15-
git clone https://github.com/cloukit/ng-library-build.git library-build-chain
16-
cd library-build-chain
17-
npm install
18-
npm run build
19-
cd ../
20-
# symlink node_modules
21-
ln -s build/node_modules
114+
cd toggle
115+
yarn
22116
```
23117

24118
(2) Now `dist/` folder appeared:
25119

26120
```
27121
cd dist/
28-
npm link
122+
yarn link
29123
```
30124

31-
(3) Link into project
125+
(3) Link into project
32126

33-
see: https://docs.npmjs.com/cli/link
34127

35128
```
36-
cd my-test-project
37-
npm link @cloukit/foo # with foo = component name
129+
cd my-other-component
130+
yarn link @cloukit/toggle
38131
```
39132

40133
(4) Now you should be able to do in your testproject
41134

42135
```typescript
43-
import { FooModule } from '@cloukit/foo';
136+
import { FooModule } from '@cloukit/toggle';
44137
```
45138

139+
-----
140+
46141
 
47142

48-
## Jenkins Job Setup
143+
### Jenkins Job Setup
49144

50145
JobTrigger via Webhook and ANSI Colors plugin active:
51146

52147
```bash
53148
#!/bin/bash
54-
149+
55150
set -e
56-
151+
57152
# ############################################################################# #
58153
# And: https://github.com/codeclou/jenkins-github-webhook-build-trigger-plugin #
59154
# ############################################################################# #

README.md

Lines changed: 3 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -4,98 +4,12 @@
44

55
Common code to build the cloukit Angular libraries based on [angular-quickstart-lib](https://github.com/filipesilva/angular-quickstart-lib) and [simple-ui-lib](https://github.com/jasonaden/simple-ui-lib)
66

7-
:bangbang: SEE [DEVELOPMENT.md](./DEVELOPMENT.md)
7+
----
88

9-
-----
9+
See [DEVELOPMENT.md](https://github.com/cloukit/library-build-chain/blob/master/DEVELOPMENT.md)
1010

11-
 
12-
13-
### Module Format - FESM
14-
15-
Each library comes as an tree-shakeable and AOT enabled flat ES2015 Module.
16-
See [YouTube Packaging Angular - Jason Aden - ng-conf 2017]()https://www.youtube.com/watch?v=unICbsPGFIA) for in depth explanation.
17-
18-
-----
19-
20-
 
21-
22-
### Metadata for each Library
23-
24-
The library itself has `metadata.json` containing:
25-
26-
```json
27-
{
28-
"moduleId": "multi-select",
29-
"version": "1.1.0",
30-
"peerDependencies": {
31-
"@angular/core": "^4.0.1",
32-
"rxjs": "^5.3.0",
33-
"zone.js": "^0.8.5"
34-
}
35-
}
36-
```
37-
38-
which will then be transformed into:
39-
40-
```json
41-
{
42-
"name": "@cloukit/multi-select",
43-
"author": "codeclou.io",
44-
"version": "1.1.0",
45-
"license": "MIT",
46-
"module": "cloukit-multi-select.es5.js",
47-
"es2015": "cloukit-multi-select.js",
48-
"typings": "cloukit-multi-select.d.ts",
49-
"peerDependencies": {
50-
"@angular/core": "^4.0.1",
51-
"rxjs": "^5.3.0",
52-
"zone.js": "^0.8.5"
53-
}
54-
}
55-
```
56-
57-
-----
58-
59-
 
60-
61-
### Building a Library and Publishing to npmjs.com
62-
63-
Goto the library dir containing `metadata.json` and execute:
64-
65-
```bash
66-
git clone https://github.com/cloukit/library-build-chain.git library-build-chain
67-
cd library-build-chain
68-
yarn install
69-
yarn run build
70-
```
71-
72-
Now there will be a `../dist/` directory containing everything that can now be published to npmjs.com
73-
74-
:bangbang: Publishing is done by `jenkins.sh` via Jenkins on TAG-Job run.
75-
76-
Therefore tag you library like so
77-
78-
```bash
79-
git tag -a 1.0.2 -m "1.0.2"
80-
git push origin 1.0.2
81-
```
82-
83-
-----
84-
85-
 
86-
87-
### Setup for a Library
88-
89-
* (1) Create `manifest.json`
90-
* (2) Add `library-build-chain`, `build`, `dist` to `.gitignore`
91-
* (3) Main file with exports is expected to be `../src/index.ts`
92-
* see example: https://github.com/cloukit/common
93-
* (4) place `jenkins.sh` at root
94-
* see example: https://github.com/cloukit/common/blob/master/jenkins.sh
95-
* (5) add Webhook to codeclou.io jenkins
96-
* (6) Create Jenkins Job for project
11+
----
9712

98-
-----
9913

10014
 
10115

_build.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env node
2+
3+
/*!
4+
* @license MIT
5+
* Copyright (c) 2017 Bernhard Grünewaldt - codeclou.io
6+
* https://github.com/cloukit/legal
7+
*/
8+
9+
//
10+
// THIS IS THE BUILDFILE FOR library-build-chain ITSELF !!!!
11+
//
12+
const shell = require('shelljs');
13+
14+
if (shell.test('-d', 'dist')) {
15+
shell.mkdir('dist');
16+
}
17+
shell.mkdir('dist');
18+
shell.cp('build-package-json-template.js', './dist/');
19+
shell.cp('build-tsconfig-template.js', './dist/');
20+
shell.cp('build.js', './dist/');
21+
shell.cp('package.json', './dist/');
22+
shell.cp('README.md', './dist/');
23+
shell.cp('LICENSE', './dist/');

jenkins.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# BUILD TRIGGERED BY: https://github.com/codeclou/jenkins-github-webhook-build-trigger-plugin
4+
set -e
5+
git clone https://github.com/cloukit/library-deploy-chain.git library-deploy-chain
6+
cd library-deploy-chain
7+
bash jenkins.sh

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
22
"name": "@cloukit/library-build-chain",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"description": "Common code to build cloukit Angular Modules",
55
"author": "Bernhard Grünewaldt",
66
"license": "MIT",
7+
"scripts": {
8+
"build": "node ./_build.js"
9+
},
710
"dependencies": {
811
"@angular/cli": "1.2.0",
912
"@angular/compiler": "^4.0.1",

0 commit comments

Comments
 (0)