Skip to content
This repository was archived by the owner on Jan 2, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs.
# Requires EditorConfig JetBrains Plugin - http://github.com/editorconfig/editorconfig-jetbrains

# Set this file as the topmost .editorconfig
# (multiple files can be used, and are applied starting from current document location)
root = true

[{package.json}]
indent_style = space
indent_size = 2

# Use bracketed regexp to target specific file types or file locations
[*.{js,json}]

# Use hard or soft tabs ["tab", "space"]
indent_style = space

# Size of a single indent [an integer, "tab"]
indent_size = tab

# Number of columns representing a tab character [an integer]
tab_width = 4

# Line breaks representation ["lf", "cr", "crlf"]
end_of_line = lf

# ["latin1", "utf-8", "utf-16be", "utf-16le"]
charset = utf-8

# Remove any whitespace characters preceding newline characters ["true", "false"]
trim_trailing_whitespace = true

# Ensure file ends with a newline when saving ["true", "false"]
insert_final_newline = true
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
*.log
.DS_Store
lib
esdocs
coverage
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sudo: required
language: node_js
node_js:
- 4.2
- stable
before_script:
- npm run link
after_success:
- npm run build
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Roc
Copyright (c) 2016 VG

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# roc-plugin-react
# roc-plugin-react
[![Build Status](https://travis-ci.org/rocjs/roc-plugin-react.svg?branch=master)](https://travis-ci.org/rocjs/roc-plugin-react)

__Adds React support to Webpack and Roc__
- [roc-plugin-react](/packages/roc-plugin-react)
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "roc-plugin-react",
"private": true,
"license": "MIT",
"scripts": {
"rid": "rid",
"build": "rid build",
"lint": "rid lint:alias",
"link": "rid link",
"test": "npm run lint"
},
"devDependencies": {
"@rocjs/roc-internal-dev": "^1.0.0"
}
}
3 changes: 3 additions & 0 deletions packages/roc-plugin-react-dev/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lib
esdocs
docs
13 changes: 13 additions & 0 deletions packages/roc-plugin-react-dev/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "vgno",

"parser": "babel-eslint",

"env": {
"es6": true
},

"ecmaFeatures": {
"modules": true
}
}
8 changes: 8 additions & 0 deletions packages/roc-plugin-react-dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# roc-plugin-react-dev
Adds React support to Webpack and Roc.

## Documentation
- [Actions](/packages/roc-plugin-react-dev/docs/Actions.md)
- [Commands](/packages/roc-plugin-react-dev/docs/Commands.md)
- [Hooks](/packages/roc-plugin-react-dev/docs/Hooks.md)
- [Settings](/packages/roc-plugin-react-dev/docs/Settings.md)
21 changes: 21 additions & 0 deletions packages/roc-plugin-react-dev/docs/Actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Actions for `roc-plugin-react-dev`

