diff --git a/accessibility-checker/src-ts/lib/ACEngineManager.ts b/accessibility-checker/src-ts/lib/ACEngineManager.ts index 250007207..6829625f5 100644 --- a/accessibility-checker/src-ts/lib/ACEngineManager.ts +++ b/accessibility-checker/src-ts/lib/ACEngineManager.ts @@ -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) { diff --git a/rule-server/gulp/gulpfile.js b/rule-server/gulp/gulpfile.js index 37e7a511e..ecfcc615f 100644 --- a/rule-server/gulp/gulpfile.js +++ b/rule-server/gulp/gulpfile.js @@ -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) => {