NativeScript / NativeScript/nativescript-cli
Livesync hangs when modifying App_Resources in before-prepare hook
還沒有人認領這個 Issue。
- 主要語言
- JavaScript
- 星號
- 1.1k
- 分支
- 204
- 平均合併
- 1 天 9 小時
- 30 天內合併 PR
- 8
描述
Tell us about the problem
When using nativescript-localize with "tns run ios", it tries to sync Localizable.strings without rebuilding the app.
Which platform(s) does your issue occur on?
iOS, haven't tried on Android
Please provide the following version numbers that your issue occurs with:
- CLI: 3.3.1
- Cross-platform modules: 3.3.0
- Runtime(s): 3.3.0
- Plugin(s): nativescript-localize (2.0.5)
- iOS 11 on iPhone X emulator
Please tell us how to recreate the issue in as much detail as possible.
git clone --depth 1 --branch v2.0.5 https://github.com/lfabreges/nativescript-localize.git
cd nativescript-localize
npm install
npm run compile
cd demo
npm install
tns run ios
Then make a change in the app/i18n/en.default.js file, change "Hello World !" to "Hello" for example.
Executing before-prepare hook from /Users/lfabreges/Documents/Developpement/nativescript-localize/demo/hooks/before-prepare/nativescript-localize.js
Preparing project...
Project successfully prepared (iOS)
Successfully transferred en.default.js.
Refreshing application...
Successfully synced application org.nativescript.demo.javascript on device ED5FEB43-DDA2-43FD-B693-4E07FD78CB1C.
Skipping prepare.
Successfully transferred Localizable.strings.
Refreshing application...
Successfully synced application org.nativescript.demo.javascript on device ED5FEB43-DDA2-43FD-B693-4E07FD78CB1C.
More
I think the problem occurs because :
- The plugin modifies Localizable.strings in the App_Resources
- Prepare is done and savePrepareInfo save the .nsprepareinfo file with a modified time greater that Localizable.strings modified time
- The watcher detects that a change has been made to the Localizable.strings and add it to the queue
- Prepared is skipped because no change is detected, appResourcesChanged is not set to true because containsNewerFiles returns false because Localizable.strings has been modified before .nsprepareinfo file is written to disk
- Localizable.strings is synced but without a rebuild and the app hangs, I need to stop tns run, remove the platforms directory and fully rebuild and resinstall the app to make it work again
I tried to hook into the process but did not find a way to fix it, I triggered a build by modifying appResourcesChanged directly into the plugin, it works but Localizable.strings is stilled synced afterwards, so it hangs again.
I'm the author of the plugin, so I can change it if needed. I definitly need some help on it.
Regards.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
使用列出的 nativescript-localize 示範指令重現問題,然後檢查 hooks/before-prepare/nativescript-localize.js、App_Resources 以及 .nsprepareinfo 的處理。追蹤 watcher、prepare-skip 決策和 Localizable.strings 同步之間如何互相作用。完成的標準是:修改 app/i18n/en.default.js 不再導致 iOS 應用程式卡住,且必要的重新建置或資源更新能夠成功完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- ios, javascript
- 領域
- build-system, cli, mobile-dev
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100