Skip to content

Commit

Permalink
Merge pull request #1845 from IBMa/ctor_error
Browse files Browse the repository at this point in the history
fix(node): Resolve ace_ibma.Checker is not a constructor error
  • Loading branch information
ErickRenteria authored Feb 16, 2024
2 parents bd63bbe + 7402e6c commit 290824b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
45 changes: 32 additions & 13 deletions accessibility-checker/src-ts/lib/ACEngineManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,21 +256,40 @@ export class ACEngineManager {
if (!fs.existsSync(engineDir)) {
fs.mkdirSync(engineDir, { recursive: true });
}
let nodePath = path.join(engineDir, "ace-node")
fs.writeFile(nodePath + ".js", data, function (err) {
try {
err && console.log(err);
var ace_ibma = require(nodePath);
checker = new ace_ibma.Checker();
} catch (e) {
console.log(e);
return reject(e);
}
resolve();
});

let fileSuffix = "";
if (!config.toolVersion) {
fileSuffix = config.ruleArchiveVersion;
} else {
fileSuffix = `${config.toolVersion}-${config.ruleArchiveVersion}`
}
fileSuffix = fileSuffix.replace(/\./g, "_");

const nodePath = path.join(engineDir, `ace-node-${fileSuffix}`);
if (fs.existsSync(`${nodePath}.js`)) {
const ace_ibma = require(nodePath);
checker = new ace_ibma.Checker();
return resolve();
} else {
fs.writeFile(nodePath + ".js", data, function (err) {
if (err) {
console.log(err);
reject(err);
} else {
try {
const ace_ibma = require(nodePath);
checker = new ace_ibma.Checker();
resolve();
} catch (e) {
console.log(e);
reject(e);
}
}
});
}
});
}
return this.localLoadPromise;
return ACEngineManager.localLoadPromise;
}

static isPuppeteer(content) {
Expand Down
4 changes: 4 additions & 0 deletions rule-server/gulp/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ function maxVersion(verA, verB) {

const archivePolicies = () => {
let releaseTag = (process.env.GITHUB_REF || "").substring(10);
// If the release tag includes a /, then it's probably a PR or other Git action that's not a release
if (releaseTag.includes("/")) {
releaseTag = "9999.9999.9999";
}
// Adds the policy ids to the archive file
return gulp.src(["../src/static/archives.json"])
.pipe(modifyFile((content, path, file) => {
Expand Down

0 comments on commit 290824b

Please sign in to comment.