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

Remove v3.0.9 from future bundles published to NPM. #1634

Merged
merged 1 commit into from
Aug 26, 2024
Merged
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
41 changes: 3 additions & 38 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ module.exports = (grunt) => {
files: ['tests/flow-headless-browser.html'],
options: {
puppeteer: {
headless: "new",
headless: 'new',
args: ['--no-sandbox', '--disable-setuid-sandbox'],
},
},
Expand Down Expand Up @@ -750,15 +750,12 @@ module.exports = (grunt) => {
verbose: 1, // See the output of each hook.
// verbose: 2, // Only for debugging.
hooks: {
'before:init': ['grunt clean', 'grunt v309:add'],
'before:init': ['grunt clean'],
'after:bump': ['grunt', 'echo Adding build/ folder...', 'git add -f build/'],
'after:npm:release': [],
'after:git:release': [],
'after:github:release': [],
'after:release': [
'grunt v309:remove',
'echo Successfully released ${name} ${version} to https://github.com/${repo.repository}',
],
'after:release': ['echo Successfully released ${name} ${version} to https://github.com/${repo.repository}'],
},
git: {
commitMessage: 'Release VexFlow ${version}',
Expand Down Expand Up @@ -827,38 +824,6 @@ module.exports = (grunt) => {
done();
});
});

// VexFlow examples on JSFiddle and other websites broke because VexFlow 4 removed these URLs:
// https://unpkg.com/vexflow/releases/vexflow-debug.js
// https://unpkg.com/vexflow/releases/vexflow-min.js
// This command restores version 3.0.9 to those locations, but adds a console.warn(...) to the JS file to alert developers
// that a new version has been released.
//
// Use this command during the release script to publish version 3.0.9 to npm alongside version 4.x.
// grunt v309:add
// grunt v309:remove
grunt.registerTask('v309', 'Include the legacy version when publishing to npm.', function (command) {
const minifiedFile = 'releases/vexflow-min.js';
const debugFile = 'releases/vexflow-debug.js';

if (command === 'add') {
// Commit ID 00ec15c67ff333ea49f4d3defbd9e22374c03684 is version 3.0.9.
const commitID = '00ec15c67ff333ea49f4d3defbd9e22374c03684';
runCommand('git', 'checkout', commitID, minifiedFile);
runCommand('git', 'checkout', commitID, debugFile);

const message =
'\nconsole.warn("Please upgrade to the newest release of VexFlow.\\n' +
'See: https://github.com/0xfe/vexflow for more information.\\nThis page uses version 3.0.9, which is no longer supported.");\n\n' +
'// YOU ARE LOOKING AT VEXFLOW LEGACY VERSION 3.0.9.\n' +
'// SEE THE `build/` FOLDER FOR THE NEWEST RELEASE.\n';
fs.appendFileSync(minifiedFile, message);
fs.appendFileSync(debugFile, message);
} else {
runCommand('git', 'rm', '-f', minifiedFile);
runCommand('git', 'rm', '-f', debugFile);
}
});
};

// Call tsc programmatically:
Expand Down
Loading