Skip to content

Commit 2764cd4

Browse files
author
Mateusz Korzel
committed
Initial commit with ouath aurelia plugin. This is first version to test it.
1 parent 7241ad2 commit 2764cd4

File tree

83 files changed

+3836
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+3836
-2
lines changed

.editorconfig

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
11+
# 2 space indentation
12+
[**.*]
13+
indent_style = space
14+
indent_size = 2

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
jspm_packages
3+
typings
4+
bower_components
5+
.idea
6+
.DS_STORE
7+
build/reports

.npmignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
jspm_packages
2+
bower_components
3+
.idea

.vscode/settings.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"typescript.tsdk": "node_modules/typescript/lib"
4+
}

.vscode/tasks.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "0.1.0",
5+
"command": "gulp",
6+
"isShellCommand": true,
7+
"args": ["--no-color"],
8+
"showOutput": "always"
9+
}

README.md

+58-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
1-
# aurelia-oauth
2-
OAuth2 authentication plugin for Aurelia
1+
# aurelia-skeleton-plugin
2+
3+
[![ZenHub](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.io)
4+
[![Join the chat at https://gitter.im/aurelia/discuss](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aurelia/discuss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5+
6+
This skeleton is part of the [Aurelia](http://www.aurelia.io/) platform. It sets up a standard aurelia plugin using gulp to build your ES6 code with the Babel compiler. Karma/Jasmine testing is also configured.
7+
8+
> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.durandal.io/) and [our email list](http://durandal.us10.list-manage1.com/subscribe?u=dae7661a3872ee02b519f6f29&id=3de6801ccc). We also invite you to [follow us on twitter](https://twitter.com/aureliaeffect). If you have questions, please [join our community on Gitter](https://gitter.im/aurelia/discuss). If you would like to have deeper insight into our development process, please install the [ZenHub](https://zenhub.io) Chrome or Firefox Extension and visit any of our repository's boards. You can get an overview of all Aurelia work by visiting [the framework board](https://github.com/aurelia/framework#boards).
9+
10+
## Building The Code
11+
12+
To build the code, follow these steps.
13+
14+
1. Ensure that [NodeJS](http://nodejs.org/) is installed. This provides the platform on which the build tooling runs.
15+
2. From the project folder, execute the following command:
16+
17+
```shell
18+
npm install
19+
```
20+
3. Ensure that [Gulp](http://gulpjs.com/) is installed. If you need to install it, use the following command:
21+
22+
```shell
23+
npm install -g gulp
24+
```
25+
4. To build the code, you can now run:
26+
27+
```shell
28+
gulp build
29+
```
30+
5. You will find the compiled code in the `dist` folder, available in three module formats: AMD, CommonJS and ES6.
31+
32+
6. See `gulpfile.js` for other tasks related to generating the docs and linting.
33+
34+
## Running The Tests
35+
36+
To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, proceed with these additional steps:
37+
38+
1. Ensure that the [Karma](http://karma-runner.github.io/) CLI is installed. If you need to install it, use the following command:
39+
40+
```shell
41+
npm install -g karma-cli
42+
```
43+
2. Ensure that [jspm](http://jspm.io/) is installed. If you need to install it, use the following commnand:
44+
45+
```shell
46+
npm install -g jspm
47+
```
48+
3. Install the client-side dependencies with jspm:
49+
50+
```shell
51+
jspm install
52+
```
53+
54+
4. You can now run the tests with this command:
55+
56+
```shell
57+
karma start
58+
```

build/args.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var yargs = require('yargs');
2+
3+
var argv = yargs.argv,
4+
validBumpTypes = "major|minor|patch|prerelease".split("|"),
5+
bump = (argv.bump || 'patch').toLowerCase();
6+
7+
if(validBumpTypes.indexOf(bump) === -1) {
8+
throw new Error('Unrecognized bump "' + bump + '".');
9+
}
10+
11+
module.exports = {
12+
bump: bump
13+
};

build/babel-options.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
modules: 'system',
3+
moduleIds: false,
4+
comments: false,
5+
compact: false,
6+
stage:2,
7+
optional: [
8+
"es7.decorators",
9+
"es7.classProperties"
10+
]
11+
};

build/paths.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
var path = require('path');
2+
3+
var appRoot = 'src/';
4+
5+
module.exports = {
6+
root: appRoot,
7+
source: appRoot + '**/*.ts',
8+
html: appRoot + '**/*.html',
9+
style: 'styles/**/*.css',
10+
output: 'dist/',
11+
doc:'./doc',
12+
dts: 'custom_typings/aurelia-oauth.d.ts',
13+
dtsSrc: [
14+
'typings/**/*.ts',
15+
'custom_typings/**/*.ts',
16+
'./jspm_packages/**/*.d.ts'
17+
]
18+
};

build/tasks/build.js

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
var gulp = require('gulp');
2+
var runSequence = require('run-sequence');
3+
var to5 = require('gulp-babel');
4+
var paths = require('../paths');
5+
var changed = require('gulp-changed');
6+
var plumber = require('gulp-plumber');
7+
var sourcemaps = require('gulp-sourcemaps');
8+
var compilerOptions = require('../babel-options');
9+
var assign = Object.assign || require('object.assign');
10+
var typescript = require('gulp-typescript');
11+
var tsc = require('typescript');
12+
13+
var tsProjectES6 = typescript.createProject('./tsconfig.json', { typescript: tsc });
14+
var tsProjectAMD = typescript.createProject('./tsconfig.json', { typescript: tsc, target: 'es5', module: 'amd' });
15+
var tsProjectCJS = typescript.createProject('./tsconfig.json', { typescript: tsc, target: 'es5', module: 'commonjs' });
16+
var tsProjectSystem = typescript.createProject('./tsconfig.json', { typescript: tsc, target: 'es5', module: 'system' });
17+
18+
function buildFromTs(tsProject, outputPath, includeEs6Dts) {
19+
var src = paths.dtsSrc.concat(paths.source);
20+
21+
return gulp.src(src)
22+
.pipe(plumber())
23+
.pipe(sourcemaps.init({loadMaps: true}))
24+
.pipe(changed(outputPath, {extension: '.js'}))
25+
.pipe(typescript(tsProject))
26+
.pipe(sourcemaps.write({includeContent: true}))
27+
.pipe(gulp.dest(outputPath));
28+
}
29+
30+
gulp.task('build-html-ts', function () {
31+
return gulp.src(paths.html)
32+
.pipe(gulp.dest(paths.output + 'ts'));
33+
});
34+
35+
gulp.task('build-ts', ['build-html-ts'], function() {
36+
return gulp.src(paths.source)
37+
.pipe(gulp.dest(paths.output + 'ts'));
38+
});
39+
40+
gulp.task('build-html-es6', function () {
41+
return gulp.src(paths.html)
42+
.pipe(gulp.dest(paths.output + 'es6'));
43+
});
44+
45+
gulp.task('build-es6', ['build-html-es6'], function () {
46+
return buildFromTs(tsProjectES6, paths.output + 'es6', false);
47+
});
48+
49+
gulp.task('build-html-commonjs', function () {
50+
return gulp.src(paths.html)
51+
.pipe(gulp.dest(paths.output + 'commonjs'));
52+
});
53+
54+
gulp.task('build-commonjs', ['build-html-commonjs'], function () {
55+
return buildFromTs(tsProjectCJS, paths.output + 'commonjs', true);
56+
});
57+
58+
gulp.task('build-html-amd', function () {
59+
return gulp.src(paths.html)
60+
.pipe(gulp.dest(paths.output + 'amd'));
61+
});
62+
63+
gulp.task('build-amd', ['build-html-amd'], function () {
64+
return buildFromTs(tsProjectAMD, paths.output + 'amd', true);
65+
});
66+
67+
gulp.task('build-html-system', function () {
68+
return gulp.src(paths.html)
69+
.pipe(gulp.dest(paths.output + 'system'));
70+
});
71+
72+
gulp.task('build-system', ['build-html-system'], function () {
73+
return buildFromTs(tsProjectSystem, paths.output + 'system', true);
74+
});
75+
76+
gulp.task('build-ts-typings', function () {
77+
return gulp.src(paths.dts)
78+
.pipe(gulp.dest(paths.output));
79+
});
80+
81+
gulp.task('build', function(callback) {
82+
return runSequence(
83+
'clean',
84+
['build-ts', 'build-es6', 'build-commonjs', 'build-amd', 'build-system', 'build-ts-typings'],
85+
callback
86+
);
87+
});

build/tasks/clean.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var gulp = require('gulp');
2+
var paths = require('../paths');
3+
var del = require('del');
4+
var vinylPaths = require('vinyl-paths');
5+
6+
gulp.task('clean', function() {
7+
return gulp.src([paths.output])
8+
.pipe(vinylPaths(del));
9+
});

build/tasks/dev.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var gulp = require('gulp');
2+
var tools = require('aurelia-tools');
3+
4+
gulp.task('update-own-deps', function(){
5+
tools.updateOwnDependenciesFromLocalRepositories();
6+
});
7+
8+
gulp.task('build-dev-env', function () {
9+
tools.buildDevEnv();
10+
});

build/tasks/doc.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var gulp = require('gulp');
2+
var tools = require('aurelia-tools');
3+
var paths = require('../paths');
4+
var yuidoc = require('gulp-yuidoc');
5+
6+
gulp.task('doc-generate', function(){
7+
return gulp.src(paths.source)
8+
.pipe(yuidoc.parser(null, 'api.json'))
9+
.pipe(gulp.dest(paths.doc));
10+
});
11+
12+
gulp.task('doc', ['doc-generate'], function(){
13+
tools.transformAPIModel(paths.doc);
14+
});

build/tasks/lint.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var gulp = require('gulp');
2+
var paths = require('../paths');
3+
var tslint = require('gulp-tslint');
4+
5+
gulp.task('lint', function () {
6+
return gulp.src(paths.source)
7+
.pipe(tslint({
8+
formatter: "verbose"
9+
}))
10+
.pipe(tslint.report())
11+
});

build/tasks/prepare-release.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
var gulp = require('gulp');
2+
var runSequence = require('run-sequence');
3+
var paths = require('../paths');
4+
var changelog = require('conventional-changelog');
5+
var fs = require('fs');
6+
var bump = require('gulp-bump');
7+
var args = require('../args');
8+
9+
gulp.task('bump-version', function(){
10+
return gulp.src(['./package.json', './bower.json'])
11+
.pipe(bump({type:args.bump })) //major|minor|patch|prerelease
12+
.pipe(gulp.dest('./'));
13+
});
14+
15+
gulp.task('changelog', function(callback) {
16+
var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
17+
18+
return changelog({
19+
repository: pkg.repository.url,
20+
version: pkg.version,
21+
file: paths.doc + '/CHANGELOG.md'
22+
}, function(err, log) {
23+
fs.writeFileSync(paths.doc + '/CHANGELOG.md', log);
24+
});
25+
});
26+
27+
gulp.task('prepare-release', function(callback){
28+
return runSequence(
29+
'build',
30+
'lint',
31+
'bump-version',
32+
'doc',
33+
'changelog',
34+
callback
35+
);
36+
});

build/tasks/test.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
var gulp = require('gulp');
2+
var karma = require('karma').server;
3+
4+
/**
5+
* Run test once and exit
6+
*/
7+
gulp.task('test', function (done) {
8+
karma.start({
9+
configFile: __dirname + '/../../karma.conf.js',
10+
singleRun: true
11+
}, function(e) {
12+
done();
13+
});
14+
});
15+
16+
/**
17+
* Watch for file changes and re-run tests on each change
18+
*/
19+
gulp.task('tdd', function (done) {
20+
karma.start({
21+
configFile: __dirname + '/../../karma.conf.js'
22+
}, function(e) {
23+
done();
24+
});
25+
});
26+
27+
/**
28+
* Run test once with code coverage and exit
29+
*/
30+
gulp.task('cover', function (done) {
31+
karma.start({
32+
configFile: __dirname + '/../../karma.conf.js',
33+
singleRun: true,
34+
reporters: ['coverage'],
35+
preprocessors: {
36+
'test/**/*.js': ['babel'],
37+
'src/**/*.js': ['babel', 'coverage']
38+
},
39+
coverageReporter: {
40+
type: 'html',
41+
dir: 'build/reports/coverage'
42+
}
43+
}, function (e) {
44+
done();
45+
});
46+
});

0 commit comments

Comments
 (0)