Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> 0.25%
not dead
5 changes: 4 additions & 1 deletion bin/synth.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ try {
const args = getArgs(process.argv);

if (args.help || args.input === undefined) {
return console.log(fs.readFileSync(`${__dirname}/../man/help.txt`, {encoding: 'utf8'}));
console.log(fs.readFileSync(`${__dirname}/../man/help.txt`, {encoding: 'utf8'}));
process.exit();
}

if (args.verbose) {
Expand All @@ -32,6 +33,8 @@ try {
return console.log('dry run complete');
}

if (!wav) process.exit();

if (args.verbose) {
console.log('writing buffer...');
}
Expand Down
23 changes: 16 additions & 7 deletions bin/utils/args.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
'use strict';

function argumentToVerboseFlag(argument) {
const camelCase = /^[\w]|\B[A-Z]/g;
const camelCase = /^[\w]|\B[A-Z]/g;
const beginning = /^(.).*$/;

/**
* @param {string} argument
*/
function argumentToVerboseFlag(argument) {
return argument.replace(camelCase, (character, index) => `-${'-'.charAt(index)}${character.toLowerCase()}`);
}

/**
* @param {string} argument
*/
function argumentToConciseFlag(argument) {
const beginning = /^(.).*$/;

return argument.replace(beginning, (match, character) => `-${character}`);
return argument.replace(beginning, (_, character) => `-${character}`);
}

// utility function to convert
// command-line arguments to object
/**
* utility function to convert
* command-line arguments to object
* @param {Array<string>} argv
* @returns {{ help?: boolean; input?: string; verbose?: boolean; DryRun?: boolean; output?: string; }}
*/
module.exports = function getArguments(argv) {
const argumentNames = [
'input',
Expand Down
3 changes: 1 addition & 2 deletions dst/synth.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dst/synth.min.js.map

Large diffs are not rendered by default.

35 changes: 0 additions & 35 deletions gulp/tasks/browserify.js

This file was deleted.

36 changes: 35 additions & 1 deletion gulp/tasks/default.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
const config = require('../config.json');

const { pipeline } = require("stream");
const gulp = require('gulp');
const browserify = require('browserify');
const babelify = require('babelify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const uglify = require('gulp-uglify');
const sourcemaps = require('gulp-sourcemaps');
const gutil = require('gulp-util');

gulp.task('default', cb => {
// set up the browserify instance on a task basis
let b = browserify({
entries: config.paths.entry,
debug: true,
standalone: config.names.glob,
transform: [
babelify.configure({
presets: ['@babel/preset-env'],
sourceMapsAbsolute: true,
}),
],
});

gulp.task('default', ['browserify']);
return pipeline([
b.bundle(),
source(config.names.app),
buffer(),
sourcemaps.init({loadMaps: true}),
uglify()
.on('error', gutil.log),
sourcemaps.write('./'),
gulp.dest(config.paths.dest)
], cb);
});
3 changes: 3 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const WAV: typeof import("./src/wav");
export const MIDIStream: typeof import("./src/midi");
export const midiToWav: typeof import("./src/midi2wav");
Loading