You've already forked gulp-shenanigans
mirror of
https://github.com/FullScreenShenanigans/gulp-shenanigans.git
synced 2026-04-28 13:03:35 -07:00
+6
-1
@@ -146,7 +146,12 @@ export const Constants = {
|
||||
/**
|
||||
* Location of all test code.
|
||||
*/
|
||||
test: "test"
|
||||
test: "test",
|
||||
|
||||
/**
|
||||
* Location of TypeScript typings.
|
||||
*/
|
||||
typings: "typings"
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,5 +6,7 @@ test/**/*.js
|
||||
test/index.html
|
||||
test/utils/**
|
||||
!test/utils/mocks.ts
|
||||
typings/**
|
||||
!typings/.gitignore
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
|
||||
+8
-5
@@ -6,11 +6,14 @@ import { IGulpSettings } from "../definitions";
|
||||
export default function (settings: IGulpSettings, callback: Function): void {
|
||||
"use strict";
|
||||
|
||||
const tasks: string[] = [
|
||||
"setup:clean",
|
||||
"setup:copy",
|
||||
"setup:package"
|
||||
const tasks: string[][] = [
|
||||
["setup:clean"],
|
||||
[
|
||||
"setup:copy",
|
||||
"setup:package",
|
||||
"setup:typings"
|
||||
]
|
||||
];
|
||||
|
||||
require("run-sequence").use(settings.gulp)(tasks, callback);
|
||||
require("run-sequence").use(settings.gulp)(...tasks, callback);
|
||||
}
|
||||
|
||||
@@ -2,13 +2,14 @@ const del: any = require("del");
|
||||
import { Constants } from "../../definitions";
|
||||
|
||||
/**
|
||||
* Deletes all built files.
|
||||
* Deletes all generated files.
|
||||
*/
|
||||
export default function (): any {
|
||||
"use strict";
|
||||
|
||||
return del([
|
||||
`${Constants.folders.lib}/**/*`,
|
||||
`${Constants.folders.src}/**/*.js`
|
||||
`${Constants.folders.src}/**/*.js`,
|
||||
`${Constants.folders.typings}/**/*`
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { IGulpSettings } from "../../definitions";
|
||||
/**
|
||||
* Deletes all built files.
|
||||
*/
|
||||
export default function taskClean(settings: IGulpSettings): any {
|
||||
export default function (settings: IGulpSettings): any {
|
||||
"use strict";
|
||||
|
||||
return settings.gulp
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
const fs: any = require("fs");
|
||||
import { Constants, IExternal, IGulpSettings } from "../../definitions";
|
||||
|
||||
/**
|
||||
* Collects required typings files for a shenanigans project.
|
||||
*
|
||||
* @param settings Settings for a shenanigans project.
|
||||
* @returns Required typings file names, keyed to their location.
|
||||
*/
|
||||
function collectTypingsFiles(settings: IGulpSettings): { [i: string]: string } {
|
||||
"use strict";
|
||||
|
||||
const files: { [i: string]: string } = {};
|
||||
|
||||
for (const dependency of Object.keys(settings.dependencies)) {
|
||||
files[dependency] = `node_modules/${dependency}/lib/${dependency}.d.ts`;
|
||||
}
|
||||
|
||||
for (const i in settings.externals) {
|
||||
if (!settings.externals.hasOwnProperty(i)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const external: IExternal = settings.externals[i];
|
||||
files[external.typing] = `node_modules/@types/${external.typing}/index.d.ts`;
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies typings files into the typings directory.
|
||||
*/
|
||||
export default function (settings: IGulpSettings): any {
|
||||
"use strict";
|
||||
|
||||
const files: { [i: string]: string } = collectTypingsFiles(settings);
|
||||
|
||||
for (const file of Object.keys(files)) {
|
||||
fs.createReadStream(files[file])
|
||||
.pipe(fs.createWriteStream(`${Constants.folders.typings}/${file}.d.ts`));
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
"src/tasks/setup/clean.ts",
|
||||
"src/tasks/setup/copy.ts",
|
||||
"src/tasks/setup/package.ts",
|
||||
"src/tasks/setup/typings.ts",
|
||||
"src/tasks/src/tsc.ts",
|
||||
"src/tasks/src/tslint.ts",
|
||||
"src/tasks/test/run.ts",
|
||||
|
||||
Reference in New Issue
Block a user