phio 0.3.0 → 0.3.2
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/package.json +3 -3
- package/src/commands/DevCommand.ts +13 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phio",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "A CLI tool to manage your PocketHost instances",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@inquirer/prompts": "^5.5.0",
|
|
42
42
|
"@s-libs/micro-dash": "^18.0.0",
|
|
43
|
-
"@samkirkland/ftp-deploy": "github:benallfree/ftp-deploy#
|
|
43
|
+
"@samkirkland/ftp-deploy": "github:benallfree/ftp-deploy#132389e",
|
|
44
44
|
"@sentool/fetch-event-source": "^0.5.0",
|
|
45
45
|
"bottleneck": "^2.19.5",
|
|
46
46
|
"chokidar": "^4.0.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"multimatch": "^7.0.0",
|
|
54
54
|
"ora": "^8.1.0",
|
|
55
55
|
"pocketbase": "^0.21.5",
|
|
56
|
-
"tsx": "^4.19.
|
|
56
|
+
"tsx": "^4.19.3",
|
|
57
57
|
"typescript": "^5.6.2"
|
|
58
58
|
},
|
|
59
59
|
"prettier": {
|
|
@@ -6,6 +6,7 @@ import { watch } from 'chokidar'
|
|
|
6
6
|
import { Command } from 'commander'
|
|
7
7
|
import multimatch from 'multimatch'
|
|
8
8
|
import { config } from '../lib/config'
|
|
9
|
+
import { ensureLoggedIn } from '../lib/ensureLoggedIn'
|
|
9
10
|
import { getInstanceBySubdomainCnameOrId } from '../lib/getClient'
|
|
10
11
|
import { savedInstanceName } from './../lib/defaultInstanceId'
|
|
11
12
|
|
|
@@ -27,24 +28,29 @@ export type DeployOptions = {
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export const watchAndDeploy = async (
|
|
30
|
-
|
|
31
|
+
instanceName: string,
|
|
31
32
|
options: DeployOptions = {
|
|
32
33
|
include: DEFAULT_INCLUDES,
|
|
33
34
|
exclude: DEFAULT_EXCLUDES,
|
|
34
35
|
verbose: false,
|
|
35
36
|
}
|
|
36
37
|
) => {
|
|
37
|
-
if (!
|
|
38
|
-
|
|
38
|
+
if (!instanceName) {
|
|
39
|
+
throw new Error(
|
|
39
40
|
`No instance name provided and none was found in package.json or pockethost.json. Use 'phio link <instance>'`
|
|
40
41
|
)
|
|
41
|
-
process.exit(1)
|
|
42
42
|
}
|
|
43
43
|
console.log(`Dev mode`)
|
|
44
44
|
const { include, exclude, verbose } = options
|
|
45
45
|
// console.log({ include, exclude })
|
|
46
46
|
|
|
47
|
-
const instance = await
|
|
47
|
+
const instance = await (async () => {
|
|
48
|
+
try {
|
|
49
|
+
return await getInstanceBySubdomainCnameOrId(instanceName)
|
|
50
|
+
} catch (error) {
|
|
51
|
+
throw new Error(`Instance ${instanceName} not found`)
|
|
52
|
+
}
|
|
53
|
+
})()
|
|
48
54
|
|
|
49
55
|
const limiter = new Bottleneck({ maxConcurrent: 1 })
|
|
50
56
|
const upload = debounce(
|
|
@@ -92,6 +98,7 @@ export async function deployMyCode(
|
|
|
92
98
|
exclude: string[],
|
|
93
99
|
verbose: boolean
|
|
94
100
|
) {
|
|
101
|
+
await ensureLoggedIn()
|
|
95
102
|
console.log(`🚚 Deploy started for ${instanceName}`)
|
|
96
103
|
const args: IFtpDeployArguments = {
|
|
97
104
|
server: 'ftp.pockethost.io',
|
|
@@ -109,7 +116,7 @@ export async function deployMyCode(
|
|
|
109
116
|
|
|
110
117
|
export const DevCommand = () => {
|
|
111
118
|
return new Command('dev')
|
|
112
|
-
.argument(`[
|
|
119
|
+
.argument(`[instanceName]`, `Instance name`, savedInstanceName())
|
|
113
120
|
.description(`Watch for local modifications and sync to remote`)
|
|
114
121
|
.option(`-v, --verbose`, `Verbose output`)
|
|
115
122
|
.option(
|