-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changing import order #68 Version bump to 1.7.0
- Loading branch information
1 parent
8f278e0
commit daceebc
Showing
18 changed files
with
520 additions
and
1,123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* taken from angular2-webpack-starter | ||
*/ | ||
var path = require('path'); | ||
|
||
// Helper functions | ||
var ROOT = path.resolve(__dirname, '..'); | ||
|
||
function hasProcessFlag(flag) { | ||
return process.argv.join('').indexOf(flag) > -1; | ||
} | ||
|
||
function isWebpackDevServer() { | ||
return process.argv[1] && !! (/webpack-dev-server$/.exec(process.argv[1])); | ||
} | ||
|
||
function root(args) { | ||
args = Array.prototype.slice.call(arguments, 0); | ||
return path.join.apply(path, [ROOT].concat(args)); | ||
} | ||
|
||
function checkNodeImport(context, request, cb) { | ||
if (!path.isAbsolute(request) && request.charAt(0) !== '.') { | ||
cb(null, 'commonjs ' + request); return; | ||
} | ||
cb(); | ||
} | ||
|
||
exports.hasProcessFlag = hasProcessFlag; | ||
exports.isWebpackDevServer = isWebpackDevServer; | ||
exports.root = root; | ||
exports.checkNodeImport = checkNodeImport; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
module.exports = function(config) { | ||
var testWebpackConfig = require('./webpack.test.js'); | ||
|
||
var configuration = { | ||
basePath: '', | ||
|
||
frameworks: ['jasmine'], | ||
|
||
// list of files to exclude | ||
exclude: [], | ||
|
||
/* | ||
* list of files / patterns to load in the browser | ||
* | ||
* we are building the test environment in ./spec-bundle.js | ||
*/ | ||
files: [ { pattern: './config/spec-bundle.js', watched: false } ], | ||
|
||
preprocessors: { './config/spec-bundle.js': ['coverage', 'webpack', 'sourcemap'] }, | ||
|
||
// Webpack Config at ./webpack.test.js | ||
webpack: testWebpackConfig, | ||
|
||
coverageReporter: { | ||
type: 'in-memory' | ||
}, | ||
|
||
remapCoverageReporter: { | ||
'text-summary': null, | ||
json: './coverage/coverage.json', | ||
html: './coverage/html' | ||
}, | ||
|
||
// Webpack please don't spam the console when running in karma! | ||
webpackMiddleware: { stats: 'errors-only'}, | ||
|
||
reporters: [ 'mocha', 'coverage', 'remap-coverage' ], | ||
|
||
mochaReporter: { | ||
ignoreSkipped: true | ||
}, | ||
|
||
// web server port | ||
port: 9876, | ||
|
||
colors: true, | ||
|
||
/* | ||
* level of logging | ||
* possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
*/ | ||
logLevel: config.LOG_INFO, | ||
|
||
autoWatch: false, | ||
|
||
browsers: [ | ||
'Chrome' | ||
], | ||
|
||
customLaunchers: { | ||
ChromeTravisCi: { | ||
base: 'Chrome', | ||
flags: ['--no-sandbox'] | ||
} | ||
}, | ||
|
||
singleRun: true | ||
}; | ||
|
||
if (process.env.TRAVIS){ | ||
configuration.browsers = [ | ||
'ChromeTravisCi' | ||
]; | ||
} | ||
|
||
config.set(configuration); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* When testing with webpack and ES6, we have to do some extra | ||
* things to get testing to work right. Because we are gonna write tests | ||
* in ES6 too, we have to compile those as well. That's handled in | ||
* karma.conf.js with the karma-webpack plugin. This is the entry | ||
* file for webpack test. Just like webpack will create a bundle.js | ||
* file for our client, when we run test, it will compile and bundle them | ||
* all here! Crazy huh. So we need to do some setup | ||
*/ | ||
Error.stackTraceLimit = Infinity; | ||
|
||
require('core-js/es6'); | ||
require('core-js/es7/reflect'); | ||
|
||
// Typescript emit helpers polyfill | ||
require('ts-helpers'); | ||
|
||
require('zone.js/dist/zone'); | ||
require('zone.js/dist/long-stack-trace-zone'); | ||
require('zone.js/dist/async-test'); | ||
require('zone.js/dist/fake-async-test'); | ||
require('zone.js/dist/sync-test'); | ||
require('zone.js/dist/proxy'); // since zone.js 0.6.15 | ||
require('zone.js/dist/jasmine-patch'); // put here since zone.js 0.6.14 | ||
|
||
// RxJS | ||
require('rxjs/Rx'); | ||
|
||
var testing = require('@angular/core/testing'); | ||
var browser = require('@angular/platform-browser-dynamic/testing'); | ||
|
||
testing.TestBed.initTestEnvironment( | ||
browser.BrowserDynamicTestingModule, | ||
browser.platformBrowserDynamicTesting() | ||
); | ||
|
||
/* | ||
* Ok, this is kinda crazy. We can use the context method on | ||
* require that webpack created in order to tell webpack | ||
* what files we actually want to require or import. | ||
* Below, context will be a function/object with file names as keys. | ||
* Using that regex we are saying look in ../src then find | ||
* any file that ends with spec.ts and get its path. By passing in true | ||
* we say do this recursively | ||
*/ | ||
var testContext = require.context('../tests', true, /\.spec\.ts/); | ||
|
||
/* | ||
* get all the files, for each file, call the context function | ||
* that will require the file and load it up here. Context will | ||
* loop and require those spec files here | ||
*/ | ||
function requireAll(requireContext) { | ||
return requireContext.keys().map(requireContext); | ||
} | ||
|
||
// requires and returns all modules that match | ||
var modules = requireAll(testContext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/// <reference path="../node_modules/@types/jasmine/index.d.ts" /> | ||
|
||
/* | ||
Temporary fiile for referencing the TypeScript defs for Jasmine + some potentially | ||
utils for testing. Will change/adjust this once I find a better way of doing | ||
*/ | ||
|
||
declare module jasmine { | ||
interface Matchers { | ||
toHaveText(text: string): boolean; | ||
toContainText(text: string): boolean; | ||
} | ||
} | ||
|
||
beforeEach(() => { | ||
jasmine.addMatchers({ | ||
|
||
toHaveText: function() { | ||
return { | ||
compare: function(actual, expectedText) { | ||
var actualText = actual.textContent; | ||
return { | ||
pass: actualText === expectedText, | ||
get message() { | ||
return 'Expected ' + actualText + ' to equal ' + expectedText; | ||
} | ||
}; | ||
} | ||
}; | ||
}, | ||
|
||
toContainText: function() { | ||
return { | ||
compare: function(actual, expectedText) { | ||
var actualText = actual.textContent; | ||
return { | ||
pass: actualText.indexOf(expectedText) > -1, | ||
get message() { | ||
return 'Expected ' + actualText + ' to contain ' + expectedText; | ||
} | ||
}; | ||
} | ||
}; | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** | ||
* Adapted from angular2-webpack-starter | ||
*/ | ||
|
||
const helpers = require('./helpers'), | ||
webpack = require('webpack'), | ||
LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin'); | ||
|
||
/** | ||
* Webpack Plugins | ||
*/ | ||
|
||
module.exports = { | ||
|
||
/** | ||
* Source map for Karma from the help of karma-sourcemap-loader & karma-webpack | ||
* | ||
* Do not change, leave as is or it wont work. | ||
* See: https://github.com/webpack/karma-webpack#source-maps | ||
*/ | ||
devtool: 'inline-source-map', | ||
|
||
resolve: { | ||
extensions: ['.ts', '.js'], | ||
modules: [helpers.root('src'), 'node_modules'] | ||
}, | ||
|
||
module: { | ||
rules: [{ | ||
enforce: 'pre', | ||
test: /\.ts$/, | ||
loader: 'tslint-loader', | ||
exclude: [helpers.root('node_modules')] | ||
}, { | ||
enforce: 'pre', | ||
test: /\.js$/, | ||
loader: 'source-map-loader', | ||
exclude: [ | ||
// these packages have problems with their sourcemaps | ||
helpers.root('node_modules/rxjs'), | ||
helpers.root('node_modules/@angular') | ||
] | ||
}, { | ||
test: /\.ts$/, | ||
loader: 'awesome-typescript-loader', | ||
query: { | ||
// use inline sourcemaps for "karma-remap-coverage" reporter | ||
sourceMap: false, | ||
inlineSourceMap: true, | ||
module: "commonjs", | ||
removeComments: true | ||
}, | ||
exclude: [/\.e2e\.ts$/] | ||
}, { | ||
enforce: 'post', | ||
test: /\.(js|ts)$/, | ||
loader: 'istanbul-instrumenter-loader', | ||
include: helpers.root('src'), | ||
exclude: [/\.spec\.ts$/, /\.e2e\.ts$/, /node_modules/] | ||
}], | ||
}, | ||
|
||
plugins: [ | ||
// fix the warning in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js | ||
new webpack.ContextReplacementPlugin( | ||
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/, | ||
helpers.root('./src') | ||
), | ||
|
||
new LoaderOptionsPlugin({ | ||
debug: true, | ||
options: { | ||
|
||
/** | ||
* Static analysis linter for TypeScript advanced options configuration | ||
* Description: An extensible linter for the TypeScript language. | ||
* | ||
* See: https://github.com/wbuchwalter/tslint-loader | ||
*/ | ||
tslint: { | ||
emitErrors: false, | ||
failOnHint: false, | ||
resourcePath: 'src' | ||
}, | ||
|
||
} | ||
}) | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {NgModule, ModuleWithProviders} from '@angular/core'; | ||
import {CommonModule} from '@angular/common'; | ||
import {HttpModule} from '@angular/http'; | ||
import {ResourceProviders} from './src/ResourceProviders'; | ||
|
||
export * from './src/Resource'; | ||
export * from './src/ResourceAction'; | ||
export * from './src/ResourceCRUD'; | ||
export * from './src/ResourceCRUDBase'; | ||
export * from './src/ResourceGlobalConfig'; | ||
export * from './src/ResourceModel'; | ||
export * from './src/ResourceParams'; | ||
export * from './src/ResourceProviders'; | ||
export * from './src/Interfaces'; | ||
|
||
@NgModule({ | ||
imports: [CommonModule, HttpModule] | ||
}) | ||
export class ResourceModule { | ||
static forRoot(): ModuleWithProviders { | ||
return { | ||
ngModule: ResourceModule, | ||
providers: ResourceProviders.providers[ResourceProviders.mainProvidersName] | ||
}; | ||
} | ||
|
||
static forChild(subSet: string): ModuleWithProviders { | ||
return { | ||
ngModule: ResourceModule, | ||
providers: ResourceProviders.providers[subSet] ? ResourceProviders.providers[subSet] : [] | ||
}; | ||
} | ||
|
||
} |
Oops, something went wrong.