Skip to content

Commit

Permalink
chore: Initial commit, adding everything needed to start the developm…
Browse files Browse the repository at this point in the history
…ent.
  • Loading branch information
Supamiu committed Jun 29, 2017
0 parents commit a2fbb35
Show file tree
Hide file tree
Showing 23 changed files with 821 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.idea/
.DS_Store
node_modules/
coverage/
npm-debug.log
dist/
*.js.map
*.js
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-prefix=^
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
language: node_js

node_js:
- '8'

script: npm test

notifications:
email: false

cache:
directories:
- node_modules

after_success:
- npm run codecov

addons:
chrome: stable

dist: trusty
13 changes: 13 additions & 0 deletions .yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"generator-angular-library": {
"githubUsername": "Supamiu",
"githubRepoName": "ng-serializer",
"npmModuleName": "ng-serializer",
"moduleGlobal": "ngSerializer",
"ngModuleName": "NgSerializerModule",
"selectorPrefix": "null",
"projectTitle": "ng serializer",
"projectDescription": "",
"authorName": "Supamiu"
}
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017 Supamiu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
90 changes: 90 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# ng serializer
[![Build Status](https://travis-ci.org/Supamiu/ng-serializer.svg?branch=master)](https://travis-ci.org/Supamiu/ng-serializer)
[![codecov](https://codecov.io/gh/Supamiu/ng-serializer/branch/master/graph/badge.svg)](https://codecov.io/gh/Supamiu/ng-serializer)
[![npm version](https://badge.fury.io/js/ng-serializer.svg)](http://badge.fury.io/js/ng-serializer)
[![devDependency Status](https://david-dm.org/Supamiu/ng-serializer/dev-status.svg)](https://david-dm.org/Supamiu/ng-serializer?type=dev)
[![GitHub issues](https://img.shields.io/github/issues/Supamiu/ng-serializer.svg)](https://github.com/Supamiu/ng-serializer/issues)
[![GitHub stars](https://img.shields.io/github/stars/Supamiu/ng-serializer.svg)](https://github.com/Supamiu/ng-serializer/stargazers)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/Supamiu/ng-serializer/master/LICENSE)

## Demo
https://Supamiu.github.io/ng-serializer/

## Table of contents

- [About](#about)
- [Installation](#installation)
- [Documentation](#documentation)
- [Development](#development)
- [License](#license)

## About



## Installation

Install through npm:
```
npm install --save ng-serializer
```

Then include in your apps module:

```typescript
import { Component, NgModule } from '@angular/core';
import { NgSerializerModule } from 'ng-serializer';

@NgModule({
imports: [
NgSerializerModule.forRoot()
]
})
export class MyModule {}
```

Finally use in one of your apps components:
```typescript
import { Component } from '@angular/core';

@Component({
template: '<hello-world></hello-world>'
})
export class MyComponent {}
```

You may also find it useful to view the [demo source](https://github.com/Supamiu/ng-serializer/blob/master/demo/demo.component.ts).

### Usage without a module bundler
```
<script src="node_modules/ng-serializer/bundles/ng-serializer.umd.js"></script>
<script>
// everything is exported ngSerializer namespace
</script>
```

## Documentation
All documentation is auto-generated from the source via [compodoc](https://compodoc.github.io/compodoc/) and can be viewed here:
https://Supamiu.github.io/ng-serializer/docs/

## Development

### Prepare your environment
* Install [Node.js](http://nodejs.org/) and NPM
* Install local dev dependencies: `npm install` while current directory is this repo

### Development server
Run `npm start` to start a development server on port 8000 with auto reload + tests.

### Testing
Run `npm test` to run tests once or `npm run test:watch` to continually run tests.

### Release
* Bump the version in package.json (once the module hits 1.0 this will become automatic)
```bash
npm run release
```

## License

MIT
8 changes: 8 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @license
* Copyright Supamiu All Rights Reserved.
*
* Use of this source code is governed by an GPL license that can be
* found in the LICENSE file at https://github.com/supamiu/ng-serializer/blob/master/LICENSE
*/
export * from './src/index';
86 changes: 86 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var webpack = require("webpack");
var path = require("path");
var ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
exports.default = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: './',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha'],
// list of files / patterns to load in the browser
files: [
'test/entry.ts'
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/entry.ts': ['webpack', 'sourcemap']
},
webpack: {
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [{
test: /\.ts$/,
loader: 'tslint-loader',
exclude: /node_modules/,
enforce: 'pre',
options: {
emitErrors: config.singleRun,
failOnHint: config.singleRun
}
}, {
test: /\.ts$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
transpileOnly: !config.singleRun
}
}, {
test: /src\/.+\.ts$/,
exclude: /(node_modules|\.spec\.ts$)/,
loader: 'istanbul-instrumenter-loader',
enforce: 'post'
}]
},
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: null,
test: /\.(ts|js)($|\?)/i
}),
new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, path.join(__dirname, 'src'))
].concat((config.singleRun ? [
new webpack.NoEmitOnErrorsPlugin()
] : [
new ForkTsCheckerWebpackPlugin({
watch: ['./src', './test']
})
]))
},
mochaReporter: {
showDiff: true,
output: 'autowatch'
},
coverageIstanbulReporter: {
reports: ['text-summary', 'html', 'lcovonly'],
fixWebpackSourcePaths: true
},
mime: {
'text/x-typescript': ['ts']
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha', 'coverage-istanbul'],
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['ChromeHeadless']
});
};
103 changes: 103 additions & 0 deletions karma.conf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import * as webpack from 'webpack';
import * as path from 'path';
import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';

export default config => {

config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: './',

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha'],

// list of files / patterns to load in the browser
files: [
'test/entry.ts'
],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/entry.ts': ['webpack', 'sourcemap']
},

webpack: {
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [{
test: /\.ts$/,
loader: 'tslint-loader',
exclude: /node_modules/,
enforce: 'pre',
options: {
emitErrors: config.singleRun,
failOnHint: config.singleRun
}
}, {
test: /\.ts$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
transpileOnly: !config.singleRun
}
}, {
test: /src\/.+\.ts$/,
exclude: /(node_modules|\.spec\.ts$)/,
loader: 'istanbul-instrumenter-loader',
enforce: 'post'
}]
},
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: null,
test: /\.(ts|js)($|\?)/i
}),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular/,
path.join(__dirname, 'src')
),
...(config.singleRun ? [
new webpack.NoEmitOnErrorsPlugin()
] : [
new ForkTsCheckerWebpackPlugin({
watch: ['./src', './test']
})
])
]
},

mochaReporter: {
showDiff: true,
output: 'autowatch'
},

coverageIstanbulReporter: {
reports: ['text-summary', 'html', 'lcovonly'],
fixWebpackSourcePaths: true
},

mime: {
'text/x-typescript': ['ts']
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha', 'coverage-istanbul'],

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['ChromeHeadless']

});

};
Loading

0 comments on commit a2fbb35

Please sign in to comment.