Skip to content

Commit c5326ce

Browse files
committed
wip: updated README.md
1 parent 7483328 commit c5326ce

File tree

2 files changed

+8
-81
lines changed

2 files changed

+8
-81
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
/prebuild
1010
/prepublishOnly
1111
/target
12-
/bundle
1312

1413
# Logs
1514
logs

README.md

+8-80
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,26 @@ Note that JavaScript libraries are not packaged in Nix. Only JavaScript applicat
5555
Building the package:
5656

5757
```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\"; }"
5960
```
6061

6162
### Nix/NixOS
6263

6364
Building the releases:
6465

6566
```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)"
7172
```
7273

7374
Install into Nix user profile:
7475

7576
```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)"
7778
```
7879

7980
### Docker
@@ -157,48 +158,6 @@ You would need to add these paths to `tsconfig.json`:
157158
},
158159
```
159160

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-
202161
### Docs Generation
203162

204163
```sh
@@ -209,26 +168,6 @@ See the docs at: https://matrixai.github.io/TypeScript-Demo-Lib/
209168

210169
### Publishing
211170

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-
232171
```sh
233172
# npm login
234173
npm version patch # major/minor/patch
@@ -237,17 +176,6 @@ npm publish --access public
237176
git push
238177
git push --tags
239178
```
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
251179

252180
## Deployment
253181

0 commit comments

Comments
 (0)