likec4 0.42.0 → 0.42.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,152 @@
1
1
  # LikeC4
2
2
 
3
- ...
3
+ `likec4` is a CLI tool for various operations and automation over LikeC4 projects.
4
+
5
+ Features:
6
+
7
+ - preview diagrams in a local web server (with fast hot-reload on changes)
8
+ - build a static website for sharing and embedding diagrams
9
+ - export to PNG, Mermaid, Dot, D2
10
+ - generate React components
11
+
12
+ ## Install
13
+
14
+ > **Compatibility Note:**
15
+ > LikeC4 requires [Node.js](https://nodejs.org/en/) version 18+, 20+
16
+
17
+ ### Local installation
18
+
19
+ If you're using it in an npm project, install it as a development dependency:
20
+
21
+ ```sh
22
+ npm install --save-dev likec4
23
+ ```
24
+
25
+ You can reference it directly in the `package.json#scripts` object:
26
+
27
+ ```json5
28
+ {
29
+ scripts: {
30
+ dev: 'likec4 serve ...',
31
+ build: 'likec4 build ...'
32
+ }
33
+ }
34
+ ```
35
+
36
+ > **Template:**
37
+ > Check out the template repository [likec4/template](https://github.com/likec4/template)
38
+ > with pre-configured CI for building and deploying to github pages.
39
+
40
+ To use the binary, you can call it with [`npx`](https://docs.npmjs.com/cli/v10/commands/npx) while in the project directory:
41
+
42
+ ```sh
43
+ npx likec4 ...
44
+ ```
45
+
46
+ ### Global installation
47
+
48
+ If you want to use it in any arbitrary project without [`npx`](https://docs.npmjs.com/cli/v10/commands/npx), install it globally:
49
+
50
+ ```sh
51
+ npm install --global likec4
52
+ ```
53
+
54
+ Then, you can call `likec4` directly:
55
+
56
+ ```sh
57
+ likec4 ...
58
+ ```
59
+
60
+ ## Usage
61
+
62
+ > Refer to the help:
63
+ >
64
+ > ```sh
65
+ > likec4 build -h
66
+ > likec4 codegen react -h
67
+ > ```
68
+ >
69
+ > Almost all commands have a `--help` option and provide usage examples.
70
+
71
+ ### Preview diagrams
72
+
73
+ In a folder with LikeC4 sources:
74
+
75
+ ```sh
76
+ likec4 serve
77
+
78
+ # Aliases:
79
+ likec4 start
80
+ likec4 dev
81
+ ```
82
+
83
+ This recursively searchs for `*.c4`, `*.likec4` files in current folder, parses and serves diagrams in a local web server.
84
+ Any changes in the sources trigger a super-fast hot update and you see changes in the browser immediately.
85
+
86
+ > **Tip:**
87
+ > You can use `likec4 serve [path]` in a separate terminal window and keep it running while you're editing diagrams in editor, or even serve multiple projects at once.
88
+
89
+ ### Build static website
90
+
91
+ Example [https://template.likec4.dev](https://template.likec4.dev/view/cloud)
92
+ Build a single-page application with all diagrams:
93
+
94
+ ```sh
95
+ likec4 build -o ./dist
96
+ ```
97
+
98
+ When you deploy the website, you can use "Share" button to get a link to a specific diagram.
99
+
100
+ > **Tip:**
101
+ > [likec4/template](https://github.com/likec4/template) repository demonstrates how to deploy to github pages.
102
+
103
+ There is also a supplementary command to preview the build:
104
+
105
+ ```sh
106
+ likec4 preview -o ./dist
107
+ ```
108
+
109
+ ### Export to PNG
110
+
111
+ ```sh
112
+ likec4 export png -o ./assets
113
+ ```
114
+
115
+ This command starts temporary local web server and uses [Playwright](https://playwright.dev/) to take screenshots of diagrams.
116
+
117
+ ### Export to Mermaid, Dot, D2
118
+
119
+ Export to various formats via codegen:
120
+
121
+ ```sh
122
+ likec4 codegen mmd
123
+ likec4 codegen mermaid
124
+ likec4 codegen dot
125
+ likec4 codegen d2
126
+ ```
127
+
128
+ ### Generate React components
129
+
130
+ ```sh
131
+ likec4 codegen react --outfile ./src/likec4.generated.tsx
132
+ ```
133
+
134
+ > Output file should have `.tsx` extension
135
+ > By default, it generates `likec4.generated.tsx` in current directory
136
+
137
+ ### Generate structured data
138
+
139
+ ```sh
140
+ likec4 codegen views-data --outfile ./src/likec4.generated.ts
141
+
142
+ #Aliases
143
+ likec4 codegen views ...
144
+ likec4 codegen ts ...
145
+ ```
146
+
147
+ > Output file should have `.ts` extension
148
+ > By default, it generates `likec4.generated.ts` in current directory
149
+
150
+ ## Support
151
+
152
+ If there's a problem you're encountering or something you need help with, don't hesitate to take advantage of my [_Priority Support_ service](https://github.com/sponsors/davydkov) where you can ask me questions in an exclusive forum. I'm well equppied to assist you with this project and would be happy to help you out! 🙂
@@ -1,5 +1,5 @@
1
1
  export function isElementRef(expr) {
2
- return "element" in expr && "isDescedants" in expr;
2
+ return "element" in expr;
3
3
  }
4
4
  export function isWildcard(expr) {
5
5
  return "wildcard" in expr;