Skip to content

Commit

Permalink
Merge pull request #1441 from ronyeh/release-it
Browse files Browse the repository at this point in the history
Remove patch for release-it
  • Loading branch information
rvilarl authored Sep 27, 2022
2 parents bded017 + 85ede87 commit f67c1ac
Show file tree
Hide file tree
Showing 4 changed files with 3,267 additions and 2,231 deletions.
53 changes: 22 additions & 31 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,8 @@ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const open = require('opener');
const concurrently = require('concurrently');

// There is a bug in one of our dependencies. See: https://github.com/release-it/release-it/issues/864
// vexflow
// └─┬ [email protected] github.com/release-it/release-it
// └─┬ [email protected] github.com/IonicaBizau/git-url-parse
// └─┬ [email protected] github.com/IonicaBizau/git-up
// └─┬ [email protected] github.com/IonicaBizau/parse-url
// └── [email protected] github.com/IonicaBizau/parse-path <<< The bug is here!!!
// Our fix has already been merged into the parse-path repo, but we need to wait for 5 projects to be updated on npm
// for the fix to be available to us. In the meantime, we check if the bug is present, and apply a patch if necessary.
let parsePath = require('parse-path');
if (parsePath('[email protected]:0xfe/vexflow.git').pathname === '/vexflow.git') {
// The .pathname should be '/0xfe/vexflow.git' instead, but the buggy version of parse-path thinks :0xfe is a port number.
// See: https://github.com/IonicaBizau/parse-path/pull/32
runCommand('npx', 'patch-package');
delete require.cache[require.resolve('parse-path')];
parsePath = require('parse-path');
}
// We require() the release-it package AFTER patching parse-path.
const release = require('release-it');
// release-it can only be dynamically imported.
const releaseItDynamicImport = import('release-it');

// A module entry file `entry/xxxx.ts` will be mapped to a build output file in build/cjs/ or /build/esm/entry/.
// Also see the package.json `exports` field, which is one way for projects to specify which entry file to import.
Expand Down Expand Up @@ -348,7 +331,13 @@ function webpackConfigs() {
const WATCH = true;

function prodConfig(watch = false) {
return getConfig([VEX, VEX_BRAVURA, VEX_GONVILLE, VEX_LELAND, VEX_PETALUMA, VEX_CORE], PRODUCTION_MODE, BANNER, 'Vex', watch);
return getConfig(
[VEX, VEX_BRAVURA, VEX_GONVILLE, VEX_LELAND, VEX_PETALUMA, VEX_CORE],
PRODUCTION_MODE,
BANNER,
'Vex',
watch
);
}

// The font modules need to have different webpack configs because they have a different
Expand Down Expand Up @@ -824,17 +813,19 @@ module.exports = (grunt) => {
}
});

release(options).then((output) => {
try {
log('Removing build/ folder...');
execSync('git rm -rf build/', { stdio: 'pipe' }); // { stdio: 'pipe' } hides the output.
execSync(`git commit -m 'Remove build/ after releasing version ${output.version} to npm and GitHub.'`);
runCommand('git', 'push');
} catch (e) {
// If the build/ folder was not added/checked in, we do nothing.
}
done();
});
releaseItDynamicImport
.then((releaseIt) => releaseIt(options))
.then((output) => {
try {
log('Removing build/ folder...');
execSync('git rm -rf build/', { stdio: 'pipe' }); // { stdio: 'pipe' } hides the output.
execSync(`git commit -m 'Remove build/ after releasing version ${output.version} to npm and GitHub.'`);
runCommand('git', 'push');
} catch (e) {
// If the build/ folder was not added/checked in, we do nothing.
}
done();
});
});

// VexFlow examples on JSFiddle and other websites broke because VexFlow 4 removed these URLs:
Expand Down
Loading

0 comments on commit f67c1ac

Please sign in to comment.