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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# (multiple files can be used, and are applied starting from current document location)
root = true

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

Expand Down
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
sudo: required
language: node_js
cache:
directories:
- node_modules
node_js:
- stable
- 4.2
before_install:
- npm install -g npm
before_script:
- npm run link
- npm run link
after_success:
- npm run build
- npm start build && npm start docs
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 VG
Copyright (c) 2016 Verdens Gang AS

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
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# roc-plugin-react
[![Build Status](https://travis-ci.org/rocjs/roc-plugin-react.svg?branch=master)](https://travis-ci.org/rocjs/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)
- [roc-plugin-react](/extensions/roc-plugin-react)
- [roc-plugin-react-dev](/extensions/roc-plugin-react-dev)

---
To be used together with [Roc](https://github.com/rocjs/roc).
18 changes: 18 additions & 0 deletions extensions/roc-plugin-react-dev/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": "airbnb-base",

"parser": "babel-eslint",

plugins: ["eslint-plugin-babel"],

"rules": {
"indent": [2, 4, { "SwitchCase": 1 }],
"max-len": [2, 120, 4],

"generator-star-spacing": 0,
"babel/generator-star-spacing": [2, { before: false, after: true }],

"import/order": [2, { "groups": ["builtin", "external", "internal", "parent", "sibling", "index"], "newlines-between": "always"}],
"import/newline-after-import": [2]
}
}
21 changes: 21 additions & 0 deletions extensions/roc-plugin-react-dev/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Verdens Gang AS

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.
15 changes: 15 additions & 0 deletions extensions/roc-plugin-react-dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# roc-plugin-react-dev

Adds React support to Webpack and Roc (Development)

## Documentation
- [Actions](docs/Actions.md)
- [Commands](docs/Commands.md)
- [Configuration](docs/Configuration.md)
- [Dependencies](docs/Dependencies.md)
- [Hooks](docs/Hooks.md)
- [Settings](docs/Settings.md)
- [Extensions](docs/Extensions.md)

---
_Generated by [Roc](https://github.com/rocjs/roc)_
15 changes: 15 additions & 0 deletions extensions/roc-plugin-react-dev/docs/Actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Actions for `roc-plugin-react-dev`

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

## roc-plugin-react-dev

### build-webpack

Adds the needed Webpack configuration to be able to build and develop React code.

__Connects to extension:__ Not specified
__Connects to hook:__ `build-webpack`
__Have post:__ No
60 changes: 60 additions & 0 deletions extensions/roc-plugin-react-dev/docs/Commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Commands for `roc-plugin-react-dev`

## General Information
All commands can be called with some additional options illustrated in the table below.

### General options

| Name | Description | Required |
| --------------------- | ---------------------------------------------- | -------- |
| -b, --better-feedback | Enables source-map-support and loud-rejection. | No |
| -c, --config | Path to configuration file. | No |
| -d, --directory | Path to working directory. | No |
| -h, --help | Output usage information. | No |
| -V, --verbose | Enable verbose mode. | No |
| -v, --version | Output version number. | No |

## Commands
* [meta](#meta)
* [docs](#docs)
* [list-settings](#list-settings)

## meta
__Meta commands__

```
roc meta <command>
```
Meta commands that can be used to generate meta data about the current project.


### docs
__Generates documentation for the current project.__

```
roc meta docs
```

#### Command options

| Name | Description | Default | Type | Required | Can be empty |
| ---------- | ------------------------------------------------------------- | -------------- | ----------------------------------------------------------------- | -------- | ------------ |
| --html | If HTML should be generated. (Not supported yet) | `false` | `Boolean` | No | |
| --markdown | If markdown should be generated. | `true` | `Boolean` | No | |
| --mode | The platform that is to be used, for link generation. | `"github.com"` | `/github\.com|nodejs\.org|bitbucket\.org|ghost\.org|gitlab\.com/` | No | |
| --output | A directory to place the generated documentation inside of. | `"docs"` | `String` | No | No |
| --project | If the projects configuration and actions should be included. | `false` | `Boolean` | No | |

#### Defined by extensions
roc

### list-settings
__Prints all the available settings that can be changed.__

```
roc meta list-settings
```

#### Defined by extensions
roc

5 changes: 5 additions & 0 deletions extensions/roc-plugin-react-dev/docs/Configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Config for `roc-plugin-react-dev`

Configuration that can be defined in `roc.config.js`, other than settings and project.

__No config available.__
20 changes: 20 additions & 0 deletions extensions/roc-plugin-react-dev/docs/Dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies for `roc-plugin-react-dev`

The dependencies that are available in the project.

## Exported
### [react](https://www.npmjs.com/package/react)
__Version__: ~15.0.1
__Extension__: roc-plugin-react
__Custom resolve function__: No

### [react-dom](https://www.npmjs.com/package/react-dom)
__Version__: ~15.0.1
__Extension__: roc-plugin-react
__Custom resolve function__: No

## Requires
Nothing is required.

## Uses
Nothing is listed as used.
10 changes: 10 additions & 0 deletions extensions/roc-plugin-react-dev/docs/Extensions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Extensions for `roc-plugin-react-dev`

The extensions that are used in the project, indirect and direct, in the order that they were added.

## Packages
_No packages._

## Plugins
### roc-plugin-react — [v1.0.0-beta.0](https://www.npmjs.com/package/roc-plugin-react)
Adds React support to Webpack and Roc
22 changes: 22 additions & 0 deletions extensions/roc-plugin-react-dev/docs/Hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Hooks for `roc-plugin-react-dev`

## Hooks
* [roc](#roc)
* [update-settings](#update-settings)

## roc

### update-settings

Expected to return new settings that should be merged with the existing ones.

Makes it possible to modify the settings object before a command is started and after potential arguments from the command line and configuration file have been parsed. This is a good point to default to some value if no was given or modify something in the settings.

__Initial value:__ _Nothing_
__Expected return value:__ `{}`

#### Arguments

| Name | Description | Type | Required | Can be empty |
| ----------- | ---------------------------------------------------------------------------- | ---------- | -------- | ------------ |
| getSettings | A function that returns the settings after the context has been initialized. | `Function` | No | |
10 changes: 10 additions & 0 deletions extensions/roc-plugin-react-dev/docs/Settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Settings for `roc-plugin-react-dev`

## Dev


### HotMiddleware

| Name | Description | Path | CLI option | Default | Type | Required | Can be empty | Extensions |
| ------ | ----------- | ------------------------ | -------------------------- | ------- | --------- | -------- | ------------ | -------------------- |
| reload | | dev.hotMiddleware.reload | --dev-hotMiddleware-reload | `false` | `Unknown` | No | Yes | roc-plugin-react-dev |
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"name": "roc-plugin-react-dev",
"description": "Adds React support to Webpack and Roc (Development)",
"author": "VG",
"license": "MIT",
"version": "1.0.0-alpha.3",
"version": "1.0.0-beta.0",
"main": "lib/index.js",
"scripts": {
"lint": "eslint .",
Expand All @@ -16,21 +14,30 @@
"roc",
"roc-plugin"
],
"repository": {
"type": "git",
"url": "https://github.com/rocjs/roc-plugin-react"
},
"repository": "https://github.com/rocjs/roc-plugin-react/tree/master/extensions/roc-plugin-react-dev",
"author": "Verdens Gang AS",
"contributors": [{
"name": "Gustaf Dalemar"
}],
"license": "MIT",
"dependencies": {
"roc-plugin-react": "1.0.0-alpha.3",
"roc-plugin-react": "1.0.0-beta.1",
"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.2.3"
},
"devDependencies": {
"babel-eslint": "~5.0.0",
"eslint": "~1.10.3",
"eslint-config-vgno": "~5.0.0"
"babel-eslint": "~6.1.2",
"eslint": "~3.0.1",
"eslint-config-airbnb-base": "~4.0.0",
"eslint-plugin-babel": "~3.3.0",
"eslint-plugin-import": "~1.10.2"
},
"roc": {
"packages": [
"./lib/index.js"
]
}
}
19 changes: 19 additions & 0 deletions extensions/roc-plugin-react-dev/src/roc/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import webpack from '../webpack';

export default {
plugins: [require.resolve('roc-plugin-react')],
config: {
settings: {
dev: {
hotMiddleware: {
reload: false,
},
},
},
},
actions: [{
hook: 'build-webpack',
description: 'Adds the needed Webpack configuration to be able to build and develop React code.',
action: webpack,
}],
};
30 changes: 30 additions & 0 deletions extensions/roc-plugin-react-dev/src/webpack/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export default ({ context: { config: { settings } }, previousValue: webpackConfig }) => (target) => () => {
const newWebpackConfig = { ...webpackConfig };
const DEV = settings.build.mode === 'dev';
const WEB = target === 'web';

/**
* Update babel configuration for React
*/
newWebpackConfig.babel.presets.push(require.resolve('babel-preset-react'));

if (DEV && WEB) {
newWebpackConfig.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')],
},
],
},
]);
}

return newWebpackConfig;
};
19 changes: 19 additions & 0 deletions extensions/roc-plugin-react/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "airbnb-base",

"parser": "babel-eslint",

plugins: ["eslint-plugin-babel"],

"rules": {
"indent": [2, 4, { "SwitchCase": 1 }],
"max-len": [2, 120, 4],
"no-warning-comments": 1,

"generator-star-spacing": 0,
"babel/generator-star-spacing": [2, { before: false, after: true }],

"import/order": [2, { "groups": ["builtin", "external", "internal", "parent", "sibling", "index"], "newlines-between": "always"}],
"import/newline-after-import": [2]
}
}
21 changes: 21 additions & 0 deletions extensions/roc-plugin-react/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Verdens Gang AS

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.
Loading