@platformatic/generators 3.41.0 → 3.43.0
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 +8 -54
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,61 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @platformatic/generators
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Generators for scaffolding Platformatic applications programmatically.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Check out the full documentation on [our website](https://docs.platformatic.dev).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Install
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- `logger`: A pino-like logger object. If not provided a fake logger with no output will be used
|
|
12
|
-
- `questions`: An array of custom questions object to provide to `inquirer`. Default to `[]`
|
|
13
|
-
|
|
14
|
-
The `setConfig({...})` function should be called to set the config generator. `BaseGenerator` supports the bare minumium set of options which are common to all types of apps
|
|
15
|
-
|
|
16
|
-
- `targetDirectory` Where in the local filesystem the app will be created
|
|
17
|
-
- `port`: The port where the app should listen
|
|
18
|
-
- `hostname`: The hostname where the app should listen
|
|
19
|
-
- `plugin`: Whether to create or not a sample plugin file structure
|
|
20
|
-
- `typescript`: `true|false`
|
|
21
|
-
- `initGitRepository`: Inits the git repository
|
|
22
|
-
- `dependencies`: A key value object to add dependencies in `package.json` file
|
|
23
|
-
- `devDependencies`: A key value object to add dev-dependencies in `package.json` file
|
|
24
|
-
- `env`: A key/value object that will be automatically appended to the generated `.env` file
|
|
25
|
-
## Usage
|
|
26
|
-
|
|
27
|
-
This is the simplest example to create a Platformatic Service app into `/path/to/app`
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
const { BaseGenerator } = require('@platformatic/generators')
|
|
31
|
-
|
|
32
|
-
async function main() {
|
|
33
|
-
const gen = new BaseGenerator({
|
|
34
|
-
type: 'service'
|
|
35
|
-
})
|
|
36
|
-
gen.setConfig({
|
|
37
|
-
targetDirectory: '/path/to/app'
|
|
38
|
-
})
|
|
39
|
-
await gen.run()
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
main()
|
|
9
|
+
```sh
|
|
10
|
+
npm install @platformatic/generators
|
|
43
11
|
```
|
|
44
12
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
### Hooks
|
|
48
|
-
|
|
49
|
-
In order to customize the behavior of a subclass there are some functions that may be implemented
|
|
50
|
-
|
|
51
|
-
#### `_getConfigFileContents`
|
|
52
|
-
|
|
53
|
-
Returns an object that will be serialized with `JSON.stringify` method. It will be saved in the `platformatic.${TYPE}.json` file
|
|
54
|
-
|
|
55
|
-
#### `_beforePrepare`
|
|
56
|
-
|
|
57
|
-
Called from `prepare` function. You have already access to the current `fastify` version (`this.fastifyVersion`) and `platformatic` version (`this.platformaticVersion`)
|
|
58
|
-
|
|
59
|
-
#### `_afterPrepare`
|
|
13
|
+
## License
|
|
60
14
|
|
|
61
|
-
|
|
15
|
+
Apache 2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/generators",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.43.0",
|
|
4
4
|
"description": "Main classes and utils for generators.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"fastify": "^5.7.0",
|
|
24
24
|
"pino": "^9.9.0",
|
|
25
25
|
"undici": "^7.0.0",
|
|
26
|
-
"@platformatic/foundation": "3.
|
|
26
|
+
"@platformatic/foundation": "3.43.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/inquirer": "^9.0.7",
|