phio 0.2.3 → 0.2.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phio",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "A CLI tool to manage your PocketHost instances",
5
5
  "repository": {
6
6
  "type": "git",
package/src/cli.ts CHANGED
@@ -3,6 +3,7 @@ import { program } from 'commander'
3
3
  import { version } from '../package.json'
4
4
  import { DeployCommand } from './commands/DeployCommand'
5
5
  import { DevCommand } from './commands/DevCommand'
6
+ import { InfoCommand } from './commands/InfoCommand'
6
7
  import { LinkCommand } from './commands/LinkCommand'
7
8
  import { ListCommand } from './commands/ListCommand'
8
9
  import { LoginCommand } from './commands/LoginCommand'
@@ -20,5 +21,6 @@ program
20
21
  .addCommand(ListCommand())
21
22
  .addCommand(LinkCommand())
22
23
  .addCommand(DeployCommand())
24
+ .addCommand(InfoCommand())
23
25
 
24
26
  program.parseAsync(process.argv).catch(console.error)
@@ -10,13 +10,15 @@ export const DeployCommand = () => {
10
10
  .option(
11
11
  '-i, --include <include...>',
12
12
  'Files to include in the sync',
13
- (val, prev) => [...prev, val],
13
+ (val, prev) => [...prev, ...val.split(',')],
14
14
  DEFAULT_INCLUDES
15
15
  )
16
16
  .option(
17
17
  '-e, --exclude <exclude...>',
18
18
  'Files to exclude from the sync',
19
- (val, prev) => [...prev, val],
19
+ (val, prev) => {
20
+ return [...prev, ...val.split(',')]
21
+ },
20
22
  DEFAULT_EXCLUDES
21
23
  )
22
24
  .action((instanceId, options) => {
@@ -4,7 +4,6 @@ import { IFtpDeployArguments } from '@samkirkland/ftp-deploy/src/types'
4
4
  import Bottleneck from 'bottleneck'
5
5
  import { watch } from 'chokidar'
6
6
  import { Command } from 'commander'
7
- import { ensureDirSync } from 'fs-extra'
8
7
  import multimatch from 'multimatch'
9
8
  import { config } from '../lib/config'
10
9
  import { getInstanceBySubdomainCnameOrId } from '../lib/getClient'
@@ -93,9 +92,6 @@ export async function deployMyCode(
93
92
  exclude: string[],
94
93
  verbose: boolean
95
94
  ) {
96
- const cachePath = '.cache'
97
- ensureDirSync(cachePath)
98
-
99
95
  console.log('🚚 Deploy started')
100
96
  const args: IFtpDeployArguments = {
101
97
  server: 'ftp.pockethost.io',
@@ -104,7 +100,7 @@ export async function deployMyCode(
104
100
  'server-dir': `${instanceName}/`,
105
101
  include,
106
102
  exclude: [...excludeDefaults, ...exclude],
107
- 'log-level': verbose ? 'verbose' : 'standard',
103
+ 'log-level': verbose ? 'verbose' : 'minimal',
108
104
  }
109
105
 
110
106
  await deploy(args)
@@ -119,13 +115,15 @@ export const DevCommand = () => {
119
115
  .option(
120
116
  '-i, --include <include...>',
121
117
  'Files to include in the sync',
122
- (val, prev) => [...prev, val],
118
+ (val, prev) => [...prev, ...val.split(',')],
123
119
  DEFAULT_INCLUDES
124
120
  )
125
121
  .option(
126
122
  '-e, --exclude <exclude...>',
127
123
  'Files to exclude from the sync',
128
- (val, prev) => [...prev, val],
124
+ (val, prev) => {
125
+ return [...prev, ...val.split(',')]
126
+ },
129
127
  DEFAULT_EXCLUDES
130
128
  )
131
129
  .action(watchAndDeploy)
@@ -0,0 +1,10 @@
1
+ import { Command } from 'commander'
2
+ import { config } from '../lib/config'
3
+ import { PHIO_HOME } from '../lib/constants'
4
+
5
+ export const InfoCommand = () => {
6
+ return new Command(`info`).description(`Get config info`).action(() => {
7
+ console.log(`Config root: ${PHIO_HOME()}`)
8
+ console.log(`Instance: ${config('instanceId')}`)
9
+ })
10
+ }
@@ -22,6 +22,14 @@ export const linkWithUserInput = async () => {
22
22
  const instances = await client
23
23
  .collection(`instances`)
24
24
  .getFullList<InstanceFields>()
25
+
26
+ if (instances.length === 0) {
27
+ console.error(
28
+ `No instances found. If this seems wrong, use 'phio login' to log in, then try again.`
29
+ )
30
+ return
31
+ }
32
+
25
33
  while (true) {
26
34
  const instanceNameOrId = await select({
27
35
  message: `Choose the instance you'd like to link`,
@@ -4,6 +4,7 @@ import { InstanceFields } from './../lib/InstanceFields'
4
4
 
5
5
  export const ListCommand = () => {
6
6
  return new Command(`list`)
7
+ .alias(`ls`)
7
8
  .description(`List all the logs`)
8
9
  .action(async () => {
9
10
  const client = getClient()