mirror of
https://github.com/FullScreenShenanigans/ModAttachr.git
synced 2026-08-12 02:18:09 -07:00
Moved build process to gulp-shenanigans
This commit is contained in:
+5
-1
@@ -1,4 +1,8 @@
|
||||
dist/**
|
||||
lib/**
|
||||
src/**/*.js*
|
||||
test/**/*.js
|
||||
test/index.html
|
||||
test/utils/**
|
||||
!test/utils/mocks.ts
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
|
||||
+4
-54
@@ -1,55 +1,5 @@
|
||||
const gulp = require("gulp");
|
||||
const merge = require("merge2");
|
||||
const mochaPhantomJS = require("gulp-mocha-phantomjs");
|
||||
const runSequence = require("run-sequence");
|
||||
const ts = require("gulp-typescript");
|
||||
const tslint = require("gulp-tslint");
|
||||
|
||||
gulp.task("tslint", () => {
|
||||
return gulp
|
||||
.src(["src/**/*.ts", "!src/**/*.d.ts"])
|
||||
.pipe(tslint())
|
||||
.pipe(tslint.report("verbose"));
|
||||
});
|
||||
|
||||
gulp.task("tsc", () => {
|
||||
const tsProject = ts.createProject("tsconfig.json");
|
||||
|
||||
return tsProject
|
||||
.src()
|
||||
.pipe(ts(tsProject))
|
||||
.js.pipe(gulp.dest("src"));
|
||||
});
|
||||
|
||||
gulp.task("test", () => {
|
||||
return gulp
|
||||
.src("test/unit/index.html")
|
||||
.pipe(mochaPhantomJS());
|
||||
|
||||
});
|
||||
|
||||
gulp.task("dist", function() {
|
||||
const tsProject = ts.createProject(
|
||||
"tsconfig.json",
|
||||
{
|
||||
outFile: "dist/ModAttachr.js",
|
||||
removeComments: true
|
||||
});
|
||||
|
||||
const tsResult = tsProject
|
||||
.src()
|
||||
.pipe(ts(tsProject));
|
||||
|
||||
return merge([
|
||||
tsResult.dts.pipe(gulp.dest("dist")),
|
||||
tsResult.js.pipe(gulp.dest("dist"))
|
||||
]);
|
||||
});
|
||||
|
||||
gulp.task("watch", ["default"], () => {
|
||||
gulp.watch("src/**/*.ts", ["default"]);
|
||||
});
|
||||
|
||||
gulp.task("default", ["tsc", "tslint", "dist"], cb => {
|
||||
runSequence(["test"], cb);
|
||||
require("gulp-shenanigans").initialize({
|
||||
dependencies: ["itemsholdr"],
|
||||
gulp: require("gulp"),
|
||||
packageName: "ModAttachr"
|
||||
});
|
||||
|
||||
+2
-12
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "modattachr",
|
||||
"description": "Hookups for extensible triggered mod events.",
|
||||
"version": "0.4.0",
|
||||
"version": "0.5.0",
|
||||
"author": {
|
||||
"name": "Josh Goldberg",
|
||||
"email": "josh@fullscreenmario.com"
|
||||
@@ -15,17 +15,7 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-mocha-phantomjs": "^0.11.0",
|
||||
"gulp-tslint": "^5.0.0",
|
||||
"gulp-typescript": "^2.13.4",
|
||||
"merge2": "^1.0.2",
|
||||
"mocha": "^2.4.5",
|
||||
"requirejs": "^2.2.0",
|
||||
"run-sequence": "^1.2.0",
|
||||
"tslint": "^3.10.2",
|
||||
"typescript": "^1.8.10"
|
||||
"gulp-shenanigans": "^0.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"itemsholdr": "^0.4.2"
|
||||
|
||||
+3
-5
@@ -1,6 +1,4 @@
|
||||
/// <reference path="../node_modules/itemsholdr/dist/ItemsHoldr.d.ts" />
|
||||
|
||||
import { IItemsHoldr } from "IItemsHoldr";
|
||||
/// <reference path="../typings/ItemsHoldr.d.ts" />
|
||||
|
||||
/**
|
||||
* General schema for a mod, including its name, events with callbacks,
|
||||
@@ -71,7 +69,7 @@ export interface IModAttachrSettings {
|
||||
/**
|
||||
* A ItemsHoldr to store mod status locally.
|
||||
*/
|
||||
ItemsHoldr?: IItemsHoldr;
|
||||
ItemsHoldr?: ItemsHoldr.IItemsHoldr;
|
||||
|
||||
/**
|
||||
* Whether there should be a ItemsHoldr created if one isn't given.
|
||||
@@ -112,7 +110,7 @@ export interface IModAttachr {
|
||||
/**
|
||||
* @returns The ItemsHoldr if storeLocally is true (by default, undefined).
|
||||
*/
|
||||
getItemsHolder(): IItemsHoldr;
|
||||
getItemsHolder(): ItemsHoldr.IItemsHoldr;
|
||||
|
||||
/**
|
||||
* @returns The default scope used to apply mods from, if not this ModAttachr.
|
||||
|
||||
+4
-6
@@ -1,7 +1,5 @@
|
||||
/// <reference path="../node_modules/itemsholdr/dist/ItemsHoldr.d.ts" />
|
||||
/// <reference path="../typings/ItemsHoldr.d.ts" />
|
||||
|
||||
import { IItemsHoldr } from "IItemsHoldr";
|
||||
import { ItemsHoldr } from "ItemsHoldr";
|
||||
import { ICallbackRegister, IEventsRegister, IEventCallback, IMod, IMods, IModAttachr, IModAttachrSettings } from "./IModAttachr";
|
||||
|
||||
/**
|
||||
@@ -21,7 +19,7 @@ export class ModAttachr implements IModAttachr {
|
||||
/**
|
||||
* A ItemsHoldr object that may be used to store mod status.
|
||||
*/
|
||||
private ItemsHolder: IItemsHoldr;
|
||||
private ItemsHolder: ItemsHoldr.IItemsHoldr;
|
||||
|
||||
/**
|
||||
* A default scope to apply mod events from, if not this ModAttachr.
|
||||
@@ -48,7 +46,7 @@ export class ModAttachr implements IModAttachr {
|
||||
this.ItemsHolder = settings.ItemsHoldr;
|
||||
} else if (settings.storeLocally) {
|
||||
// If one isn't provided by storeLocally is still true, make one
|
||||
this.ItemsHolder = new ItemsHoldr();
|
||||
this.ItemsHolder = new ItemsHoldr.ItemsHoldr();
|
||||
}
|
||||
|
||||
if (settings.mods) {
|
||||
@@ -88,7 +86,7 @@ export class ModAttachr implements IModAttachr {
|
||||
/**
|
||||
* @returns The ItemsHoldr if storeLocally is true (by default, undefined).
|
||||
*/
|
||||
public getItemsHolder(): IItemsHoldr {
|
||||
public getItemsHolder(): ItemsHoldr.IItemsHoldr {
|
||||
return this.ItemsHolder;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference path="../../node_modules/@types/chai/index.d.ts" />
|
||||
/// <reference path="../../node_modules/@types/mocha/index.d.ts" />
|
||||
/// <reference path="../../lib/ModAttachr.d.ts" />
|
||||
/// <reference path="../utils/MochaLoader.ts" />
|
||||
/// <reference path="../utils/mocks.ts" />
|
||||
|
||||
mochaLoader.addTest("_", (): void => { });
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es3",
|
||||
"declaration": false
|
||||
},
|
||||
"files": [
|
||||
"utils/mocks.ts",
|
||||
"utils/MochaLoader.ts",
|
||||
"ModAttachr/_.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
define(["mocks"], function (mocks) {
|
||||
return function () {
|
||||
var expect = require("chai").expect;
|
||||
|
||||
it("tests haven't been implemented", function () {
|
||||
// ...
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -1,18 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>EightBittr Unit Tests</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
|
||||
<script src="../../node_modules/chai/chai.js" type="text/javascript"></script>
|
||||
<script src="../../node_modules/mocha/mocha.js" type="text/javascript"></script>
|
||||
<script data-main="require" src="../../node_modules/requirejs/require.js" type="text/javascript"></script>
|
||||
|
||||
<script src="phantom.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,20 +0,0 @@
|
||||
define(["ModAttachr"], function (ModAttachrModule) {
|
||||
var ModAttachr = ModAttachrModule.ModAttachr;
|
||||
|
||||
var mocks = {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
mockItemValue: function (settings) {
|
||||
return new ItemValue(settings)
|
||||
},
|
||||
/**
|
||||
*
|
||||
*/
|
||||
mockModAttachr: function (settings) {
|
||||
return new ModAttachr(settings)
|
||||
}
|
||||
};
|
||||
|
||||
return mocks;
|
||||
});
|
||||
@@ -1 +0,0 @@
|
||||
require(["unit"]);
|
||||
@@ -1,5 +0,0 @@
|
||||
require(
|
||||
["unit"],
|
||||
function () {
|
||||
mocha.run();
|
||||
});
|
||||
@@ -1,65 +0,0 @@
|
||||
var sources = (function () {
|
||||
var config = {
|
||||
paths: {
|
||||
// Source code
|
||||
"ModAttachr": "../../src/ModAttachr",
|
||||
// FullScreenShenanigans modules
|
||||
"ItemsHoldr": "../../node_modules/itemsholdr/dist/ItemsHoldr",
|
||||
// External libraries
|
||||
"chai": "../../node_modules/chai/chai"
|
||||
}
|
||||
};
|
||||
|
||||
requirejs.config(config);
|
||||
|
||||
return Object.keys(config.paths).concat("mocks");
|
||||
})();
|
||||
|
||||
var tests = {
|
||||
"ModAttachr": [
|
||||
"_"
|
||||
]
|
||||
};
|
||||
|
||||
require(sources, function () {
|
||||
var classTests = {};
|
||||
var requiredTests = 0;
|
||||
var loadedTests = 0;
|
||||
|
||||
var runTests = function () {
|
||||
mocha.setup("bdd");
|
||||
|
||||
for (var className in classTests) {
|
||||
describe(className, function () {
|
||||
for (var functionName in classTests[className]) {
|
||||
describe(functionName, classTests[className][functionName]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mocha.run();
|
||||
};
|
||||
|
||||
var generateOnTestLoad = function (className, functionName) {
|
||||
requiredTests += 1;
|
||||
|
||||
return function (functionTests) {
|
||||
classTests[className][functionName] = functionTests;
|
||||
loadedTests += 1;
|
||||
|
||||
if (loadedTests === requiredTests) {
|
||||
runTests();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var className in tests) {
|
||||
classTests[className] = {};
|
||||
|
||||
tests[className].forEach(function (functionName) {
|
||||
require(
|
||||
[className + "Tests/" + functionName],
|
||||
generateOnTestLoad(className, functionName));
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
/// <reference path="../../lib/ModAttachr.d.ts" />
|
||||
|
||||
const mocks = {
|
||||
/**
|
||||
* @param settings Settings for the ModAttachr.
|
||||
* @returns An ModAttachr instance.
|
||||
*/
|
||||
mockModAttachr: (settings?: ModAttachr.IModAttachrSettings): ModAttachr.IModAttachr => {
|
||||
return new ModAttachr.ModAttachr(settings);
|
||||
}
|
||||
};
|
||||
+3
-2
@@ -6,7 +6,8 @@
|
||||
"declaration": true,
|
||||
"outDir": "dist"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
"files": [
|
||||
"src/IModAttachr.ts",
|
||||
"src/ModAttachr.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+773
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user