commit 1016f5f26f858703e59d99d5401a30ab6e7a3764 Author: Julien Fontanet Date: Wed Nov 2 16:43:19 2016 +0100 initial commit diff --git a/packages/xo-common/.editorconfig b/packages/xo-common/.editorconfig new file mode 100644 index 000000000..b6db0112a --- /dev/null +++ b/packages/xo-common/.editorconfig @@ -0,0 +1,65 @@ +# http://EditorConfig.org +# +# Julien Fontanet's configuration +# https://gist.github.com/julien-f/8096213 + +# Top-most EditorConfig file. +root = true + +# Common config. +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespaces = true + +# CoffeeScript +# +# https://github.com/polarmobile/coffeescript-style-guide/blob/master/README.md +[*.{,lit}coffee] +indent_size = 2 +indent_style = space + +# Markdown +[*.{md,mdwn,mdown,markdown}] +indent_size = 4 +indent_style = space + +# Package.json +# +# This indentation style is the one used by npm. +[/package.json] +indent_size = 2 +indent_style = space + +# Jade +[*.jade] +indent_size = 2 +indent_style = space + +# JavaScript +# +# Two spaces seems to be the standard most common style, at least in +# Node.js (http://nodeguide.com/style.html#tabs-vs-spaces). +[*.{js,jsx,ts,tsx}] +indent_size = 2 +indent_style = space + +# Less +[*.less] +indent_size = 2 +indent_style = space + +# Sass +# +# Style used for http://libsass.com +[*.s[ac]ss] +indent_size = 2 +indent_style = space + +# YAML +# +# Only spaces are allowed. +[*.yaml] +indent_size = 2 +indent_style = space diff --git a/packages/xo-common/.gitignore b/packages/xo-common/.gitignore new file mode 100644 index 000000000..827e4e420 --- /dev/null +++ b/packages/xo-common/.gitignore @@ -0,0 +1,7 @@ +/dist/ +/node_modules/ + +npm-debug.log +npm-debug.log.* +pnpm-debug.log +pnpm-debug.log.* diff --git a/packages/xo-common/.npmignore b/packages/xo-common/.npmignore new file mode 100644 index 000000000..c31ee82cb --- /dev/null +++ b/packages/xo-common/.npmignore @@ -0,0 +1,10 @@ +/examples/ +example.js +example.js.map +*.example.js +*.example.js.map + +/test/ +/tests/ +*.spec.js +*.spec.js.map diff --git a/packages/xo-common/.travis.yml b/packages/xo-common/.travis.yml new file mode 100644 index 000000000..1a582c426 --- /dev/null +++ b/packages/xo-common/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - stable + - 6 + - 4 + +# Use containers. +# http://docs.travis-ci.com/user/workers/container-based-infrastructure/ +sudo: false diff --git a/packages/xo-common/README.md b/packages/xo-common/README.md new file mode 100644 index 000000000..987ed83fd --- /dev/null +++ b/packages/xo-common/README.md @@ -0,0 +1,49 @@ +# xo-common [![Build Status](https://travis-ci.org/vatesfr/xo-common.png?branch=master)](https://travis-ci.org/vatesfr/xo-common) + +> Code shared between [XO](https://xen-orchestra.com) server and clients + +## Install + +Installation of the [npm package](https://npmjs.org/package/xo-common): + +``` +> npm install --save xo-common +``` + +## Usage + +**TODO** + +## Development + +``` +# Install dependencies +> npm install + +# Run the tests +> npm test + +# Continuously compile +> npm run dev + +# Continuously run the tests +> npm run dev-test + +# Build for production (automatically called by npm install) +> npm run build +``` + +## Contributions + +Contributions are *very* welcomed, either on the documentation or on +the code. + +You may: + +- report any [issue](https://github.com/vatesfr/xo-common/issues) + you've encountered; +- fork and create a pull request. + +## License + +AGPL3 © [Vates SAS](https://vates.fr) diff --git a/packages/xo-common/api-errors.js b/packages/xo-common/api-errors.js new file mode 100644 index 000000000..3b3e7974b --- /dev/null +++ b/packages/xo-common/api-errors.js @@ -0,0 +1 @@ +module.exports = require('./dist/api-errors') diff --git a/packages/xo-common/package.json b/packages/xo-common/package.json new file mode 100644 index 000000000..ab5d1cb2e --- /dev/null +++ b/packages/xo-common/package.json @@ -0,0 +1,83 @@ +{ + "name": "xo-common", + "version": "0.0.0", + "license": "AGPL-3.0", + "description": "Code shared between [XO](https://xen-orchestra.com) server and clients", + "keywords": [], + "homepage": "https://github.com/vatesfr/xo-common", + "bugs": "https://github.com/vatesfr/xo-common/issues", + "repository": { + "type": "git", + "url": "https://github.com/vatesfr/xo-common.git" + }, + "author": { + "name": "Julien Fontanet", + "email": "julien.fontanet@isonoe.net" + }, + "preferGlobal": false, + "main": "dist/", + "bin": {}, + "files": [ + "dist/", + "*.js" + ], + "engines": { + "node": ">=4" + }, + "dependencies": { + "babel-runtime": "^6.18.0", + "lodash": "^4.16.6" + }, + "devDependencies": { + "babel-cli": "^6.18.0", + "babel-eslint": "^7.1.0", + "babel-plugin-lodash": "^3.2.9", + "babel-plugin-transform-runtime": "^6.15.0", + "babel-preset-env": "^0.0.6", + "babel-preset-stage-0": "^6.16.0", + "cross-env": "^3.1.3", + "dependency-check": "^2.6.0", + "ghooks": "^1.3.2", + "rimraf": "^2.5.4", + "standard": "^8.5.0" + }, + "scripts": { + "build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/", + "clean": "rimraf dist/", + "depcheck": "dependency-check ./package.json", + "dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/", + "lint": "standard", + "posttest": "npm run lint && npm run depcheck", + "prebuild": "npm run clean", + "predev": "npm run clean", + "prepublish": "npm run build" + }, + "babel": { + "plugins": [ + "lodash" + ], + "presets": [ + [ + "env", + { + "targets": { + "browsers": "> 1% last 2 versions", + "node": 4 + } + } + ], + "stage-0" + ] + }, + "standard": { + "ignore": [ + "dist" + ], + "parser": "babel-eslint" + }, + "config": { + "ghooks": { + "commit-msg": "npm test" + } + } +} diff --git a/packages/xo-common/src/api-errors.js b/packages/xo-common/src/api-errors.js new file mode 100644 index 000000000..e69de29bb