├── .gitignore ├── package.json ├── LICENSE ├── bin.js └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | sheetsee.js 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sheetsee", 3 | "version": "0.1.0", 4 | "description": "module for building out custom sheetsee.js instances", 5 | "main": "bin.js", 6 | "bin": { 7 | "sheetsee": "bin.js" 8 | }, 9 | "scripts": { 10 | "test": "standard" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/jlord/sheetsee.git" 15 | }, 16 | "author": { 17 | "name": "Jessica Lord" 18 | }, 19 | "license": "BSD-2-Clause", 20 | "bugs": { 21 | "url": "https://github.com/jlord/sheetsee/issues" 22 | }, 23 | "keywords": [ 24 | "spreadsheet", 25 | "data", 26 | "google spreadsheet" 27 | ], 28 | "dependencies": { 29 | "browserify": "^2.35.4", 30 | "lodash.assign": "^2.1.0", 31 | "sheetsee-core": "^0.1.1", 32 | "sheetsee-maps": "^1.0.0", 33 | "sheetsee-tables": "^0.2.0", 34 | "through": "^2.3.8" 35 | }, 36 | "devDependencies": { 37 | "standard": "^8.6.0" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Jessica Lord 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, this 11 | list of conditions and the following disclaimer in the documentation and/or 12 | other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var modules = process.argv.slice(2) 4 | var browserify = require('browserify') 5 | var through = require('through') 6 | var fs = require('fs') 7 | var path = require('path') 8 | 9 | makeBuildInstructions(modules, includeModules) 10 | 11 | function makeBuildInstructions (modules, cb) { 12 | getWantedModules(modules, cb) 13 | } 14 | 15 | function getWantedModules (modules, cb) { 16 | var npmModules = [] 17 | var writeFile = false 18 | if (modules === '') console.log('Please include modules -maps/-m or -tables/-t') 19 | modules.forEach(function whichModules (module) { 20 | if (module === '-m' || module === '-maps') return npmModules.push('sheetsee-maps') 21 | if (module === '-t' || module === '-tables') return npmModules.push('sheetsee-tables') 22 | if (module === '--save') { 23 | writeFile = true 24 | return 25 | } 26 | console.error(module + ' does not exist, please use -maps/-m or -tables/-t') 27 | }) 28 | cb(npmModules, writeFile) 29 | } 30 | 31 | function includeModules (npmModules, writeFile) { 32 | if (npmModules.length === 0) return console.error('Aborted build, no modules required') 33 | var extendString = "if (typeof window.Sheetsee === 'undefined') window.Sheetsee = {};" + 34 | " window.Sheetsee = require('sheetsee-core'); var extend = require('lodash.assign'); extend(window.Sheetsee, " 35 | var counter = npmModules.length 36 | npmModules.forEach(function addModules (module) { 37 | counter-- 38 | if (counter !== 0) extendString = extendString + "require('" + module + "'), " 39 | if (counter === 0) extendString = extendString + "require('" + module + "')); module.exports = Sheetsee;" 40 | }) 41 | runBuild(extendString, writeFile) 42 | } 43 | 44 | function runBuild (extendString, writeFile) { 45 | var dataStream = through() 46 | var origDir = process.cwd() 47 | process.chdir(__dirname) 48 | var b = browserify() 49 | b.files.push(dataStream) 50 | if (writeFile) { 51 | var output = path.join(origDir, 'sheetsee.js') 52 | b.bundle().pipe(fs.createWriteStream(output)) 53 | } else b.bundle().pipe(process.stdout) 54 | dataStream.queue(extendString) 55 | dataStream.queue(null) 56 | process.chdir(origDir) 57 | } 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Standard - JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 2 | 3 | # Sheetsee 4 | 5 | **A Node.js command line tool for creating a custom build of the [sheetsee.js](http://jlord.github.io/sheetsee.js) library with just the components you want.** :sparkles: 6 | 7 | If you want to just use the full version, you can grab it here at [github.com/jlord/sheetsee.js](https://github.com/jlord/sheetsee.js/blob/master/js/sheetsee.js). 8 | 9 | All bundles comes with [mapbox.js](https://www.mapbox.com) and [mustache.js](https://mustache.github.io) (since both are available on [NPM](http://www.npmjs.org)). Additionally, you'll need to also include [tabletop.js](https://github.com/jsoma/tabletop) in your HTML head like so: 10 | 11 | ```HTML 12 | 13 | ``` 14 | 15 | **To build your Sheetsee you'll need [Node.js](http://www.nodejs.org) and [npm](http://www.npmjs.org) (the latter comes with the former) on your computer.** 16 | 17 | #### Get Node/NPM 18 | 19 | Download Node.js from [nodejs.org/download](http://nodejs.org/download). For most users you can just download the Mac _.pkg_ or Windows _.msi_. Follow the install instructions, both include NPM. Once they're installed, proceed: 20 | 21 | ## To Use 22 | 23 | Install `sheetsee` globally and then run it within the folder of your soon-to-be sheetsee.js project. 24 | 25 | _Install globally_ 26 | 27 | ```bash 28 | npm install -g sheetsee 29 | ``` 30 | 31 | _Run from within a project folder_ 32 | 33 | ```bash 34 | # go into your project's directory 35 | cd my-cool-project 36 | # build sheetsee 37 | sheetsee [options] 38 | ``` 39 | 40 | ### Options 41 | 42 | Here are the options for the different modules and an option for saving the file (as `sheetsee.js`). 43 | 44 | - `-m` or `-maps` for maps 45 | - `-t` or `-tables` for tables 46 | - `--save` to write out the file* 47 | 48 | _* otherwise, defaults to standardout on your console which you can_ `| pbcopy` 49 | 50 | So for instance, `sheetsee -m -t --save` will build you a Sheetsee.js with the basic **data** functions that are included by default, the **map** and **table** sections and save it as a file named `sheetsee.js`. Running `sheetsee -m -t | pbcopy` will save the same output to your clipboard. 51 | --------------------------------------------------------------------------------