cross-packer 0.1.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 +661 -0
- package/README.md +151 -0
- package/README.zh-CN.md +151 -0
- package/dist/archive/ar.d.ts +12 -0
- package/dist/archive/seven-za.d.ts +32 -0
- package/dist/archive/tar.d.ts +30 -0
- package/dist/archive/zip-reader.d.ts +17 -0
- package/dist/asar/dependency/collect.d.ts +2 -0
- package/dist/asar/dependency/detector.d.ts +8 -0
- package/dist/asar/dependency/hoister.d.ts +27 -0
- package/dist/asar/dependency/utils.d.ts +59 -0
- package/dist/asar/fileset/matcher.d.ts +12 -0
- package/dist/asar/fileset/platform-fileset.d.ts +36 -0
- package/dist/asar/fileset/transformer.d.ts +2 -0
- package/dist/asar/fileset/unpack-detector.d.ts +10 -0
- package/dist/asar/fileset/walker.d.ts +14 -0
- package/dist/asar/pack.d.ts +23 -0
- package/dist/asar/packer/app-collector.d.ts +2 -0
- package/dist/asar/packer/collector.d.ts +18 -0
- package/dist/asar/packer/concurrency.d.ts +1 -0
- package/dist/asar/packer/integrity.d.ts +8 -0
- package/dist/asar/packer/nm-collector.d.ts +7 -0
- package/dist/asar/packer/stream-builder.d.ts +18 -0
- package/dist/cli.d.ts +2 -0
- package/dist/config/index.d.ts +97 -0
- package/dist/electron/dist-zip.d.ts +18 -0
- package/dist/electron/download.d.ts +21 -0
- package/dist/index.d.ts +11 -0
- package/dist/packer/common/app-update-yml.d.ts +5 -0
- package/dist/packer/common/extra-resources.d.ts +39 -0
- package/dist/packer/common/staging.d.ts +3 -0
- package/dist/packer/common/template.d.ts +2 -0
- package/dist/packer/linux/linux.d.ts +2 -0
- package/dist/packer/mac/mac.d.ts +23 -0
- package/dist/packer/win/nsis.d.ts +24 -0
- package/dist/packer/win/resedit.d.ts +5 -0
- package/dist/packer/win/toolchain.d.ts +8 -0
- package/dist/packer/win/win.d.ts +12 -0
- package/dist/pipeline/pipeline.d.ts +41 -0
- package/dist/pipeline/targets.d.ts +28 -0
- package/dist/shared/hash.d.ts +2 -0
- package/dist/shared/logger.d.ts +39 -0
- package/dist/shared/platform.d.ts +26 -0
- package/dist/shared/types.d.ts +68 -0
- package/dist/update/blockmap.d.ts +13 -0
- package/dist/update/metadata.d.ts +20 -0
- package/dist/update/version.d.ts +7 -0
- package/package.json +71 -0
- package/src/archive/ar.ts +41 -0
- package/src/archive/seven-za.ts +160 -0
- package/src/archive/tar.ts +142 -0
- package/src/archive/zip-reader.ts +61 -0
- package/src/asar/dependency/collect.ts +437 -0
- package/src/asar/dependency/detector.ts +73 -0
- package/src/asar/dependency/hoister.ts +714 -0
- package/src/asar/dependency/utils.ts +225 -0
- package/src/asar/fileset/matcher.ts +101 -0
- package/src/asar/fileset/platform-fileset.ts +416 -0
- package/src/asar/fileset/transformer.ts +154 -0
- package/src/asar/fileset/unpack-detector.ts +38 -0
- package/src/asar/fileset/walker.ts +115 -0
- package/src/asar/pack.ts +186 -0
- package/src/asar/packer/app-collector.ts +74 -0
- package/src/asar/packer/collector.ts +134 -0
- package/src/asar/packer/concurrency.ts +24 -0
- package/src/asar/packer/integrity.ts +53 -0
- package/src/asar/packer/nm-collector.ts +194 -0
- package/src/asar/packer/stream-builder.ts +723 -0
- package/src/cli.ts +182 -0
- package/src/config/index.ts +365 -0
- package/src/electron/dist-zip.ts +65 -0
- package/src/electron/download.ts +121 -0
- package/src/index.ts +14 -0
- package/src/packer/common/app-update-yml.ts +21 -0
- package/src/packer/common/extra-resources.ts +83 -0
- package/src/packer/common/staging.ts +33 -0
- package/src/packer/common/template.ts +24 -0
- package/src/packer/linux/linux.ts +329 -0
- package/src/packer/mac/mac.ts +495 -0
- package/src/packer/win/nsis.ts +244 -0
- package/src/packer/win/resedit.ts +60 -0
- package/src/packer/win/toolchain.ts +63 -0
- package/src/packer/win/win.ts +421 -0
- package/src/pipeline/pipeline.ts +149 -0
- package/src/pipeline/targets.ts +67 -0
- package/src/shared/hash.ts +15 -0
- package/src/shared/logger.ts +91 -0
- package/src/shared/platform.ts +41 -0
- package/src/shared/types.ts +82 -0
- package/src/update/blockmap.ts +247 -0
- package/src/update/metadata.ts +97 -0
- package/src/update/version.ts +59 -0
- package/templates/linux/app.desktop +11 -0
- package/templates/linux/control +9 -0
- package/templates/linux/postinst +10 -0
- package/templates/linux/postrm +8 -0
- package/templates/linux/preinst +49 -0
- package/templates/linux/prerm +43 -0
- package/templates/mac/Info.plist +18 -0
- package/templates/mac/app-update.yml +4 -0
- package/templates/win/nsis/README.md +51 -0
- package/templates/win/nsis/THIRD-PARTY-NOTICES.md +20 -0
- package/templates/win/nsis/assistedInstaller.nsh +154 -0
- package/templates/win/nsis/assistedMessages.yml +368 -0
- package/templates/win/nsis/common.nsh +147 -0
- package/templates/win/nsis/empty-license.txt +1 -0
- package/templates/win/nsis/include/FileAssociation.nsh +123 -0
- package/templates/win/nsis/include/StdUtils.nsh +496 -0
- package/templates/win/nsis/include/StrContains.nsh +48 -0
- package/templates/win/nsis/include/UAC.nsh +299 -0
- package/templates/win/nsis/include/allowOnlyOneInstallerInstance.nsh +164 -0
- package/templates/win/nsis/include/extractAppPackage.nsh +138 -0
- package/templates/win/nsis/include/getProcessInfo.nsh +157 -0
- package/templates/win/nsis/include/installUtil.nsh +248 -0
- package/templates/win/nsis/include/installer.nsh +247 -0
- package/templates/win/nsis/include/nsProcess.nsh +28 -0
- package/templates/win/nsis/include/webPackage.nsh +64 -0
- package/templates/win/nsis/installSection.nsh +110 -0
- package/templates/win/nsis/installer.nsi +132 -0
- package/templates/win/nsis/messages.yml +240 -0
- package/templates/win/nsis/multiUser.nsh +134 -0
- package/templates/win/nsis/multiUserUi.nsh +230 -0
- package/templates/win/nsis/oneClick.nsh +19 -0
- package/templates/win/nsis/portable.nsi +91 -0
- package/templates/win/nsis/uninstaller.nsh +263 -0
- package/templates/win/nsis-header.nsh +57 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
Function un.checkAppRunning
|
|
2
|
+
!insertmacro CHECK_APP_RUNNING
|
|
3
|
+
FunctionEnd
|
|
4
|
+
|
|
5
|
+
Function un.onInit
|
|
6
|
+
SetOutPath $INSTDIR
|
|
7
|
+
${LogSet} on
|
|
8
|
+
|
|
9
|
+
!insertmacro check64BitAndSetRegView
|
|
10
|
+
|
|
11
|
+
# Parse command line for /S flag and set silent mode
|
|
12
|
+
${GetParameters} $R0
|
|
13
|
+
${GetOptions} $R0 "/S" $R1
|
|
14
|
+
${IfNot} ${Errors}
|
|
15
|
+
SetSilent silent
|
|
16
|
+
${EndIf}
|
|
17
|
+
|
|
18
|
+
${If} ${Silent}
|
|
19
|
+
call un.checkAppRunning
|
|
20
|
+
${else}
|
|
21
|
+
!ifdef ONE_CLICK
|
|
22
|
+
MessageBox MB_OKCANCEL "$(areYouSureToUninstall)" IDOK +2
|
|
23
|
+
Quit
|
|
24
|
+
|
|
25
|
+
# one-click installer executes uninstall section in the silent mode, but we must show message dialog if silent mode was not explicitly set by user (using /S flag)
|
|
26
|
+
call un.checkAppRunning
|
|
27
|
+
SetSilent silent
|
|
28
|
+
!endif
|
|
29
|
+
${endIf}
|
|
30
|
+
|
|
31
|
+
!insertmacro initMultiUser
|
|
32
|
+
|
|
33
|
+
!ifmacrodef customUnInit
|
|
34
|
+
!insertmacro customUnInit
|
|
35
|
+
!endif
|
|
36
|
+
FunctionEnd
|
|
37
|
+
|
|
38
|
+
Function un.atomicRMDir
|
|
39
|
+
Exch $R0
|
|
40
|
+
Push $R1
|
|
41
|
+
Push $R2
|
|
42
|
+
Push $R3
|
|
43
|
+
|
|
44
|
+
StrCpy $R3 "$INSTDIR$R0\*.*"
|
|
45
|
+
FindFirst $R1 $R2 $R3
|
|
46
|
+
|
|
47
|
+
loop:
|
|
48
|
+
StrCmp $R2 "" break
|
|
49
|
+
|
|
50
|
+
StrCmp $R2 "." continue
|
|
51
|
+
StrCmp $R2 ".." continue
|
|
52
|
+
|
|
53
|
+
IfFileExists "$INSTDIR$R0\$R2\*.*" isDir isNotDir
|
|
54
|
+
|
|
55
|
+
isDir:
|
|
56
|
+
CreateDirectory "$PLUGINSDIR\old-install$R0\$R2"
|
|
57
|
+
|
|
58
|
+
Push "$R0\$R2"
|
|
59
|
+
Call un.atomicRMDir
|
|
60
|
+
Pop $R3
|
|
61
|
+
|
|
62
|
+
${if} $R3 != 0
|
|
63
|
+
Goto done
|
|
64
|
+
${endIf}
|
|
65
|
+
|
|
66
|
+
Goto continue
|
|
67
|
+
|
|
68
|
+
isNotDir:
|
|
69
|
+
ClearErrors
|
|
70
|
+
Rename "$INSTDIR$R0\$R2" "$PLUGINSDIR\old-install$R0\$R2"
|
|
71
|
+
|
|
72
|
+
# Ignore errors when renaming ourselves.
|
|
73
|
+
StrCmp "$R0\$R2" "${UNINSTALL_FILENAME}" 0 +2
|
|
74
|
+
ClearErrors
|
|
75
|
+
|
|
76
|
+
IfErrors 0 +3
|
|
77
|
+
StrCpy $R3 "$INSTDIR$R0\$R2"
|
|
78
|
+
Goto done
|
|
79
|
+
|
|
80
|
+
continue:
|
|
81
|
+
FindNext $R1 $R2
|
|
82
|
+
Goto loop
|
|
83
|
+
|
|
84
|
+
break:
|
|
85
|
+
StrCpy $R3 0
|
|
86
|
+
|
|
87
|
+
done:
|
|
88
|
+
FindClose $R1
|
|
89
|
+
|
|
90
|
+
StrCpy $R0 $R3
|
|
91
|
+
|
|
92
|
+
Pop $R3
|
|
93
|
+
Pop $R2
|
|
94
|
+
Pop $R1
|
|
95
|
+
Exch $R0
|
|
96
|
+
FunctionEnd
|
|
97
|
+
|
|
98
|
+
Function un.restoreFiles
|
|
99
|
+
Exch $R0
|
|
100
|
+
Push $R1
|
|
101
|
+
Push $R2
|
|
102
|
+
Push $R3
|
|
103
|
+
|
|
104
|
+
StrCpy $R3 "$PLUGINSDIR\old-install$R0\*.*"
|
|
105
|
+
FindFirst $R1 $R2 $R3
|
|
106
|
+
|
|
107
|
+
loop:
|
|
108
|
+
StrCmp $R2 "" break
|
|
109
|
+
|
|
110
|
+
StrCmp $R2 "." continue
|
|
111
|
+
StrCmp $R2 ".." continue
|
|
112
|
+
|
|
113
|
+
IfFileExists "$INSTDIR$R0\$R2\*.*" isDir isNotDir
|
|
114
|
+
|
|
115
|
+
isDir:
|
|
116
|
+
CreateDirectory "$INSTDIR$R0\$R2"
|
|
117
|
+
|
|
118
|
+
Push "$R0\$R2"
|
|
119
|
+
Call un.restoreFiles
|
|
120
|
+
Pop $R3
|
|
121
|
+
|
|
122
|
+
Goto continue
|
|
123
|
+
|
|
124
|
+
isNotDir:
|
|
125
|
+
Rename "$PLUGINSDIR\old-install$R0\$R2" "$INSTDIR$R0\$R2"
|
|
126
|
+
|
|
127
|
+
continue:
|
|
128
|
+
FindNext $R1 $R2
|
|
129
|
+
Goto loop
|
|
130
|
+
|
|
131
|
+
break:
|
|
132
|
+
StrCpy $R0 0
|
|
133
|
+
FindClose $R1
|
|
134
|
+
|
|
135
|
+
Pop $R3
|
|
136
|
+
Pop $R2
|
|
137
|
+
Pop $R1
|
|
138
|
+
Exch $R0
|
|
139
|
+
FunctionEnd
|
|
140
|
+
|
|
141
|
+
!ifndef UNINSTALL_SECTION_NAME
|
|
142
|
+
!define UNINSTALL_SECTION_NAME "Uninstall"
|
|
143
|
+
!endif
|
|
144
|
+
|
|
145
|
+
Section "un.${UNINSTALL_SECTION_NAME}"
|
|
146
|
+
SectionIn RO
|
|
147
|
+
# for assisted installer we check it here to show progress
|
|
148
|
+
!ifndef ONE_CLICK
|
|
149
|
+
${IfNot} ${Silent}
|
|
150
|
+
call un.checkAppRunning
|
|
151
|
+
${endIf}
|
|
152
|
+
!endif
|
|
153
|
+
|
|
154
|
+
!insertmacro setLinkVars
|
|
155
|
+
|
|
156
|
+
!ifmacrodef customUnInstall
|
|
157
|
+
!insertmacro customUnInstall
|
|
158
|
+
!endif
|
|
159
|
+
|
|
160
|
+
# delete the installed files
|
|
161
|
+
!ifmacrodef customRemoveFiles
|
|
162
|
+
!insertmacro customRemoveFiles
|
|
163
|
+
!else
|
|
164
|
+
${if} ${isUpdated}
|
|
165
|
+
CreateDirectory "$PLUGINSDIR\old-install"
|
|
166
|
+
|
|
167
|
+
Push ""
|
|
168
|
+
Call un.atomicRMDir
|
|
169
|
+
Pop $R0
|
|
170
|
+
|
|
171
|
+
${if} $R0 != 0
|
|
172
|
+
DetailPrint "File is busy, aborting: $R0"
|
|
173
|
+
|
|
174
|
+
# Attempt to restore previous directory
|
|
175
|
+
Push ""
|
|
176
|
+
Call un.restoreFiles
|
|
177
|
+
Pop $R0
|
|
178
|
+
|
|
179
|
+
Abort `Can't rename "$INSTDIR" to "$PLUGINSDIR\old-install".`
|
|
180
|
+
${endif}
|
|
181
|
+
|
|
182
|
+
${endif}
|
|
183
|
+
|
|
184
|
+
# Move out of $INSTDIR so it can be removed
|
|
185
|
+
SetOutPath $TEMP
|
|
186
|
+
# Remove all files (or remaining shallow directories from the block above)
|
|
187
|
+
RMDir /r $INSTDIR
|
|
188
|
+
!endif
|
|
189
|
+
|
|
190
|
+
${ifNot} ${isKeepShortcuts}
|
|
191
|
+
WinShell::UninstAppUserModelId "${APP_ID}"
|
|
192
|
+
|
|
193
|
+
!ifndef DO_NOT_CREATE_DESKTOP_SHORTCUT
|
|
194
|
+
WinShell::UninstShortcut "$oldDesktopLink"
|
|
195
|
+
Delete "$oldDesktopLink"
|
|
196
|
+
!endif
|
|
197
|
+
|
|
198
|
+
!ifndef DO_NOT_CREATE_START_MENU_SHORTCUT
|
|
199
|
+
WinShell::UninstShortcut "$oldStartMenuLink"
|
|
200
|
+
|
|
201
|
+
Delete "$oldStartMenuLink"
|
|
202
|
+
ReadRegStr $R1 SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" MenuDirectory
|
|
203
|
+
${ifNot} $R1 == ""
|
|
204
|
+
RMDir "$SMPROGRAMS\$R1"
|
|
205
|
+
${endIf}
|
|
206
|
+
!endif
|
|
207
|
+
${endIf}
|
|
208
|
+
|
|
209
|
+
# refresh the desktop
|
|
210
|
+
System::Call 'shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
|
211
|
+
|
|
212
|
+
!ifmacrodef unregisterFileAssociations
|
|
213
|
+
!insertmacro unregisterFileAssociations
|
|
214
|
+
!endif
|
|
215
|
+
|
|
216
|
+
Var /GLOBAL isDeleteAppData
|
|
217
|
+
StrCpy $isDeleteAppData "0"
|
|
218
|
+
|
|
219
|
+
ClearErrors
|
|
220
|
+
${GetParameters} $R0
|
|
221
|
+
${GetOptions} $R0 "--delete-app-data" $R1
|
|
222
|
+
${if} ${Errors}
|
|
223
|
+
!ifdef DELETE_APP_DATA_ON_UNINSTALL
|
|
224
|
+
${ifNot} ${isUpdated}
|
|
225
|
+
StrCpy $isDeleteAppData "1"
|
|
226
|
+
${endif}
|
|
227
|
+
!endif
|
|
228
|
+
${else}
|
|
229
|
+
StrCpy $isDeleteAppData "1"
|
|
230
|
+
${endIf}
|
|
231
|
+
|
|
232
|
+
${if} $isDeleteAppData == "1"
|
|
233
|
+
# electron always uses per user app data
|
|
234
|
+
${if} $installMode == "all"
|
|
235
|
+
SetShellVarContext current
|
|
236
|
+
${endif}
|
|
237
|
+
RMDir /r "$APPDATA\${APP_FILENAME}"
|
|
238
|
+
!ifdef APP_PRODUCT_FILENAME
|
|
239
|
+
RMDir /r "$APPDATA\${APP_PRODUCT_FILENAME}"
|
|
240
|
+
!endif
|
|
241
|
+
# electron use package.json name for cache,indexdb etc.
|
|
242
|
+
!ifdef APP_PACKAGE_NAME
|
|
243
|
+
RMDir /r "$APPDATA\${APP_PACKAGE_NAME}"
|
|
244
|
+
!endif
|
|
245
|
+
${if} $installMode == "all"
|
|
246
|
+
SetShellVarContext all
|
|
247
|
+
${endif}
|
|
248
|
+
${endif}
|
|
249
|
+
|
|
250
|
+
DeleteRegKey SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}"
|
|
251
|
+
!ifdef UNINSTALL_REGISTRY_KEY_2
|
|
252
|
+
DeleteRegKey SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY_2}"
|
|
253
|
+
!endif
|
|
254
|
+
DeleteRegKey SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}"
|
|
255
|
+
|
|
256
|
+
!ifdef ONE_CLICK
|
|
257
|
+
!insertmacro quitSuccess
|
|
258
|
+
!endif
|
|
259
|
+
SectionEnd
|
|
260
|
+
|
|
261
|
+
!ifmacrodef customUnInstallSection
|
|
262
|
+
!insertmacro customUnInstallSection
|
|
263
|
+
!endif
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
!include "${NSIS_STDLIBS_NSH_PATH}"
|
|
2
|
+
!addincludedir "${NSIS_INCLUDE_DIR}"
|
|
3
|
+
!addincludedir "${NSIS_TEMPLATES_DIR}"
|
|
4
|
+
|
|
5
|
+
!macro _isUpdated _a _b _t _f
|
|
6
|
+
${StdUtils.TestParameter} $R9 "updated"
|
|
7
|
+
StrCmp "$R9" "true" `${_t}` `${_f}`
|
|
8
|
+
!macroend
|
|
9
|
+
!define isUpdated `"" isUpdated ""`
|
|
10
|
+
|
|
11
|
+
!macro _isForceRun _a _b _t _f
|
|
12
|
+
${StdUtils.TestParameter} $R9 "force-run"
|
|
13
|
+
StrCmp "$R9" "true" `${_t}` `${_f}`
|
|
14
|
+
!macroend
|
|
15
|
+
!define isForceRun `"" isForceRun ""`
|
|
16
|
+
|
|
17
|
+
!macro _isKeepShortcuts _a _b _t _f
|
|
18
|
+
${StdUtils.TestParameter} $R9 "keep-shortcuts"
|
|
19
|
+
StrCmp "$R9" "true" `${_t}` `${_f}`
|
|
20
|
+
!macroend
|
|
21
|
+
!define isKeepShortcuts `"" isKeepShortcuts ""`
|
|
22
|
+
|
|
23
|
+
!macro _isNoDesktopShortcut _a _b _t _f
|
|
24
|
+
${StdUtils.TestParameter} $R9 "no-desktop-shortcut"
|
|
25
|
+
StrCmp "$R9" "true" `${_t}` `${_f}`
|
|
26
|
+
!macroend
|
|
27
|
+
!define isNoDesktopShortcut `"" isNoDesktopShortcut ""`
|
|
28
|
+
|
|
29
|
+
!macro _isDeleteAppData _a _b _t _f
|
|
30
|
+
${StdUtils.TestParameter} $R9 "delete-app-data"
|
|
31
|
+
StrCmp "$R9" "true" `${_t}` `${_f}`
|
|
32
|
+
!macroend
|
|
33
|
+
!define isDeleteAppData `"" isDeleteAppData ""`
|
|
34
|
+
|
|
35
|
+
!macro _isForAllUsers _a _b _t _f
|
|
36
|
+
${StdUtils.TestParameter} $R9 "allusers"
|
|
37
|
+
StrCmp "$R9" "true" `${_t}` `${_f}`
|
|
38
|
+
!macroend
|
|
39
|
+
!define isForAllUsers `"" isForAllUsers ""`
|
|
40
|
+
|
|
41
|
+
!macro _isForCurrentUser _a _b _t _f
|
|
42
|
+
${StdUtils.TestParameter} $R9 "currentuser"
|
|
43
|
+
StrCmp "$R9" "true" `${_t}` `${_f}`
|
|
44
|
+
!macroend
|
|
45
|
+
!define isForCurrentUser `"" isForCurrentUser ""`
|
|
46
|
+
|
|
47
|
+
!macro addLangs
|
|
48
|
+
!insertmacro MUI_LANGUAGE "English"
|
|
49
|
+
!insertmacro MUI_LANGUAGE "SimpChinese"
|
|
50
|
+
!macroend
|
|
51
|
+
|
|
52
|
+
!addplugindir /${NSIS_PLUGIN_ARCH} "${NSIS_PLUGINS_DIR}"
|
|
53
|
+
|
|
54
|
+
!include "${NSIS_MESSAGES_NSH}"
|
|
55
|
+
|
|
56
|
+
!macro customMessageBox
|
|
57
|
+
!macroend
|