File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,10 +31,10 @@ addTest ... ok (6ms)
3131ok | 1 passed | 0 failed (29ms)
3232```
3333
34- This subcommand will create two files (` main.ts ` and ` main_test.ts ` ). These
35- files provide a basic example of how to write a Deno program and how to write
36- tests for it. The ` main.ts ` file exports a ` add ` function that adds two numbers
37- together and the ` main_test.ts ` file contains a test for this function.
34+ The ` init ` subcommand will create two files (` main.ts ` and ` main_test.ts ` ).
35+ These files provide a basic example of how to write a Deno program and how to
36+ write tests for it. The ` main.ts ` file exports a ` add ` function that adds two
37+ numbers together and the ` main_test.ts ` file contains a test for this function.
3838
3939You can also specify an argument to ` deno init ` to initialize a project in a
4040specific directory:
@@ -141,3 +141,30 @@ Task dev deno serve --watch -R main.ts
141141Watcher Process started.
142142deno serve: Listening on http://0.0.0.0:8000/
143143```
144+
145+ ## Generate a library project
146+
147+ You can append a ` --lib ` flag to add extra parameters to your ` deno.json ` , such
148+ as "name", "version" and an "exports" fields.
149+
150+ ``` sh
151+ $ deno init my_deno_project --lib
152+ ✅ Project initialized
153+ ```
154+
155+ The resulting `deno.json will be as follows:
156+
157+ ``` jsonc
158+ {
159+ " name" : " my_deno_project" ,
160+ " version" : " 0.1.0" ,
161+ " exports" : " ./mod.ts" ,
162+ " tasks" : {
163+ " dev" : " deno test --watch mod.ts"
164+ },
165+ " license" : " MIT" ,
166+ " imports" : {
167+ " @std/assert" : " jsr:@std/assert@1"
168+ }
169+ }
170+ ```
You can’t perform that action at this time.
0 commit comments