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 | ```
|
15 | yarn global add @creuna/cli
|
16 | ```
|
17 |
|
18 | or
|
19 |
|
20 | ```
|
21 | npm install -g @creuna/cli
|
22 | ```
|
23 |
|
24 | ### Usage
|
25 |
|
26 | Print help:
|
27 |
|
28 | ```
|
29 | creuna
|
30 | ```
|
31 |
|
32 | Run commands:
|
33 |
|
34 | ```
|
35 | creuna <command>
|
36 | ```
|
37 |
|
38 | ### Commands
|
39 |
|
40 | #### new \<relative-path>
|
41 |
|
42 | Creates 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 |
|
46 | Select and download components from the React component library.
|
47 |
|
48 | #### component \<name>
|
49 |
|
50 | Create empty React component in your components folder.
|
51 |
|
52 | #### page \<name> \<human-readable-name> \<group-name> \<url>
|
53 |
|
54 | Create 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 |
|
58 | Rename React component. Supports absolute path or path relative to `componentsPath`.
|
59 |
|
60 | #### stateful \<component-name>
|
61 |
|
62 | Convert React component to stateful. Supports absolute path or path relative to `componentsPath`
|
63 |
|
64 | #### stateless \<component-name>
|
65 |
|
66 | Convert React component to stateless if able to. Supports absolute path or path relative to `componentsPath`
|
67 |
|
68 | ### Notes
|
69 |
|
70 | All 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 | ```
|