socket icon indicating copy to clipboard operation
socket copied to clipboard

Using build watch with vite creates infinite build loop

Open tmcappsph opened this issue 1 year ago • 6 comments

What OS are you using (uname -a, or Windows version)?

OS Name: Microsoft Windows 11 Pro OS Version: 10.0.22635 N/A Build 22635

What version Socket Runtime are you using?

0.5.4 (f90ba121)

What programming language are you using (C/C++/Go/Rust)?

N/A

What did you expect to see and what you saw instead?

When using "ssc build --run --watch" with vite, when a file changes it just rebuild infinitely rather than only build once.

Test repo: https://github.com/socketsupply/socket-examples/tree/master/frontend-tools-integrations/vite-vue-ts socket.ini:


;  ___  __   ___      __ ____
; /__  /  / /   /_/  /_   /
; __/ /__/ /__ /  \ /__  /
;
; Socket ⚡︎ Runtime · A modern runtime for Web Apps · v0.1.0 (1b4d4af8)
;

; The value of the "script" property in a build section will be interpreted as a shell command when
; you run "ssc build". This is the most important command in this file. It will
; do all the heavy lifting and should handle 99.9% of your use cases for moving
; files into place or tweaking platform-specific build artifacts. If you don't
; specify it, ssc will just copy everything in your project to the build target.

[build]

; ssc will copy everything in this directory to the build output directory.
; This is useful when you want to avoid bundling or want to use tools like
; vite, webpack, rollup, etc. to build your project and then copy output to
; the Socket bundle resources directory.
copy = "dist"

; An list of environment variables, separated by commas.
env = USER, TMPDIR, PWD

; Advanced Compiler Settings (ie C++ compiler -02, -03, etc).
flags = -O3

; If false, the window will never be displayed.
headless = false

; The name of the program and executable to be output. Can't contain spaces or special characters. Required field.
name = "vite-vue-ts"

; The binary output path. It's recommended to add this path to .gitignore.
output = "build"

; The build script
script = "npm run build"

[build.watch]
; Configure your project to watch for sources that could change when running `ssc`.
; Could be a string or an array of strings
sources[] = "src"

[debug]
; Advanced Compiler Settings for debug purposes (ie C++ compiler -g, etc).
flags = "-g"


[meta]

; A unique ID that identifies the bundle (used by all app stores).
bundle_identifier = "com.beepboop"

; A string that gets used in the about dialog and package meta info.
copyright = "(c) Beep Boop Corp. 1985"

; A short description of the app.
description = "A UI for the beep boop network"

; Set the limit of files that can be opened by your process.
file_limit = 1024

; Localization
lang = "en-us"

; A String used in the about dialog and meta info.
maintainer = "Beep Boop Corp."

; The title of the app used in metadata files. This is NOT a window title. Can contain spaces and special characters. Defaults to name in a [build] section.
title = "Beep Boop"

; A string that indicates the version of the application. It should be a semver triple like 1.2.3. Defaults to 1.0.0.
version = 1.0.0


[android]

; TODO description needed
main_activity = ""


[ios]

; signing guide: https://socketsupply.co/guides/#ios-1
codesign_identity = ""

; Describes how Xcode should export the archive. Available options: app-store, package, ad-hoc, enterprise, development, and developer-id.
distribution_method = "ad-hoc"

; A path to the provisioning profile used for signing iOS app.
provisioning_profile = ""

; which device to target when building for the simulator
simulator_device = "iPhone 14"


[linux]
; Helps to make your app searchable in Linux desktop environments.
categories = "Developer Tools"

; The command to execute to spawn the "back-end" process.
cmd = "beepboop"

; The icon to use for identifying your app in Linux desktop environments.
icon = "src/icon.png"


[mac]

; Mac App Store icon
appstore_icon = "src/icons/icon.png"

; A category in the App Store
category = ""

; The command to execute to spawn the "back-end" process.
cmd = ""

; The icon to use for identifying your app on MacOS.
icon = ""

; TODO description & value (signing guide: https://socketsupply.co/guides/#macos-1)
sign = ""

; TODO description & value
codesign_identity = ""

; TODO description & value
sign_paths = ""


[native]

; Files that should be added to the compile step.
files = native-module1.cc native-module2.cc

; Extra Headers
headers = native-module1.hh


[win]

; The command to execute to spawn the “back-end” process.
cmd = "beepboop.exe"

; The icon to use for identifying your app on Windows.
icon = ""

; The icon to use for identifying your app on Windows.
logo = "src/icons/icon.png"

; A relative path to the pfx file used for signing.
pfx = "certs/cert.pfx"

; The signing information needed by the appx api.
publisher = "CN=Beep Boop Corp., O=Beep Boop Corp., L=San Francisco, S=California, C=US"

[window]

; The initial height of the first window.
height = 50%

; The initial width of the first window.
width = 50%

tmcappsph avatar Jan 17 '24 07:01 tmcappsph

would it be possible to show the delta/diff between the vite example that works and your changes?

heapwolf avatar Jan 17 '24 08:01 heapwolf

@heapwolf i just added the [build.watch] section in the socket.ini.

tmcappsph avatar Jan 17 '24 08:01 tmcappsph

Did you also change copy = "src" to copy = "dist"?

heapwolf avatar Jan 17 '24 09:01 heapwolf

@heapwolf it is already on dist. The socket.ini I used is in the first comment.

tmcappsph avatar Jan 17 '24 09:01 tmcappsph

someone changed it ;) by default copy = "src" (as evidenced here) so im curious what else may have changed from the demo that works, can you provide a link to a reproducible example?

heapwolf avatar Jan 17 '24 11:01 heapwolf

@heapwolf I'm doing the testing in the socket examples for vite. Here's a test repo you can use: https://github.com/tmcappsph/socket-examples/tree/master/frontend-tools-integrations/vite-vue-ts (https://github.com/tmcappsph/socket-examples.git). I just updated the socket.ini.

tmcappsph avatar Jan 18 '24 00:01 tmcappsph