-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
2,097 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
#!/usr/bin/env node | ||
|
||
/*jshint latedef:nofunc, node:true*/ | ||
|
||
// Modules | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var dependencyPath = path.join(process.cwd(), 'node_modules'); | ||
// cordova-uglify module dependencies | ||
var UglifyJS = require(path.join(dependencyPath, 'uglify-js')); | ||
var CleanCSS = require(path.join(dependencyPath, 'clean-css')); | ||
var ngAnnotate = require(path.join(dependencyPath, 'ng-annotate')); | ||
|
||
// Process | ||
var rootDir = process.argv[2]; | ||
var platformPath = path.join(rootDir, 'platforms'); | ||
var platforms = process.env.CORDOVA_PLATFORMS.split(','); | ||
var cliCommand = process.env.CORDOVA_CMDLINE; | ||
|
||
// Hook configuration | ||
var configFilePath = path.join(rootDir, 'hooks/uglify-config.json'); | ||
var hookConfig = JSON.parse(fs.readFileSync(configFilePath)); | ||
var isRelease = hookConfig.alwaysRun || (cliCommand.indexOf('--release') > -1); | ||
var recursiveFolderSearch = hookConfig.recursiveFolderSearch; // set this to false to manually indicate the folders to process | ||
var foldersToProcess = hookConfig.foldersToProcess; // add other www folders in here if needed (ex. js/controllers) | ||
var cssMinifier = new CleanCSS(hookConfig.cleanCssOptions); | ||
|
||
// Exit | ||
if (!isRelease) { | ||
return; | ||
} | ||
|
||
// Run uglifier | ||
run(); | ||
|
||
/** | ||
* Run compression for all specified platforms. | ||
* @return {undefined} | ||
*/ | ||
function run() { | ||
platforms.forEach(function(platform) { | ||
var wwwPath; | ||
|
||
switch (platform) { | ||
case 'android': | ||
wwwPath = path.join(platformPath, platform, 'assets', 'www'); | ||
break; | ||
|
||
case 'ios': | ||
case 'browser': | ||
case 'wp8': | ||
case 'windows': | ||
wwwPath = path.join(platformPath, platform, 'www'); | ||
break; | ||
|
||
default: | ||
console.log('this hook only supports android, ios, wp8, windows, and browser currently'); | ||
return; | ||
} | ||
|
||
processFolders(wwwPath); | ||
}); | ||
} | ||
|
||
/** | ||
* Processes defined folders. | ||
* @param {string} wwwPath - Path to www directory | ||
* @return {undefined} | ||
*/ | ||
function processFolders(wwwPath) { | ||
foldersToProcess.forEach(function(folder) { | ||
processFiles(path.join(wwwPath, folder)); | ||
}); | ||
} | ||
|
||
/** | ||
* Processes files in directories. | ||
* @param {string} dir - Directory path | ||
* @return {undefined} | ||
*/ | ||
function processFiles(dir) { | ||
fs.readdir(dir, function(err, list) { | ||
if (err) { | ||
console.log('processFiles err: ' + err); | ||
|
||
return; | ||
} | ||
|
||
list.forEach(function(file) { | ||
file = path.join(dir, file); | ||
|
||
fs.stat(file, function(err, stat) { | ||
if (stat.isFile()) { | ||
compress(file); | ||
|
||
return; | ||
} | ||
|
||
if (recursiveFolderSearch && stat.isDirectory()) { | ||
processFiles(file); | ||
|
||
return; | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
|
||
/** | ||
* Compresses file. | ||
* @param {string} file - File path | ||
* @return {undefined} | ||
*/ | ||
function compress(file) { | ||
var ext = path.extname(file), | ||
res, | ||
source, | ||
result; | ||
|
||
switch (ext) { | ||
case '.js': | ||
console.log('uglifying js file ' + file); | ||
|
||
res = ngAnnotate(String(fs.readFileSync(file)), { | ||
add: true | ||
}); | ||
result = UglifyJS.minify(res.src, hookConfig.uglifyJsOptions); | ||
fs.writeFileSync(file, result.code, 'utf8'); // overwrite the original unminified file | ||
break; | ||
|
||
case '.css': | ||
console.log('minifying css file ' + file); | ||
|
||
source = fs.readFileSync(file, 'utf8'); | ||
result = cssMinifier.minify(source); | ||
fs.writeFileSync(file, result.styles, 'utf8'); // overwrite the original unminified file | ||
break; | ||
|
||
default: | ||
console.log('encountered a ' + ext + ' file, not compressing it'); | ||
break; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"alwaysRun": false, | ||
"recursiveFolderSearch": true, | ||
"foldersToProcess": [ | ||
"js", | ||
"css", | ||
"img", | ||
"build" | ||
], | ||
"uglifyJsOptions": { | ||
"compress": { | ||
"drop_console": true | ||
}, | ||
"fromString": true, | ||
"mangle": false | ||
}, | ||
"cleanCssOptions": { | ||
"noAdvanced": true, | ||
"keepSpecialComments": 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "ionPOS", | ||
"app_id": "993e4936", | ||
"gulpStartupTasks": [ | ||
"sass", | ||
"watch" | ||
], | ||
"watchPatterns": [ | ||
"www/**/*", | ||
"!www/lib/**/*" | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "papaparse", | ||
"main": "papaparse.js", | ||
"homepage": "http://papaparse.com", | ||
"authors": [ | ||
"Matthew Holt" | ||
], | ||
"description": "Fast and powerful CSV parser for the browser. Converts CSV->JSON and JSON->CSV. Supports web workers and streaming large files.", | ||
"keywords": [ | ||
"csv", | ||
"parse", | ||
"parsing", | ||
"parser", | ||
"delimited", | ||
"text", | ||
"data", | ||
"auto-detect", | ||
"comma", | ||
"tab", | ||
"pipe", | ||
"file", | ||
"filereader", | ||
"stream", | ||
"worker", | ||
"workers", | ||
"ajax", | ||
"thread", | ||
"threading", | ||
"multi-threaded" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests", | ||
"player" | ||
], | ||
"version": "4.1.2", | ||
"_release": "4.1.2", | ||
"_resolution": { | ||
"type": "version", | ||
"tag": "4.1.2", | ||
"commit": "f26c8e5c58ea669e5bdee8b8363f740550552ea6" | ||
}, | ||
"_source": "https://github.com/mholt/PapaParse.git", | ||
"_target": "^4.1.2", | ||
"_originalSource": "papaparse", | ||
"_direct": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = function(grunt) { | ||
grunt.initConfig({ | ||
uglify: { | ||
options: { | ||
preserveComments: 'some', | ||
}, | ||
min: { | ||
files: { | ||
'papaparse.min.js': ['papaparse.js'] | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
|
||
grunt.registerTask('build', ['uglify']); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Matthew Holt | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
Parse CSV with JavaScript | ||
======================================== | ||
|
||
[![mholt on Gratipay](http://img.shields.io/badge/tips-accepted-brightgreen.svg?style=flat)](https://www.gratipay.com/mholt/) | ||
|
||
Papa Parse is the [fastest](http://jsperf.com/javascript-csv-parsers/4) in-browser CSV (or delimited text) parser for JavaScript. It is reliable and correct according to [RFC 4180](https://tools.ietf.org/html/rfc4180), and it comes with these features: | ||
|
||
- Easy to use | ||
- Parse CSV files directly (local or over the network) | ||
- Fast mode ([is really fast](http://jsperf.com/javascript-csv-parsers/3)) | ||
- Stream large files (even via HTTP) | ||
- Reverse parsing (converts JSON to CSV) | ||
- Auto-detect delimiter | ||
- Worker threads to keep your web page reactive | ||
- Header row support | ||
- Pause, resume, abort | ||
- Can convert numbers and booleans to their types | ||
- Optional jQuery integration to get files from `<input type="file">` elements | ||
|
||
Papa Parse has **no dependencies** - not even jQuery. | ||
|
||
|
||
Homepage & Demo | ||
---------------- | ||
|
||
- [Homepage](http://papaparse.com) | ||
- [Demo](http://papaparse.com/demo) | ||
|
||
To learn how to use Papa Parse: | ||
|
||
- [Documentation](http://papaparse.com/docs) | ||
|
||
|
||
Papa Parse for Node | ||
-------------------- | ||
|
||
[Rich Harris](https://github.com/Rich-Harris) forked this project to make **[Baby Parse](https://github.com/Rich-Harris/BabyParse)** which runs in Node.js environments. | ||
|
||
```bash | ||
$ npm install babyparse | ||
``` | ||
|
||
[Baby Parse on npm registry](https://www.npmjs.org/package/babyparse) | ||
|
||
Use it just like Papa Parse. However: | ||
|
||
- Files are not supported; strings only (you can use Node's file facilities to load file contents yourself) | ||
- Some config options are unavailable: | ||
- worker | ||
- download (you can use Node's network facilities to download files yourself) | ||
- encoding | ||
- chunk | ||
|
||
Otherwise, Baby Parse has nearly all the same functionality as Papa Parse 4.0, including the `unparse()` utility. | ||
|
||
|
||
Get Started | ||
----------- | ||
|
||
Use [papaparse.min.js](https://github.com/mholt/PapaParse/blob/master/papaparse.min.js) for production. | ||
|
||
For usage instructions, see the [homepage](http://papaparse.com) and, for more detail, the [documentation](http://papaparse.com/docs). | ||
|
||
|
||
|
||
Tests | ||
----- | ||
|
||
Papa Parse is under test. Download this repository, run `npm install`, then `npm test` to run the tests in your browser. | ||
|
||
|
||
|
||
Contributing | ||
------------ | ||
|
||
To discuss a new feature or ask a question, open an issue. To fix a bug, submit a pull request to be credited with the [contributors](https://github.com/mholt/PapaParse/graphs/contributors)! Remember, a pull request, *with test*, is best. You may also discuss on Twitter with [#PapaParse](https://twitter.com/search?q=%23PapaParse&src=typd&f=realtime) or directly to me, [@mholt6](https://twitter.com/mholt6). |
Oops, something went wrong.