Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ovsky committed Jan 24, 2023
1 parent 42e08eb commit 6a9198c
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 100 deletions.
106 changes: 53 additions & 53 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Release libs

on:
workflow_dispatch:
branches: [ main ]
branches: [main]
inputs:
version:
description: 'Version'
description: "Version"
required: true

jobs:
Expand All @@ -17,63 +17,63 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release

- if: runner.os == 'MacOS'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-apple-darwin
- if: runner.os == 'MacOS'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-apple-darwin

- if: runner.os == 'MacOS'
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=aarch64-apple-darwin
- if: runner.os == 'MacOS'
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=aarch64-apple-darwin

- name: Create universal lib for macOS
if: runner.os == 'MacOS'
run: |
mkdir -p target/tmp
mv target/release/libdeno_installer.dylib target/tmp/libdeno_installer.dylib
- name: Create universal lib for macOS
if: runner.os == 'MacOS'
run: |
mkdir -p target/tmp
mv target/release/libdeno_modern_installer.dylib target/tmp/libdeno_modern_installer.dylib
lipo -create -output target/release/libdeno_installer.dylib \
target/tmp/libdeno_installer.dylib \
target/aarch64-apple-darwin/release/libdeno_installer.dylib
lipo -create -output target/release/libdeno_modern_installer.dylib \
target/tmp/libdeno_modern_installer.dylib \
target/aarch64-apple-darwin/release/libdeno_modern_installer.dylib
- name: Release MacOS lib
if: runner.os == 'MacOS'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/libdeno_installer.dylib
tag: ${{ github.event.inputs.version }}
overwrite: true
- name: Release MacOS lib
if: runner.os == 'MacOS'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/libdeno_modern_installer.dylib
tag: ${{ github.event.inputs.version }}
overwrite: true

- name: Release Linux lib
if: runner.os == 'Linux'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/libdeno_installer.so
tag: ${{ github.event.inputs.version }}
overwrite: true
- name: Release Linux lib
if: runner.os == 'Linux'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/libdeno_modern_installer.so
tag: ${{ github.event.inputs.version }}
overwrite: true

- name: Release Windows lib
if: runner.os == 'Windows'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/deno_installer.dll
tag: ${{ github.event.inputs.version }}
overwrite: true
- name: Release Windows lib
if: runner.os == 'Windows'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/deno_modern_installer.dll
tag: ${{ github.event.inputs.version }}
overwrite: true
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "deno_installer"
name = "deno_modern_installer"
version = "0.1.3"
edition = "2021"

[lib]
name = "deno_installer"
name = "deno_modern_installer"
crate-type = ["cdylib"]

[dependencies]
Expand Down
72 changes: 46 additions & 26 deletions bindings/bindings.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,48 @@
// Auto-generated with deno_bindgen
import { CachePolicy, prepare } from "https://deno.land/x/plug@0.5.1/plug.ts"
import { CachePolicy, prepare } from "https://deno.land/x/plug@0.5.2/plug.ts"

function encode(v: string | Uint8Array): Uint8Array {
if (typeof v !== "string") return v
return new TextEncoder().encode(v)
}

function decode(v: Uint8Array): string {
return new TextDecoder().decode(v)
}

function readPointer(v: any): Uint8Array {
const ptr = new Deno.UnsafePointerView(v)
const ptr = new Deno.UnsafePointerView(v as bigint)
const lengthBe = new Uint8Array(4)
const view = new DataView(lengthBe.buffer)
ptr.copyInto(lengthBe, 0)
const buf = new Uint8Array(view.getUint32(0))
ptr.copyInto(buf, 4)
return buf
}

const url = new URL("../target/release", import.meta.url)
let uri = url.toString()
if (!uri.endsWith("/")) uri += "/"

let darwin: string | { aarch64: string; x86_64: string } = uri
+ "libdeno_modern_installer.dylib"

if (url.protocol !== "file:") {
// Assume that remote assets follow naming scheme
// for each macOS artifact.
darwin = {
aarch64: uri + "libdeno_modern_installer_arm64.dylib",
x86_64: uri + "libdeno_modern_installer.dylib",
}
}

