phio 0.1.0 → 0.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phio",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "A CLI tool to manage your PocketHost instances",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,7 +12,8 @@ import { defaultInstanceId } from './../lib/defaultInstanceId'
12
12
  async function deployMyCode(
13
13
  instanceName: string,
14
14
  include: string[],
15
- exclude: string[]
15
+ exclude: string[],
16
+ verbose: boolean
16
17
  ) {
17
18
  const cachePath = '.cache'
18
19
  ensureDirSync(cachePath)
@@ -25,8 +26,7 @@ async function deployMyCode(
25
26
  'server-dir': `${instanceName}/`,
26
27
  include,
27
28
  exclude: [...excludeDefaults, ...exclude],
28
- 'state-name': '.cache/.ftp-deploy-sync-state.json',
29
- 'log-level': 'verbose',
29
+ 'log-level': verbose ? 'verbose' : 'standard',
30
30
  })
31
31
  console.log('🚀 Deploy done!')
32
32
  }
@@ -35,19 +35,27 @@ export const DevCommand = () => {
35
35
  return new Command('dev')
36
36
  .argument(`[instanceId]`, `Instance name`, defaultInstanceId())
37
37
  .description(`Watch for local modifications and sync to remote`)
38
+ .option(`-v, --verbose`, `Verbose output`)
38
39
  .option(
39
40
  '-i, --include <include...>',
40
41
  'Files to include in the sync',
41
42
  (val, prev) => [...prev, val],
42
- ['pb_*/**/*', `package.json`, `bun.lockb`]
43
+ [
44
+ `pb_*`,
45
+ 'pb_*/**/*',
46
+ `package.json`,
47
+ `bun.lockb`,
48
+ `patches`,
49
+ `patches/**/*`,
50
+ ]
43
51
  )
44
52
  .option(
45
53
  '-e, --exclude <exclude...>',
46
54
  'Files to exclude from the sync',
47
55
  (val, prev) => [...prev, val],
48
- [`pb_data/**/*`]
56
+ [`pb_data`, `pb_data/**/*`]
49
57
  )
50
- .action(async (_instanceId, { include, exclude }) => {
58
+ .action(async (_instanceId, { include, exclude, verbose }) => {
51
59
  if (!_instanceId) {
52
60
  console.error(
53
61
  `No instance name provided and none was found in package.json or pockethost.json. Use 'phio link <instance>'`
@@ -55,7 +63,7 @@ export const DevCommand = () => {
55
63
  process.exit(1)
56
64
  }
57
65
  console.log(`Dev mode`)
58
- console.log({ include, exclude })
66
+ // console.log({ include, exclude })
59
67
 
60
68
  const instance = await getInstanceBySubdomainCnameOrId(_instanceId)
61
69
 
@@ -63,7 +71,7 @@ export const DevCommand = () => {
63
71
  const upload = debounce(
64
72
  () =>
65
73
  limiter.schedule(() =>
66
- deployMyCode(instance.subdomain, include, exclude).catch(
74
+ deployMyCode(instance.subdomain, include, exclude, verbose).catch(
67
75
  console.error
68
76
  )
69
77
  ),
@@ -74,10 +82,17 @@ export const DevCommand = () => {
74
82
  persistent: true,
75
83
  ignored: (file) => {
76
84
  if (file === '.') return false
77
- const isIgnored =
78
- multimatch([file], include).length === 0 ||
79
- multimatch([file], exclude).length > 0
80
- console.log({ file, isIgnored })
85
+ const isIncluded = multimatch([file], include).length > 0
86
+ const isExcluded = multimatch([file], exclude).length > 0
87
+ const isIgnored = !isIncluded || isExcluded
88
+ // console.log({
89
+ // file,
90
+ // include,
91
+ // isIncluded,
92
+ // exclude,
93
+ // isExcluded,
94
+ // isIgnored,
95
+ // })
81
96
  return isIgnored
82
97
  },
83
98
  })
@@ -87,7 +102,7 @@ export const DevCommand = () => {
87
102
  const handle = (path: string, details: any) => {
88
103
  upload()
89
104
  // internal
90
- console.log(`Syncing ${path}`)
105
+ // console.log(`Syncing ${path}`)
91
106
  }
92
107
  watcher.on('add', handle).on('change', handle).on('unlink', handle)
93
108
  })