@typed-assistant/builder 0.0.73 → 0.0.75

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/CHANGELOG.md CHANGED
@@ -1,13 +1,7 @@
1
1
  # @typed-assistant/builder
2
2
 
3
- ## 0.0.2
3
+ ## 0.0.75
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Update READMEs.
8
-
9
- ## 0.0.1
10
-
11
- ### Patch Changes
12
-
13
- - First version.
7
+ - Prevent git pull from throwing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typed-assistant/builder",
3
- "version": "0.0.73",
3
+ "version": "0.0.75",
4
4
  "exports": {
5
5
  "./appProcess": "./src/appProcess.tsx",
6
6
  "./bunInstall": "./src/bunInstall.tsx",
@@ -23,11 +23,11 @@
23
23
  "eslint-plugin-html": "^7.1.0",
24
24
  "eslint": "^8.56.0",
25
25
  "ts-toolbelt": "^9.6.0",
26
- "typescript": "^5.3.3",
27
- "@typed-assistant/eslint-config": "0.0.10",
26
+ "typescript": "^5.4.0",
28
27
  "@typed-assistant/logger": "0.0.21",
29
28
  "@typed-assistant/typescript-config": "0.0.10",
30
- "@typed-assistant/utils": "0.0.18"
29
+ "@typed-assistant/utils": "0.0.18",
30
+ "@typed-assistant/eslint-config": "0.0.10"
31
31
  },
32
32
  "peerDependencies": {},
33
33
  "publishConfig": {
@@ -74,7 +74,15 @@ export async function setup({
74
74
  )
75
75
  },
76
76
  })
77
- await setupGitSync()
77
+ await setupGitSync({
78
+ onChangesPulled: async () => {
79
+ subprocesses = await killAndRestartApp(
80
+ entryFile,
81
+ { mdiPaths },
82
+ subprocesses,
83
+ )
84
+ },
85
+ })
78
86
 
79
87
  return subprocesses
80
88
  }
@@ -164,7 +172,11 @@ const getAddonInfo = async () => {
164
172
  return data
165
173
  }
166
174
 
167
- const setupGitSync = async () => {
175
+ const setupGitSync = async ({
176
+ onChangesPulled,
177
+ }: {
178
+ onChangesPulled: () => void
179
+ }) => {
168
180
  if (
169
181
  !process.env.GITHUB_TOKEN ||
170
182
  !process.env.GITHUB_USERNAME ||
@@ -178,7 +190,7 @@ const setupGitSync = async () => {
178
190
  }
179
191
 
180
192
  logger.warn({ emoji: "⬇️" }, "Setting up git poller...")
181
- await setupGitPoller()
193
+ await setupGitPoller({ onChangesPulled })
182
194
  }
183
195
 
184
196
  const ig = ignore().add(
@@ -2,9 +2,13 @@ import { logger } from "@typed-assistant/logger"
2
2
  import { $ } from "bun"
3
3
  import { bunInstall } from "./bunInstall"
4
4
 
5
- export const pullChanges = async () => {
5
+ export const pullChanges = async ({
6
+ onChangesPulled,
7
+ }: {
8
+ onChangesPulled: () => void
9
+ }) => {
6
10
  logger.debug({ emoji: "⬇️" }, "Pulling changes...")
7
- const { exitCode, stderr, stdout } = await $`git pull`.quiet()
11
+ const { exitCode, stderr, stdout } = await $`git pull`.nothrow().quiet()
8
12
  if (exitCode) {
9
13
  logger.error(
10
14
  { additionalDetails: stderr.toString().trim(), emoji: "⬇️🚨" },
@@ -19,11 +23,12 @@ export const pullChanges = async () => {
19
23
  logger.debug({ emoji: "⬇️👌" }, "No new changes.")
20
24
  return {}
21
25
  } else {
26
+ if (packageJSONUpdated) {
27
+ logger.info({ emoji: "⬇️📦" }, "package.json updated.")
28
+ await bunInstall()
29
+ }
22
30
  logger.info({ emoji: "⬇️🆕" }, "Changes pulled.")
23
- }
24
- if (packageJSONUpdated) {
25
- logger.info({ emoji: "⬇️📦" }, "package.json updated.")
26
- await bunInstall()
31
+ onChangesPulled()
27
32
  }
28
33
  return {}
29
34
  }
@@ -4,18 +4,20 @@ import { pullChanges } from "./pullChanges"
4
4
 
5
5
  export const setupGitPoller = async ({
6
6
  gitPullPollDuration,
7
+ onChangesPulled,
7
8
  }: {
8
9
  /** Duration in seconds */
9
10
  gitPullPollDuration?: number
10
- } = {}) => {
11
+ onChangesPulled: () => void
12
+ }) => {
11
13
  const duration = gitPullPollDuration ?? 30
12
- await pullChanges()
14
+ await pullChanges({ onChangesPulled })
13
15
  logger.debug(
14
16
  { emoji: "⬇️⏳" },
15
17
  `Pulling changes again in ${duration} seconds...`,
16
18
  )
17
19
 
18
20
  setTimeout(() => {
19
- setupGitPoller({ gitPullPollDuration })
21
+ setupGitPoller({ gitPullPollDuration, onChangesPulled })
20
22
  }, duration * ONE_SECOND)
21
23
  }