Function
| Static Public Summary | ||
| public |
addTrailingSlash(path: string): string Adds a trailing slashes to a path. |
|
| public |
Cleans a directory |
|
| public |
createBuilder(target: string, rocBuilder: rocBuilder, resolver: string): rocBuilder Creates a builder. |
|
| public |
createServer(options: rocServerOptions, beforeUserMiddlewares: Function[]): rocServer Creates a server instance. |
|
| public |
getBuilder(debug: boolean, target: string, createBuilders: function | array | object, extensionCreateBuilders: object | array): rocBuilder Gets the final rocBuilder object.. |
|
| public |
getDevPath(relativeBuildPath: string): string Returns the current dev path. |
|
| public |
getDevPort(): number Returns the current dev port. |
|
| public |
Returns the current port. |
|
| public |
getResolvePath(resolvePaths: ...string): string Used on the server to find all dependecies. |
|
| public |
listSettings(rocCommandObject: object) List the settings that are possible with the current extensions. |
|
| public |
markdownSettings(rocCommandObject: object) List the settings that are possible with the current extensions in a markdown format. |
|
| public |
middlewares(config: object): array Returns the middlewares to be used |
|
| public |
removeTrailingSlash(path: string): string Removes possible trailing slashes from a path. |
|
| public |
Build runner. |
|
| public |
Development runner. |
|
| public |
Starts a Roc application. |
|
| public |
watchClient(compiler: object): Promise Client watcher. |
|
| public |
watchServer(compiler: object): Promise Server watcher. |
|
Static Public
public addTrailingSlash(path: string): string source
import {addTrailingSlash} from 'roc-web/lib/helpers/general.js'Adds a trailing slashes to a path.
Runs removeTrailingSlash internally first.
Params:
| Name | Type | Attribute | Description |
| path | string | Path to add a trailing slashes to. |
public clean(path: string): Promise source
import clean from 'roc-web/lib/builder/utils/clean.js'Cleans a directory
Params:
| Name | Type | Attribute | Description |
| path | string | A directory that should be cleaned |
public createBuilder(target: string, rocBuilder: rocBuilder, resolver: string): rocBuilder source
import createBuilder from 'roc-web/lib/builder/index.js'Creates a builder.
Params:
| Name | Type | Attribute | Description |
| target | string |
|
a target: should be either "client" or "server" |
| rocBuilder | rocBuilder | A rocBuilder to base everything on. |
|
| resolver | string |
|
Path to the resolver for the server side getResolvePath |
public createServer(options: rocServerOptions, beforeUserMiddlewares: Function[]): rocServer source
import createServer from 'roc-web/src/app/server/index.js'Creates a server instance.
Params:
| Name | Type | Attribute | Description |
| options | rocServerOptions | Options for the server. Will override configuration in roc.config.js. |
|
| beforeUserMiddlewares | Function[] | Middlewares that should be added before the user middlewares. |
Example:
import { createServer } from 'roc-web/app';
const server = createServer({
serve: 'static',
favicon: 'static/favicon.png'
});
server.start();
public getBuilder(debug: boolean, target: string, createBuilders: function | array | object, extensionCreateBuilders: object | array): rocBuilder source
import {getBuilder} from 'roc-web/lib/helpers/plugin-managment.js'Gets the final rocBuilder object..
Params:
| Name | Type | Attribute | Description |
| debug | boolean | If the command should run in debug mode |
|
| target | string | What target the builder should be configured against |
|
| createBuilders | function | array | object | The createBuilders defined in the configuration. See documentation for more information on what it can be. |
|
| extensionCreateBuilders | object | array | The createBuilders defined in the extensions. Should most often be an object. |
public getDevPath(relativeBuildPath: string): string source
import {getDevPath} from 'roc-web/lib/helpers/general.js'Returns the current dev path.
Will use getDevPort for getting the port.
Params:
| Name | Type | Attribute | Description |
| relativeBuildPath | string |
|
Relative path to where the build is saved. |
public getDevPort(): number source
import {getDevPort} from 'roc-web/lib/helpers/general.js'Returns the current dev port.
It will first default to the environment variable DEV_PORT and after that roc.config.js.
Will give a warning if DEV_PORT is defined and the value in the configuration is something other than default.
public getPort(): number source
import {getPort} from 'roc-web/lib/helpers/general.js'Returns the current port.
It will first default to the environment variable PORT and after that roc.config.js.
Will give a warning if PORT is defined and the value in the configuration is something other than default.
public getResolvePath(resolvePaths: ...string): string source
import getResolvePath from 'roc-web/lib/helpers/get-resolve-path.js'Used on the server to find all dependecies.
When creating a extension of this project this needs to be extended.
Params:
| Name | Type | Attribute | Description |
| resolvePaths | ...string | Paths to be resolved. |
Example:
import path from 'path';
import { getResolvePath } from 'roc-web';
export default function(...resolvePaths) {
return getResolvePath(path.join(__dirname, '..', 'node_modules'), ...resolvePaths);
}
public listSettings(rocCommandObject: object) source
import {listSettings} from 'roc-web/lib/commands/index.js'List the settings that are possible with the current extensions.
Params:
| Name | Type | Attribute | Description |
| rocCommandObject | object | A command object |
public markdownSettings(rocCommandObject: object) source
import {markdownSettings} from 'roc-web/lib/commands/index.js'List the settings that are possible with the current extensions in a markdown format.
Params:
| Name | Type | Attribute | Description |
| rocCommandObject | object | A command object |
public middlewares(config: object): array source
import middlewares from 'roc-web/src/app/server/middlewares.js'Returns the middlewares to be used
Params:
| Name | Type | Attribute | Description |
| config | object | A roc config object. |
Return:
| array | A array with middlewares to use. |
public removeTrailingSlash(path: string): string source
import {removeTrailingSlash} from 'roc-web/lib/helpers/general.js'Removes possible trailing slashes from a path.
Params:
| Name | Type | Attribute | Description |
| path | string | Path to remove possible trailing slashes. |
public runBuild(rocCommandObject: object): Promise source
import runBuild from 'roc-web/lib/commands/build.js'Build runner.
Helper for building an application.
Params:
| Name | Type | Attribute | Description |
| rocCommandObject | object | A command object |
public runDev(rocCommandObject: object) source
import runDev from 'roc-web/lib/commands/dev.js'Development runner.
Helper for starting an application in watch mode.
Params:
| Name | Type | Attribute | Description |
| rocCommandObject | object | A command object |
public start(rocCommandObject: object) source
import start from 'roc-web/lib/commands/start.js'Starts a Roc application.
Params:
| Name | Type | Attribute | Description |
| rocCommandObject | object | A command object |
public watchClient(compiler: object): Promise source
import watchClient from 'roc-web/lib/runtime/watch-client.js'Client watcher.
Params:
| Name | Type | Attribute | Description |
| compiler | object | Webpack compiler instance. |