diff --git a/.editorconfig b/.editorconfig index c380e58..3310f9a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.travis.yml b/.travis.yml index 7afc640..b845a4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/LICENSE b/LICENSE index ed56f05..3eedbdf 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index 149e0c5..161376e 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/packages/roc-plugin-react-dev/.eslintignore b/extensions/roc-plugin-react-dev/.eslintignore similarity index 100% rename from packages/roc-plugin-react-dev/.eslintignore rename to extensions/roc-plugin-react-dev/.eslintignore diff --git a/extensions/roc-plugin-react-dev/.eslintrc b/extensions/roc-plugin-react-dev/.eslintrc new file mode 100644 index 0000000..ff84d20 --- /dev/null +++ b/extensions/roc-plugin-react-dev/.eslintrc @@ -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] + } +} diff --git a/extensions/roc-plugin-react-dev/LICENSE b/extensions/roc-plugin-react-dev/LICENSE new file mode 100644 index 0000000..3eedbdf --- /dev/null +++ b/extensions/roc-plugin-react-dev/LICENSE @@ -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. diff --git a/extensions/roc-plugin-react-dev/README.md b/extensions/roc-plugin-react-dev/README.md new file mode 100644 index 0000000..49abdc2 --- /dev/null +++ b/extensions/roc-plugin-react-dev/README.md @@ -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)_ diff --git a/extensions/roc-plugin-react-dev/docs/Actions.md b/extensions/roc-plugin-react-dev/docs/Actions.md new file mode 100644 index 0000000..a3c16d3 --- /dev/null +++ b/extensions/roc-plugin-react-dev/docs/Actions.md @@ -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 diff --git a/extensions/roc-plugin-react-dev/docs/Commands.md b/extensions/roc-plugin-react-dev/docs/Commands.md new file mode 100644 index 0000000..b52c6f6 --- /dev/null +++ b/extensions/roc-plugin-react-dev/docs/Commands.md @@ -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 +``` +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 + diff --git a/extensions/roc-plugin-react-dev/docs/Configuration.md b/extensions/roc-plugin-react-dev/docs/Configuration.md new file mode 100644 index 0000000..c7c6bb5 --- /dev/null +++ b/extensions/roc-plugin-react-dev/docs/Configuration.md @@ -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.__ diff --git a/extensions/roc-plugin-react-dev/docs/Dependencies.md b/extensions/roc-plugin-react-dev/docs/Dependencies.md new file mode 100644 index 0000000..05b83e3 --- /dev/null +++ b/extensions/roc-plugin-react-dev/docs/Dependencies.md @@ -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. diff --git a/extensions/roc-plugin-react-dev/docs/Extensions.md b/extensions/roc-plugin-react-dev/docs/Extensions.md new file mode 100644 index 0000000..e919d80 --- /dev/null +++ b/extensions/roc-plugin-react-dev/docs/Extensions.md @@ -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 diff --git a/extensions/roc-plugin-react-dev/docs/Hooks.md b/extensions/roc-plugin-react-dev/docs/Hooks.md new file mode 100644 index 0000000..c3c475b --- /dev/null +++ b/extensions/roc-plugin-react-dev/docs/Hooks.md @@ -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 | | diff --git a/extensions/roc-plugin-react-dev/docs/Settings.md b/extensions/roc-plugin-react-dev/docs/Settings.md new file mode 100644 index 0000000..ada2c0f --- /dev/null +++ b/extensions/roc-plugin-react-dev/docs/Settings.md @@ -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 | diff --git a/packages/roc-plugin-react-dev/package.json b/extensions/roc-plugin-react-dev/package.json similarity index 53% rename from packages/roc-plugin-react-dev/package.json rename to extensions/roc-plugin-react-dev/package.json index 0c8ce57..5452618 100644 --- a/packages/roc-plugin-react-dev/package.json +++ b/extensions/roc-plugin-react-dev/package.json @@ -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 .", @@ -16,12 +14,14 @@ "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", @@ -29,8 +29,15 @@ "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" + ] } } diff --git a/packages/roc-plugin-react-dev/src/index.js b/extensions/roc-plugin-react-dev/src/index.js similarity index 100% rename from packages/roc-plugin-react-dev/src/index.js rename to extensions/roc-plugin-react-dev/src/index.js diff --git a/extensions/roc-plugin-react-dev/src/roc/index.js b/extensions/roc-plugin-react-dev/src/roc/index.js new file mode 100644 index 0000000..7ec1804 --- /dev/null +++ b/extensions/roc-plugin-react-dev/src/roc/index.js @@ -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, + }], +}; diff --git a/extensions/roc-plugin-react-dev/src/webpack/index.js b/extensions/roc-plugin-react-dev/src/webpack/index.js new file mode 100644 index 0000000..d9ee31e --- /dev/null +++ b/extensions/roc-plugin-react-dev/src/webpack/index.js @@ -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; +}; diff --git a/packages/roc-plugin-react/.eslintignore b/extensions/roc-plugin-react/.eslintignore similarity index 100% rename from packages/roc-plugin-react/.eslintignore rename to extensions/roc-plugin-react/.eslintignore diff --git a/extensions/roc-plugin-react/.eslintrc b/extensions/roc-plugin-react/.eslintrc new file mode 100644 index 0000000..a8942a6 --- /dev/null +++ b/extensions/roc-plugin-react/.eslintrc @@ -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] + } +} diff --git a/extensions/roc-plugin-react/LICENSE b/extensions/roc-plugin-react/LICENSE new file mode 100644 index 0000000..3eedbdf --- /dev/null +++ b/extensions/roc-plugin-react/LICENSE @@ -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. diff --git a/extensions/roc-plugin-react/README.md b/extensions/roc-plugin-react/README.md new file mode 100644 index 0000000..464195d --- /dev/null +++ b/extensions/roc-plugin-react/README.md @@ -0,0 +1,15 @@ +# roc-plugin-react + +Adds React support to Webpack and Roc + +## 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)_ diff --git a/extensions/roc-plugin-react/docs/Actions.md b/extensions/roc-plugin-react/docs/Actions.md new file mode 100644 index 0000000..cba5dc1 --- /dev/null +++ b/extensions/roc-plugin-react/docs/Actions.md @@ -0,0 +1,3 @@ +# Actions for `roc-plugin-react` + +__No actions available.__ diff --git a/extensions/roc-plugin-react/docs/Commands.md b/extensions/roc-plugin-react/docs/Commands.md new file mode 100644 index 0000000..63b4fd6 --- /dev/null +++ b/extensions/roc-plugin-react/docs/Commands.md @@ -0,0 +1,60 @@ +# Commands for `roc-plugin-react` + +## 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 +``` +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 + diff --git a/extensions/roc-plugin-react/docs/Configuration.md b/extensions/roc-plugin-react/docs/Configuration.md new file mode 100644 index 0000000..4085399 --- /dev/null +++ b/extensions/roc-plugin-react/docs/Configuration.md @@ -0,0 +1,5 @@ +# Config for `roc-plugin-react` + +Configuration that can be defined in `roc.config.js`, other than settings and project. + +__No config available.__ diff --git a/extensions/roc-plugin-react/docs/Dependencies.md b/extensions/roc-plugin-react/docs/Dependencies.md new file mode 100644 index 0000000..2f37f3d --- /dev/null +++ b/extensions/roc-plugin-react/docs/Dependencies.md @@ -0,0 +1,20 @@ +# Dependencies for `roc-plugin-react` + +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. diff --git a/extensions/roc-plugin-react/docs/Extensions.md b/extensions/roc-plugin-react/docs/Extensions.md new file mode 100644 index 0000000..ae6985e --- /dev/null +++ b/extensions/roc-plugin-react/docs/Extensions.md @@ -0,0 +1,9 @@ +# Extensions for `roc-plugin-react` + +The extensions that are used in the project, indirect and direct, in the order that they were added. + +## Packages +_No packages._ + +## Plugins +_No plugins._ diff --git a/extensions/roc-plugin-react/docs/Hooks.md b/extensions/roc-plugin-react/docs/Hooks.md new file mode 100644 index 0000000..76eab0e --- /dev/null +++ b/extensions/roc-plugin-react/docs/Hooks.md @@ -0,0 +1,22 @@ +# Hooks for `roc-plugin-react` + +## 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 | | diff --git a/extensions/roc-plugin-react/docs/Settings.md b/extensions/roc-plugin-react/docs/Settings.md new file mode 100644 index 0000000..aee5236 --- /dev/null +++ b/extensions/roc-plugin-react/docs/Settings.md @@ -0,0 +1,3 @@ +# Settings for `roc-plugin-react` + +__No settings available.__ diff --git a/extensions/roc-plugin-react/package.json b/extensions/roc-plugin-react/package.json new file mode 100644 index 0000000..9d3d629 --- /dev/null +++ b/extensions/roc-plugin-react/package.json @@ -0,0 +1,40 @@ +{ + "name": "roc-plugin-react", + "description": "Adds React support to Webpack and Roc", + "version": "1.0.0-beta.0", + "main": "lib/index.js", + "scripts": { + "lint": "eslint .", + "test": "npm run lint" + }, + "files": [ + "lib" + ], + "keywords": [ + "roc", + "roc-plugin" + ], + "repository": "https://github.com/rocjs/roc-plugin-react/tree/master/extensions/roc-plugin-react", + "author": "Verdens Gang AS", + "contributors": [{ + "name": "Gustaf Dalemar" + }], + "license": "MIT", + "dependencies": { + "react": "~15.0.1", + "react-dom": "~15.0.1", + "roc": "1.0.0-rc.11" + }, + "devDependencies": { + "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" + ] + } +} diff --git a/extensions/roc-plugin-react/src/index.js b/extensions/roc-plugin-react/src/index.js new file mode 100644 index 0000000..5ed0e86 --- /dev/null +++ b/extensions/roc-plugin-react/src/index.js @@ -0,0 +1 @@ +export roc from './roc'; diff --git a/extensions/roc-plugin-react/src/roc/index.js b/extensions/roc-plugin-react/src/roc/index.js new file mode 100644 index 0000000..302a2a6 --- /dev/null +++ b/extensions/roc-plugin-react/src/roc/index.js @@ -0,0 +1,12 @@ +import { generateDependencies } from 'roc'; + +const packageJSON = require('../../package.json'); + +export default { + dependencies: { + exports: generateDependencies(packageJSON, [ + 'react', + 'react-dom', + ]), + }, +}; diff --git a/package.json b/package.json index 45b0dd6..a33507b 100644 --- a/package.json +++ b/package.json @@ -3,13 +3,15 @@ "private": true, "license": "MIT", "scripts": { + "start": "rid", "rid": "rid", "build": "rid build", "lint": "rid lint:alias", "link": "rid link", + "link:all": "rid link roc", "test": "npm run lint" }, "devDependencies": { - "@rocjs/roc-internal-dev": "^1.0.0" + "@rocjs/roc-internal-dev": "^2.0.0" } } diff --git a/packages/roc-plugin-react-dev/.eslintrc b/packages/roc-plugin-react-dev/.eslintrc deleted file mode 100644 index 811e6a8..0000000 --- a/packages/roc-plugin-react-dev/.eslintrc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "vgno", - - "parser": "babel-eslint", - - "env": { - "es6": true - }, - - "ecmaFeatures": { - "modules": true - } -} diff --git a/packages/roc-plugin-react-dev/README.md b/packages/roc-plugin-react-dev/README.md deleted file mode 100644 index 82e4599..0000000 --- a/packages/roc-plugin-react-dev/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# 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) diff --git a/packages/roc-plugin-react-dev/docs/Actions.md b/packages/roc-plugin-react-dev/docs/Actions.md deleted file mode 100644 index dea88e2..0000000 --- a/packages/roc-plugin-react-dev/docs/Actions.md +++ /dev/null @@ -1,21 +0,0 @@ -# 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` diff --git a/packages/roc-plugin-react-dev/docs/Commands.md b/packages/roc-plugin-react-dev/docs/Commands.md deleted file mode 100644 index bdd77ee..0000000 --- a/packages/roc-plugin-react-dev/docs/Commands.md +++ /dev/null @@ -1 +0,0 @@ -No commands available. \ No newline at end of file diff --git a/packages/roc-plugin-react-dev/docs/Hooks.md b/packages/roc-plugin-react-dev/docs/Hooks.md deleted file mode 100644 index 8298515..0000000 --- a/packages/roc-plugin-react-dev/docs/Hooks.md +++ /dev/null @@ -1 +0,0 @@ -No hooks available. \ No newline at end of file diff --git a/packages/roc-plugin-react-dev/docs/Settings.md b/packages/roc-plugin-react-dev/docs/Settings.md deleted file mode 100644 index 3c1f637..0000000 --- a/packages/roc-plugin-react-dev/docs/Settings.md +++ /dev/null @@ -1,9 +0,0 @@ -# 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 | diff --git a/packages/roc-plugin-react-dev/roc.config.js b/packages/roc-plugin-react-dev/roc.config.js deleted file mode 100644 index 2d0a4b0..0000000 --- a/packages/roc-plugin-react-dev/roc.config.js +++ /dev/null @@ -1,6 +0,0 @@ -const path = require('path'); - -// Makes it possible for use to generate documentation for this package. -module.exports = { - packages: [path.join(__dirname, 'lib', 'index.js')] -}; diff --git a/packages/roc-plugin-react-dev/src/builder/index.js b/packages/roc-plugin-react-dev/src/builder/index.js deleted file mode 100644 index c66e741..0000000 --- a/packages/roc-plugin-react-dev/src/builder/index.js +++ /dev/null @@ -1,45 +0,0 @@ -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 - }; -}; diff --git a/packages/roc-plugin-react-dev/src/roc/index.js b/packages/roc-plugin-react-dev/src/roc/index.js deleted file mode 100644 index ee5dc05..0000000 --- a/packages/roc-plugin-react-dev/src/roc/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import { name } from './util'; -import builder from '../builder'; - -export default { - name, - config: { - settings: { - dev: { - hotMiddleware: { - reload: false - } - } - } - }, - actions: { - react: { - hook: 'build-webpack', - action: builder - } - } -}; diff --git a/packages/roc-plugin-react-dev/src/roc/util.js b/packages/roc-plugin-react-dev/src/roc/util.js deleted file mode 100644 index fd74b92..0000000 --- a/packages/roc-plugin-react-dev/src/roc/util.js +++ /dev/null @@ -1,4 +0,0 @@ -/** - * The name of the package, for easy consumption. - */ -export const name = require('../../package.json').name; diff --git a/packages/roc-plugin-react/.eslintrc b/packages/roc-plugin-react/.eslintrc deleted file mode 100644 index 811e6a8..0000000 --- a/packages/roc-plugin-react/.eslintrc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "vgno", - - "parser": "babel-eslint", - - "env": { - "es6": true - }, - - "ecmaFeatures": { - "modules": true - } -} diff --git a/packages/roc-plugin-react/README.md b/packages/roc-plugin-react/README.md deleted file mode 100644 index 5eac8fa..0000000 --- a/packages/roc-plugin-react/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# 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) diff --git a/packages/roc-plugin-react/docs/Actions.md b/packages/roc-plugin-react/docs/Actions.md deleted file mode 100644 index 2c00ac5..0000000 --- a/packages/roc-plugin-react/docs/Actions.md +++ /dev/null @@ -1,12 +0,0 @@ -# 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` diff --git a/packages/roc-plugin-react/docs/Commands.md b/packages/roc-plugin-react/docs/Commands.md deleted file mode 100644 index bdd77ee..0000000 --- a/packages/roc-plugin-react/docs/Commands.md +++ /dev/null @@ -1 +0,0 @@ -No commands available. \ No newline at end of file diff --git a/packages/roc-plugin-react/docs/Hooks.md b/packages/roc-plugin-react/docs/Hooks.md deleted file mode 100644 index 8298515..0000000 --- a/packages/roc-plugin-react/docs/Hooks.md +++ /dev/null @@ -1 +0,0 @@ -No hooks available. \ No newline at end of file diff --git a/packages/roc-plugin-react/docs/Settings.md b/packages/roc-plugin-react/docs/Settings.md deleted file mode 100644 index 0d5cd50..0000000 --- a/packages/roc-plugin-react/docs/Settings.md +++ /dev/null @@ -1 +0,0 @@ -No settings available. \ No newline at end of file diff --git a/packages/roc-plugin-react/package.json b/packages/roc-plugin-react/package.json deleted file mode 100644 index 97c8a6d..0000000 --- a/packages/roc-plugin-react/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "roc-plugin-react", - "description": "Adds React support to Webpack and Roc", - "author": "VG", - "license": "MIT", - "version": "1.0.0-alpha.3", - "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": "~15.0.1", - "react-dom": "~15.0.1" - }, - "devDependencies": { - "babel-eslint": "~5.0.0", - "eslint": "~1.10.3", - "eslint-config-vgno": "~5.0.0" - } -} diff --git a/packages/roc-plugin-react/roc.config.js b/packages/roc-plugin-react/roc.config.js deleted file mode 100644 index 2d0a4b0..0000000 --- a/packages/roc-plugin-react/roc.config.js +++ /dev/null @@ -1,6 +0,0 @@ -const path = require('path'); - -// Makes it possible for use to generate documentation for this package. -module.exports = { - packages: [path.join(__dirname, 'lib', 'index.js')] -}; diff --git a/packages/roc-plugin-react/src/index.js b/packages/roc-plugin-react/src/index.js deleted file mode 100644 index 4e03014..0000000 --- a/packages/roc-plugin-react/src/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export roc from './roc'; - -export resolvePath from './resolver'; diff --git a/packages/roc-plugin-react/src/resolver/index.js b/packages/roc-plugin-react/src/resolver/index.js deleted file mode 100644 index e17f543..0000000 --- a/packages/roc-plugin-react/src/resolver/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import { join } from 'path'; - -const resolvePath = join(__dirname, '..', '..', 'node_modules'); - -export default resolvePath; diff --git a/packages/roc-plugin-react/src/roc/index.js b/packages/roc-plugin-react/src/roc/index.js deleted file mode 100644 index 7d832a1..0000000 --- a/packages/roc-plugin-react/src/roc/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { name } from './util'; -import resolvePath from '../resolver'; - -export default { - name, - actions: { - react: { - extension: 'roc-plugin-start', - hook: 'get-resolve-paths', - action: () => () => () => () => resolvePath - } - } -}; diff --git a/packages/roc-plugin-react/src/roc/util.js b/packages/roc-plugin-react/src/roc/util.js deleted file mode 100644 index fd74b92..0000000 --- a/packages/roc-plugin-react/src/roc/util.js +++ /dev/null @@ -1,4 +0,0 @@ -/** - * The name of the package, for easy consumption. - */ -export const name = require('../../package.json').name;