wattpm 3.0.6 → 3.2.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 CHANGED
@@ -25,12 +25,12 @@ npx wattpm@latest init
25
25
  npm install wattpm
26
26
  ```
27
27
 
28
- Follow our [Quick Start Guide](https://docs.platformatic.dev/docs/getting-started/quick-start-watt)
28
+ Follow our [Quick Start Guide](https://docs.platformatic.dev/docs/getting-started/quick-start)
29
29
  guide to get up and running with Platformatic.
30
30
 
31
31
  ## Documentation
32
32
 
33
- - [Getting Started](https://docs.platformatic.dev/docs/getting-started/quick-start-watt)
33
+ - [Getting Started](https://docs.platformatic.dev/docs/getting-started/quick-start)
34
34
  - [Reference](https://docs.platformatic.dev/docs/reference/watt/overview)
35
35
  - [Guides](https://docs.platformatic.dev/docs/guides/build-modular-monolith)
36
36
 
@@ -1,8 +1,8 @@
1
- import { getPackageManager, parseArgs } from '@platformatic/foundation'
2
- import { spawn } from 'node:child_process'
1
+ import { parseArgs } from '@platformatic/foundation'
2
+ import { runDelegatedCommand } from './create.js'
3
3
 
4
4
  export async function adminCommand (logger, args) {
5
- let {
5
+ const {
6
6
  values: { latest, 'package-manager': packageManager }
7
7
  } = parseArgs(
8
8
  args,
@@ -19,27 +19,7 @@ export async function adminCommand (logger, args) {
19
19
  false
20
20
  )
21
21
 
22
- if (!packageManager) {
23
- packageManager = await getPackageManager(process.cwd())
24
- }
25
-
26
- const modifier = latest ? '@latest' : ''
27
-
28
- let command = 'npx'
29
- const commandArgs = ['@platformatic/watt-admin' + modifier]
30
-
31
- if (packageManager === 'pnpm') {
32
- command = 'pnpx'
33
- } else {
34
- commandArgs.unshift('-y')
35
- }
36
-
37
- logger.info(`Running watt-admin via ${command} ...`)
38
- const proc = spawn(command, commandArgs, { stdio: 'inherit' })
39
-
40
- proc.on('exit', code => {
41
- process.exit(code)
42
- })
22
+ return runDelegatedCommand(logger, packageManager, ['@platformatic/watt-admin' + (latest ? '@latest' : '')])
43
23
  }
44
24
 
45
25
  export const help = {
@@ -1,40 +1,97 @@
1
1
  import { getExecutableName, getPackageManager, parseArgs } from '@platformatic/foundation'
2
+ import { bold } from 'colorette'
2
3
  import { spawn } from 'node:child_process'
4
+ import { platform } from 'node:os'
5
+
6
+ export async function runDelegatedCommand (logger, packageManager, args) {
7
+ if (!packageManager) {
8
+ packageManager = await getPackageManager(process.cwd())
9
+ }
10
+
11
+ let runner = 'npx'
12
+ if (packageManager === 'pnpm') {
13
+ runner = 'pnpx'
14
+ } else {
15
+ args.unshift('-y')
16
+ }
17
+
18
+ logger.info(`Running ${bold(runner)} ${bold(args.join(' '))} ...`)
19
+
20
+ const options = { stdio: 'inherit' }
21
+
22
+ if (platform() === 'win32') {
23
+ options.shell = true
24
+ options.windowsVerbatimArguments = true
25
+ }
26
+
27
+ const proc = spawn(runner, args, options)
28
+
29
+ proc.on('exit', code => {
30
+ process.exit(code)
31
+ })
32
+ }
3
33
 
4
34
  export async function createCommand (logger, args) {
5
- let {
6
- values: { 'package-manager': packageManager }
35
+ const {
36
+ values: {
37
+ latest,
38
+ config,
39
+ 'package-manager': packageManager,
40
+ 'skip-dependencies': skipDependencies,
41
+ module: modules
42
+ }
7
43
  } = parseArgs(
8
44
  args,
9
45
  {
46
+ latest: {
47
+ type: 'boolean',
48
+ short: 'l'
49
+ },
50
+ // Keep following options in sync with the create command from wattpm-utils
51
+ config: {
52
+ type: 'string',
53
+ short: 'c',
54
+ default: 'watt.json'
55
+ },
10
56
  'package-manager': {
11
57
  type: 'string',
12
58
  short: 'P'
59
+ },
60
+ 'skip-dependencies': {
61
+ type: 'boolean',
62
+ short: 's',
63
+ default: false
64
+ },
65
+ module: {
66
+ short: 'M',
67
+ type: 'string',
68
+ multiple: true,
69
+ default: []
13
70
  }
14
71
  },
15
72
  false,
16
73
  false
17
74
  )
18
75
 
19
- if (!packageManager) {
20
- packageManager = await getPackageManager(process.cwd())
21
- }
76
+ const runArgs = ['wattpm-utils' + (latest ? '@latest' : ''), '--', 'create']
22
77
 
23
- let command = 'npx'
24
- const commandArgs = ['wattpm-utils']
78
+ runArgs.push('-c', config)
25
79
 
26
- if (packageManager === 'pnpm') {
27
- command = 'pnpx'
28
- } else {
29
- commandArgs.unshift('-y')
80
+ if (packageManager) {
81
+ runArgs.push('-P', packageManager)
30
82
  }
31
83
 
32
- logger.info(`Running watt-utils create via ${command} ...`)
33
- const proc = spawn(command, [...commandArgs, '--', 'create', ...args], { stdio: 'inherit' })
84
+ if (skipDependencies) {
85
+ runArgs.push('-s')
86
+ }
34
87
 
35
- proc.on('exit', code => {
36
- process.exit(code)
37
- })
88
+ if (modules.length > 0) {
89
+ for (const m of modules) {
90
+ runArgs.push('-M', m)
91
+ }
92
+ }
93
+
94
+ return runDelegatedCommand(logger, packageManager, runArgs)
38
95
  }
39
96
 
40
97
  const createHelp = {
@@ -42,6 +99,10 @@ const createHelp = {
42
99
  return `Creates a new ${getExecutableName()} project`
43
100
  },
44
101
  options: [
102
+ {
103
+ usage: '-l --latest',
104
+ description: 'Use the latest version of @platformatic/watt-admin from'
105
+ },
45
106
  {
46
107
  usage: '-c, --config <config>',
47
108
  description: 'Name of the configuration file to use (the default is watt.json)'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wattpm",
3
- "version": "3.0.6",
3
+ "version": "3.2.0",
4
4
  "description": "The Node.js Application Server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  "bugs": {
14
14
  "url": "https://github.com/platformatic/platformatic/issues"
15
15
  },
16
- "homepage": "https://docs.platformatic.dev/docs/getting-started/quick-start-watt",
16
+ "homepage": "https://docs.platformatic.dev/docs/getting-started/quick-start",
17
17
  "bin": {
18
18
  "watt": "./bin/cli.js",
19
19
  "wattpm": "./bin/cli.js"
@@ -29,9 +29,9 @@
29
29
  "pino-pretty": "^13.0.0",
30
30
  "split2": "^4.2.0",
31
31
  "table": "^6.8.2",
32
- "@platformatic/control": "3.0.6",
33
- "@platformatic/foundation": "3.0.6",
34
- "@platformatic/runtime": "3.0.6"
32
+ "@platformatic/control": "3.2.0",
33
+ "@platformatic/foundation": "3.2.0",
34
+ "@platformatic/runtime": "3.2.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "cleaner-spec-reporter": "^0.5.0",
@@ -42,10 +42,10 @@
42
42
  "neostandard": "^0.12.0",
43
43
  "typescript": "^5.5.4",
44
44
  "undici": "^7.0.0",
45
- "@platformatic/node": "3.0.6"
45
+ "@platformatic/node": "3.2.0"
46
46
  },
47
47
  "engines": {
48
- "node": ">=22.18.0"
48
+ "node": ">=22.19.0"
49
49
  },
50
50
  "scripts": {
51
51
  "test": "node --test --test-reporter=cleaner-spec-reporter --test-concurrency=1 --test-timeout=2000000 test/*.test.js test/**/*.test.js",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/wattpm/3.0.6.json",
2
+ "$id": "https://schemas.platformatic.dev/wattpm/3.2.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Runtime Config",
5
5
  "type": "object",
@@ -1665,8 +1665,19 @@
1665
1665
  }
1666
1666
  ]
1667
1667
  },
1668
- "additionalProperties": false
1669
- }
1668
+ "plugins": {
1669
+ "type": "array",
1670
+ "items": {
1671
+ "anyOf": [
1672
+ {
1673
+ "type": "string",
1674
+ "resolvePath": true
1675
+ }
1676
+ ]
1677
+ }
1678
+ }
1679
+ },
1680
+ "additionalProperties": false
1670
1681
  }
1671
1682
  ]
1672
1683
  },