Skip to content

Commit

Permalink
Merge pull request #27 from akserg/aot
Browse files Browse the repository at this point in the history
Fixed AOT issues
  • Loading branch information
akserg authored Dec 5, 2016
2 parents 2e207b4 + 563fb60 commit dbff0f9
Show file tree
Hide file tree
Showing 25 changed files with 629 additions and 375 deletions.
6 changes: 6 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Submitting Pull Requests
If you're changing the structure of the repository please create an issue first

## Submitting bug reports

Make sure you are on latest changes and that you ran this command `npm run clean:install` after updating your local repository. If you can, please provide more infomation about your environment such as browser, operating system, node version, and npm version
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
**I'm submitting a ...** (check one with "x")
```
[ ] bug report => check the FAQ and search github for a similar issue or PR before submitting
[ ] support request => check the FAQ and search github for a similar issue before submitting
[ ] feature request
```

**Current behavior**


**Expected/desired behavior**


**Reproduction of the problem**
If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar.


**What is the expected behavior?**


**What is the motivation / use case for changing the behavior?**


**Please tell us about your environment:**

* **ng2-translate version:** x.x.x

* **Angular version:** 2.0.0-rc.X

* **Browser:** [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

* **Language:** [all | TypeScript X.X | ES6/7 | ES5]
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
* **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...)



* **What is the current behavior?** (You can also link to an open issue here)



* **What is the new behavior (if this is a feature change)?**



* **Other information**:
24 changes: 9 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,24 @@ manifest.mf
build.xml
node_modules/*
npm-debug.log
*.js
!config/*
!karma.conf.js
!webpack.config.js
*.map
*.d.ts
!make.js
coverage
dist
typings
*.metadata.json
bundles
src/*.js
src/*.d.ts
src/*.js.map
tests/*.js
tests/*.d.ts
tests/*.js.map
typings
index.js
index.d.ts
index.js.map
_test-output
.vscode

#################
## JetBrains
#################
.idea
.project
.settings
.idea/*
*.iml

############
## Windows
Expand Down
20 changes: 7 additions & 13 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,21 @@ manifest.mf
build.xml
node_modules/*
npm-debug.log
coverage
typings
typings.json
**/*.ts
*.ts
!*.d.ts
!src/*.d.ts
!tests/*.d.ts
.travis.yml
karma*
make.js
tsconfig.json
_test-output
tests
.github
coverage
!*.metadata.json
!bundles/*.js
*.ngFactory.ts

#################
## JetBrains
#################
.idea
.project
.settings
.idea/*
*.iml

############
## Windows
Expand Down
29 changes: 21 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
sudo: false
language: node_js

cache:
directories:
- $HOME/.npm
- $HOME/.yarn-cache
- node_modules

sudo: false

notifications:
email: false

node_js:
- '5'
- '6'

branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"

before_install:
- npm i -g npm@^3.7
- export CHROME_BIN=chromium-browser
- npm i -g yarn

before_script:
- npm prune
script:
- npm run test

install:
- yarn

after_success:
- npm run semantic-release
branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"

before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ System.config({
'ng2-slim-loading-bar': 'node_modules/ng2-slim-loading-bar'
},
packages: {
'ng2-slim-loading-bar': { main: 'index.js', defaultExtension: 'js' },
'ng2-slim-loading-bar': { defaultExtension: 'js' },
}
});
```
Expand Down
32 changes: 32 additions & 0 deletions config/helpers.js
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;
58 changes: 58 additions & 0 deletions config/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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' ],

// 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: [process.env.TRAVIS ? 'Firefox' : 'Chrome'],

singleRun: true
};

config.set(configuration);
};
58 changes: 58 additions & 0 deletions config/spec-bundle.js
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);
46 changes: 46 additions & 0 deletions config/testing-utils.ts
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;
}
};
}
};
}
});
});
Loading

0 comments on commit dbff0f9

Please sign in to comment.