Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Lautier committed May 16, 2016
0 parents commit 0e83681
Show file tree
Hide file tree
Showing 31 changed files with 1,336 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .bithoundrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"ignore": [
"**/node_modules/**",
"**/vendor/**",
"**/**-min-**",
"**/**-min.**",
"**/**.min.**",
"bower_components/**",
"dist/**",
"_artifact/**",
"typings/**"
],
"test": [
"**/test/**",
"**/tests/**",
"**/spec/**",
"**/specs/**",
"**/*.spec.ts"
]
}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
jspm_packages
bower_components
.idea


_artifact
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jspm_packages
bower_components
.idea
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) 2016

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.
111 changes: 111 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
[projectUri]: https://github.com/sketch7/ssv-ng2-core
[projectGit]: https://github.com/sketch7/ssv-ng2-core.git
[changeLog]: ./doc/CHANGELOG.md

[contribWiki]: ./doc/CONTRIBUTION.md
[releaseWorkflowWiki]: ./doc/RELEASE-WORKFLOW.md

[jspm]: http://jspm.io
[typings]: https://github.com/typings/typings

# ssv-ng2-core
[![Build status](https://ci.appveyor.com/api/projects/status/2e0an5hvxtfs08mf?svg=true)](https://ci.appveyor.com/project/chiko/ssv-ng2-core)
[![Build status](https://ci.appveyor.com/api/projects/status/2e0an5hvxtfs08mf/branch/master?svg=true)](https://ci.appveyor.com/project/chiko/ssv-ng2-core/branch/master)
[![bitHound Overall Score](https://www.bithound.io/github/sketch7/ssv-ng2-core/badges/score.svg)](https://www.bithound.io/github/sketch7/ssv-ng2-core)
[![npm version](https://badge.fury.io/js/ssv-ng2-core.svg)](https://badge.fury.io/js/ssv-ng2-core)

Sketch7 Angular2 core components and utilities

In order to contribute please read the [Contribution guidelines][contribWiki].

**Quick links**

[Change logs][changeLog] | [Project Repository][projectUri] | [Contribution guidelines][contribWiki]

# Installation
Get library via [jspm]
```bash
jspm install ssv-ng2-core
```
TypeScript Typings via [typings]
```bash
typings install github:sketch7/ssv-ng2-core --save
```

# Usage
```ts
// todo: add sample
import {logger} from "ssv-ng2-core";

```


# Getting Started

## Setup Machine for Development
Install/setup the following:

- NodeJS v4+
- Visual Studio Code or similar code editor
- TypeScript 1.8+
- SourceTree, SmartGit (or similar)
- Ensure to install **global NPM modules** using the following:


```bash
npm install -g git gulp typings karma-cli jspm
```


### Cloning Repo

- Open SourceTree
- Clone project repo from [project git][projectGit]
- Switch to `develop` branch


## Project Setup
The following process need to be executed in order to get started.

```bash
npm install
jspm install
```


## Building the code

```
gulp build
```
In order to view all other tasks invoke `gulp` or check the gulp tasks directly.

## Running the tests

```
gulp test
```


## Development utils

### Trigger gulp watch
Handles compiling of changes.
```
gulp watch
```


### Running Continuous Tests
Spawns test runner and keep watching for changes.
```
gulp tdd
```


## Preparation for Release

```
gulp prepare-release --bump major|minor|patch|prerelease (default: patch)
```
Check out the [release workflow guide][releaseWorkflowWiki] in order to guide you creating a release and distributing it.
40 changes: 40 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
environment:
JSPM_GITHUB_AUTH_TOKEN:
secure: q2JNqq1JlQ7ferxb6TSYgW1S/pUFEhYgGEDgl8iRAy25jM/y3NpoKXyKlACscd2zjbVGUCWlbnyjfMAfgl/0nKEi+KNDaNG5ZR8C3EvYaG8=
# Test against this version of Node.js
nodejs_version: "5"

# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
- npm install -g gulp jspm
# install modules
- npm install
- jspm --version
#- jspm config registries.github.auth %JSPM_GITHUB_AUTH_TOKEN%
#- jspm registry export github
- jspm install

# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# run tests
- gulp lint
- gulp test

# Don't actually build.
build: off

notifications:
- provider: Slack
incoming_webhook:
secure: vEkNTGdxrec+HtMuHg87gPDSbcATux8FurC+ntE6+y9HzsbAkhizj5UIEA9ccKj0RC2SBkJECVo3dX9K5OQunXHRNFxBbvZrS08gMGRIx2I=

cache:
- node_modules
- '%APPDATA%\npm-cache'

version: "{build}-{branch}"
16 changes: 16 additions & 0 deletions build/args.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var yargs = require("yargs");

var argv = yargs.argv,
validBumpTypes = "major|minor|patch|prerelease".split("|"),
bump = (argv.bump || "patch").toLowerCase();

if (validBumpTypes.indexOf(bump) === -1) {
throw new Error(`Unrecognized bump "${bump}".`);
}

var versionSuffix = (argv.versionSuffix || "rc" ).toLowerCase();

module.exports = {
bump: bump,
versionSuffix: versionSuffix
};
10 changes: 10 additions & 0 deletions build/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const gulp = require("gulp");
const paths = require("./paths");

require("require-dir")("./tasks");

gulp.task("default", () => {

console.log(`======== ${paths.packageName} ========`);

});
23 changes: 23 additions & 0 deletions build/paths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const path = require("path");
const fs = require("fs");

const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
const srcRoot = "src";
const tsdMainFile = "typings/browser.d.ts";


module.exports = {
output: {
dist: `./dist`,
artifact: `./_artifact`,
},
src: {
root: srcRoot,
typings: [tsdMainFile, "./jspm_packages/**/*.d.ts"],
ts: `./${srcRoot}/**/*.ts`,
testTs: `./${srcRoot}/**/*.spec.ts`,
karmaConfig: `karma.conf.js`
},
doc: "./doc",
packageName: pkg.name
};
68 changes: 68 additions & 0 deletions build/tasks/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const gulp = require("gulp");
const runSeq = require("run-sequence");
const tsc = require("gulp-typescript");
const sourcemaps = require("gulp-sourcemaps");
const plumber = require("gulp-plumber");
const merge = require("merge2");

const paths = require("../paths");

gulp.task("build", (cb) => {
return runSeq(
["compile:ts"],
cb);
});

gulp.task("rebuild", (cb) => {
return runSeq(
"clean:artifact",
"build",
cb);
});

gulp.task("rebuild:rel", (cb) => {
return runSeq(
"clean",
"build",
"copy-dist",
cb);
});

// scripts
gulp.task("compile:ts", () => {
const tsProject = getTscProject();
const tsResult = gulp.src([...paths.src.typings, paths.src.ts, `!${paths.src.testTs}`])
.pipe(plumber())
//.pipe(changed(paths.output.dist, { extension: ".js" }))
//.pipe(sourcemaps.init())
.pipe(tsc(tsProject));

return merge([
tsResult.js
//.pipe(sourcemaps.write("."))
.pipe(gulp.dest(`${paths.output.artifact}/amd`)),
tsResult.dts.pipe(gulp.dest(`${paths.output.artifact}/typings`))
]);
});

function getTscProject() {
return tsc.createProject("tsconfig.json", {
typescript: require("typescript"),
//outFile: `${paths.packageName}.js`
});
}

// copy-dist
gulp.task("copy-dist", () => {
return runSeq(["copy-dist:scripts", "copy-dist:dts"]);
});

gulp.task("copy-dist:scripts", () => {
return gulp.src(`${paths.output.artifact}/amd/**/*.js`)
.pipe(gulp.dest(`${paths.output.dist}/amd`));
});

gulp.task("copy-dist:dts", () => {
return gulp.src(`${paths.output.artifact}/typings/**/*.d.ts`)
.pipe(gulp.dest(`${paths.output.dist}/typings`));
});
14 changes: 14 additions & 0 deletions build/tasks/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const gulp = require("gulp");
const del = require("del");

const paths = require("../paths");

gulp.task("clean", ["clean:artifact", "clean:dist"]);

gulp.task("clean:artifact", () => {
return del(paths.output.artifact);
});

gulp.task("clean:dist", () => {
return del(paths.output.dist);
});
21 changes: 21 additions & 0 deletions build/tasks/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const gulp = require("gulp");
const util = require("gulp-util");

const paths = require("../paths");

gulp.task("watch", () => {

// ts
gulp.watch(paths.src.ts, ["compile:ts"])
.on("change", reportChange)
.on("error", swallowError);

});

function reportChange(event) {
console.log(`File ${event.path} was ${event.type}, running tasks...`);
}

function swallowError(error) {
console.log(util.colors.red(`Error occurred while running watched task...`));
}
16 changes: 16 additions & 0 deletions build/tasks/lint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const gulp = require("gulp");
const tslint = require("gulp-tslint");
const stylish = require("gulp-tslint-stylish");

const paths = require("../paths");

gulp.task("lint", () => {
gulp.src(paths.src.ts)
.pipe(tslint())
.pipe(tslint.report(stylish, {
emitError: true,
sort: true,
bell: true,
fullPath: true
}));
});
Loading

0 comments on commit 0e83681

Please sign in to comment.