UNPKG

2.33 kBMarkdownView Raw
1# ![Creuna CLI](source/creuna.png?raw=true "Creuna CLI")
2
3[![npm version](https://img.shields.io/npm/v/@creuna/cli.svg?style=flat)](https://www.npmjs.com/package/@creuna/cli)
4[![Travis status](https://travis-ci.org/Creuna-Oslo/cli.svg?branch=master)](https://travis-ci.org/Creuna-Oslo/cli)
5
6`@creuna/cli` provides a unified interface for:
7
8- [create-react-app](https://github.com/Creuna-Oslo/create-react-app)
9- [react-scripts](https://github.com/Creuna-Oslo/react-scripts)
10- [react-components](https://github.com/Creuna-Oslo/react-components)
11
12### Install
13
14```
15yarn global add @creuna/cli
16```
17
18or
19
20```
21npm install -g @creuna/cli
22```
23
24### Usage
25
26Print help:
27
28```
29creuna
30```
31
32Run commands:
33
34```
35creuna <command>
36```
37
38### Commands
39
40#### new \<relative-path>
41
42Creates a new React app in the **current working directory**. If a `path` is provided, files will be written to this path, **relative** to the current working directory
43
44#### lib
45
46Select and download components from the React component library.
47
48#### component \<name>
49
50Create empty React component in your components folder.
51
52#### page \<name> \<human-readable-name> \<group-name> \<url>
53
54Create empty static site page component in your static site pages folder (Useful if you're working with an app created with the `new` command)
55
56#### rename \<old-name> \<new-name>
57
58Rename React component. Supports absolute path or path relative to `componentsPath`.
59
60#### stateful \<component-name>
61
62Convert React component to stateful. Supports absolute path or path relative to `componentsPath`
63
64#### stateless \<component-name>
65
66Convert React component to stateless if able to. Supports absolute path or path relative to `componentsPath`
67
68### Notes
69
70All commands except `creuna new` support a `.creunarc.json` in your project root. Having this file ensures that components are always added to the correct folder, regardless of your current directory (within the project of course). The boilerplate app created by `creuna new` includes this file. `dataFileExtension` and `dataFileContent` control the static data file generated by the `creuna page` command.
71
72#### .creunarc.json
73
74```json
75{
76 "componentsPath": "relative/path/to/components",
77 "staticSitePath": "relative/path/to/static/site/pages",
78 "dataFileExtension": "js",
79 "dataFileContent": "export default { a: 'a' };"
80}
81```