Skip to content

Fix webpack export #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ We use Gulp for managing the build. Here are some useful Gulp tasks:

* `npm test` Runs all tests (webpack, commonjs, etc) checks the coding style, lints the code, calculates complexity, runs all tests, and enforces code coverage. You should make sure you do this before submitting a PR.
* `gulp` The default task checks the coding style, lints the code, calculates complexity, runs the tests (not webpack or commonJS tests), and enforces code coverage.
* `gulp scss` Generates the css file from the source scss.
* `gulp css-lint` Lint the css files after generating.
* `gulp templatecache` Generates src/js/datetimepicker.templates.js. You must re-add the IIFE around the generated code after it is generated (PR to fix this would be apprecaited)

# Contributing to AngularJS

Expand Down
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ bower_components
complexity
coverage
demo
Gruntfile.js
gulpfile.js
karma.conf.js
paths.js
Expand Down
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
sudo: false
dist: bionic
language: node_js
node_js:
- '12'
services:
- xvfb
addons:
firefox: latest
chrome: latest
cache:
directories:
- node_modules
notifications:
email: none
node_js:
- '6'
before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
before_script:
- npm prune
script:
Expand Down
20 changes: 10 additions & 10 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ var standard = require('gulp-standard')

var karmaConfig = path.join(__dirname, 'karma.conf.js')

gulp.task('clean', function () {
gulp.task('clean', function clean () {
var del = require('del')
return del([
'build'
])
})

gulp.task('complexity', function (done) {
gulp.task('complexity', function complexity (done) {
var callback = function () {
done()
}

plato.inspect(paths.lint, 'build/complexity', {title: 'prerender', recurse: true}, callback)
})

gulp.task('lint', function () {
gulp.task('lint', function lint () {
return gulp
.src(paths.lint)
.pipe(standard())
Expand All @@ -37,13 +37,13 @@ gulp.task('lint', function () {
}))
})

gulp.task('tdd', function (done) {
gulp.watch(paths.all, ['jscs', 'lint'])
gulp.task('tdd', function tdd (done) {
gulp.watch(paths.all, gulp.parallel('lint'))

var config = testConfig(
{
autoWatch: true,
browsers: ['PhantomJS'],
browsers: ['ChromeHeadless'],
configFile: karmaConfig,
singleRun: false
}
Expand All @@ -53,7 +53,7 @@ gulp.task('tdd', function (done) {
server.start()
})

gulp.task('test', ['lint'], function (done) {
gulp.task('test', gulp.series('lint', function test (done) {
var config = testConfig(
{
configFile: karmaConfig,
Expand All @@ -64,13 +64,13 @@ gulp.task('test', ['lint'], function (done) {

var server = new Server(config, done)
server.start()
})
}))

gulp.task('default', ['complexity', 'test'])
gulp.task('default', gulp.parallel('complexity', 'test'))

var testConfig = function (options) {
var travisDefaultOptions = {
browsers: ['Firefox'],
browsers: ['FirefoxHeadless', 'ChromeHeadless'],
reporters: ['dots', 'coverage', 'threshold']
}

Expand Down
3 changes: 1 addition & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module.exports = function (config) {
'karma-jasmine',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-phantomjs-launcher',
'karma-coverage',
'karma-threshold-reporter'
],
Expand Down Expand Up @@ -85,7 +84,7 @@ module.exports = function (config) {
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['PhantomJS'],
browsers: ['FirefoxHeadless', 'ChromeHeadless'],

// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
Expand Down
25 changes: 10 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,27 @@
"angular-mocks": "^1.x",
"coveralls": "^2.11.14",
"cz-conventional-changelog": "^1.2.0",
"del": "^5.1.0",
"eslint": "^3.8.1",
"gulp": "^3.9.1",
"gulp-htmlmin": "^3.0.0",
"gulp-jscs": "^4.0.0",
"gulp-jshint": "^2.0.1",
"gulp-standard": "^8.0.2",
"jasmine-core": "^2.5.2",
"gulp": "^4.0.0",
"gulp-standard": "^8.0.4",
"jquery": "^3.1.1",
"jshint": "^2.9.4",
"jshint-stylish": "^2.2.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.2",
"karma": "^5.0.0",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.0.2",
"karma-firefox-launcher": "^1.3.0",
"karma-jasmine": "^3.1.1",
"karma-threshold-reporter": "^0.1.15",
"karma-webpack": "^1.8.0",
"karma-webpack": "^4.0.2",
"lodash": "^4.16.4",
"phantomjs-prebuilt": "^2.1.13",
"plato": "^1.7.0",
"run-browser": "^2.0.2",
"semantic-release": "^6.3.0",
"standard": "^8.4.0",
"tape": "^4.6.2",
"webpack": "^1.13.2"
"webpack": "^4.43.0"
},
"scripts": {
"coverage:upload": "cat build/coverage/lcov.info | coveralls",
Expand Down
2 changes: 1 addition & 1 deletion paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var nodeModules = [
'node_modules/angular-mocks/angular-mocks.js'
]
var bumpFiles = ['package.json', 'bower.json', 'README.md', 'src/js/*.js']
var miscFiles = ['GruntFile.js', 'gulpfile.js', 'karma.conf.js', 'paths.js']
var miscFiles = ['gulpfile.js', 'karma.conf.js', 'paths.js']
var demoFiles = []
var sourceFiles = ['src/**/*.js']
var testFiles = ['test/**/*.spec.js']
Expand Down
5 changes: 2 additions & 3 deletions src/dateTimeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
var ng = typeof angular === 'undefined' ? require('angular') : angular
var mt = typeof moment === 'undefined' ? require('moment') : moment
factory(ng, mt)
module.exports = 'ui.bootstrap.datetimepicker'
/* istanbul ignore next */
} else if (typeof define === 'function' && /* istanbul ignore next */ define.amd) {
module.exports = 'ui.dateTimeInput'
} else /* istanbul ignore next */ if (typeof define === 'function' && define.amd) {
define(['angular', 'moment'], factory)
} else {
factory(root.angular, root.moment)
Expand Down
12 changes: 0 additions & 12 deletions test/webpack/app.js

This file was deleted.

17 changes: 11 additions & 6 deletions test/webpack/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @since 9/11/16.
*/

var webpackConfig = require('./webpack.conf');

module.exports = function(config) {
'use strict';
config.set({
Expand All @@ -30,10 +28,10 @@ module.exports = function(config) {
}],

// webpack configuration
webpack: webpackConfig,
webpack: {},

// webpack middlewae configuration
webpackMiddleware: { noInfo: true },
webpackMiddleware: { stats: 'errors-only' },

// list of files to exclude
exclude: [],
Expand Down Expand Up @@ -64,14 +62,21 @@ module.exports = function(config) {

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

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
concurrency: Infinity,

// Webpack tests need the tests to run in order in order to test the require call
client: {
jasmine: {
random: false
}
},
});
};
19 changes: 0 additions & 19 deletions test/webpack/webpack.conf.js

This file was deleted.

5 changes: 3 additions & 2 deletions test/webpack/webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ describe('webpack require', function () {
}

it('should throw an error if the module is not defined', function () {
expect(loadDateTimeInput).toThrow();
expect(loadDateTimeInput).toThrowError(/\[\$injector:nomod\] Module 'ui\.dateTimeInput'/);
});

it('should be available when required', function () {
require('../../');
var exported = require('../../');
expect(exported).toBe('ui.dateTimeInput');
expect(loadDateTimeInput).not.toThrow();
});
});