Skip to content

Commit

Permalink
Fix bug with import which breaks the ESM build.
Browse files Browse the repository at this point in the history
GOOD:
import { Dot } from '../src/dot';

BAD / BREAKS ESM BUILD:
import { Dot } from '../src';
  • Loading branch information
ronyeh committed Jan 9, 2022
1 parent 71847bf commit b754829
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
36 changes: 19 additions & 17 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,46 +442,43 @@ module.exports = (grunt) => {
});

// grunt watch
// Watch for changes and build all targets.
// grunt watch runs many tasks in parallel, so increase the limit (default: 10) to avoid warnings about memory leaks.
EventEmitter.defaultMaxListeners = 20;
grunt.config.set('watch', {
scripts: {
files: ['src/**', 'entry/**', 'tests/**', '!src/version.ts', '!node_modules/**', '!build/**'],
options: {
atBegin: true,
spawn: true,
spawn: false,
interrupt: true,
debounceDelay: 700,
},
tasks: [
'clean:build',
'eslint', // skip this because it slows down the watch task substantially.
'concurrent:all',
],
tasks: ['clean:build', 'eslint', 'concurrent:all'],
},
});

// grunt watch:debug
// Watch for changes and build debug CJS files & esm/*.
grunt.registerTask('watch:debug', '', () => {
// REPLACE THE DEFAULT WATCH TASKS.
grunt.config.set('watch.scripts.tasks', [
'clean:build',
'eslint', // skip this because it slows down the watch task substantially.
'concurrent:debug',
]);
grunt.config.set('watch.scripts.tasks', ['clean:build', 'eslint', 'concurrent:debug']);
runTask('watch');
});

// grunt watch:production
// Watch for changes and build production CJS files & esm/*.
grunt.registerTask('watch:production', '', () => {
// REPLACE THE DEFAULT WATCH TASKS.
grunt.config.set('watch.scripts.tasks', [
'clean:build',
'eslint', // skip this because it slows down the watch task substantially.
'concurrent:production',
]);
grunt.config.set('watch.scripts.tasks', ['clean:build', 'eslint', 'concurrent:production']);
runTask('watch');
});

// grunt watch:esm
// Watch for changes and build esm/*.
grunt.registerTask('watch:esm', '', () => {
// REPLACE THE DEFAULT WATCH TASKS.
grunt.config.set('watch.scripts.tasks', ['clean:build', 'eslint', 'build:esm']);
runTask('watch');
});

Expand Down Expand Up @@ -533,11 +530,13 @@ module.exports = (grunt) => {
'copy:reference',
]);

// grunt generate:current
// node ./tools/generate_images.js build ./build/images/current ${VEX_GENERATE_OPTIONS}
grunt.registerTask('generate:current', 'Create images from the vexflow version in build/.', () => {
runCommand('node', './tools/generate_images.js', 'build', './build/images/current', ...GENERATE_IMAGES_ARGS);
});

// grunt generate:reference
// node ./tools/generate_images.js reference ./build/images/reference ${VEX_GENERATE_OPTIONS}
grunt.registerTask('generate:reference', 'Create images from vexflow version in reference/.', () => {
runCommand('node', './tools/generate_images.js', 'reference', './build/images/reference', ...GENERATE_IMAGES_ARGS);
Expand Down Expand Up @@ -589,11 +588,13 @@ module.exports = (grunt) => {
});

// grunt get:releases:3.0.9:4.0.0 => node ./tools/get_releases.mjs 3.0.9 4.0.0
// Note: the arguments are separated by colons!
grunt.registerTask('get:releases', '', () => {
runCommand('node', './tools/get_releases.mjs', ...grunt.task.current.args);
});

// grunt release
// Release to npm and GitHub.
grunt.registerTask('release', '', () => {
runCommand('npx', 'release-it');
});
Expand All @@ -613,7 +614,8 @@ module.exports = (grunt) => {
runCommand('npx', 'release-it', '--preRelease=rc');
});

// grunt release:alpha
// grunt release:dry-run
// Walk through the release process without actually doing anything.
grunt.registerTask('release:dry-run', '', () => {
runCommand('npx', 'release-it', '--dry-run');
});
Expand Down
4 changes: 2 additions & 2 deletions src/version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const VERSION: string = '4.0.0';
export const ID: string = 'ca983b586280e6e73b6b25fdb111c4bd8d6ac55a';
export const DATE: string = '2022-01-09T10:56:42.986Z';
export const ID: string = '71847bf8f9d4f7e279961c2fae499f2b0f076022';
export const DATE: string = '2022-01-09T11:22:27.041Z';
2 changes: 1 addition & 1 deletion tests/stavenote_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Dot } from '../src';
import { Accidental } from '../src/accidental';
import { Annotation } from '../src/annotation';
import { Articulation } from '../src/articulation';
import { Beam } from '../src/beam';
import { Dot } from '../src/dot';
import { Flow } from '../src/flow';
import { Formatter } from '../src/formatter';
import { Fraction } from '../src/fraction';
Expand Down
2 changes: 1 addition & 1 deletion tests/tabnote_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Dot } from '../src';
import { Dot } from '../src/dot';
import { Flow } from '../src/flow';
import { Font, FontWeight } from '../src/font';
import { Formatter } from '../src/formatter';
Expand Down

0 comments on commit b754829

Please sign in to comment.