Skip to content

Commit

Permalink
Merge pull request #482 from kool-dev/vanilla-node
Browse files Browse the repository at this point in the history
Fix nodejs preset + update docs
  • Loading branch information
fabriciojs authored Oct 29, 2023
2 parents 8fb1048 + fed2dd7 commit d9a915b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
23 changes: 15 additions & 8 deletions docs/2-Presets/NodeJS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ After installing Node.js, `kool create` automatically runs the `kool preset node
```bash
$ Preset nodejs is initializing!

? Which javascript package manager do you want to use [Use arrows to move, type to filter]
? Which Javascript package manager do you want to use [Use arrows to move, type to filter]
> npm
yarn
None

$ Preset nodejs initialized!
...
...

Preset nodejs created successfully!
```

Now, move into your new Node.js project:
Expand Down Expand Up @@ -65,18 +69,21 @@ To help get you started, **kool.yml** comes prebuilt with an initial set of scri
```yaml
scripts:
node: kool exec app node
npm: kool exec app npm # or yarn
npx: kool exec app npx

# npm - helpers for JS handling
npm: kool docker kooldev/node:20 npm
npx: kool docker kooldev/node:20 npx
setup:
- kool start
# - add more setup commands
- kool run npm install
reset:
- kool run npm install
```
Go ahead and run `kool run setup` to start your Docker environment and finish setting up your project:
Go ahead and run `kool run setup` to finish setting up your project and then `kool start` to start running the container:

```bash
$ kool run setup
$ kool start
```

> 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.
Expand Down
4 changes: 3 additions & 1 deletion presets/nodejs/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ tags: [ 'JS' ]

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

- name: 'Customize your setup'
actions:
- scripts:
- kool docker kooldev/node:20 npm init -f
- recipe: pick-node-pkg-mgr

0 comments on commit d9a915b

Please sign in to comment.