Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Starting the boilerplate NPM function

Paul Copplestone8a9e1e480321
diff --git a/libraries/supabase-js/.babelrc b/libraries/supabase-js/.babelrc
new file mode 100644
index 00000000000..ef749a2d6c0
--- /dev/null
+++ b/libraries/supabase-js/.babelrc
@@ -0,0 +1,16 @@
+{
+ "env": {
+ "development": {
+ "presets": ["env"],
+ "plugins": [
+ "add-module-exports"
+ ]
+ },
+ "production": {
+ "presets": ["env", "minify"],
+ "plugins": [
+ "add-module-exports"
+ ]
+ }
+ }
+}
diff --git a/libraries/supabase-js/.gitignore b/libraries/supabase-js/.gitignore
new file mode 100644
index 00000000000..02c78233224
--- /dev/null
+++ b/libraries/supabase-js/.gitignore
@@ -0,0 +1,44 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+
+# Runtime data
+pids
+*.pid
+*.seed
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Compiled binary addons (http://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules
+jspm_packages
+
+# Optional npm cache directory
+.npm
+
+# Optional REPL history
+.node_repl_history
+
+# Editors
+.idea
+
+# Lib
+lib
+
+# npm package lock
+package-lock.json
+yarn.lock
+
+others
+.DS_Store
\ No newline at end of file
diff --git a/libraries/supabase-js/.npmignore b/libraries/supabase-js/.npmignore
new file mode 100644
index 00000000000..45c2f4af977
--- /dev/null
+++ b/libraries/supabase-js/.npmignore
@@ -0,0 +1,25 @@
+*.log
+npm-debug.log*
+
+# Coverage directory used by tools like istanbul
+coverage
+.nyc_output
+
+# Dependency directories
+node_modules
+
+# npm package lock
+package-lock.json
+yarn.lock
+
+# project files
+src
+test
+examples
+CHANGELOG.md
+.travis.yml
+.editorconfig
+.eslintignore
+.eslintrc
+.babelrc
+.gitignore
diff --git a/libraries/supabase-js/.travis.yml b/libraries/supabase-js/.travis.yml
new file mode 100644
index 00000000000..24b8730037e
--- /dev/null
+++ b/libraries/supabase-js/.travis.yml
@@ -0,0 +1,10 @@
+language: node_js
+node_js:
+ - '8'
+ - '6'
+script:
+ - npm run test
+ - npm run build
+branches:
+ only:
+ - master
diff --git a/libraries/supabase-js/README.md b/libraries/supabase-js/README.md
new file mode 100644
index 00000000000..805dc7214bf
--- /dev/null
+++ b/libraries/supabase-js/README.md
@@ -0,0 +1,14 @@
+# Supabase JS
+
+# Commands
+- `npm run clean` - Remove `lib/` directory
+- `npm test` - Run tests with linting and coverage results.
+- `npm test:only` - Run tests without linting or coverage.
+- `npm test:watch` - You can even re-run tests on file changes!
+- `npm test:prod` - Run tests with minified code.
+- `npm run test:examples` - Test written examples on pure JS for better understanding module usage.
+- `npm run lint` - Run ESlint with airbnb-config
+- `npm run cover` - Get coverage report for your code.
+- `npm run build` - Babel will transpile ES6 => ES5 and minify the code.
+- `npm run prepublish` - Hook for npm. Do all the checks before publishing your module.
+
diff --git a/libraries/supabase-js/package.json b/libraries/supabase-js/package.json
new file mode 100644
index 00000000000..2662b39d3c0
--- /dev/null
+++ b/libraries/supabase-js/package.json
@@ -0,0 +1,50 @@
+{
+ "name": "@supabase/supabase-js",
+ "version": "0.1.0",
+ "description": "Supabase Realtime API",
+ "main": "./lib/index.js",
+ "scripts": {
+ "clean": "rimraf lib",
+ "test": "npm run cover",
+ "test:prod": "cross-env BABEL_ENV=production npm run test",
+ "test:only": "mocha --require babel-core/register --require babel-polyfill --recursive",
+ "test:watch": "npm test -- --watch",
+ "test:examples": "node examples/",
+ "cover": "nyc --check-coverage npm run test:only",
+ "build": "cross-env BABEL_ENV=production babel src --out-dir lib",
+ "prepublish": "npm run clean && npm run test && npm run build"
+ },
+ "files": [
+ "lib",
+ "src"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/supabase/monorepolate.git"
+ },
+ "keywords": [
+ "boilerplate",
+ "npm",
+ "module",
+ "node",
+ "javascript"
+ ],
+ "author": "Supabase",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/supabase/monorepo/issues"
+ },
+ "homepage": "https://supabase.io",
+ "devDependencies": {
+ "babel-cli": "^6.26.0",
+ "babel-plugin-add-module-exports": "^1.0.0",
+ "babel-polyfill": "^6.26.0",
+ "babel-preset-env": "^1.6.1",
+ "babel-preset-minify": "^0.5.0",
+ "chai": "^4.1.2",
+ "cross-env": "^5.1.3",
+ "mocha": "^6.1.3",
+ "nyc": "^13.3.0",
+ "rimraf": "^2.6.2"
+ }
+}
diff --git a/libraries/supabase-js/src/index.js b/libraries/supabase-js/src/index.js
new file mode 100644
index 00000000000..297611e5996
--- /dev/null
+++ b/libraries/supabase-js/src/index.js
@@ -0,0 +1,10 @@
+const defaultAwesomeFunction = (name) => {
+ const returnStr = `I am the Default Awesome Function, fellow comrade! - ${name}`;
+ return returnStr;
+};
+
+const awesomeFunction = () => 'I am just an Awesome Function';
+
+export default defaultAwesomeFunction;
+
+export { awesomeFunction };
diff --git a/libraries/supabase-js/test/index.js b/libraries/supabase-js/test/index.js
new file mode 100644
index 00000000000..744ba68daf9
--- /dev/null
+++ b/libraries/supabase-js/test/index.js
@@ -0,0 +1,14 @@
+import { assert } from 'chai';
+import defaultAwesomeFunction, { awesomeFunction } from '../src';
+
+describe('Awesome test.', () => {
+ it('should test default awesome function', () => {
+ const expectedVal = 'I am the Default Awesome Function, fellow comrade! - Dinesh';
+ assert(defaultAwesomeFunction('Dinesh') === expectedVal, 'Default not awesome :(');
+ });
+
+ it('should test awesome function', () => {
+ const expectedVal = 'I am just an Awesome Function';
+ assert(awesomeFunction() === expectedVal, 'Named awesome :(');
+ });
+});