const opts = {
name: "deno_installer",
url:
(new URL(
"https://github.com/marc2332/deno_installer/releases/download/0.1.3",
import.meta.url,
)).toString(),
name: "deno_modern_installer",
urls: {
darwin,
windows: uri + "deno_modern_installer.dll",
linux: uri + "libdeno_modern_installer.so",
},
policy: undefined,
}
const _lib = await prepare(opts, {
Expand All @@ -32,20 +52,6 @@ const _lib = await prepare(opts, {
nonblocking: false,
},
})
export type PackageSettingsInstaller = {
product_name: string
version: string
description: string
homepage: string | undefined | null
authors: Array<string> | undefined | null
default_run: string | undefined | null
}
export type InstallerSettings = {
src_path: string
out_path: string
bundle: BundleSettingsInstaller
package: PackageSettingsInstaller
}
export type BundleSettingsInstaller = {
identifier: string | undefined | null
icon: Array<string> | undefined | null
Expand All @@ -54,10 +60,24 @@ export type BundleSettingsInstaller = {
short_description: string | undefined | null
long_description: string | undefined | null
}
export type InstallerSettings = {
src_path: string
out_path: string
bundle: BundleSettingsInstaller
package: PackageSettingsInstaller
}
export type PackageSettingsInstaller = {
product_name: string
version: string
description: string
homepage: string | undefined | null
authors: Array<string> | undefined | null
default_run: string | undefined | null
}
export function create_installer(a0: InstallerSettings) {
const a0_buf = encode(JSON.stringify(a0));
const a0_ptr = Deno.UnsafePointer.of(a0_buf);
let rawResult = _lib.symbols.create_installer(a0_ptr, a0_buf.byteLength);
const result = rawResult;
const a0_buf = encode(JSON.stringify(a0))
const a0_ptr = Deno.UnsafePointer.of(a0_buf)
let rawResult = _lib.symbols.create_installer(a0_ptr, a0_buf.byteLength)
const result = rawResult
return result
}
4 changes: 2 additions & 2 deletions examples/oak/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const installer = new Installer({
product_name: "MyApp",
version: "1.0.0",
description: "woooow",
homepage: "https://github.com/marc2332",
authors: ["Marc Espín"],
homepage: "https://github.com/ovsky",
authors: ["Author"],
default_run: "MyApp",
},
bundle: {
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## ⚙️ Fork of [deno_installer](https://github.com/marc2332/deno_installer)
Fork of original `deno_installer` module, with fixes that makes it up-to-date with the latest Deno's releases.
Fork of original `deno_modern_installer` module, with fixes that makes it up-to-date with the latest Deno's releases.

Latest release: https://github.com/ovsky/deno_modern_installer/releases/

Expand Down Expand Up @@ -28,7 +28,7 @@ Before making the installer make sure you have your project as:
| +-- (See note for Linux)
```

> Note: For **Linux** you will also need some special [icons](https://github.com/ovsky/deno_installer/tree/main/examples/oak/icons).
> Note: For **Linux** you will also need some special [icons](https://github.com/ovsky/deno_modern_installer/tree/main/examples/oak/icons).
Create a file `build.ts`, paste and modify as you wish:

Expand Down
20 changes: 6 additions & 14 deletions test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const installer = new Installer({
product_name: "TestApp",
version: "1.0.0",
description: "woooow",
homepage: "https://github.com/marc2332",
authors: ["Marc Espín"],
homepage: "https://github.com/ovsky",
authors: ["Author"],
default_run: "TestApp",
},
bundle: {
Expand Down Expand Up @@ -57,9 +57,7 @@ Deno.test(`Installer created ${Deno.build.os}`, async () => {
let exists = true;
try {
// Check Windows installer
await Deno.readFile(
`${dist}/msi/TestApp_1.0.0_x64_en-US.msi`,
);
await Deno.readFile(`${dist}/msi/TestApp_1.0.0_x64_en-US.msi`);
} catch {
exists = false;
}
Expand All @@ -71,13 +69,9 @@ Deno.test(`Installer created ${Deno.build.os}`, async () => {
let exists = true;
try {
// Check Debian installer
await Deno.readFile(
`${dist}/deb/TestApp_1.0.0_amd64.deb`,
);
await Deno.readFile(`${dist}/deb/TestApp_1.0.0_amd64.deb`);
// Check AppImage installer
await Deno.readFile(
`${dist}/appimage/TestApp_1.0.0_amd64.AppImage`,
);
await Deno.readFile(`${dist}/appimage/TestApp_1.0.0_amd64.AppImage`);
} catch {
exists = false;
}
Expand All @@ -90,9 +84,7 @@ Deno.test(`Installer created ${Deno.build.os}`, async () => {
let exists = true;
try {
// Check MacOS installer
await Deno.readFile(
`${dist}/dmg/TestApp_1.0.0_x64.dmg`,
);
await Deno.readFile(`${dist}/dmg/TestApp_1.0.0_x64.dmg`);
} catch {
exists = false;
}
Expand Down

0 comments on commit 6a9198c

Please sign in to comment.