Skip to content

Commit a6cf756

Browse files
committed
☕ Fresh cup of open source 🅿️
0 parents  commit a6cf756

File tree

92 files changed

+17030
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+17030
-0
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
coverage
2+
dist
3+
lib
4+
node_modules
5+
test_output
6+
*~
7+
.DS_Store

.travis.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
language: node_js
3+
node_js:
4+
- 'iojs'
5+
6+
branches:
7+
only:
8+
- master
9+
10+
after_script: cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage

CONTRIBUTING.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Contributing to the Parse JavaScript SDK
2+
We want to make contributing to this project as easy and transparent as possible.
3+
4+
If you're looking to get started, but want to ease yourself into the codebase, look for issues tagged [good first bug](https://github.com/ParsePlatform/Parse-SDK-JS/labels/good%20first%20bug). These are simple yet valuable tasks that should be easy to get started.
5+
6+
## Pull Requests
7+
We actively welcome your pull requests.
8+
9+
1. Fork the repo and create your branch from `master`.
10+
2. If you've added code that should be tested, add tests
11+
3. If you've changed APIs, update the documentation.
12+
4. Ensure the test suite passes.
13+
5. Make sure your code lints.
14+
6. If you haven't already, complete the Contributor License Agreement ("CLA").
15+
16+
## Contributor License Agreement ("CLA")
17+
In order to accept your pull request, we need you to submit a CLA. You only need to do this once to work on any of Facebook's open source projects.
18+
19+
Complete your CLA here: <https://developers.facebook.com/opensource/cla>
20+
21+
## Issues
22+
We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue.
23+
24+
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. In those cases, please go through the process outlined on that page and do not file a public issue.
25+
26+
## Coding Style
27+
* Most importantly, match the existing code style as much as possible.
28+
* We use [Flow](http://flowtype.org/) and ES6 for this codebase. Use modern syntax whenever possible.
29+
* Keep lines within 80 characters.
30+
* Always end lines with semicolons.
31+
32+
## License
33+
By contributing to the Parse JavaScript SDK, you agree that your contributions will be licensed under its license.
34+
35+
## Code of Conduct
36+
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated.

LICENSE

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
BSD License
2+
3+
For Parse JavaScript SDK software
4+
5+
Copyright (c) 2015-present, Parse, LLC. All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without modification,
8+
are permitted provided that the following conditions are met:
9+
10+
* Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
12+
13+
* Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
16+
17+
* Neither the name Parse nor the names of its contributors may be used to
18+
endorse or promote products derived from this software without specific
19+
prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PATENTS

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Additional Grant of Patent Rights Version 2
2+
3+
"Software" means the Parse JavaScript SDK software distributed by Parse, LLC.
4+
5+
Parse, LLC. ("Parse") hereby grants to each recipient of the Software
6+
("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
7+
(subject to the termination provision below) license under any Necessary
8+
Claims, to make, have made, use, sell, offer to sell, import, and otherwise
9+
transfer the Software. For avoidance of doubt, no license is granted under
10+
Parse’s rights in any patent claims that are infringed by (i) modifications
11+
to the Software made by you or any third party or (ii) the Software in
12+
combination with any software or other technology.
13+
14+
The license granted hereunder will terminate, automatically and without notice,
15+
if you (or any of your subsidiaries, corporate affiliates or agents) initiate
16+
directly or indirectly, or take a direct financial interest in, any Patent
17+
Assertion: (i) against Parse or any of its subsidiaries or corporate
18+
affiliates, (ii) against any party if such Patent Assertion arises in whole or
19+
in part from any software, technology, product or service of Parse or any of
20+
its subsidiaries or corporate affiliates, or (iii) against any party relating
21+
to the Software. Notwithstanding the foregoing, if Parse or any of its
22+
subsidiaries or corporate affiliates files a lawsuit alleging patent
23+
infringement against you in the first instance, and you respond by filing a
24+
patent infringement counterclaim in that lawsuit against that party that is
25+
unrelated to the Software, the license granted hereunder will not terminate
26+
under section (i) of this paragraph due to such counterclaim.
27+
28+
A "Necessary Claim" is a claim of a patent owned by Parse that is
29+
necessarily infringed by the Software standing alone.
30+
31+
A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
32+
or contributory infringement or inducement to infringe any patent, including a
33+
cross-claim or counterclaim.

README.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Parse SDK for JavaScript
2+
[![Build Status][build-status-svg]][build-status-link]
3+
[![Test Coverage][coverage-status-svg]][coverage-status-link]
4+
[![Npm Version][npm-svg]][npm-link]
5+
[![License][license-svg]][license-link]
6+
7+
A library that gives you access to the powerful Parse cloud platform from your JavaScript app. For more information on Parse and its features, see [the website](https://parse.com) or [the JavaScript guide](https://parse.com/docs/js/guide).
8+
9+
## Getting Started
10+
11+
The SDK is available for download [on our website](https://parse.com/downloads) or [on our CDN](http://www.parsecdn.com/js/parse-latest.js). However, the easiest way to integrate it into your JavaScript project is through the [npm module](https://npmjs.org/parse).
12+
13+
### Using Parse on Different Platforms
14+
15+
The JavaScript ecosystem is wide and incorporates a large number of platforms and execution environments. To handle this, the Parse npm module contains special versions of the SDK tailored to use in Node.js and [React Native](https://facebook.github.io/react-native/) environments. Not all features make sense in all environments, so using the appropriate package will ensure that items like local storage, user sessions, and HTTP requests use appropriate dependencies.
16+
17+
To use the npm modules for a browser based application, include it as you normally would:
18+
19+
```js
20+
var Parse = require('parse');
21+
```
22+
23+
For server-side applications or Node.js command line tools, include `'parse/node'`:
24+
25+
```js
26+
// In a node.js environment
27+
var Parse = require('parse/node');
28+
```
29+
30+
For React Native applications, include `'parse/react-native'`:
31+
```js
32+
// In a React Native application
33+
var Parse = require('parse/react-native');
34+
```
35+
36+
## License
37+
38+
```
39+
Copyright (c) 2015-present, Parse, LLC.
40+
All rights reserved.
41+
42+
This source code is licensed under the BSD-style license found in the
43+
LICENSE file in the root directory of this source tree. An additional grant
44+
of patent rights can be found in the PATENTS file in the same directory.
45+
```
46+
47+
[build-status-svg]: https://travis-ci.org/ParsePlatform/Parse-SDK-JS.svg?branch=master
48+
[build-status-link]: https://travis-ci.org/ParsePlatform/Parse-SDK-JS
49+
[coverage-status-svg]: https://coveralls.io/repos/ParsePlatform/Parse-SDK-JS/badge.svg?branch=master&service=github
50+
[coverage-status-link]: https://coveralls.io/github/ParsePlatform/Parse-SDK-JS?branch=master
51+
[npm-svg]: https://badge.fury.io/js/parse-react.svg
52+
[npm-link]: https://npmjs.org/parse
53+
[license-svg]: https://img.shields.io/badge/license-BSD-lightgrey.svg
54+
[license-link]: https://github.com/ParsePlatform/Parse-SDK-JS/blob/master/LICENSE

build_releases.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
SDK_VERSION=$(cat package.json | sed -n -e '/version/ s/.*: *"\([^"]*\).*/\1/p')
4+
echo "Building JavaScript SDK v$SDK_VERSION...\n"
5+
6+
echo "Cleaning up old builds...\n"
7+
rm -rf dist lib
8+
9+
echo "Browser Release:"
10+
PARSE_BUILD=browser gulp compile
11+
echo "Node.js Release:"
12+
PARSE_BUILD=node gulp compile
13+
echo "React Native Release:"
14+
PARSE_BUILD=react-native gulp compile
15+
echo "Bundling and minifying for CDN distribution:"
16+
gulp browserify
17+
gulp minify

gulpfile.js

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
var babel = require('gulp-babel');
2+
var browserify = require('browserify');
3+
var derequire = require('gulp-derequire');
4+
var gulp = require('gulp');
5+
var insert = require('gulp-insert');
6+
var path = require('path');
7+
var rename = require('gulp-rename');
8+
var replace = require('gulp-replace');
9+
var source = require('vinyl-source-stream');
10+
var uglify = require('gulp-uglify');
11+
12+
var BUILD = process.env.PARSE_BUILD || 'browser';
13+
var VERSION = require('./package.json').version;
14+
15+
var DEV_HEADER = (
16+
'/**\n' +
17+
' * Parse JavaScript SDK v' + VERSION + '\n' +
18+
' */\n'
19+
);
20+
21+
var FULL_HEADER = (
22+
'/**\n' +
23+
' * Parse JavaScript SDK v' + VERSION + '\n' +
24+
' *\n' +
25+
' * Copyright (c) 2015-present, Parse, LLC.\n' +
26+
' * All rights reserved.\n' +
27+
' *\n' +
28+
' * This source code is licensed under the BSD-style license found in the\n' +
29+
' * LICENSE file in the root directory of this source tree. An additional grant\n' +
30+
' * of patent rights can be found in the PATENTS file in the same directory.\n' +
31+
' */\n'
32+
);
33+
34+
gulp.task('compile', function() {
35+
var packageJSON = {
36+
version: VERSION
37+
};
38+
return gulp.src('src/*.js')
39+
.pipe(babel({
40+
experimental: true,
41+
optional: [
42+
'runtime',
43+
'utility.inlineEnvironmentVariables'
44+
],
45+
plugins: [require('./vendor/babel-plugin-dead-code-elimination')],
46+
}))
47+
.pipe(replace(/require\('\.\.\/package\.json'\)/g, JSON.stringify(packageJSON)))
48+
.pipe(gulp.dest(path.join('lib', BUILD)));
49+
});
50+
51+
gulp.task('browserify', function() {
52+
var stream = browserify({
53+
builtins: { _process: true },
54+
entries: 'lib/browser/Parse.js',
55+
standalone: 'Parse'
56+
})
57+
.exclude('xmlhttprequest')
58+
.ignore('_process')
59+
.bundle();
60+
61+
return stream.pipe(source('parse-latest.js'))
62+
.pipe(derequire())
63+
.pipe(insert.prepend(DEV_HEADER))
64+
.pipe(gulp.dest('./dist'));
65+
});
66+
67+
gulp.task('minify', function() {
68+
return gulp.src('dist/parse-latest.js')
69+
.pipe(uglify())
70+
.pipe(insert.prepend(FULL_HEADER))
71+
.pipe(rename({ extname: '.min.js' }))
72+
.pipe(gulp.dest('./dist'))
73+
});

index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./lib/browser/Parse.js');

node.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./lib/node/Parse.js');

package.json

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"name": "parse",
3+
"version": "1.6.3",
4+
"description": "The Parse JavaScript SDK",
5+
"homepage": "https://www.parse.com",
6+
"keywords": [
7+
"cloud",
8+
"mobile",
9+
"api"
10+
],
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/ParsePlatform/Parse-SDK-JS"
14+
},
15+
"bugs": "https://github.com/ParsePlatform/Parse-SDK-JS/issues",
16+
"files": [
17+
"index.js",
18+
"node.js",
19+
"react-native.js",
20+
"lib/",
21+
"LICENSE",
22+
"README.md"
23+
],
24+
"browser": {
25+
"react-native": false
26+
},
27+
"dependencies": {
28+
"babel-runtime": "^5.8.20",
29+
"xmlhttprequest": "^1.7.0"
30+
},
31+
"devDependencies": {
32+
"babel-jest": "~5.3.0",
33+
"babel-plugin-flow-comments": "^1.0.9",
34+
"browserify": "^11.0.1",
35+
"coveralls": "^2.11.3",
36+
"gulp": "^3.9.0",
37+
"gulp-babel": "^5.2.0",
38+
"gulp-derequire": "^2.1.0",
39+
"gulp-insert": "^0.5.0",
40+
"gulp-rename": "^1.2.2",
41+
"gulp-replace": "^0.5.4",
42+
"gulp-uglify": "^1.4.0",
43+
"jasmine-reporters": "~1.0.0",
44+
"jest-cli": "~0.5.0",
45+
"vinyl-source-stream": "^1.1.0"
46+
},
47+
"scripts": {
48+
"build": "./build_releases.sh",
49+
"release": "./build_releases.sh && npm publish",
50+
"test": "PARSE_BUILD=node jest"
51+
},
52+
"jest": {
53+
"collectCoverage": true,
54+
"testPathDirs": [
55+
"src/"
56+
],
57+
"testPathIgnorePatterns": [
58+
"/node_modules/",
59+
"/test_helpers/"
60+
],
61+
"scriptPreprocessor": "node_modules/babel-jest",
62+
"setupTestFrameworkScriptFile": "setup-jest.js"
63+
}
64+
}

react-native.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./lib/react-native/Parse.js');

setup-jest.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require('jasmine-reporters');
2+
var reporter = new jasmine.JUnitXmlReporter('test_output/');
3+
jasmine.getEnv().addReporter(reporter);

src/.flowconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[ignore]
2+
.*\/node_modules\/
3+
4+
[include]
5+
6+
[libs]
7+
interfaces/
8+
9+
[options]
10+
unsafe.enable_getters_and_setters=true

0 commit comments

Comments
 (0)