@@ -55,25 +55,26 @@ Note that JavaScript libraries are not packaged in Nix. Only JavaScript applicat
55
55
Building the package:
56
56
57
57
``` sh
58
- nix-build -E ' (import ./pkgs.nix {}).callPackage ./default.nix {}'
58
+ npmDepsHash=" $( prefetch-npm-deps ./package-lock.json) "
59
+ nix-build -E " (import ./pkgs.nix {}).callPackage ./default.nix { npmDepsHash = \" $npmDepsHash \" ; }"
59
60
```
60
61
61
62
### Nix/NixOS
62
63
63
64
Building the releases:
64
65
65
66
``` sh
66
- nix-build ./release.nix --attr application
67
- nix-build ./release.nix --attr docker
68
- nix-build ./release.nix --attr package.linux.x64.elf
69
- nix-build ./release.nix --attr package.windows.x64.exe
70
- nix-build ./release.nix --attr package.macos.x64.macho
67
+ nix-build ./release.nix --attr application --argstr npmDepsHash " $( prefetch-npm-deps ./package-lock.json ) "
68
+ nix-build ./release.nix --attr docker --argstr npmDepsHash " $( prefetch-npm-deps ./package-lock.json ) "
69
+ nix-build ./release.nix --attr package.linux.x64.elf --argstr npmDepsHash " $( prefetch-npm-deps ./package-lock.json ) "
70
+ nix-build ./release.nix --attr package.windows.x64.exe --argstr npmDepsHash " $( prefetch-npm-deps ./package-lock.json ) "
71
+ nix-build ./release.nix --attr package.macos.x64.macho --argstr npmDepsHash " $( prefetch-npm-deps ./package-lock.json ) "
71
72
```
72
73
73
74
Install into Nix user profile:
74
75
75
76
``` sh
76
- nix-env -f ./release.nix --install --attr application
77
+ nix-env -f ./release.nix --install --attr application --argstr npmDepsHash " $( prefetch-npm-deps ./package-lock.json ) "
77
78
```
78
79
79
80
### Docker
@@ -157,48 +158,6 @@ You would need to add these paths to `tsconfig.json`:
157
158
},
158
159
```
159
160
160
- ### Native Module Toolchain
161
-
162
- There are some nuances when packaging with native modules.
163
- Included native modules are level witch include leveldown and utp-native.
164
-
165
- If a module is not set to public then pkg defaults to including it as bytecode.
166
- To avoid this breaking with the ` --no-bytecode ` flag we need to add ` --public-packages "*" `
167
-
168
- #### leveldown
169
-
170
- To get leveldown to work with pkg we need to include the prebuilds with the executable.
171
- after building with pkg you need to copy from ` node_modules/leveldown/prebuilds ` -> ` path_to_executable/prebuilds `
172
- You only need to include the prebuilds for the arch you are targeting. e.g. for linux-x64 you need ` prebuild/linux-x64 ` .
173
-
174
- The folder structure for the executable should look like this.
175
- - linux_executable_elf
176
- - prebuilds
177
- - linux-x64
178
- - (node files)
179
-
180
- #### threads.js
181
-
182
- To make sure that the worker threads work properly you need to include the compiled worker scripts as an asset.
183
- This can be fixed by adding the following to ` package.json `
184
-
185
- ``` json
186
- "pkg" : {
187
- "assets" : " dist/bin/worker.js"
188
- }
189
- ```
190
-
191
- If you need to include multiple assets then add them as an array.
192
-
193
- ``` json
194
- "pkg" : {
195
- "assets" : [
196
- " node_modules/utp-native/**/*" ,
197
- " dist/bin/worker.js"
198
- ]
199
- }
200
- ```
201
-
202
161
### Docs Generation
203
162
204
163
``` sh
@@ -209,26 +168,6 @@ See the docs at: https://matrixai.github.io/TypeScript-Demo-Lib/
209
168
210
169
### Publishing
211
170
212
- Publishing is handled automatically by the staging pipeline.
213
-
214
- Prerelease:
215
-
216
- ``` sh
217
- # npm login
218
- npm version prepatch --preid alpha # premajor/preminor/prepatch
219
- git push --follow-tags
220
- ```
221
-
222
- Release:
223
-
224
- ``` sh
225
- # npm login
226
- npm version patch # major/minor/patch
227
- git push --follow-tags
228
- ```
229
-
230
- Manually:
231
-
232
171
``` sh
233
172
# npm login
234
173
npm version patch # major/minor/patch
@@ -237,17 +176,6 @@ npm publish --access public
237
176
git push
238
177
git push --tags
239
178
```
240
- ### Packaging Cross-Platform Executables
241
-
242
- We use ` pkg ` to package the source code into executables.
243
-
244
- This requires a specific version of ` pkg ` and also ` node-gyp-build ` .
245
-
246
- Configuration for ` pkg ` is done in:
247
-
248
- * ` package.json ` - Pins ` pkg ` and ` node-gyp-build ` , and configures assets and scripts.
249
- * ` utils.nix ` - Pins ` pkg ` for Nix usage
250
- * ` release.nix ` - Build expressions for executables
251
179
252
180
## Deployment
253
181
0 commit comments