Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node): Resolve ace_ibma.Checker is not a constructor error #1845

Merged
merged 8 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading