Build script
This commit is contained in:
parent
e62b2c3fbc
commit
8e60dcb97b
13
dist/index.js
vendored
13
dist/index.js
vendored
@ -45,10 +45,7 @@ class ImageGenerator {
|
|||||||
zip.extractAllTo(path_1.default.join(tmpDir, 'archive'));
|
zip.extractAllTo(path_1.default.join(tmpDir, 'archive'));
|
||||||
return zip.getEntries().length;
|
return zip.getEntries().length;
|
||||||
}
|
}
|
||||||
/**
|
//Test archive
|
||||||
* Temporary test method zip file
|
|
||||||
|
|
||||||
*/
|
|
||||||
testArchive(fileName, tmpDir) {
|
testArchive(fileName, tmpDir) {
|
||||||
// Check archive exists
|
// Check archive exists
|
||||||
try {
|
try {
|
||||||
@ -127,9 +124,6 @@ class ImageGenerator {
|
|||||||
if (!(0, node_fs_1.existsSync)(this.folderConfig.imgDir)) {
|
if (!(0, node_fs_1.existsSync)(this.folderConfig.imgDir)) {
|
||||||
throw Error('Output folder does not exist.');
|
throw Error('Output folder does not exist.');
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
console.error(`output dir: ${this.folderConfig.imgDir}`);
|
|
||||||
}
|
|
||||||
// Set filenames
|
// Set filenames
|
||||||
//Use the filename of the gerber zip to determine the output png filename
|
//Use the filename of the gerber zip to determine the output png filename
|
||||||
const imageName = path_1.default.basename(gerber, '.zip');
|
const imageName = path_1.default.basename(gerber, '.zip');
|
||||||
@ -161,10 +155,7 @@ class ImageGenerator {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Take an archive containing gerber files and return a stream containing
|
* Take an archive containing gerber files and return a stream containing
|
||||||
* a PNG image from the gerber
|
* a PNG image from the gerber */
|
||||||
* @param {string} gerber Path to an archive file containing gerber
|
|
||||||
* @returns {Promise.<stream.Readable>} Promise that resolves to a PNG stream
|
|
||||||
*/
|
|
||||||
gerberToStream(gerber) {
|
gerberToStream(gerber) {
|
||||||
// Check temp and output dirs exist
|
// Check temp and output dirs exist
|
||||||
if (!(0, node_fs_1.existsSync)(gerber)) {
|
if (!(0, node_fs_1.existsSync)(gerber)) {
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "types/npe_gerber.d.ts",
|
"types": "types/npe_gerber.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"build": "tsc --build",
|
||||||
"test": "NODE_ENV=test PORT=7788 jest",
|
"test": "NODE_ENV=test PORT=7788 jest",
|
||||||
"test:watch": "npm run test -- --watchAll",
|
"test:watch": "npm run test -- --watchAll",
|
||||||
"lint": "eslint ."
|
"lint": "eslint ."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user