Project sanity check (#76)

* tslint: CRLF -> LF

* gitignore more build artifacts

* Add proposed .editorconfig

* Allow for "clean" builds

src/ts/generated/ content is still required (sprites.ts,
gamepad-mappings.ts), but src/scripts is not.

* Add --sprites option to production build

* Add note about sprites to README
This commit is contained in:
Eliot Partridge
2019-09-06 20:32:10 -05:00
committed by GitHub
parent a761dfaa8e
commit c8472f5c65
21 changed files with 200 additions and 1099 deletions
+9
View File
@@ -1,4 +1,7 @@
/// <reference path="../../typings/my.d.ts" />
import * as fs from 'fs';
import * as path from 'path';
import { createCanvas, Image } from 'canvas';
import { ExtCanvas, Point } from './types';
@@ -167,6 +170,12 @@ export function isCanvasEmpty(canvas: ExtCanvas | undefined): boolean {
}
export function saveCanvas(filePath: string, canvas: HTMLCanvasElement) {
try {
fs.mkdirSync(path.dirname(filePath), { recursive: true });
} catch (e) {
if (e.code !== 'EEXIST') throw e;
}
fs.writeFileSync(filePath, canvas.toBuffer());
}