Skip to content

Commit d9a915b

Browse files
authored
Merge pull request #482 from kool-dev/vanilla-node
Fix nodejs preset + update docs
2 parents 8fb1048 + fed2dd7 commit d9a915b

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

docs/2-Presets/NodeJS.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ After installing Node.js, `kool create` automatically runs the `kool preset node
3232
```bash
3333
$ Preset nodejs is initializing!
3434

35-
? Which javascript package manager do you want to use [Use arrows to move, type to filter]
35+
? Which Javascript package manager do you want to use [Use arrows to move, type to filter]
3636
> npm
3737
yarn
38+
None
3839

39-
$ Preset nodejs initialized!
40+
...
41+
...
42+
43+
Preset nodejs created successfully!
4044
```
4145

4246
Now, move into your new Node.js project:
@@ -65,18 +69,21 @@ To help get you started, **kool.yml** comes prebuilt with an initial set of scri
6569
```yaml
6670
scripts:
6771
node: kool exec app node
68-
npm: kool exec app npm # or yarn
69-
npx: kool exec app npx
70-
72+
# npm - helpers for JS handling
73+
npm: kool docker kooldev/node:20 npm
74+
npx: kool docker kooldev/node:20 npx
7175
setup:
72-
- kool start
73-
# - add more setup commands
76+
- kool run npm install
77+
reset:
78+
- kool run npm install
7479
```
7580
76-
Go ahead and run `kool run setup` to start your Docker environment and finish setting up your project:
81+
Go ahead and run `kool run setup` to finish setting up your project and then `kool start` to start running the container:
7782

7883
```bash
7984
$ kool run setup
85+
86+
$ kool start
8087
```
8188

8289
> As you can see in **kool.yml**, the `setup` script will do the following in sequence: run the `kool start` command to spin up your Docker environment using **docker-compose.yml** (which includes a `command` to automatically run `node app.js`); and then run any additional commands you add to the list.

presets/nodejs/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ tags: [ 'JS' ]
33

44
# Create defines the workflow for creating a new Project where this preset can then be installed
55
create:
6-
- name: Creating new Laravel Application
6+
- name: Creating new Node application
77
actions:
88
- scripts:
99
- mkdir $CREATE_DIRECTORY
@@ -20,4 +20,6 @@ preset:
2020

2121
- name: 'Customize your setup'
2222
actions:
23+
- scripts:
24+
- kool docker kooldev/node:20 npm init -f
2325
- recipe: pick-node-pkg-mgr

0 commit comments

Comments
 (0)