urbit-ob

JavaScript utilities for phonemic base wrangling.
Log | Files | Refs | README

commit cde37bc249602967cb54af0c5bfb294628cd6d2e
parent e229601095854134a802ab220e6501616b6af382
Author: Gavin <gvnatknsn@gmail.com>
Date:   Thu,  1 Aug 2019 10:09:09 -0700

update changelog, add browser key to package.json, clean up gulpfile

Diffstat:
MCHANGELOG | 3+++
MREADME.md | 4++++
Mgulpfile.js | 141-------------------------------------------------------------------------------
Mpackage.json | 6+++++-
4 files changed, 12 insertions(+), 142 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG @@ -1,5 +1,8 @@ # Changelog +- 4.0.2 (2019-06-17) + * Removes most of lodash, adds gulp build automation for the browser. + - 4.0.1 (2019-06-17) * Fixes a bug in isValidPat{p, q} that caused it to return 'true' for '~'. (#23) diff --git a/README.md b/README.md @@ -85,3 +85,7 @@ true A simple `npm test` will run the test suite. + +## Building + +`npm run build` will build the library for the browser. diff --git a/gulpfile.js b/gulpfile.js @@ -1,39 +1,17 @@ -/*** - - MAIN COMMANDS TO RUN: - - `gulp bundle-dev`: Bundle everything for development - `gulp bundle-prod`: Bundle everything for production - `gulp watch`: Watch files, `bundle-dev` on file change - -**/ - // A task runner that helps automate development tasks var gulp = require('gulp'); -// merges multiple css files into one css file using @import. -// var cssimport = require('gulp-cssimport'); -// Minifies CSS – removes unnessecary characters like spaces and line returns to save filesize. -// var cssnano = require('gulp-cssnano'); // A module bundler for JS which compiles small pieces of code into something larger and more complex var rollup = require('gulp-better-rollup'); // A fast, economical JS transpiler. Takes JS like ES6/7 and transforms it to JS that is consumable by a conventional JS runtime. It is like Babel but faster and less extensible. var sucrase = require('@sucrase/gulp-plugin'); // Like sucrase, this is a transpiler. It has more features. We occasionally use it because Sucrase does not support the object rest/spread language feature but babel does. // var babel = require("rollup-plugin-babel"); -// removes spaces, line returns and other unnessecary characters from .js files to reduce filesize. -// var minify = require('gulp-minify'); -// This is actually a node runtime method. Spawns a shell then executes the command within that shell, buffering any generated output -// var exec = require('child_process').exec; -// runs a hot-loading webserver -// var server = require("gulp-server-livereload"); // allows importing libraries node_modules without specifying path eg "import x from '/node_modules/react'" -> "import x from 'react'" var resolve = require('rollup-plugin-node-resolve'); // Parses commonjs-style "require" statements as imported modules. Pretty standard dependency required for most NPM-sourced dependencies var commonjs = require('rollup-plugin-commonjs'); // Replace particular strings with other things var replace = require('rollup-plugin-replace'); -// loads .json files as parsed JSON objects -// var json = require('rollup-plugin-json'); // Many modern NPM repositories are packaged for _node_ environments, // and they use _node_ standard library primitives, like // - fs @@ -51,17 +29,6 @@ var globals = require('rollup-plugin-node-globals'); var rootImport = require('rollup-plugin-root-import'); -// CSS //////////////////////////////////////////////////////////////////////// - -// gulp.task('css-bundle', function() { -// return gulp -// .src('src/css/index.css') -// .pipe(cssimport()) -// .pipe(cssnano()) -// .pipe(gulp.dest('./dist/css')); -// }); - - // JS ///////////////////////////////////////////////////////////////////////// @@ -123,111 +90,3 @@ gulp.task('default', function(cb) { .pipe(gulp.dest('./dist/')) .on('end', cb); }); - - -// makes a JS filesize smaller by removing unnessecary chars -// gulp.task('js-minify', function () { -// return gulp -// .src('./dist/js/index.js') -// .pipe(minify()) -// .pipe(gulp.dest('./dist/js/')); -// }); - - - -// gulp.task('js-cachebust', function(cb) { -// return Promise.resolve( -// exec('git log', function (err, stdout, stderr) { -// let firstLine = stdout.split("\n")[0]; -// let commitHash = firstLine.split(' ')[1].substr(0, 10); -// let newFilename = "index-" + commitHash + "-min.js"; -// exec('mv ./dist/js/index-min.js ./dist/' + newFilename); -// }) -// ); -// }) - - -// Runs a hotloading webserver for development. Serves the /dist directory. -// gulp.task("webserver", function() { -// gulp -// .src(`./dist/`).pipe( -// server({ -// livereload: true, -// open: false, -// port: 3000, -// defaultFile: "index.html" -// }) -// ); -// }); - - - -// Copies the entry HTML file for a website or webapp -// gulp.task( -// "copy-html", function() { -// return gulp -// .src('./src/index.html') -// .pipe(gulp.dest('./dist/')); -// }); - - - -// Copies the assets folder for a website or webapp with images, fonts etc -// gulp.task( -// "copy-assets", function() { -// return gulp -// .src('./src/assets') -// .pipe(gulp.dest('./dist/assets')); -// }); - - - -// transpiles and bundles JS -// gulp.task( -// 'js-bundle-dev', -// gulp.series('jsx-transform', 'js-imports') -// ); - - - -// transpiles, bundles, minifies and tags JS -// gulp.task( -// 'js-bundle-prod', -// gulp.series('jsx-transform', 'js-imports', 'js-minify', 'js-cachebust') -// ) - -// -// -// -// gulp.task('bundle-dev', -// gulp.series( -// 'copy-html', -// 'copy-assets', -// gulp.parallel( -// 'css-bundle', -// 'js-bundle-dev' -// ), -// 'webserver' -// ) -// ); -// -// -// -// gulp.task('bundle-prod', -// gulp.series( -// gulp.parallel( -// 'css-bundle', -// 'js-bundle-prod', -// ), -// ) -// ); -// -// -// -// gulp.task('default', gulp.series('bundle-dev')); -// -// -// gulp.task('watch', gulp.series('default', function() { -// gulp.watch('src/**/*.js', gulp.parallel('js-bundle-dev')); -// gulp.watch('src/**/*.css', gulp.parallel('css-bundle')); -// })); diff --git a/package.json b/package.json @@ -2,8 +2,12 @@ "name": "urbit-ob", "version": "4.0.2", "description": "Utilities for Hoon-style atom printing and conversion", - "main": "dist/index.js", + "main": "src/index.js", + "browser": { + "src/index.js": "dist/index.js" + }, "scripts": { + "build": "gulp", "test": "nyc mocha --reporter spec" }, "repository": {