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

Commit c21e136

Browse files
committed
Clone jsog-typescript
0 parents  commit c21e136

30 files changed

+2772
-0
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
dist
3+
spec
4+
package
5+
coverage
6+
7+
# macOS
8+
.DS_Store

.gitlab-ci.yml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Beschreibt wie unsere CI/CD Pipeline mit der Gitlab-CI funktioniert
2+
#
3+
# Referenz: https://docs.gitlab.com/ce/ci/yaml/
4+
# Linter: https://gitsc.emundo.eu/ci/lint
5+
# Doku: https://gitsc.emundo.eu/help/ci/README.md
6+
#
7+
# Authoren: Oliver Broome
8+
# Lukas Lisowski
9+
# Simon Nagl
10+
11+
# Wir brauchen genau dieses Image und kein Alpine weil sonst u.a. Karma, Jasmine
12+
# und der Webpack Build nicht ordentlich läuft
13+
image: node:latest
14+
15+
stages:
16+
- rebased
17+
- compile
18+
- package
19+
- test
20+
- publish
21+
22+
cache:
23+
key: "default"
24+
paths:
25+
- node_modules/
26+
27+
# Wird vor jeder stage ausgeführt.
28+
before_script:
29+
# Nun stellen wir nochmal sicher, dass alle npm-Pakete im Cache vorhanden sind
30+
- npm install
31+
# und löschen die überzähligen
32+
- npm prune
33+
34+
rebased:
35+
stage: rebased
36+
# Wir brauchen hier einfach nur kurz und bündig ein Git image
37+
image: docker:git
38+
only:
39+
# die Prüfung ob gerebased ist passiert nur in Branches
40+
- branches
41+
# oder durchs antriggern
42+
- triggers
43+
cache:
44+
# wir brauchen keinen Cache
45+
key: "none"
46+
before_script:
47+
# Wir brauchen die allgemeinen Skripte hier nicht
48+
- echo "check if branch is rebased on master"
49+
script:
50+
# Variable wird mit Gitlab >= 9.0 auf CI_COMMIT_REF_NAME umbenannt. TODO Lukas/Oliver
51+
- if ! git merge-base --is-ancestor origin/master origin/$CI_BUILD_REF_NAME ; then exit 1; fi
52+
53+
compile:
54+
stage: compile
55+
script:
56+
- npm run build
57+
58+
build:
59+
stage: package
60+
script:
61+
- npm run build
62+
- npm pack
63+
artifacts:
64+
when: on_success
65+
expire_in: 1 week
66+
paths:
67+
- jsog-typescript-*.tgz
68+
69+
test:
70+
stage: test
71+
script:
72+
- npm run test
73+
74+
deploy-npm:
75+
stage: publish
76+
only:
77+
- manual
78+
- tags
79+
script:
80+
# Wir bauen die Anwendung für die Zielumgebung mit der Config
81+
- npm run build
82+
- echo "TODO Create .npmrc with token from secrete gitlab variable"
83+
- npm publish

.npmignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
src
2+
spec
3+
tsconfig.test.json
4+
jasmine.json
5+
.gitlab-ci.yml
6+
tsconfig*.json
7+
tslint.json
8+
package
9+
.npmignore
10+
.vscode/

.travis.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
language: node_js
2+
node_js:
3+
- node
4+
5+
notifications:
6+
email:
7+
on_success: never
8+
on_failure: change
9+
10+
deploy:
11+
provider: npm
12+
13+
api_key:
14+
secure: EkoXfGTgycBZZf6J1YvW937PRnqxHJ78bwOYG1/sB6khhh6aHPDkLEAZWf+X5dnj4MmfUfNdd1UdZKqxhx+GBTdaqQsgYruNbxkfuA/UpiqGN59P5vWz15NFl9sXJPzBIUQR9Mh2fKmzCjvvn0sKQo/oENx8/5k28MU4pZNYHUI2US0mhKRwp7JF+zrVrnsbqGnmZtuLMWONTfrMUhM6tKhPWzAFKAjVLTNWYYyvD4etv2CBk4uCWXVwQMYrp13lXjpl6sLyWTQrUS/hopRcE9R001O044kPR1TmfLj98XkXEo+Uwin/3nnTL0z3OzswGX/UnOXLsTtqvY4QZeTBa0lmrJHYinXb7rSUIXePC+yZEKyU4kjQwMzNDqlhhmVJKQBNLEBXygKxCfPKT10WFK2Vk4y+p+drvD8OSuZqLJY3fDjjPeDTZ7DbaFIfA0140pyl8Ya1hpuJW2wddnH3V2mISObH+1zklyZNJj2+dptSohG4YcyjVCNKMNLxmtV6ApMXt/hIiJDELSs40lKw8H7mOq/gZjfMOxEJw14aYmmDBhmJS/+Q35gYb4Ztls/sj6ad6AkLcYx8kKG6gjf3wXS+nwX1c6eF4zKDiAReR4t52Hv9scj4zfEj+0tP2pXk6gv2ab1f08DOgz8Eo44Un6ncTUzl8TSV57YUtt8gFNY=
15+
on:
16+
tags: true
17+
repo: e-mundo/jsog-typescript
18+
19+
after_success:
20+
# Remap javascript coverage to typescript files and send it to codacy
21+
- cat ./coverage/coverage.json | ./node_modules/.bin/remap-istanbul -t lcovonly | ./node_modules/.bin/codacy-coverage
22+

