mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-15 23:35:17 +03:00
fix(cfe-borrow): не затирать существующий Module.bsl при повторном заимствовании формы
Повторный borrow формы записывал пустой Module.bsl безусловно → терялся пользовательский код, добавленный в модуль формы (аналог IngvarConsulting/unica#4, воспроизведено: 150→3 байта). Теперь пустой модуль создаётся только если файла ещё нет; существующий сохраняется ("Preserved existing Module.bsl"). Дополняет идемпотентность re-borrow (форма-обёртка/uuid уже были закрыты в v1.5). Тест form-bindings усилен: между первым и вторым заимствованием в модуль пишется код (writeFile), idempotent:true теперь проверяет его сохранность побайтно. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# cfe-borrow v1.5 — Borrow objects from configuration into extension (CFE)
|
||||
# cfe-borrow v1.6 — Borrow objects from configuration into extension (CFE)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$ExtensionPath,
|
||||
@@ -882,14 +882,19 @@ function Borrow-Form {
|
||||
[System.IO.File]::WriteAllText($formXmlFile, $formXmlSb.ToString(), $enc)
|
||||
Info " Created: $formXmlFile"
|
||||
|
||||
# 6. Create empty Module.bsl
|
||||
# 6. Create empty Module.bsl — but NEVER overwrite an existing one (re-borrow must
|
||||
# not clobber user code added to the form module).
|
||||
$moduleDir = Join-Path $formXmlDir "Form"
|
||||
if (-not (Test-Path $moduleDir)) {
|
||||
New-Item -ItemType Directory -Path $moduleDir -Force | Out-Null
|
||||
}
|
||||
$moduleBslFile = Join-Path $moduleDir "Module.bsl"
|
||||
[System.IO.File]::WriteAllText($moduleBslFile, "", $enc)
|
||||
Info " Created: $moduleBslFile"
|
||||
if (Test-Path $moduleBslFile) {
|
||||
Info " Preserved existing Module.bsl"
|
||||
} else {
|
||||
[System.IO.File]::WriteAllText($moduleBslFile, "", $enc)
|
||||
Info " Created: $moduleBslFile"
|
||||
}
|
||||
|
||||
# 7. Register form in parent object ChildObjects
|
||||
Register-FormInObject $typeName $objName $formName
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# cfe-borrow v1.5 — Borrow objects from configuration into extension (CFE)
|
||||
# cfe-borrow v1.6 — Borrow objects from configuration into extension (CFE)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import argparse
|
||||
@@ -1483,12 +1483,16 @@ def main():
|
||||
save_text_bom(form_xml_file, "".join(parts))
|
||||
info(f" Created: {form_xml_file}")
|
||||
|
||||
# 6. Create empty Module.bsl
|
||||
# 6. Create empty Module.bsl — but NEVER overwrite an existing one (re-borrow must
|
||||
# not clobber user code added to the form module).
|
||||
module_dir = os.path.join(form_xml_dir, "Form")
|
||||
os.makedirs(module_dir, exist_ok=True)
|
||||
module_bsl_file = os.path.join(module_dir, "Module.bsl")
|
||||
save_text_bom(module_bsl_file, "")
|
||||
info(f" Created: {module_bsl_file}")
|
||||
if os.path.isfile(module_bsl_file):
|
||||
info(" Preserved existing Module.bsl")
|
||||
else:
|
||||
save_text_bom(module_bsl_file, "")
|
||||
info(f" Created: {module_bsl_file}")
|
||||
|
||||
# 7. Register form in parent object ChildObjects
|
||||
register_form_in_object(type_name, obj_name, form_name)
|
||||
|
||||
Reference in New Issue
Block a user