@platformatic/node 2.74.2 → 2.75.0-alpha.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/bin/create.js +60 -5
- package/package.json +7 -7
- package/schema.json +1 -1
package/bin/create.js
CHANGED
|
@@ -4,6 +4,20 @@ import { basename, join } from 'node:path'
|
|
|
4
4
|
import { parseArgs } from 'node:util'
|
|
5
5
|
import { Generator } from '../lib/generator.js'
|
|
6
6
|
|
|
7
|
+
function parseBoolean (value) {
|
|
8
|
+
if (value === undefined) {
|
|
9
|
+
return false
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (value === 'true') {
|
|
13
|
+
return true
|
|
14
|
+
} else if (value === 'false') {
|
|
15
|
+
return false
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
throw new Error(`Invalid boolean value: ${value}`)
|
|
19
|
+
}
|
|
20
|
+
|
|
7
21
|
async function execute () {
|
|
8
22
|
const args = parseArgs({
|
|
9
23
|
args: process.argv.slice(2),
|
|
@@ -12,21 +26,62 @@ async function execute () {
|
|
|
12
26
|
type: 'string',
|
|
13
27
|
default: join(process.cwd(), 'plt-node')
|
|
14
28
|
},
|
|
15
|
-
|
|
29
|
+
port: { type: 'string', default: '3042' },
|
|
30
|
+
hostname: { type: 'string', default: '0.0.0.0' },
|
|
31
|
+
main: { type: 'string', default: 'index.js' },
|
|
32
|
+
plugin: { type: 'string', default: 'true' },
|
|
33
|
+
tests: { type: 'string', default: 'true' },
|
|
34
|
+
typescript: { type: 'boolean', default: false },
|
|
35
|
+
git: { type: 'boolean', default: false },
|
|
36
|
+
localSchema: { type: 'string', default: 'true' },
|
|
37
|
+
help: { type: 'boolean', default: false }
|
|
16
38
|
}
|
|
17
39
|
})
|
|
18
40
|
|
|
41
|
+
if (args.values.help) {
|
|
42
|
+
console.log(`
|
|
43
|
+
Usage: create [options]
|
|
44
|
+
|
|
45
|
+
Options:
|
|
46
|
+
--dir <directory> Target directory (default: plt-node)
|
|
47
|
+
--port <port> Port number (default: 3042)
|
|
48
|
+
--hostname <hostname> Hostname (default: 0.0.0.0)
|
|
49
|
+
--main <file> Main entry file (default: index.js)
|
|
50
|
+
--plugin <true|false> Enable plugin support (default: true)
|
|
51
|
+
--tests <true|false> Generate tests (default: true)
|
|
52
|
+
--typescript Enable TypeScript (default: false)
|
|
53
|
+
--git Initialize git repository (default: false)
|
|
54
|
+
--localSchema <true|false> Use local schema (default: true)
|
|
55
|
+
--help Show this help message
|
|
56
|
+
`)
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
|
|
19
60
|
const generator = new Generator()
|
|
20
61
|
|
|
21
|
-
|
|
62
|
+
const config = {
|
|
63
|
+
port: parseInt(args.values.port),
|
|
64
|
+
hostname: args.values.hostname,
|
|
22
65
|
targetDirectory: args.values.dir,
|
|
23
66
|
serviceName: basename(args.values.dir),
|
|
24
|
-
main: args.values.main
|
|
25
|
-
|
|
67
|
+
main: args.values.main,
|
|
68
|
+
plugin: parseBoolean(args.values.plugin),
|
|
69
|
+
tests: parseBoolean(args.values.tests),
|
|
70
|
+
typescript: args.values.typescript,
|
|
71
|
+
initGitRepository: args.values.git,
|
|
72
|
+
localSchema: parseBoolean(args.values.localSchema)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
generator.setConfig(config)
|
|
26
76
|
|
|
27
77
|
await generator.run()
|
|
28
78
|
|
|
29
79
|
console.log('Application created successfully! Run `npm run start` to start an application.')
|
|
30
80
|
}
|
|
31
81
|
|
|
32
|
-
execute()
|
|
82
|
+
execute().catch(err => {
|
|
83
|
+
console.error(err)
|
|
84
|
+
process.exit(1)
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
// Signed-off-by: tawseefnabi <tawseefnabi9@gmail.com>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/node",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.75.0-alpha.0",
|
|
4
4
|
"description": "Platformatic Node.js Stackable",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"json5": "^2.2.3",
|
|
23
23
|
"light-my-request": "^6.0.0",
|
|
24
|
-
"@platformatic/basic": "2.
|
|
25
|
-
"@platformatic/
|
|
26
|
-
"@platformatic/config": "2.
|
|
27
|
-
"@platformatic/
|
|
24
|
+
"@platformatic/basic": "2.75.0-alpha.0",
|
|
25
|
+
"@platformatic/generators": "2.75.0-alpha.0",
|
|
26
|
+
"@platformatic/config": "2.75.0-alpha.0",
|
|
27
|
+
"@platformatic/utils": "2.75.0-alpha.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"borp": "^0.20.0",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"neostandard": "^0.12.0",
|
|
37
37
|
"tsx": "^4.19.0",
|
|
38
38
|
"typescript": "^5.5.4",
|
|
39
|
-
"@platformatic/
|
|
40
|
-
"@platformatic/
|
|
39
|
+
"@platformatic/composer": "2.75.0-alpha.0",
|
|
40
|
+
"@platformatic/service": "2.75.0-alpha.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"test": "pnpm run lint && borp --concurrency=1 --no-timeout",
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/node/2.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/node/2.75.0-alpha.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Node.js Stackable",
|
|
5
5
|
"type": "object",
|