.vscode/launch.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "jasmine",
6+
"type": "node",
7+
"request": "launch",
8+
"program": "${workspaceRoot}/node_modules/jasmine/bin/jasmine.js",
9+
"stopOnEntry": false,
10+
"args": [
11+
"--config=jasmine.json"
12+
],
13+
"cwd": "${workspaceRoot}",
14+
"runtimeArgs": [
15+
"--nolazy"
16+
],
17+
"env": {
18+
"NODE_ENV": "development"
19+
},
20+
"sourceMaps": true,
21+
"outFiles": [
22+
"${workspaceRoot}/**/*.js"
23+
]
24+
}
25+
]
26+
}

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2013 Voost LLC
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# JavaScript Object Graphs with Typescript
2+
3+
[![Build Status](https://travis-ci.org/emundo/jsog-typescript.svg?branch=master)](https://travis-ci.org/emundo/jsog-typescript)
4+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/f1aa8312b430447083609f8ca5519136)](https://www.codacy.com/app/simonnagl/jsog-typescript?utm_source=github.com&utm_medium=referral&utm_content=emundo/jsog-typescript&utm_campaign=badger)
5+
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/f1aa8312b430447083609f8ca5519136)](https://www.codacy.com/app/simonnagl/jsog-typescript?utm_source=github.com&utm_medium=referral&utm_content=emundo/jsog-typescript&utm_campaign=Badge_Coverage)
6+
7+
This Typescript module implements [JSOG format](https://github.com/jsog/jsog).
8+
It is able to instantiante typescript objects during deserialization.
9+
10+
## Usage
11+
12+
### Installation
13+
14+
```
15+
npm --save jsog-typescript
16+
```
17+
18+
Enable typescript `experimentalDecorator` and `emitDecoratorMetadata` compiler options.
19+
20+
Minimal tslint.json:
21+
```
22+
{
23+
"compilerOptions": {
24+
"experimentalDecorators": true,
25+
"emitDecoratorMetadata": true,
26+
}
27+
}
28+
```
29+
30+
### General
31+
32+
Generate a new instance of the service. See Integration for integration to some popular frameworks.
33+
34+
```
35+
import { jsogService } from 'jsog-typescript'
36+
37+
const jsog = new JsogService();
38+
```
39+
40+
Use it to serialize and deserialize JavaScript Objects.
41+
```
42+
jsog.serialize(javaScriptObject);
43+
jsog.deserialize(jsogObjectGraph);
44+
```
45+
46+
### Instatiate Typescript Objects
47+
48+
Description how to instatiate Typescript objects to provide convinent methods and use the `typeof` operator.
49+
50+
Instantiate the root object or a list of rootObjects:
51+
```
52+
jsog.deserializeObject(jsogObjectGraph, ExampleClass);
53+
jsog.deserializeArray(jsogObjectArray, ExampleClass);
54+
```
55+
56+
To instantiate references somewhere in the tree decorate class properties to instantiate with `@JsonProperty()` and properties with Lists containing objects of type `ExamplecClass` use `@JsonProperty(ExampleClass)`.
57+
58+
### Integration
59+
60+
#### Angular 4
61+
62+
Provide JsogService as an Angular 4 Service which can be injected into your Components/Services.
63+
64+
```
65+
import { NgModule } from '@angular/core';
66+
import { JsogService } from 'jsog-typescript';
67+
68+
@NgModule({
69+
providers: [
70+
JsogService
71+
]
72+
)}
73+
```
74+
75+
#### AngularJs
76+
77+
Register JsogService as an Angular Service
78+
79+
```
80+
import { module } from 'angular';
81+
import { JsogService } from 'jsog-typescript';
82+
83+
module.service('JsogService', JsogService)
84+
```
85+
86+
## Developer Guide
87+
88+
### System dependencies
89+
- [npm](https://www.npmjs.com/) (4.6.1)
90+
91+
## Author
92+
93+
* Simon Nagl ([email protected])
94+
95+
## License
96+
97+
This software is provided under the [MIT license](http://opensource.org/licenses/MIT)
98+
99+
This software uses code and ideas from:
100+
101+
- [JSOG - JavaScript Object Graph](https://github.com/jsog/jsog)
102+
- [json-typescript-mapper](https://github.com/jf3096/json-typescript-mapper)

jasmine.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"spec_dir": "spec",
3+
"spec_files": [
4+
"**/*[sS]pec.js"
5+
],
6+
"stopSpecOnExpectationFailure": false
7+
}

0 commit comments

Comments
 (0)