Skip to content

Commit

Permalink
Merge pull request #1182 from kethinov/0.20.1
Browse files Browse the repository at this point in the history
0.20.1
  • Loading branch information
kethinov authored Jul 29, 2022
2 parents ce620fc + 430a9bf commit a4f9a28
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 76 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

- Some error message copyediting.

## 0.20.1

- `makeBuildArtifacts` will now accept a new value of `'staticsOnly'` which will allow Roosevelt to create static files but skip the creation of the MVC directories.
- `initServer` can now also be called as `init` instead.
- Various dependencies updated.

## 0.20.0

- Renamed `generateFolderStructure` to `makeBuildArtifacts`.
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Some notable features:
- [Create and run a Roosevelt app](https://github.com/rooseveltframework/roosevelt#create-and-run-a-roosevelt-app)
- [Using the Roosevelt app generator](https://github.com/rooseveltframework/roosevelt#using-the-roosevelt-app-generator)
- [Create a Roosevelt app manually](https://github.com/rooseveltframework/roosevelt#create-a-roosevelt-app-manually)
- [Use Roosevelt as a static site generator](https://github.com/rooseveltframework/roosevelt#use-roosevelt-as-a-static-site-generator)
- [Available npm scripts](https://github.com/rooseveltframework/roosevelt#available-npm-scripts)
- [Available command line arguments](https://github.com/rooseveltframework/roosevelt#available-command-line-arguments)
- [Combining npm scripts and command line arguments](https://github.com/rooseveltframework/roosevelt#combining-npm-scripts-and-command-line-arguments)
Expand Down Expand Up @@ -129,6 +130,16 @@ To do that:

- Then `node app.js`. If the `makeBuildArtifacts` parameter is set to true like the above code example, an entire Roosevelt app with bare minimum viability will be created and the server will be started. See below for more information about parameter configuration.

### Use Roosevelt as a static site generator

Same steps as above, except set `makeBuildArtifacts` to the value of `'staticsOnly'` which will allow Roosevelt to create static files but skip the creation of the MVC directories:

```javascript
require('roosevelt')({
'makeBuildArtifacts': 'staticsOnly'
}).init()
```

## Available npm scripts

Roosevelt apps created with the app generator come with the following notable [npm scripts](https://docs.npmjs.com/misc/scripts) prepopulated in [package.json](https://docs.npmjs.com/files/package.json):
Expand Down Expand Up @@ -331,6 +342,8 @@ Resolves to:
- Will be set to `true` in apps generated with [generator-roosevelt](https://github.com/rooseveltframework/generator-roosevelt).
- Can also accept a value of `'staticsOnly'` which will allow Roosevelt to create static files but skip the creation of the MVC directories.
- This parameter is useful in scenarios when you want to create a Roosevelt app entirely from nothing (without using [generator-roosevelt](https://github.com/rooseveltframework/generator-roosevelt)). See [create a Roosevelt app manually](https://github.com/rooseveltframework/roosevelt#create-a-roosevelt-app-manually) for an example.
- `appDir`: Root directory of your application.
Expand Down Expand Up @@ -1190,6 +1203,7 @@ Additionally the Roosevelt constructor returns the following object:
| `reloadHttpServer` | *[Object]* The [http instance of reload](https://github.com/alallier/reload#returns) created by Roosevelt. |
| `reloadHttpsServer` | *[Object]* The [https instance of reload](https://github.com/alallier/reload#returns) created by Roosevelt. |
| `initServer(callback)` | *[Method]* Starts the HTML validator, sets up some middleware, runs the CSS and JS preprocessors, and maps routes, but does not start the HTTP server. Call this method manually first instead of `startServer` if you need to setup the Express app, but still need to do additional setup before the HTTP server is started. This method is automatically called by `startServer` once per instance if it has not yet already been called. Takes an optional callback. |
| `init` | *[Method]* Shorthand for `initServer`. |
| `startServer` | *[Method]* Calls the `listen` method of `http`, `https`, or both (depending on your configuration) to start the web server with Roosevelt's config. |
| `stopServer(close)` | *[Method]* Stops the server and takes an optional argument `stopServer('close')` which stops the server from accepting new connections before exiting. |
Expand Down
8 changes: 5 additions & 3 deletions lib/mapRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ module.exports = app => {
}

// generate mvc directories
fsr.ensureDirSync(app.get('modelsPath'))
fsr.ensureDirSync(app.get('viewsPath'))
fsr.ensureDirSync(app.get('controllersPath'))
if (params.makeBuildArtifacts && params.makeBuildArtifacts !== 'staticsOnly') {
fsr.ensureDirSync(app.get('modelsPath'))
fsr.ensureDirSync(app.get('viewsPath'))
fsr.ensureDirSync(app.get('controllersPath'))
}

// map statics for developer mode
if (params.hostPublic || app.get('env') === 'development') {
Expand Down
Loading

0 comments on commit a4f9a28

Please sign in to comment.