Skip to content

Commit

Permalink
Init ...
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanr committed Dec 12, 2015
0 parents commit 240be38
Show file tree
Hide file tree
Showing 19 changed files with 281 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"plugins": [
"transform-flow-strip-types",
"transform-object-assign"
],
"presets": [
"es2015",
"stage-0"
]
}
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# .editorconfig
#

# --------------------------------------
root = true

[*] # ----------------------------------
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md] # -------------------------------
insert_final_newline = false
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# .eslintignore
#

# --------------------------------------
**/dist/**
**/node_modules/**
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "natron"
}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# .gitignore
#

# --------------------------------------
.DS_Store

# npm ----------------------------------
node_modules
3 changes: 3 additions & 0 deletions .natronrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"natronfile": "build/natronfile"
}
33 changes: 33 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# .travis.yml
#

language: "node_js"

node_js:
- "stable"
- "0.12"
- "0.10"
# Long-term Support
- "4.2" # Argon

install:
# Install Global Modules
- "npm install eslint babel-eslint natronjs/eslint-config-natron"
- "npm install mocha"

# Install Standard Library
- "npm install core-js"

# Install Local Modules
- "npm install"

# Install Test Modules
- "npm --prefix test install"

script:
# ESLint: Lint Packages
- "node_modules/.bin/eslint packages/*/src"

# Mocha: Test Packages
- "node_modules/.bin/mocha packages/*/test"
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) 2015 Stefan Rumzucker

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.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# [![Natron][natron-img]][natron-url]

[natron-img]: http://static.natronjs.com/img/natronjs.svg
[natron-url]: http://natronjs.com/

**A JavaScript Task Runner**

[![Version][npm-img]][npm-url]
[![Downloads][dlm-img]][npm-url]
[![Build Status][travis-img]][travis-url]
[![ReadMe][readme-img]][readme-url]

[![Gitter Chat][gitter-img]][gitter-url]

[npm-img]: https://img.shields.io/npm/v/natron.svg
[npm-url]: https://npmjs.org/package/natron
[dlm-img]: https://img.shields.io/npm/dm/natron.svg
[travis-img]: https://travis-ci.org/natronjs/natron.svg
[travis-url]: https://travis-ci.org/natronjs/natron
[readme-img]: https://img.shields.io/badge/read-me-orange.svg
[readme-url]: https://natron.readme.io/

[gitter-img]: https://badges.gitter.im/Join%20Chat.svg
[gitter-url]: https://gitter.im/natronjs/natron

## Documentation

See the [documentation for Natron][readme-url]
6 changes: 6 additions & 0 deletions build/.natronrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"transpiler": "babel",
"logging": {
"wrapConsole": true
}
}
14 changes: 14 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Natron Build

## Building Packages

```
$ natron build [package] [...targets = cjs]
```

**Example `natron-core`**

```
$ natron build core
Building: package = core, targets = cjs
```
68 changes: 68 additions & 0 deletions build/natronfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* @module natron
* build
*/
import {resolve} from "path";
import {task} from "natron";
import {src, dest} from "natron-vinyl";
import {transform} from "vinyl-tf-babel";

const PKG_DIR = resolve(__dirname, "..");

function builder(target: string, options?: Object): Function {
return (pkg: string) => {
let pkgDir = resolve(PKG_DIR, "packages", pkg);

return (src(resolve(pkgDir, "src", "**/*.js"))
.pipe(transform(options))
.pipe(dest(resolve(pkgDir, "dist", target)))
);
};
}

let builderTasks = {
"cjs": task(builder("cjs", {
"babelrc": false,
"plugins": [
"transform-flow-strip-types",
"transform-object-assign",
],
"presets": [
"es2015",
"stage-0",
],
})),
"es6": task(builder("es6", {
"babelrc": false,
"plugins": [
"transform-flow-strip-types",
],
"presets": [
"stage-0",
],
})),
};

export function build(pkg: string, ...targets: string): Promise {
/* eslint-disable no-console */
if (!pkg) {
console.error("No package specified");
return;
}
if (!targets.length) {
targets = ["cjs"];
}

let tasks = [];
for (let target of targets) {
if (!builderTasks[target]) {
console.error(`No builder for ${target}`);
return;
}
tasks.push(builderTasks[target]);
}

console.log(`Building: package = ${pkg}, targets = ${targets.join(", ")}`);

return task([tasks]).run(pkg);
}
8 changes: 8 additions & 0 deletions build/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"private": true,
"dependencies": {
"natron": "^0.1.0",
"natron-vinyl": "^0.1.0",
"vinyl-tf-babel": "^0.1.0"
}
}
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"private": true,
"homepage": "http://natronjs.com/",
"author": "Stefan Rumzucker",
"repository": {
"type": "git",
"url": "git+https://github.com/natronjs/natron.git"
},
"devDependencies": {
"babel-core": "^6.0.0",
"babel-plugin-transform-flow-strip-types": "^6.0.0",
"babel-plugin-transform-object-assign": "^6.0.0",
"babel-preset-es2015": "^6.0.0",
"babel-preset-stage-0": "^6.0.0",
"babel-register": "^6.0.0"
},
"license": "MIT"
}
6 changes: 6 additions & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "natron/test",
"globals": {
"assert": true
}
}
2 changes: 2 additions & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--compilers js:babel-register
--require test/support/node
7 changes: 7 additions & 0 deletions test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"private": true,
"dependencies": {
"chai": "^3.4.0",
"chai-as-promised": "^5.1.0"
}
}
13 changes: 13 additions & 0 deletions test/support/node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @module natron
* test
*/
import chai from "chai";
import chaiAsPromised from "chai-as-promised";
import "./polyfills/v0.10";

chai.use(chaiAsPromised);

Object.assign(global, {
assert: chai.assert,
});
7 changes: 7 additions & 0 deletions test/support/polyfills/v0.10.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* @module natron
* test
*/
if (process.version.match(/^v0\.10/)) {
require("core-js");
}

0 comments on commit 240be38

Please sign in to comment.