regen.mde 0.2.2 → 0.8.0
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/LICENSE +16 -16
- package/README.md +409 -295
- package/bin/build-corpus-editor.js +83 -81
- package/bin/build-corpus.js +41 -41
- package/bin/postinstall.js +259 -187
- package/bin/regen-mdeditor-install.js +27 -27
- package/bin/regen-mdeditor-uninstall.js +19 -19
- package/bin/validate-katex.js +93 -93
- package/desktop/BuildCorpusEditor/BuildCorpusBridge.cs +493 -270
- package/desktop/BuildCorpusEditor/BuildCorpusEditor.csproj +22 -22
- package/desktop/BuildCorpusEditor/EditorForm.cs +853 -540
- package/desktop/BuildCorpusEditor/Program.cs +85 -81
- package/desktop/BuildCorpusEditor/app.manifest +16 -16
- package/dist/release/regen-mde-0.8.0-win-x64.zip +0 -0
- package/dist/windows-editor/BuildCorpusEditor.dll +0 -0
- package/dist/windows-editor/BuildCorpusEditor.exe +0 -0
- package/dist/windows-editor/BuildCorpusEditor.pdb +0 -0
- package/dist/windows-editor/BuildCorpusEditor.runtimeconfig.json +1 -1
- package/dist/windows-editor/wwwroot/assets/index-C_VxJk4k.js +375 -0
- package/dist/windows-editor/wwwroot/assets/index-Wt9zSjIw.css +1 -0
- package/dist/windows-editor/wwwroot/index.html +22 -22
- package/editor-web/index.html +21 -21
- package/editor-web/src/main.jsx +1044 -399
- package/editor-web/src/styles.css +846 -602
- package/editor-web/vite.config.js +13 -13
- package/examples/build-corpus.config.example.json +21 -21
- package/installer/install-regen-mde.ps1 +214 -175
- package/installer/regen-mde.nsi +81 -81
- package/package.json +10 -6
- package/pyproject.toml +4 -3
- package/requirements.txt +5 -4
- package/scripts/build-windows-editor.ps1 +47 -47
- package/scripts/package-windows-editor.ps1 +90 -90
- package/scripts/release-dual.mjs +105 -0
- package/scripts/run-corpus.ps1 +28 -28
- package/scripts/run-editor-implementation-plane.ps1 +226 -203
- package/scripts/run-required-tests.ps1 +98 -98
- package/scripts/run-smoke.ps1 +28 -28
- package/src/build_corpus/__init__.py +1 -1
- package/src/build_corpus/docx_exporter.py +1055 -798
- package/src/build_corpus/equations.py +1345 -0
- package/src/build_corpus/exporter.py +1488 -1195
- package/src/build_corpus/frontmatter.py +302 -0
- package/src/build_corpus/ppt_exporter.py +543 -532
- package/src/build_corpus/templates/__init__.py +1 -1
- package/src/build_corpus/validate_assets.py +46 -46
- package/tools/audit_corpus.py +203 -203
- package/tools/collect_microsoft_word_templates.py +228 -228
- package/tools/collect_online_docx_corpus.py +272 -272
- package/tools/collect_online_pptx_corpus.py +252 -252
- package/tools/compare_pptx_inputs_outputs.py +87 -87
- package/tools/roundtrip_docx_corpus.py +171 -171
- package/dist/release/regen.mde-0.2.2-win-x64-setup.exe +0 -0
- package/dist/release/regen.mde-0.2.2-win-x64.zip +0 -0
- package/dist/windows-editor/wwwroot/assets/index-DjJ6xmhy.js +0 -326
- package/dist/windows-editor/wwwroot/assets/index-_dwMNNsm.css +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineConfig } from "vite";
|
|
2
|
-
import react from "@vitejs/plugin-react";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
root: path.resolve(import.meta.dirname),
|
|
7
|
-
base: "./",
|
|
8
|
-
plugins: [react()],
|
|
9
|
-
build: {
|
|
10
|
-
outDir: "../desktop/BuildCorpusEditor/wwwroot",
|
|
11
|
-
emptyOutDir: true,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import react from "@vitejs/plugin-react";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
root: path.resolve(import.meta.dirname),
|
|
7
|
+
base: "./",
|
|
8
|
+
plugins: [react()],
|
|
9
|
+
build: {
|
|
10
|
+
outDir: "../desktop/BuildCorpusEditor/wwwroot",
|
|
11
|
+
emptyOutDir: true,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"conversion": {
|
|
3
|
-
"equations": "tex",
|
|
4
|
-
"images": "assets"
|
|
5
|
-
},
|
|
6
|
-
"output": {
|
|
7
|
-
"out": ".codex/build-corpus/out",
|
|
8
|
-
"out_same_dir": false
|
|
9
|
-
},
|
|
10
|
-
"s3": {
|
|
11
|
-
"bucket": "build-corpus-assets",
|
|
12
|
-
"public_base_url": "https://assets.example.com",
|
|
13
|
-
"prefix": "build-corpus",
|
|
14
|
-
"endpoint_url": "https://ACCOUNT_ID.r2.cloudflarestorage.com",
|
|
15
|
-
"region_name": "auto",
|
|
16
|
-
"access_key_id": "%R2_ACCESS_KEY_ID%",
|
|
17
|
-
"secret_access_key": "%R2_SECRET_ACCESS_KEY%",
|
|
18
|
-
"cache_control": "public, max-age=31536000, immutable",
|
|
19
|
-
"acl": null
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"conversion": {
|
|
3
|
+
"equations": "tex",
|
|
4
|
+
"images": "assets"
|
|
5
|
+
},
|
|
6
|
+
"output": {
|
|
7
|
+
"out": ".codex/build-corpus/out",
|
|
8
|
+
"out_same_dir": false
|
|
9
|
+
},
|
|
10
|
+
"s3": {
|
|
11
|
+
"bucket": "build-corpus-assets",
|
|
12
|
+
"public_base_url": "https://assets.example.com",
|
|
13
|
+
"prefix": "build-corpus",
|
|
14
|
+
"endpoint_url": "https://ACCOUNT_ID.r2.cloudflarestorage.com",
|
|
15
|
+
"region_name": "auto",
|
|
16
|
+
"access_key_id": "%R2_ACCESS_KEY_ID%",
|
|
17
|
+
"secret_access_key": "%R2_SECRET_ACCESS_KEY%",
|
|
18
|
+
"cache_control": "public, max-age=31536000, immutable",
|
|
19
|
+
"acl": null
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,175 +1,214 @@
|
|
|
1
|
-
[CmdletBinding()]
|
|
2
|
-
param(
|
|
3
|
-
[string]$PackageRoot = "",
|
|
4
|
-
[string]$InstallDir = "$env:LOCALAPPDATA\Programs\regen
|
|
5
|
-
)
|
|
6
|
-
|
|
7
|
-
$ErrorActionPreference = "Stop"
|
|
8
|
-
|
|
9
|
-
if ([string]::IsNullOrWhiteSpace($PackageRoot)) {
|
|
10
|
-
$PackageApp = Join-Path $PSScriptRoot "app"
|
|
11
|
-
if (Test-Path -LiteralPath (Join-Path $PackageApp "BuildCorpusEditor.exe")) {
|
|
12
|
-
$PackageRoot = $PackageApp
|
|
13
|
-
} else {
|
|
14
|
-
$PackageRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
$ProductName = "regen
|
|
19
|
-
$LegacyProductNames = @("Manuscript Forge", "Regen.MDeditor")
|
|
20
|
-
$AppSource = if (Test-Path -LiteralPath (Join-Path $PackageRoot "BuildCorpusEditor.exe")) {
|
|
21
|
-
$PackageRoot
|
|
22
|
-
} else {
|
|
23
|
-
Join-Path $PackageRoot "dist\windows-editor"
|
|
24
|
-
}
|
|
25
|
-
$AppExe = Join-Path $AppSource "BuildCorpusEditor.exe"
|
|
26
|
-
$StartMenuDir = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\LIFE AI"
|
|
27
|
-
$ShortcutPath = Join-Path $StartMenuDir "$ProductName.lnk"
|
|
28
|
-
$UninstallShortcutPath = Join-Path $StartMenuDir "Uninstall $ProductName.lnk"
|
|
29
|
-
$LegacyInstallDir = Join-Path $env:LOCALAPPDATA "Programs\Manuscript Forge"
|
|
30
|
-
$LegacyInstallDir2 = Join-Path $env:LOCALAPPDATA "Programs\Regen.MDeditor"
|
|
31
|
-
|
|
32
|
-
if (-not (Test-Path -LiteralPath $AppExe)) {
|
|
33
|
-
throw "Package is missing BuildCorpusEditor.exe"
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function Remove-FileVerb {
|
|
37
|
-
param(
|
|
38
|
-
[string]$Extension,
|
|
39
|
-
[string]$Verb
|
|
40
|
-
)
|
|
41
|
-
Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb" -Recurse -Force -ErrorAction SilentlyContinue
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
Get-Process BuildCorpusEditor -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
|
|
45
|
-
foreach ($legacyProductName in $LegacyProductNames) {
|
|
46
|
-
Remove-Item -LiteralPath (Join-Path $StartMenuDir "$legacyProductName.lnk") -Force -ErrorAction SilentlyContinue
|
|
47
|
-
Remove-Item -LiteralPath (Join-Path $StartMenuDir "Uninstall $legacyProductName.lnk") -Force -ErrorAction SilentlyContinue
|
|
48
|
-
}
|
|
49
|
-
Remove-Item -LiteralPath $ShortcutPath -Force -ErrorAction SilentlyContinue
|
|
50
|
-
Remove-Item -LiteralPath $UninstallShortcutPath -Force -ErrorAction SilentlyContinue
|
|
51
|
-
foreach ($ext in @(".md", ".docx")) {
|
|
52
|
-
foreach ($verb in @("ManuscriptForgeOpen", "BuildCorpusOpenEditor", "RegenMDEditorOpen")) {
|
|
53
|
-
Remove-FileVerb -Extension $ext -Verb $verb
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
foreach ($item in @("
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
$
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
$
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
$Command
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
"
|
|
162
|
-
Set-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
$
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
1
|
+
[CmdletBinding()]
|
|
2
|
+
param(
|
|
3
|
+
[string]$PackageRoot = "",
|
|
4
|
+
[string]$InstallDir = "$env:LOCALAPPDATA\Programs\regen-mde"
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
$ErrorActionPreference = "Stop"
|
|
8
|
+
|
|
9
|
+
if ([string]::IsNullOrWhiteSpace($PackageRoot)) {
|
|
10
|
+
$PackageApp = Join-Path $PSScriptRoot "app"
|
|
11
|
+
if (Test-Path -LiteralPath (Join-Path $PackageApp "BuildCorpusEditor.exe")) {
|
|
12
|
+
$PackageRoot = $PackageApp
|
|
13
|
+
} else {
|
|
14
|
+
$PackageRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
$ProductName = "regen-mde"
|
|
19
|
+
$LegacyProductNames = @("Manuscript Forge", "Regen.MDeditor")
|
|
20
|
+
$AppSource = if (Test-Path -LiteralPath (Join-Path $PackageRoot "BuildCorpusEditor.exe")) {
|
|
21
|
+
$PackageRoot
|
|
22
|
+
} else {
|
|
23
|
+
Join-Path $PackageRoot "dist\windows-editor"
|
|
24
|
+
}
|
|
25
|
+
$AppExe = Join-Path $AppSource "BuildCorpusEditor.exe"
|
|
26
|
+
$StartMenuDir = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\LIFE AI"
|
|
27
|
+
$ShortcutPath = Join-Path $StartMenuDir "$ProductName.lnk"
|
|
28
|
+
$UninstallShortcutPath = Join-Path $StartMenuDir "Uninstall $ProductName.lnk"
|
|
29
|
+
$LegacyInstallDir = Join-Path $env:LOCALAPPDATA "Programs\Manuscript Forge"
|
|
30
|
+
$LegacyInstallDir2 = Join-Path $env:LOCALAPPDATA "Programs\Regen.MDeditor"
|
|
31
|
+
|
|
32
|
+
if (-not (Test-Path -LiteralPath $AppExe)) {
|
|
33
|
+
throw "Package is missing BuildCorpusEditor.exe"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function Remove-FileVerb {
|
|
37
|
+
param(
|
|
38
|
+
[string]$Extension,
|
|
39
|
+
[string]$Verb
|
|
40
|
+
)
|
|
41
|
+
Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb" -Recurse -Force -ErrorAction SilentlyContinue
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
Get-Process BuildCorpusEditor -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
|
|
45
|
+
foreach ($legacyProductName in $LegacyProductNames) {
|
|
46
|
+
Remove-Item -LiteralPath (Join-Path $StartMenuDir "$legacyProductName.lnk") -Force -ErrorAction SilentlyContinue
|
|
47
|
+
Remove-Item -LiteralPath (Join-Path $StartMenuDir "Uninstall $legacyProductName.lnk") -Force -ErrorAction SilentlyContinue
|
|
48
|
+
}
|
|
49
|
+
Remove-Item -LiteralPath $ShortcutPath -Force -ErrorAction SilentlyContinue
|
|
50
|
+
Remove-Item -LiteralPath $UninstallShortcutPath -Force -ErrorAction SilentlyContinue
|
|
51
|
+
foreach ($ext in @(".md", ".docx", ".pptx", ".ppt")) {
|
|
52
|
+
foreach ($verb in @("ManuscriptForgeOpen", "BuildCorpusOpenEditor", "RegenMDEditorOpen", "BuildCorpusToMarkdown", "BuildCorpusToWord", "BuildCorpusInlineImages")) {
|
|
53
|
+
Remove-FileVerb -Extension $ext -Verb $verb
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\Directory\shell\BuildCorpusFolderToMarkdown" -Recurse -Force -ErrorAction SilentlyContinue
|
|
57
|
+
if ((Test-Path -LiteralPath $LegacyInstallDir) -and ($LegacyInstallDir -ne $InstallDir)) {
|
|
58
|
+
Remove-Item -LiteralPath $LegacyInstallDir -Recurse -Force -ErrorAction SilentlyContinue
|
|
59
|
+
}
|
|
60
|
+
if ((Test-Path -LiteralPath $LegacyInstallDir2) -and ($LegacyInstallDir2 -ne $InstallDir)) {
|
|
61
|
+
Remove-Item -LiteralPath $LegacyInstallDir2 -Recurse -Force -ErrorAction SilentlyContinue
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
|
|
65
|
+
foreach ($item in @("wwwroot", "runtimes")) {
|
|
66
|
+
Remove-Item -LiteralPath (Join-Path $InstallDir $item) -Recurse -Force -ErrorAction SilentlyContinue
|
|
67
|
+
}
|
|
68
|
+
foreach ($pattern in @("BuildCorpusEditor.*", "Microsoft.Web.WebView2.*", "WebView2Loader.dll")) {
|
|
69
|
+
Get-ChildItem -LiteralPath $InstallDir -Filter $pattern -ErrorAction SilentlyContinue | Remove-Item -Force -ErrorAction SilentlyContinue
|
|
70
|
+
}
|
|
71
|
+
Copy-Item -Path (Join-Path $AppSource "*") -Destination $InstallDir -Recurse -Force
|
|
72
|
+
foreach ($item in @("bin", "src")) {
|
|
73
|
+
$sourcePath = Join-Path $PackageRoot $item
|
|
74
|
+
if (Test-Path -LiteralPath $sourcePath) {
|
|
75
|
+
$destinationPath = Join-Path $InstallDir $item
|
|
76
|
+
Remove-Item -LiteralPath $destinationPath -Recurse -Force -ErrorAction SilentlyContinue
|
|
77
|
+
Copy-Item -LiteralPath $sourcePath -Destination $InstallDir -Recurse -Force
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
foreach ($item in @("requirements.txt", "pyproject.toml", "package.json", "package-lock.json")) {
|
|
81
|
+
$sourcePath = Join-Path $PackageRoot $item
|
|
82
|
+
if (Test-Path -LiteralPath $sourcePath) {
|
|
83
|
+
Copy-Item -LiteralPath $sourcePath -Destination $InstallDir -Force
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
$InstalledExe = Join-Path $InstallDir "BuildCorpusEditor.exe"
|
|
88
|
+
$UninstallScript = Join-Path $InstallDir "uninstall-regen-mde.ps1"
|
|
89
|
+
|
|
90
|
+
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
|
|
91
|
+
throw "Node.js is required on PATH for DOCX/Markdown conversion."
|
|
92
|
+
}
|
|
93
|
+
$NodeExe = (Get-Command node -ErrorAction Stop).Source
|
|
94
|
+
|
|
95
|
+
$requirements = Join-Path $InstallDir "requirements.txt"
|
|
96
|
+
$pythonReady = $false
|
|
97
|
+
foreach ($candidate in @("py", "python")) {
|
|
98
|
+
if (-not (Get-Command $candidate -ErrorAction SilentlyContinue)) { continue }
|
|
99
|
+
if ($candidate -eq "py") {
|
|
100
|
+
& py -3 -c "import omml2latex, boto3, PIL, docx" 2>$null
|
|
101
|
+
} else {
|
|
102
|
+
& python -c "import omml2latex, boto3, PIL, docx" 2>$null
|
|
103
|
+
}
|
|
104
|
+
if ($LASTEXITCODE -eq 0) {
|
|
105
|
+
$pythonReady = $true
|
|
106
|
+
break
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (-not $pythonReady) {
|
|
111
|
+
Write-Warning "Python conversion dependencies are not already installed. Install them later with: py -3 -m pip install -r `"$requirements`""
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
New-Item -ItemType Directory -Force -Path $StartMenuDir | Out-Null
|
|
115
|
+
$shell = New-Object -ComObject WScript.Shell
|
|
116
|
+
$shortcut = $shell.CreateShortcut($ShortcutPath)
|
|
117
|
+
$shortcut.TargetPath = $InstalledExe
|
|
118
|
+
$shortcut.WorkingDirectory = $InstallDir
|
|
119
|
+
$shortcut.IconLocation = "$InstalledExe,0"
|
|
120
|
+
$shortcut.Description = "$ProductName Word and Markdown editor"
|
|
121
|
+
$shortcut.Save()
|
|
122
|
+
|
|
123
|
+
function Set-FileVerb {
|
|
124
|
+
param(
|
|
125
|
+
[string]$Extension,
|
|
126
|
+
[string]$Verb,
|
|
127
|
+
[string]$Label,
|
|
128
|
+
[string]$Command
|
|
129
|
+
)
|
|
130
|
+
$key = "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb"
|
|
131
|
+
$commandKey = Join-Path $key "command"
|
|
132
|
+
New-Item -Path $commandKey -Force | Out-Null
|
|
133
|
+
New-ItemProperty -Path $key -Name "MUIVerb" -Value $Label -PropertyType String -Force | Out-Null
|
|
134
|
+
New-ItemProperty -Path $key -Name "Icon" -Value $InstalledExe -PropertyType ExpandString -Force | Out-Null
|
|
135
|
+
[Microsoft.Win32.Registry]::SetValue(
|
|
136
|
+
"HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb\command",
|
|
137
|
+
"",
|
|
138
|
+
$Command,
|
|
139
|
+
[Microsoft.Win32.RegistryValueKind]::String)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function Set-FolderVerb {
|
|
143
|
+
param(
|
|
144
|
+
[string]$Verb,
|
|
145
|
+
[string]$Label,
|
|
146
|
+
[string]$Command
|
|
147
|
+
)
|
|
148
|
+
$key = "Registry::HKEY_CURRENT_USER\Software\Classes\Directory\shell\$Verb"
|
|
149
|
+
$commandKey = Join-Path $key "command"
|
|
150
|
+
New-Item -Path $commandKey -Force | Out-Null
|
|
151
|
+
New-ItemProperty -Path $key -Name "MUIVerb" -Value $Label -PropertyType String -Force | Out-Null
|
|
152
|
+
New-ItemProperty -Path $key -Name "Icon" -Value $InstalledExe -PropertyType ExpandString -Force | Out-Null
|
|
153
|
+
[Microsoft.Win32.Registry]::SetValue(
|
|
154
|
+
"HKEY_CURRENT_USER\Software\Classes\Directory\shell\$Verb\command",
|
|
155
|
+
"",
|
|
156
|
+
$Command,
|
|
157
|
+
[Microsoft.Win32.RegistryValueKind]::String)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
Set-FileVerb -Extension ".md" -Verb "RegenMDEditorOpen" -Label "Open in regen-mde" -Command "`"$InstalledExe`" `"%1`""
|
|
161
|
+
Set-FileVerb -Extension ".docx" -Verb "RegenMDEditorOpen" -Label "Open in regen-mde" -Command "`"$InstalledExe`" `"%1`""
|
|
162
|
+
Set-FileVerb -Extension ".docx" -Verb "BuildCorpusToMarkdown" -Label "Convert to Markdown" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --out-same-dir"
|
|
163
|
+
Set-FileVerb -Extension ".pptx" -Verb "BuildCorpusToMarkdown" -Label "Convert to Markdown" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --out-same-dir"
|
|
164
|
+
Set-FileVerb -Extension ".ppt" -Verb "BuildCorpusToMarkdown" -Label "Convert to Markdown" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --out-same-dir"
|
|
165
|
+
Set-FileVerb -Extension ".md" -Verb "BuildCorpusToWord" -Label "Convert to Word" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --to word --out-same-dir"
|
|
166
|
+
Set-FileVerb -Extension ".md" -Verb "BuildCorpusInlineImages" -Label "Inline Markdown Images" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --inline-images"
|
|
167
|
+
Set-FolderVerb -Verb "BuildCorpusFolderToMarkdown" -Label "Convert Documents to Markdown" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%V`" --out-same-dir"
|
|
168
|
+
New-Item -Path "Registry::HKEY_CURRENT_USER\Software\Classes\.md\ShellNew" -Force | Out-Null
|
|
169
|
+
New-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Classes\.md" -Name "Content Type" -Value "text/markdown" -PropertyType String -Force | Out-Null
|
|
170
|
+
New-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Classes\.md\ShellNew" -Name "NullFile" -Value "" -PropertyType String -Force | Out-Null
|
|
171
|
+
|
|
172
|
+
$uninstall = @"
|
|
173
|
+
`$ErrorActionPreference = "Stop"
|
|
174
|
+
`$ProductName = "regen-mde"
|
|
175
|
+
`$InstallDir = Split-Path -Parent `$MyInvocation.MyCommand.Path
|
|
176
|
+
`$StartMenuDir = Join-Path `$env:APPDATA "Microsoft\Windows\Start Menu\Programs\LIFE AI"
|
|
177
|
+
Get-Process BuildCorpusEditor -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
|
|
178
|
+
Remove-Item -LiteralPath (Join-Path `$StartMenuDir "`$ProductName.lnk") -Force -ErrorAction SilentlyContinue
|
|
179
|
+
Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Uninstall `$ProductName.lnk") -Force -ErrorAction SilentlyContinue
|
|
180
|
+
Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Regen.MDeditor.lnk") -Force -ErrorAction SilentlyContinue
|
|
181
|
+
Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Manuscript Forge.lnk") -Force -ErrorAction SilentlyContinue
|
|
182
|
+
Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Uninstall Regen.MDeditor.lnk") -Force -ErrorAction SilentlyContinue
|
|
183
|
+
foreach (`$ext in @(".md", ".docx", ".pptx", ".ppt")) {
|
|
184
|
+
foreach (`$verb in @("RegenMDEditorOpen", "BuildCorpusToMarkdown", "BuildCorpusToWord", "BuildCorpusInlineImages", "ManuscriptForgeOpen", "BuildCorpusOpenEditor")) {
|
|
185
|
+
Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\`$ext\shell\`$verb" -Recurse -Force -ErrorAction SilentlyContinue
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\Directory\shell\BuildCorpusFolderToMarkdown" -Recurse -Force -ErrorAction SilentlyContinue
|
|
189
|
+
Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\.md\ShellNew" -Recurse -Force -ErrorAction SilentlyContinue
|
|
190
|
+
for (`$i = 0; `$i -lt 10; `$i++) {
|
|
191
|
+
Start-Sleep -Milliseconds 250
|
|
192
|
+
try {
|
|
193
|
+
Remove-Item -LiteralPath `$InstallDir -Recurse -Force
|
|
194
|
+
break
|
|
195
|
+
} catch {
|
|
196
|
+
if (`$i -eq 9) { throw }
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
Write-Host "`$ProductName removed."
|
|
200
|
+
"@
|
|
201
|
+
Set-Content -LiteralPath $UninstallScript -Value $uninstall -Encoding UTF8
|
|
202
|
+
|
|
203
|
+
$uninstallShortcut = $shell.CreateShortcut($UninstallShortcutPath)
|
|
204
|
+
$uninstallShortcut.TargetPath = "powershell.exe"
|
|
205
|
+
$uninstallShortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -File `"$UninstallScript`""
|
|
206
|
+
$uninstallShortcut.WorkingDirectory = $InstallDir
|
|
207
|
+
$uninstallShortcut.IconLocation = "$InstalledExe,0"
|
|
208
|
+
$uninstallShortcut.Description = "Uninstall $ProductName"
|
|
209
|
+
$uninstallShortcut.Save()
|
|
210
|
+
|
|
211
|
+
Write-Host "$ProductName installed."
|
|
212
|
+
Write-Host "InstallDir=$InstallDir"
|
|
213
|
+
Write-Host "Shortcut=$ShortcutPath"
|
|
214
|
+
Write-Host "Executable=$InstalledExe"
|
package/installer/regen-mde.nsi
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
!ifndef VERSION
|
|
2
|
-
!define VERSION "0.2.1"
|
|
3
|
-
!endif
|
|
4
|
-
!ifndef APP_SOURCE
|
|
5
|
-
!error "APP_SOURCE must point to the staged app directory"
|
|
6
|
-
!endif
|
|
7
|
-
!ifndef OUT_FILE
|
|
8
|
-
!define OUT_FILE "regen
|
|
9
|
-
!endif
|
|
10
|
-
|
|
11
|
-
Unicode true
|
|
12
|
-
Name "regen
|
|
13
|
-
OutFile "${OUT_FILE}"
|
|
14
|
-
InstallDir "$LOCALAPPDATA\Programs\regen
|
|
15
|
-
RequestExecutionLevel user
|
|
16
|
-
SetCompressor /SOLID lzma
|
|
17
|
-
|
|
18
|
-
!include LogicLib.nsh
|
|
19
|
-
|
|
20
|
-
Var StartMenuDir
|
|
21
|
-
|
|
22
|
-
Function .onInit
|
|
23
|
-
StrCpy $StartMenuDir "$SMPROGRAMS\LIFE AI"
|
|
24
|
-
FunctionEnd
|
|
25
|
-
|
|
26
|
-
Section "Install"
|
|
27
|
-
SetShellVarContext current
|
|
28
|
-
|
|
29
|
-
; Remove earlier app identities and npm-era shell verbs before installing.
|
|
30
|
-
RMDir /r "$LOCALAPPDATA\Programs\Manuscript Forge"
|
|
31
|
-
RMDir /r "$LOCALAPPDATA\Programs\Regen.MDeditor"
|
|
32
|
-
Delete "$SMPROGRAMS\LIFE AI\Manuscript Forge.lnk"
|
|
33
|
-
Delete "$SMPROGRAMS\LIFE AI\Regen.MDeditor.lnk"
|
|
34
|
-
Delete "$SMPROGRAMS\LIFE AI\Uninstall Regen.MDeditor.lnk"
|
|
35
|
-
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\ManuscriptForgeOpen"
|
|
36
|
-
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\ManuscriptForgeOpen"
|
|
37
|
-
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\BuildCorpusOpenEditor"
|
|
38
|
-
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\BuildCorpusOpenEditor"
|
|
39
|
-
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen"
|
|
40
|
-
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen"
|
|
41
|
-
|
|
42
|
-
SetOutPath "$INSTDIR"
|
|
43
|
-
File /r "${APP_SOURCE}\*.*"
|
|
44
|
-
|
|
45
|
-
WriteUninstaller "$INSTDIR\uninstall.exe"
|
|
46
|
-
CreateDirectory "$StartMenuDir"
|
|
47
|
-
CreateShortcut "$StartMenuDir\regen
|
|
48
|
-
CreateShortcut "$StartMenuDir\Uninstall regen
|
|
49
|
-
|
|
50
|
-
WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen" "MUIVerb" "Open in regen
|
|
51
|
-
WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen" "Icon" "$INSTDIR\BuildCorpusEditor.exe"
|
|
52
|
-
WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen\command" "" '"$INSTDIR\BuildCorpusEditor.exe" "%1"'
|
|
53
|
-
|
|
54
|
-
WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen" "MUIVerb" "Open in regen
|
|
55
|
-
WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen" "Icon" "$INSTDIR\BuildCorpusEditor.exe"
|
|
56
|
-
WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen\command" "" '"$INSTDIR\BuildCorpusEditor.exe" "%1"'
|
|
57
|
-
|
|
58
|
-
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen
|
|
59
|
-
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen
|
|
60
|
-
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen
|
|
61
|
-
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen
|
|
62
|
-
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen
|
|
63
|
-
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen
|
|
64
|
-
SectionEnd
|
|
65
|
-
|
|
66
|
-
Section "Uninstall"
|
|
67
|
-
SetShellVarContext current
|
|
68
|
-
Delete "$SMPROGRAMS\LIFE AI\regen
|
|
69
|
-
Delete "$SMPROGRAMS\LIFE AI\Uninstall regen
|
|
70
|
-
RMDir "$SMPROGRAMS\LIFE AI"
|
|
71
|
-
|
|
72
|
-
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen"
|
|
73
|
-
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen"
|
|
74
|
-
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\ManuscriptForgeOpen"
|
|
75
|
-
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\ManuscriptForgeOpen"
|
|
76
|
-
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\BuildCorpusOpenEditor"
|
|
77
|
-
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\BuildCorpusOpenEditor"
|
|
78
|
-
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen
|
|
79
|
-
|
|
80
|
-
RMDir /r "$INSTDIR"
|
|
81
|
-
SectionEnd
|
|
1
|
+
!ifndef VERSION
|
|
2
|
+
!define VERSION "0.2.1"
|
|
3
|
+
!endif
|
|
4
|
+
!ifndef APP_SOURCE
|
|
5
|
+
!error "APP_SOURCE must point to the staged app directory"
|
|
6
|
+
!endif
|
|
7
|
+
!ifndef OUT_FILE
|
|
8
|
+
!define OUT_FILE "regen-mde-${VERSION}-win-x64-setup.exe"
|
|
9
|
+
!endif
|
|
10
|
+
|
|
11
|
+
Unicode true
|
|
12
|
+
Name "regen-mde"
|
|
13
|
+
OutFile "${OUT_FILE}"
|
|
14
|
+
InstallDir "$LOCALAPPDATA\Programs\regen-mde"
|
|
15
|
+
RequestExecutionLevel user
|
|
16
|
+
SetCompressor /SOLID lzma
|
|
17
|
+
|
|
18
|
+
!include LogicLib.nsh
|
|
19
|
+
|
|
20
|
+
Var StartMenuDir
|
|
21
|
+
|
|
22
|
+
Function .onInit
|
|
23
|
+
StrCpy $StartMenuDir "$SMPROGRAMS\LIFE AI"
|
|
24
|
+
FunctionEnd
|
|
25
|
+
|
|
26
|
+
Section "Install"
|
|
27
|
+
SetShellVarContext current
|
|
28
|
+
|
|
29
|
+
; Remove earlier app identities and npm-era shell verbs before installing.
|
|
30
|
+
RMDir /r "$LOCALAPPDATA\Programs\Manuscript Forge"
|
|
31
|
+
RMDir /r "$LOCALAPPDATA\Programs\Regen.MDeditor"
|
|
32
|
+
Delete "$SMPROGRAMS\LIFE AI\Manuscript Forge.lnk"
|
|
33
|
+
Delete "$SMPROGRAMS\LIFE AI\Regen.MDeditor.lnk"
|
|
34
|
+
Delete "$SMPROGRAMS\LIFE AI\Uninstall Regen.MDeditor.lnk"
|
|
35
|
+
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\ManuscriptForgeOpen"
|
|
36
|
+
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\ManuscriptForgeOpen"
|
|
37
|
+
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\BuildCorpusOpenEditor"
|
|
38
|
+
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\BuildCorpusOpenEditor"
|
|
39
|
+
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen"
|
|
40
|
+
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen"
|
|
41
|
+
|
|
42
|
+
SetOutPath "$INSTDIR"
|
|
43
|
+
File /r "${APP_SOURCE}\*.*"
|
|
44
|
+
|
|
45
|
+
WriteUninstaller "$INSTDIR\uninstall.exe"
|
|
46
|
+
CreateDirectory "$StartMenuDir"
|
|
47
|
+
CreateShortcut "$StartMenuDir\regen-mde.lnk" "$INSTDIR\BuildCorpusEditor.exe" "" "$INSTDIR\BuildCorpusEditor.exe" 0
|
|
48
|
+
CreateShortcut "$StartMenuDir\Uninstall regen-mde.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\BuildCorpusEditor.exe" 0
|
|
49
|
+
|
|
50
|
+
WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen" "MUIVerb" "Open in regen-mde"
|
|
51
|
+
WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen" "Icon" "$INSTDIR\BuildCorpusEditor.exe"
|
|
52
|
+
WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen\command" "" '"$INSTDIR\BuildCorpusEditor.exe" "%1"'
|
|
53
|
+
|
|
54
|
+
WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen" "MUIVerb" "Open in regen-mde"
|
|
55
|
+
WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen" "Icon" "$INSTDIR\BuildCorpusEditor.exe"
|
|
56
|
+
WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen\command" "" '"$INSTDIR\BuildCorpusEditor.exe" "%1"'
|
|
57
|
+
|
|
58
|
+
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "DisplayName" "regen-mde"
|
|
59
|
+
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "DisplayVersion" "${VERSION}"
|
|
60
|
+
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "Publisher" "LIFE AI"
|
|
61
|
+
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "InstallLocation" "$INSTDIR"
|
|
62
|
+
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "DisplayIcon" "$INSTDIR\BuildCorpusEditor.exe"
|
|
63
|
+
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
|
64
|
+
SectionEnd
|
|
65
|
+
|
|
66
|
+
Section "Uninstall"
|
|
67
|
+
SetShellVarContext current
|
|
68
|
+
Delete "$SMPROGRAMS\LIFE AI\regen-mde.lnk"
|
|
69
|
+
Delete "$SMPROGRAMS\LIFE AI\Uninstall regen-mde.lnk"
|
|
70
|
+
RMDir "$SMPROGRAMS\LIFE AI"
|
|
71
|
+
|
|
72
|
+
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen"
|
|
73
|
+
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen"
|
|
74
|
+
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\ManuscriptForgeOpen"
|
|
75
|
+
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\ManuscriptForgeOpen"
|
|
76
|
+
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\BuildCorpusOpenEditor"
|
|
77
|
+
DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\BuildCorpusOpenEditor"
|
|
78
|
+
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde"
|
|
79
|
+
|
|
80
|
+
RMDir /r "$INSTDIR"
|
|
81
|
+
SectionEnd
|