Skip to content

Commit

Permalink
Clean up Gruntfile.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
ronyeh committed Jun 29, 2021
1 parent 1050376 commit 26207af
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,18 @@ module.exports = (grunt) => {
],
},
plugins: [
// Add VERSION and BUILD properties to both Vex.Flow and Vex.Flow.Test.
new InjectPlugin(function () {
// Both Vex.Flow and Vex.Flow.Test will have the VERSION and BUILD properties.
const im =
moduleEntry === MODULE_ENTRY_SRC
? `import { Vex } from './src/vex';\n`
: `import { VexFlowTests } from './tests/vexflow_test_helpers';\n`;
const vf = moduleEntry === MODULE_ENTRY_SRC ? 'Vex.Flow' : 'Vex.Flow.Test';
return (
im +
`${vf}.VERSION = ${JSON.stringify(packageJSON.version)};\n` +
`${vf}.BUILD = ${JSON.stringify(GIT_COMMIT_HASH)};`
);
const isVexSRC = moduleEntry === MODULE_ENTRY_SRC;
const importVex = isVexSRC
? `import { Vex } from './src/vex';`
: `import { VexFlowTests } from './tests/vexflow_test_helpers';`;
const vf = isVexSRC ? 'Vex.Flow' : 'Vex.Flow.Test';
return `${importVex}
${vf}.VERSION = "${packageJSON.version}";
${vf}.BUILD = "${GIT_COMMIT_HASH}";`;
}),
// Add a banner at the top of the file.
new webpack.BannerPlugin(BANNER),
],
};
Expand Down

0 comments on commit 26207af

Please sign in to comment.