(v0.7.0) Used shenanigans-manager@0.2 instead of Gulp

This commit is contained in:
Josh Goldberg
2017-12-25 16:01:34 -05:00
parent 06824d9756
commit 3bf565be80
14 changed files with 117 additions and 8906 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
language: node_js language: node_js
node_js: node_js:
- "7" - "node"
- "5" - "5"
script: script:
node_modules/gulp/bin/gulp.js npm run verify
+7
View File
@@ -0,0 +1,7 @@
{
"editor.tabSize": 4,
"editor.trimAutoWhitespace": true,
"tslint.alwaysShowRuleFailuresAsWarnings": true,
"tslint.autoFixOnSave": true,
"typescript.tsdk": "node_modules\\typescript\\lib"
}
-1
View File
@@ -1 +0,0 @@
require("gulp-shenanigans").initialize(require("gulp"));
+2 -8709
View File
File diff suppressed because it is too large Load Diff
+66 -28
View File
@@ -1,29 +1,67 @@
{ {
"name": "timehandlr", "author": {
"description": "A flexible, pausable alternative to setTimeout and setInterval.", "email": "joshuakgoldberg@outlook.com",
"version": "0.6.1", "name": "Josh Goldberg"
"author": { },
"name": "Josh Goldberg", "bugs": {
"email": "joshuakgoldberg@outlook.com" "url": "https://github.com/FullScreenShenanigans/TimeHandlr/issues"
}, },
"repository": { "dependencies": {
"type": "git", },
"url": "ssh://git@github.com:FullScreenShenanigans/TimeHandlr.git" "description": "A flexible, pausable alternative to setTimeout and setInterval.",
}, "devDependencies": {
"bugs": { "@types/chai": "^4.0.4",
"url": "https://github.com/FullScreenShenanigans/TimeHandlr/issues" "@types/lolex": "^1.5.32",
}, "@types/mocha": "^2.2.44",
"license": "MIT", "@types/sinon": "^4.0.0",
"devDependencies": { "@types/sinon-chai": "^2.7.29",
"gulp": "^3.9.1", "chai": "^4.1.2",
"gulp-shenanigans": "^0.6.17" "glob": "^7.1.2",
}, "lolex": "^2.3.0",
"scripts": { "mocha": "^4.0.1",
"gulp": "gulp", "mocha-headless-chrome": "^1.7.1",
"test": "gulp test" "requirejs": "^2.3.5",
}, "run-for-every-file": "^1.1.0",
"shenanigans": { "shenanigans-manager": "^0.2.0",
"name": "TimeHandlr" "sinon": "^4.1.2",
}, "sinon-chai": "^2.14.0",
"dependencies": {} "tslint": "5.8.0",
} "typedoc": "^0.9.0",
"typescript": "^2.6.2",
"webpack": "^3.10.0"
},
"license": "MIT",
"name": "timehandlr",
"repository": {
"type": "git",
"url": "ssh://git@github.com:FullScreenShenanigans/TimeHandlr.git"
},
"scripts": {
"dist": "npm run dist:webpack",
"dist:webpack": "webpack --config webpack.config.js",
"docs": "npm run docs:typedoc",
"docs:typedoc": "typedoc src/ --out docs/generated",
"init": "npm install && npm run setup && npm run verify",
"setup": "npm run setup:copy && npm run setup:package",
"setup:copy": "npm run setup:copy:default",
"setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/default/\" --file \"**/*\" --run \"mustache package.json {{src-file}} {{file}}\" --dest \".\" --only-files",
"setup:package": "shenanigans-manager hydrate-package-json",
"src": "npm run src:tsc && npm run src:tslint",
"src:tsc": "tsc -p .",
"src:tslint": "tslint -c tslint.json --exclude ./node_modules/**/*.ts* -p tsconfig.json -t stylish",
"test": "npm run test:setup && npm run test:run",
"test:run": "mocha-headless-chrome --file test/index.html",
"test:setup": "npm run test:setup:copy && npm run test:setup:html && npm run test:setup:tsc",
"test:setup:copy": "npm run test:setup:copy:default",
"test:setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/test/\" --file \"**/*\" --run \"mustache package.json {{src-file}} ./test/{{file}}\" --dest \".\" --only-files",
"test:setup:html": "shenanigans-manager generate-test-html",
"test:setup:tsc": "tsc -p test",
"verify": "npm run src && npm run test && npm run dist && npm run docs",
"watch": "run-p \"tsc -p . -w\" \"echo sup\""
},
"shenanigans": {
"name": "TimeHandlr"
},
"types": "./src/index.d.ts",
"version": "0.7.0"
}
+7 -40
View File
@@ -54,9 +54,7 @@ export interface ITimeCycles {
* @param args Any arguments, passed through a TimeHandlr. * @param args Any arguments, passed through a TimeHandlr.
* @returns Anything truthy to stop repetition. * @returns Anything truthy to stop repetition.
*/ */
export interface IEventCallback { export type IEventCallback = (...args: any[]) => any;
(...args: any[]): any;
}
/** /**
* General-purpose calculator for numeric values. * General-purpose calculator for numeric values.
@@ -64,9 +62,7 @@ export interface IEventCallback {
* @param args Any arguments. * @param args Any arguments.
* @returns Some numeric value. * @returns Some numeric value.
*/ */
export interface INumericCalculator { export type INumericCalculator = (...args: any[]) => number;
(...args: any[]): number;
}
/** /**
* Calculator for event repetition. * Calculator for event repetition.
@@ -75,9 +71,7 @@ export interface INumericCalculator {
* parent event's passed args. * parent event's passed args.
* @returns Whether an event should keep repeating. * @returns Whether an event should keep repeating.
*/ */
export interface IRepeatCalculator { export type IRepeatCalculator = (...args: any[]) => boolean;
(...args: any[]): boolean;
}
/** /**
* Calculator for a class within a class cycle. * Calculator for a class within a class cycle.
@@ -85,9 +79,7 @@ export interface IRepeatCalculator {
* @param args Any arguments. * @param args Any arguments.
* @returns Either a className or a value for whether this should stop. * @returns Either a className or a value for whether this should stop.
*/ */
export interface IClassCalculator { export type IClassCalculator = (thing: IThing, settings: ITimeCycle) => string | boolean;
(thing: IThing, settings: ITimeCycle): string | boolean;
}
/** /**
* General-purpose Function to add or remove a class on a Thing. * General-purpose Function to add or remove a class on a Thing.
@@ -95,9 +87,7 @@ export interface IClassCalculator {
* @param thing A Thing whose class is to change. * @param thing A Thing whose class is to change.
* @param className The class to add or remove. * @param className The class to add or remove.
*/ */
export interface IClassChanger { export type IClassChanger = (thing: IThing, className: string) => void;
(thing: IThing, className: string): void;
}
/** /**
* An object that may have classes added or removed, such as in a cycle. * An object that may have classes added or removed, such as in a cycle.
@@ -123,7 +113,7 @@ export interface IThing {
/** /**
* A callback for when this is added. * A callback for when this is added.
*/ */
onThingAdd?: (thing: IThing) => void; onThingAdd?(thing: IThing): void;
/** /**
* Whether this is ready to have a visual display. * Whether this is ready to have a visual display.
@@ -143,7 +133,7 @@ export interface ITimeEvent {
/** /**
* Something to run when this event is triggered. * Something to run when this event is triggered.
*/ */
callback: Function; callback(): void;
/** /**
* Arguments to be passed to the callback. * Arguments to be passed to the callback.
@@ -182,29 +172,6 @@ export interface ITimeHandlrSettings {
*/ */
timingDefault?: number; timingDefault?: number;
/**
* Attribute name to store listings of cycles in objects (by default,
* "cycles").
*/
keyCycles?: string;
/**
* Atribute name to store class name in objects (by default, "className").
*/
keyClassName?: string;
/**
* Key to check for a callback before a cycle starts in objects (by default,
* "onClassCycleStart").
*/
keyOnClassCycleStart?: string;
/**
* Key to check for a callback after a cycle starts in objects (by default,
* "doClassCycleStart").
*/
keyDoClassCycleStart?: string;
/** /**
* Optional attribute to check for whether a cycle may be given to an * Optional attribute to check for whether a cycle may be given to an
* object (if not given, ignored). * object (if not given, ignored).
+3 -3
View File
@@ -12,7 +12,7 @@ export class TimeEvent implements ITimeEvent {
/** /**
* Something to run when this event is triggered. * Something to run when this event is triggered.
*/ */
public callback: Function; public callback: () => void;
/** /**
* Arguments to be passed to the callback. * Arguments to be passed to the callback.
@@ -32,7 +32,7 @@ export class TimeEvent implements ITimeEvent {
/** /**
* How many times this has been called. * How many times this has been called.
*/ */
public count: number = 0; public count = 0;
/** /**
* Computes a value as either a raw Number or a Function. * Computes a value as either a raw Number or a Function.
@@ -48,7 +48,7 @@ export class TimeEvent implements ITimeEvent {
} }
/** /**
* Initializes a new instance of the Event class. * Initializes a new instance of the TimeEvent class.
* *
* @param callback A callback to be run some number of times. If it returns * @param callback A callback to be run some number of times. If it returns
* truthy, repetition stops. * truthy, repetition stops.
+8 -39
View File
@@ -1,6 +1,6 @@
import { import {
IClassCalculator, IClassChanger, ICurrentEvents, IEventCallback, INumericCalculator, IClassCalculator, IClassChanger, ICurrentEvents, IEventCallback, INumericCalculator,
IThing, ITimeCycle, ITimeCycles, ITimeCycleSettings, ITimeEvent, ITimeHandlr, ITimeHandlrSettings IThing, ITimeCycle, ITimeCycles, ITimeCycleSettings, ITimeEvent, ITimeHandlr, ITimeHandlrSettings,
} from "./ITimeHandlr"; } from "./ITimeHandlr";
import { TimeEvent } from "./TimeEvent"; import { TimeEvent } from "./TimeEvent";
@@ -13,26 +13,6 @@ export class TimeHandlr implements ITimeHandlr {
*/ */
private readonly timingDefault: number; private readonly timingDefault: number;
/**
* Attribute name to store listings of cycles in objects.
*/
private readonly keyCycles: string;
/**
* Attribute name to store class name in objects.
*/
private readonly keyClassName: string;
/**
* Key to check for a callback before a cycle starts in objects.
*/
private readonly keyOnClassCycleStart: string;
/**
* Key to check for a callback after a cycle starts in objects.
*/
private readonly keyDoClassCycleStart: string;
/** /**
* Optional attribute to check for whether a cycle may be given to an * Optional attribute to check for whether a cycle may be given to an
* object. * object.
@@ -75,10 +55,6 @@ export class TimeHandlr implements ITimeHandlr {
this.timingDefault = settings.timingDefault || 1; this.timingDefault = settings.timingDefault || 1;
this.keyCycles = settings.keyCycles || "cycles";
this.keyClassName = settings.keyClassName || "className";
this.keyOnClassCycleStart = settings.keyOnClassCycleStart || "onClassCycleStart";
this.keyDoClassCycleStart = settings.keyDoClassCycleStart || "doClassCycleStart";
this.keyCycleCheckValidity = settings.keyCycleCheckValidity; this.keyCycleCheckValidity = settings.keyCycleCheckValidity;
this.copyCycleSettings = typeof settings.copyCycleSettings === "undefined" ? true : settings.copyCycleSettings; this.copyCycleSettings = typeof settings.copyCycleSettings === "undefined" ? true : settings.copyCycleSettings;
@@ -363,13 +339,9 @@ export class TimeHandlr implements ITimeHandlr {
thing.onThingAdd = (): void => { thing.onThingAdd = (): void => {
const calcTime: number = settings.length * (timing as number); const calcTime: number = settings.length * (timing as number);
const entryDelay: number = Math.ceil(this.time / calcTime) * calcTime - this.time; const entryDelay: number = Math.ceil(this.time / calcTime) * calcTime - this.time;
let event: ITimeEvent; const event = entryDelay === 0
? this.addEventInterval(this.cycleClass, timing, Infinity, thing, settings)
if (entryDelay === 0) { : this.addEvent(this.addEventInterval, entryDelay, this.cycleClass, timing, Infinity, thing, settings);
event = this.addEventInterval(this.cycleClass, timing, Infinity, thing, settings);
} else {
event = this.addEvent(this.addEventInterval, entryDelay, this.cycleClass, timing, Infinity, thing, settings);
}
settings.event = event; settings.event = event;
}; };
@@ -416,12 +388,9 @@ export class TimeHandlr implements ITimeHandlr {
return false; return false;
} }
let name: string | boolean; const name = current.constructor === Function
if (current.constructor === Function) { ? (current as IClassCalculator)(thing, settings)
name = (current as IClassCalculator)(thing, settings); : current;
} else {
name = current as string;
}
settings.oldclass = settings.location; settings.oldclass = settings.location;
@@ -473,7 +442,7 @@ export class TimeHandlr implements ITimeHandlr {
* @param className The String to be added to the thing's class. * @param className The String to be added to the thing's class.
*/ */
private classAddGeneric(thing: IThing, className: string): void { private classAddGeneric(thing: IThing, className: string): void {
thing.className += " " + className; thing.className += ` ${className}`;
} }
/** /**
+3
View File
@@ -0,0 +1,3 @@
export * from "./ITimeHandlr";
export * from "./TimeEvent";
export * from "./TimeHandlr";
-3
View File
@@ -1,3 +0,0 @@
import { mochaLoader } from "../main";
mochaLoader.it("_", (): void => { });
+2 -17
View File
@@ -1,19 +1,4 @@
{ {
"compilerOptions": { "extends": "../tsconfig.json",
"declaration": true, "include": ["*.ts"]
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
"module": "amd",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"target": "es5"
},
"include": [
"./**/*.ts"
]
} }
-9
View File
@@ -1,9 +0,0 @@
import { ITimeHandlr, ITimeHandlrSettings } from "../../src/ITimeHandlr";
import { TimeHandlr } from "../../src/TimeHandlr";
/**
*
*/
export function mockTimeHandlr(settings: ITimeHandlrSettings): ITimeHandlr {
return new TimeHandlr(settings);
}
+9 -3
View File
@@ -1,6 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"declaration": true, "declaration": true,
"experimentalDecorators": true,
"jsx": "react",
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"], "lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
"module": "amd", "module": "amd",
"moduleResolution": "node", "moduleResolution": "node",
@@ -8,12 +10,16 @@
"noImplicitReturns": true, "noImplicitReturns": true,
"noImplicitThis": true, "noImplicitThis": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noUnusedLocals": true, "pretty": true,
"noUnusedParameters": true,
"strictNullChecks": true, "strictNullChecks": true,
"target": "es5" "target": "es5"
}, },
"exclude": [
"dist",
"node_modules"
],
"include": [ "include": [
"./src/**/*.ts" "./src/**/*.ts",
"./src/**/*.tsx"
] ]
} }
+8 -52
View File
@@ -1,56 +1,12 @@
{ {
"extends": "tslint:all", "extends": "./node_modules/shenanigans-manager/setup/tslint.json",
"rules": { "rules": {
"array-type": [false], "completed-docs": false,
"arrow-return-shorthand": [false], "no-any": false,
"ban-types": [false], "no-non-null-assertion": false,
"callable-types": [false], "no-unbound-method": false,
"comment-format": [false], "no-unsafe-any": false,
"completed-docs": [false], "prefer-function-over-method": false,
"cyclomatic-complexity": [false], "strict-boolean-expressions": false
"forin": [false],
"linebreak-style": [false],
"max-file-line-count": [false],
"max-line-length": [true, 140],
"member-ordering": [
true,
"public-before-private",
"static-before-instance",
"variables-before-functions"
],
"newline-before-return": [false],
"no-any": [false],
"no-bitwise": [false],
"no-console": [false],
"no-default-export": [false],
"no-inferrable-types": [false],
"no-magic-numbers": [false],
"no-redundant-jsdoc": [false],
"no-non-null-assertion": [false],
"no-object-literal-type-assertion": [false],
"no-submodule-imports": [false],
"no-require-imports": false,
"no-unbound-method": [false],
"no-unsafe-any": [false],
"no-unused-variable": [false],
"no-void-expression": [false],
"number-literal-format": [false],
"object-literal-key-quotes": [false],
"object-literal-shorthand": [false],
"object-literal-sort-keys": [false],
"only-arrow-functions": [false],
"prefer-function-over-method": [false],
"prefer-method-signature": [false],
"prefer-switch": [false],
"prefer-conditional-expression": [false],
"prefer-template": [false],
"restrict-plus-operands": [false],
"space-before-function-paren": [false],
"strict-boolean-expressions": [false],
"strict-type-predicates": [false],
"switch-final-break": [false],
"trailing-comma": [false],
"typedef": [false],
"variable-name": [false]
} }
} }