## Actions
* [roc-plugin-react](#roc-plugin-react)
* [react](#react)
* [roc-plugin-react-dev](#roc-plugin-react-dev)
* [react](#react)

## roc-plugin-react

### react

__Connects to extension:__ `roc-plugin-start`
__Connects to hook:__ `get-resolve-paths`

## roc-plugin-react-dev

### react

__Connects to extension:__ Not specified
__Connects to hook:__ `build-webpack`
Empty file.
1 change: 1 addition & 0 deletions packages/roc-plugin-react-dev/docs/Hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No hooks available.
9 changes: 9 additions & 0 deletions packages/roc-plugin-react-dev/docs/Settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Settings for `roc-plugin-react-dev`

## Dev

### HotMiddleware

| Name | Description | Path | CLI option | Default | Type | Required |
| ------ | ----------- | ------------------------ | -------------------------- | ------- | --------- | -------- |
| reload | | dev.hotMiddleware.reload | --dev-hotMiddleware-reload | `false` | `Unknown` | No |
37 changes: 37 additions & 0 deletions packages/roc-plugin-react-dev/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "roc-plugin-react-dev",
"description": "Adds React support to Webpack and Roc (Development)",
"author": "VG",
"license": "MIT",
"version": "1.0.0-alpha.0",
"main": "lib/index.js",
"scripts": {
"lint": "eslint .",
"test": "npm run lint"
},
"files": [
"lib"
],
"keywords": [
"roc",
"roc-plugin"
],
"repository": {
"type": "git",
"url": "https://github.com/rocjs/roc-plugin-react"
},
"dependencies": {
"roc-plugin-react": "^1.0.0-alpha",
"babel-plugin-react-transform": "~2.0.0",
"babel-preset-react": "~6.3.13",
"react-transform-catch-errors": "~1.0.2",
"react-transform-hmr": "~1.0.2",
"redbox-react": "~1.1.0",
"react": "~0.14.0"
},
"devDependencies": {
"babel-eslint": "~5.0.0",
"eslint": "~1.10.3",
"eslint-config-vgno": "~5.0.0"
}
}
6 changes: 6 additions & 0 deletions packages/roc-plugin-react-dev/roc.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const path = require('path');

// Makes it possible for use to generate documentation for this package.
module.exports = {
packages: [path.join(__dirname, 'lib', 'index.js')]
};
45 changes: 45 additions & 0 deletions packages/roc-plugin-react-dev/src/builder/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { resolvePath } from 'roc-plugin-react';

export default () => ({ settings, previousValue: rocBuilder }) => (target) => () => {
let {
buildConfig,
builder,
info
} = rocBuilder;

const DEV = settings.build.mode === 'dev';
const WEB = target === 'web';

/**
* Update babel configuration for React
*/
buildConfig.babel.presets.push(require.resolve('babel-preset-react'));
if (DEV && WEB) {
buildConfig.babel.plugins.push([
require.resolve('babel-plugin-react-transform'), {
transforms: [
{
transform: require.resolve('react-transform-hmr'),
imports: ['react'],
locals: ['module']
},
{
transform: require.resolve('react-transform-catch-errors'),
imports: ['react', require.resolve('redbox-react')]
}
]
}
]);
}

/**
* Add resolver from roc-plugin-react
*/
buildConfig.resolve.fallback.push(resolvePath);

return {
buildConfig,
builder,
info
};
};
1 change: 1 addition & 0 deletions packages/roc-plugin-react-dev/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export roc from './roc';
21 changes: 21 additions & 0 deletions packages/roc-plugin-react-dev/src/roc/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { name } from './util';
import builder from '../builder';

export default {
name,
config: {
settings: {
dev: {
hotMiddleware: {
reload: false
}
}
}
},
actions: {
react: {
hook: 'build-webpack',
action: builder
}
}
};
4 changes: 4 additions & 0 deletions packages/roc-plugin-react-dev/src/roc/util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* The name of the package, for easy consumption.
*/
export const name = require('../../package.json').name;
3 changes: 3 additions & 0 deletions packages/roc-plugin-react/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lib
esdocs
docs
13 changes: 13 additions & 0 deletions packages/roc-plugin-react/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "vgno",

"parser": "babel-eslint",

"env": {
"es6": true
},

"ecmaFeatures": {
"modules": true
}
}
8 changes: 8 additions & 0 deletions packages/roc-plugin-react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# roc-plugin-react
Adds React support to Webpack and Roc.

## Documentation
- [Actions](/packages/roc-plugin-react/docs/Actions.md)
- [Commands](/packages/roc-plugin-react/docs/Commands.md)
- [Hooks](/packages/roc-plugin-react/docs/Hooks.md)
- [Settings](/packages/roc-plugin-react/docs/Settings.md)
12 changes: 12 additions & 0 deletions packages/roc-plugin-react/docs/Actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Actions for `roc-plugin-react`

## Actions
* [roc-plugin-react](#roc-plugin-react)
* [react](#react)

## roc-plugin-react

### react

__Connects to extension:__ `roc-plugin-start`
__Connects to hook:__ `get-resolve-paths`
Empty file.
1 change: 1 addition & 0 deletions packages/roc-plugin-react/docs/Hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No hooks available.
1 change: 1 addition & 0 deletions packages/roc-plugin-react/docs/Settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No settings available.
32 changes: 32 additions & 0 deletions packages/roc-plugin-react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "roc-plugin-react",
"description": "Adds React support to Webpack and Roc",
"author": "VG",
"license": "MIT",
"version": "1.0.0-alpha.0",
"main": "lib/index.js",
"scripts": {
"lint": "eslint .",
"test": "npm run lint"
},
"files": [
"lib"
],
"keywords": [
"roc",
"roc-plugin"
],
"repository": {
"type": "git",
"url": "https://github.com/rocjs/roc-plugin-react"
},
"dependencies": {
"react": "~0.14.0",
"react-dom": "~0.14.0"
},
"devDependencies": {
"babel-eslint": "~5.0.0",
"eslint": "~1.10.3",
"eslint-config-vgno": "~5.0.0"
}
}
6 changes: 6 additions & 0 deletions packages/roc-plugin-react/roc.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const path = require('path');

// Makes it possible for use to generate documentation for this package.
module.exports = {
packages: [path.join(__dirname, 'lib', 'index.js')]
};
3 changes: 3 additions & 0 deletions packages/roc-plugin-react/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export roc from './roc';

export resolvePath from './resolver';
5 changes: 5 additions & 0 deletions packages/roc-plugin-react/src/resolver/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { join } from 'path';

const resolvePath = join(__dirname, '..', '..', 'node_modules');

export default resolvePath;
13 changes: 13 additions & 0 deletions packages/roc-plugin-react/src/roc/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { name } from './util';
import resolvePath from '../resolver';

export default {
name,
actions: {
react: {
extension: 'roc-plugin-start',
hook: 'get-resolve-paths',
action: () => () => () => () => resolvePath
}
}
};
4 changes: 4 additions & 0 deletions packages/roc-plugin-react/src/roc/util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* The name of the package, for easy consumption.
*/
export const name = require('../../package.json').name;