checkPlugin: Compare entire file

This commit is contained in:
Richard Hansen 2021-06-14 19:54:37 -04:00
parent f0669a8d31
commit 51c530a3a0
3 changed files with 1 additions and 10 deletions

View file

@ -107,16 +107,13 @@ const prepareRepo = () => {
const checkFile = (srcFn, dstFn) => {
const outFn = path.join(pluginPath, dstFn);
const verRegEx = /^##ETHERPAD_NPM_V=(\d+)$/;
const wantContents = fs.readFileSync(srcFn, {encoding: 'utf8'});
const [, wantVer] = verRegEx.exec(wantContents) || [];
let gotContents = null;
try {
gotContents = fs.readFileSync(outFn, {encoding: 'utf8'});
} catch (err) { /* treat as if the file doesn't exist */ }
const [, gotVer] = verRegEx.exec(gotContents || '') || [];
try {
assert.equal(gotVer, wantVer);
assert.equal(gotContents, wantContents);
} catch (err) {
console.warn(`File ${dstFn} is out of date`);
console.warn(err.message);

View file

@ -59,6 +59,3 @@ jobs:
- name: Run the backend tests
run: cd src && npm test
# Automatically generated by src/bin/plugins/checkPlugin.js
##ETHERPAD_NPM_V=3

View file

@ -85,6 +85,3 @@ jobs:
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
# Automatically generated by src/bin/plugins/checkPlugin.js
##ETHERPAD_NPM_V=3