Skip to content

Commit

Permalink
added typings, updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
smartin85 committed Jul 24, 2017
1 parent 2203323 commit a293446
Show file tree
Hide file tree
Showing 14 changed files with 361 additions and 216 deletions.
44 changes: 44 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"env": {
"browser": true,
"node": true
},
"rules": {
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
"camelcase": 1,
"object-shorthand": 0,
"spaced-comment": 1,
"no-invalid-this": 0,
"linebreak-style": 0,
"no-tabs": 0,
"padded-blocks": 0,
"indent": [2, "tab", { "SwitchCase": 1 }],
"strict": 2,
"func-names": 0,
"space-before-function-paren": [2, { "anonymous": "always", "named": "always" }],
"global-require": 0,
"max-len": [0, 100, 4, {
"ignoreUrls": true,
"ignoreComments": true
}],
"comma-dangle": [2, "never"],
"no-underscore-dangle": 0,
"no-empty-function": 1,
"semi": 1,
"complexity": ["error", 5],
"default-case": 1,
"eqeqeq": 1,
"no-eval": 1,
"no-extend-native": 1,
"no-fallthrough": 1,
"no-implicit-globals": 1,
"no-loop-func": 1,
"no-multi-spaces": 1,
"no-redeclare": 1,
"no-self-assign": 1,
"no-sequences": 1,
"no-useless-return": 1,
"radix": 1,
"vars-on-top": 1
}
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/node_modules
/node_modules
/.nyc_output
/coverage
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 0.10
before_script:
- npm install -g gulp
- "4"
- "6"
- "7"
sudo: false
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# moment-immutable
[![MIT License][license-image]][license-url]
[![npm version][npm-image]][npm-url]
[![Bower version][bower-image]][bower-url]
[![Build Status][travis-image]][travis-url]
[![Coverage Status][coveralls-image]][coveralls-url]
[![Dependency Status][versioneye-image]][versioneye-url]
[![npm version][npm-image]][npm-url]

[![Known Vulnerabilities][snyk-image]][snyk-url]

Make moment.js immutable (moments and durations)

Expand Down Expand Up @@ -74,11 +76,22 @@ moment.immutable.addDurationMutable('set', 0); // makes the set-function immuta
[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat
[license-url]: LICENSE

[npm-image]: https://badge.fury.io/js/moment-immutable.svg
[npm-url]: https://badge.fury.io/js/moment-immutable

[bower-image]: https://badge.fury.io/bo/moment-immutable.svg
[bower-url]: https://badge.fury.io/bo/moment-immutable



[travis-url]: http://travis-ci.org/smartin85/moment-immutable
[travis-image]: https://travis-ci.org/smartin85/moment-immutable.svg?branch=master

[coveralls-image]: https://coveralls.io/repos/github/smartin85/moment-immutable/badge.svg
[coveralls-url]: https://coveralls.io/github/smartin85/moment-immutable

[versioneye-image]: https://www.versioneye.com/user/projects/58a0d4ab6a7781003a57a209/badge.svg
[versioneye-url]: https://www.versioneye.com/user/projects/58a0d4ab6a7781003a57a209

[npm-image]: https://badge.fury.io/js/moment-immutable.svg
[npm-url]: https://badge.fury.io/js/moment-immutable
[snyk-image]: https://snyk.io/test/github/smartin85/moment-period/badge.svg
[snyk-url]: https://snyk.io/test/github/smartin85/moment-period
22 changes: 13 additions & 9 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,19 @@
"moment": ">= 2.8.1 <3.0.0"
},
"devDependencies": {
"gulp": "~3.9.1",
"gulp-uglifyjs": "~0.6.2",
"jasmine-core": "~2.5.2",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-global-preprocessor": "~0.0.2",
"karma-jasmine": "~1.1.0",
"karma-phantomjs-launcher": "~1.0.2",
"run-sequence": "~1.2.2"
"@types/moment": "^2.13.0",
"jasmine-core": "2.5.2",
"karma": "1.6.0",
"karma-chrome-launcher": "2.0.0",
"karma-coverage": "1.1.1",
"karma-coveralls": "1.1.2",
"karma-eslint": "2.2.0",
"karma-global-preprocessor": "0.0.2",
"karma-jasmine": "1.1.0",
"karma-phantomjs-launcher": "1.0.4",
"npm-run-all": "4.0.2",
"typescript": "2.2.2",
"uglify-js": "2.8.22"
},
"ignore": [
"**/.*",
Expand Down
28 changes: 23 additions & 5 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,47 @@
var package = require('./package.json');

module.exports = function (config) {
const package = require('./package.json');
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
'node_modules/moment/moment.js',
'moment-immutable.js',
'tests/moment-immutable.spec.js'
'tests/unit-tests/moment-immutable.spec.js'
],
exclude: [],
reporters: ['progress', 'coverage', 'coveralls'],
port: 8080,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['PhantomJS'],
plugins: [
'karma-jasmine',
'karma-phantomjs-launcher',
'karma-global-preprocessor'
'karma-global-preprocessor',
'karma-coverage',
'karma-coveralls',
'karma-eslint'
],
globals: {
packageVersion: package.version
},
preprocessors: {
'tests/moment-immutable.spec.js': ['global']
'tests/unit-tests/moment-immutable.spec.js': ['global', 'eslint'],
'moment-immutable.js': ['coverage', 'eslint']
},
coverageReporter: {
reporters: [
{ type: 'lcov', dir: 'coverage/'},
{ type: 'text' }
]
},
eslint: {
stopOnError: false,
stopOnWarning: false,
showWarnings: true,
engine: {
configFile: '.eslintrc'
}
},
singleRun: false
});
Expand Down
24 changes: 24 additions & 0 deletions moment-immutable.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as moment from 'moment';

declare module "moment" {
interface MomentTsTz {
ts: number;
tz: string;
}

interface Moment {
mutable(isMutable : boolean): moment.Moment;
mutable() : boolean;
}

interface MomentImmutable {
version: string;
addMomentMutable: (attributeName: string, minParameters?: number) => MomentImmutable;
addDurationMutable: (attributeName: string, parminParameters?: number) => MomentImmutable;
}

const immutable: MomentImmutable;
}

// require("moment-dt") === require("moment-timezone")
export = moment;
Loading

0 comments on commit a293446

Please sign in to comment.