Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
thegecko committed Dec 3, 2017
1 parent 4cde880 commit f457e0e
Show file tree
Hide file tree
Showing 46 changed files with 2,601 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
.vscode
node_modules
package-lock.json
lib
docs
types
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docs
.gitignore
circle.yml
gulpfile.js
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017 Rob Moran

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.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# web-bluetooth
Node.js implementation of Web Bluetooth Specification
# Node Web Bluetooth
Node.js implementation of the Web Bluetooth Specification

[![Circle CI](https://circleci.com/gh/thegecko/webbluetooth.svg?style=shield)](https://circleci.com/gh/thegecko/webbluetooth/)

## Prerequisites

[Node.js > v4.0.0](https://nodejs.org), which includes `npm`.

## Installation

```bash
$ npm install web-usb
```
43 changes: 43 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
general:
artifacts:
- ~/docs
branches:
ignore:
- build

machine:
node:
version: 4.0.0
environment:
PROJECT_NAME: ${CIRCLE_PROJECT_REPONAME}
PROJECT_TAG: ${CIRCLE_BRANCH}-${CIRCLE_BUILD_NUM}
PROJECT_LIVE_BRANCH: build
PROJECT_DOCS: ${HOME}/docs

checkout:
post:
- git config --global user.name thegecko
- git config --global user.email [email protected]

compile:
override:
- npm run gulp
- mkdir -p ${PROJECT_DOCS}
- cp -r docs/* ${PROJECT_DOCS}/

test:
override:
- exit 0

deployment:
staging:
branch: master
commands:
- echo Syncing $PROJECT_NAME to $PROJECT_LIVE_BRANCH on GitHub...
- git add --force docs lib types
- git stash save
- git checkout $PROJECT_LIVE_BRANCH
- git merge master --no-commit
- git checkout stash -- .
- git commit --allow-empty --message "Automatic Deployment"
- git push
88 changes: 88 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
var path = require("path");
var del = require("del");
var merge = require("merge2");
var tslint = require("tslint");
var gulp = require("gulp");
var sourcemaps = require("gulp-sourcemaps");
var gulpTs = require("gulp-typescript");
var gulpTslint = require("gulp-tslint");
var gulpTypedoc = require("gulp-typedoc");

var name = "Node Web Bluetooth";
var docsToc = "";

var srcDir = "src";
var srcFiles = srcDir + "/**/*.ts";
var docsDir = "docs";
var nodeDir = "lib";
var typesDir = "types";
var watching = false;

function handleError() {
if (watching) this.emit("end");
else process.exit(1);
}

// Set watching
gulp.task("setWatch", function() {
watching = true;
});

// Clear built directories
gulp.task("clean", function() {
return del([nodeDir, typesDir]);
});

// Lint the source
gulp.task("lint", function() {
var program = tslint.Linter.createProgram("./");

gulp.src(srcFiles)
.pipe(gulpTslint({
program: program,
formatter: "stylish"
}))
.pipe(gulpTslint.report({
emitError: !watching
}))
});

// Create documentation
gulp.task("doc", function() {
return gulp.src(srcFiles)
.pipe(gulpTypedoc({
name: name,
readme: "src/documentation.md",
theme: "src/theme",
mode: "file",
target: "es6",
module: "commonjs",
out: docsDir,
excludeExternals: true,
excludePrivate: true,
hideGenerator: true,
toc: docsToc
}))
.on("error", handleError);
});

// Build TypeScript source into CommonJS Node modules
gulp.task("compile", ["clean"], function() {
var tsResult = gulp.src(srcFiles)
.pipe(sourcemaps.init())
.pipe(gulpTs.createProject("tsconfig.json")())
.on("error", handleError);

return merge([
tsResult.js.pipe(sourcemaps.write(".", {
sourceRoot: path.relative(nodeDir, srcDir)
})).pipe(gulp.dest(nodeDir)),
tsResult.dts.pipe(gulp.dest(typesDir))
]);
});

gulp.task("watch", ["setWatch", "default"], function() {
gulp.watch(srcFiles, ["default"]);
});

gulp.task("default", ["lint", "doc", "compile"]);
43 changes: 43 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "webbluetooth",
"version": "0.0.1",
"description": "Node.js implementation of the Web Bluetooth Specification",
"homepage": "https://github.com/thegecko/webbluetooth",
"author": "Rob Moran <[email protected]>",
"license": "MIT",
"types": "./types/index.d.ts",
"main": "./index.js",
"repository": {
"type": "git",
"url": "git://github.com/thegecko/webbluetooth.git"
},
"keywords": [
"web-bluetooth",
"ble",
"bluetooth"
],
"scripts": {
"gulp": "gulp"
},
"engines": {
"node": ">=4.0.0"
},
"dependencies": {
"noble": "^1.8.1"
},
"devDependencies": {
"@types/noble": "0.0.34",
"@types/node": "^8.0.54",
"del": "^3.0.0",
"gulp": "^3.9.1",
"gulp-sourcemaps": "^2.6.1",
"gulp-tslint": "^8.1.2",
"gulp-typedoc": "^2.1.1",
"gulp-typescript": "^3.2.3",
"merge2": "^1.2.0",
"tslint": "^5.8.0",
"tslint-eslint-rules": "^4.1.1",
"typedoc": "^0.9.0",
"typescript": "^2.6.2"
}
}
Loading

0 comments on commit f457e0e

Please sign in to comment.