platformatic 1.50.0 → 2.0.0-alpha.1
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/cli.js +31 -12
- package/help/help.txt +0 -1
- package/lib/upgrade.js +0 -6
- package/package.json +14 -13
- package/help/login.txt +0 -10
package/cli.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import { createRequire } from 'node:module'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import { pathToFileURL } from 'node:url'
|
|
6
|
+
import { readFile } from 'node:fs/promises'
|
|
3
7
|
import commist from 'commist'
|
|
4
8
|
import minimist from 'minimist'
|
|
5
|
-
import { runDB } from '@platformatic/db/db.mjs'
|
|
6
9
|
import { run as runRuntime, compile } from '@platformatic/runtime/runtime.mjs'
|
|
7
10
|
import { startCommand } from '@platformatic/runtime'
|
|
8
|
-
import { runService } from '@platformatic/service/service.mjs'
|
|
9
|
-
import { runComposer } from '@platformatic/composer/composer.mjs'
|
|
10
|
-
import { login } from '@platformatic/authenticate/authenticate.js'
|
|
11
11
|
import { command as client } from '@platformatic/client-cli'
|
|
12
|
-
import { readFile } from 'fs/promises'
|
|
13
12
|
import { join } from 'desm'
|
|
14
13
|
import { isColorSupported } from 'colorette'
|
|
15
14
|
import helpMe from 'help-me'
|
|
@@ -29,6 +28,12 @@ const help = helpMe({
|
|
|
29
28
|
ext: '.txt'
|
|
30
29
|
})
|
|
31
30
|
|
|
31
|
+
async function load (moduleName) {
|
|
32
|
+
const require = createRequire(path.join(process.cwd(), 'package.json'))
|
|
33
|
+
const file = require.resolve(moduleName)
|
|
34
|
+
return import(pathToFileURL(file))
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
const ensureCommand = async ({ output, help }) => {
|
|
33
38
|
if (!output) {
|
|
34
39
|
return
|
|
@@ -42,10 +47,19 @@ const ensureCommand = async ({ output, help }) => {
|
|
|
42
47
|
process.exit(1)
|
|
43
48
|
}
|
|
44
49
|
|
|
45
|
-
program.register('db', async (args) =>
|
|
50
|
+
program.register('db', async (args) => {
|
|
51
|
+
const { runDB } = await load('@platformatic/db/db.mjs')
|
|
52
|
+
return ensureCommand(await runDB(args))
|
|
53
|
+
})
|
|
46
54
|
program.register('runtime', async (args) => ensureCommand(await runRuntime(args)))
|
|
47
|
-
program.register('service', async (args) =>
|
|
48
|
-
|
|
55
|
+
program.register('service', async (args) => {
|
|
56
|
+
const { runService } = await load('@platformatic/service/service.mjs')
|
|
57
|
+
return ensureCommand(await runService(args))
|
|
58
|
+
})
|
|
59
|
+
program.register('composer', async (args) => {
|
|
60
|
+
const { runComposer } = await load('@platformatic/composer/composer.mjs')
|
|
61
|
+
return ensureCommand(await runComposer(args))
|
|
62
|
+
})
|
|
49
63
|
program.register('start', async (args) => ensureCommand(await startCommand(args)))
|
|
50
64
|
program.register('ctl', async (args) => ensureCommand(await runControl(args)))
|
|
51
65
|
program.register('ps', async (args) => getRuntimesCommand(args))
|
|
@@ -55,11 +69,16 @@ program.register('upgrade', upgrade)
|
|
|
55
69
|
program.register('client', client)
|
|
56
70
|
program.register('compile', async (args) => await compile(args) ? null : process.exit(1))
|
|
57
71
|
program.register('help', help.toStdout)
|
|
58
|
-
program.register('help db', async (args) =>
|
|
72
|
+
program.register('help db', async (args) => {
|
|
73
|
+
const { runDB } = await load('@platformatic/db/db.mjs')
|
|
74
|
+
return runDB(['help', ...args])
|
|
75
|
+
})
|
|
59
76
|
program.register('help client', () => client([]))
|
|
60
77
|
program.register('help runtime', async (args) => runRuntime(['help', ...args]))
|
|
61
|
-
program.register('help service', async (args) =>
|
|
62
|
-
|
|
78
|
+
program.register('help service', async (args) => {
|
|
79
|
+
const { runService } = await load('@platformatic/service/service.mjs')
|
|
80
|
+
return runService(['help', ...args])
|
|
81
|
+
})
|
|
63
82
|
|
|
64
83
|
const args = minimist(process.argv.slice(2), {
|
|
65
84
|
boolean: ['help', 'version'],
|
|
@@ -69,7 +88,7 @@ const args = minimist(process.argv.slice(2), {
|
|
|
69
88
|
}
|
|
70
89
|
})
|
|
71
90
|
|
|
72
|
-
if (args.version && !args._.includes('
|
|
91
|
+
if (args.version && !args._.includes('inject')) {
|
|
73
92
|
const version = JSON.parse(await readFile(join(import.meta.url, 'package.json'))).version
|
|
74
93
|
console.log('v' + version)
|
|
75
94
|
process.exit(0)
|
package/help/help.txt
CHANGED
|
@@ -8,7 +8,6 @@ Welcome to Platformatic. Available commands are:
|
|
|
8
8
|
* `gh` - create a new gh action for Platformatic deployments.
|
|
9
9
|
* `runtime` - start Platformatic Runtime; type `platformatic runtime help` to know more.
|
|
10
10
|
* `start` - start a Platformatic application.
|
|
11
|
-
* `login` - generate a Platformatic login api key.
|
|
12
11
|
* `client` - generate a Platformatic client.
|
|
13
12
|
* `ps` - list all Platformatic runtime applications.
|
|
14
13
|
* `logs` - stream logs for a Platformatic runtime application.
|
package/lib/upgrade.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { Store, getStringifier } from '@platformatic/config'
|
|
2
2
|
import parseArgs from 'minimist'
|
|
3
3
|
import { writeFile } from 'fs/promises'
|
|
4
|
-
import { platformaticService } from '@platformatic/service'
|
|
5
|
-
import { platformaticDB } from '@platformatic/db'
|
|
6
|
-
import { platformaticComposer } from '@platformatic/composer'
|
|
7
4
|
import { platformaticRuntime } from '@platformatic/runtime'
|
|
8
5
|
import pino from 'pino'
|
|
9
6
|
import pretty from 'pino-pretty'
|
|
@@ -33,9 +30,6 @@ async function upgradeApp (config, logger) {
|
|
|
33
30
|
cwd: process.cwd(),
|
|
34
31
|
logger
|
|
35
32
|
})
|
|
36
|
-
store.add(platformaticService)
|
|
37
|
-
store.add(platformaticDB)
|
|
38
|
-
store.add(platformaticComposer)
|
|
39
33
|
store.add(platformaticRuntime)
|
|
40
34
|
|
|
41
35
|
const { configManager } = await store.loadConfig({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "platformatic",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.1",
|
|
4
4
|
"description": "Platformatic CLI",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,11 @@
|
|
|
34
34
|
"mkdirp": "^2.1.6",
|
|
35
35
|
"snazzy": "^9.0.0",
|
|
36
36
|
"split2": "^4.2.0",
|
|
37
|
-
"standard": "^17.1.0"
|
|
37
|
+
"standard": "^17.1.0",
|
|
38
|
+
"typescript": "^5.5.3",
|
|
39
|
+
"@platformatic/db": "2.0.0-alpha.1",
|
|
40
|
+
"@platformatic/composer": "2.0.0-alpha.1",
|
|
41
|
+
"@platformatic/service": "2.0.0-alpha.1"
|
|
38
42
|
},
|
|
39
43
|
"dependencies": {
|
|
40
44
|
"@fastify/error": "^3.4.1",
|
|
@@ -51,17 +55,14 @@
|
|
|
51
55
|
"pino": "^8.19.0",
|
|
52
56
|
"pino-pretty": "^11.0.0",
|
|
53
57
|
"undici": "^6.9.0",
|
|
54
|
-
"@platformatic/
|
|
55
|
-
"@platformatic/
|
|
56
|
-
"@platformatic/
|
|
57
|
-
"@platformatic/
|
|
58
|
-
"@platformatic/
|
|
59
|
-
"@platformatic/
|
|
60
|
-
"@platformatic/frontend-template": "
|
|
61
|
-
"
|
|
62
|
-
"@platformatic/service": "1.50.0",
|
|
63
|
-
"create-platformatic": "1.50.0",
|
|
64
|
-
"@platformatic/utils": "1.50.0"
|
|
58
|
+
"@platformatic/client-cli": "2.0.0-alpha.1",
|
|
59
|
+
"@platformatic/config": "2.0.0-alpha.1",
|
|
60
|
+
"@platformatic/control": "2.0.0-alpha.1",
|
|
61
|
+
"@platformatic/db": "2.0.0-alpha.1",
|
|
62
|
+
"@platformatic/runtime": "2.0.0-alpha.1",
|
|
63
|
+
"@platformatic/utils": "2.0.0-alpha.1",
|
|
64
|
+
"@platformatic/frontend-template": "2.0.0-alpha.1",
|
|
65
|
+
"create-platformatic": "2.0.0-alpha.1"
|
|
65
66
|
},
|
|
66
67
|
"scripts": {
|
|
67
68
|
"test": "pnpm run lint && borp --timeout 120000 --concurrency 1",
|
package/help/login.txt
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
Generate a Platformatic login api key.
|
|
2
|
-
|
|
3
|
-
``` bash
|
|
4
|
-
$ platformatic deploy
|
|
5
|
-
```
|
|
6
|
-
|
|
7
|
-
Options:
|
|
8
|
-
|
|
9
|
-
* `-c, --config FILE` - Specify a path to a global Platformatic config file. Defaults to `~/.platformatic/config.json`.
|
|
10
|
-
* `--browser` - Automatically open default browser. If process stdout is a TTY, the default is `true`. Otherwise, the default is `false`.
|