Add new e2e command
This commit is contained in:
24
scripts/e2e.ts
Normal file
24
scripts/e2e.ts
Normal file
@ -0,0 +1,24 @@
|
||||
// tslint:disable:no-console
|
||||
import * as fs from "fs";
|
||||
import * as request from "request-promise";
|
||||
|
||||
async function e2e(filePath: string): Promise<void> {
|
||||
console.log(`Running e2e for: ${filePath}`);
|
||||
|
||||
const result = await request.post({
|
||||
url: "https://wt-9017166451e5dc00461b648d19f5e8da-0.sandbox.auth0-extend.com/docx-validator",
|
||||
formData: {
|
||||
document: fs.createReadStream(filePath),
|
||||
},
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
e2e(process.argv[2])
|
||||
.then(() => {
|
||||
console.log("Success! Document is valid");
|
||||
})
|
||||
.catch(() => {
|
||||
console.log("Error! Validation failed");
|
||||
});
|
20
scripts/types-absolute-fixer.ts
Normal file
20
scripts/types-absolute-fixer.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import * as glob from "glob";
|
||||
import * as replace from "replace-in-file";
|
||||
|
||||
const files = glob.sync("build/**/*.d.ts");
|
||||
|
||||
for (const file of files) {
|
||||
replace({
|
||||
files: file,
|
||||
from: /"file[a-z/-]*"/gi,
|
||||
to: (match) => {
|
||||
const matchSlug = match.replace(/['"]+/g, "").trim();
|
||||
const levelCount = file.split("/").length - 2;
|
||||
const backLevels = Array(levelCount)
|
||||
.fill("../")
|
||||
.join("");
|
||||
|
||||
return `"${backLevels}${matchSlug}"`;
|
||||
},
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user