-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
publish 0.10.0-6 using optionalDependencies
- Loading branch information
Showing
20 changed files
with
110 additions
and
48 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { $ } from "execa"; | ||
import getTypstPath from "./lib/getTypstPath.js"; | ||
|
||
export default async function help(options: { signal?: AbortSignal } = {}) { | ||
const { stdout } = await $({ | ||
signal: options.signal, | ||
})`${getTypstPath()} --help`; | ||
return stdout; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
import { createRequire } from "node:module"; | ||
import { fileURLToPath, pathToFileURL } from "node:url"; | ||
const require = createRequire(new URL(import.meta.url)); | ||
import.meta.resolve ??= (s) => require.resolve(s); | ||
import.meta.resolve ??= (s) => pathToFileURL(require.resolve(s)).href; | ||
|
||
const getTypstPath = { | ||
"win32,x64": () => import.meta.resolve("@typst-community/typst-win32-x64"), | ||
"darwin-x64": () => import.meta.resolve("@typst-community/typst-darwin-x64"), | ||
"darwin-arm64": () => | ||
import.meta.resolve("@typst-community/typst-darwin-arm64"), | ||
"linux-arm64": () => | ||
import.meta.resolve("@typst-community/typst-linux-arm64"), | ||
"linux-x64": () => import.meta.resolve("@typst-community/typst-linux-x64"), | ||
}[[process.platform, process.arch].toString()]!; | ||
const getTypstPath = | ||
{ | ||
"win32,x64": () => | ||
fileURLToPath(import.meta.resolve("@typst-community/typst-win32-x64")), | ||
"darwin,x64": () => | ||
fileURLToPath(import.meta.resolve("@typst-community/typst-darwin-x64")), | ||
"darwin,arm64": () => | ||
fileURLToPath(import.meta.resolve("@typst-community/typst-darwin-arm64")), | ||
"linux,arm64": () => | ||
fileURLToPath(import.meta.resolve("@typst-community/typst-linux-arm64")), | ||
"linux,x64": () => | ||
fileURLToPath(import.meta.resolve("@typst-community/typst-linux-x64")), | ||
}[[process.platform, process.arch].toString()] ?? | ||
(() => { | ||
throw new ReferenceError( | ||
`@typst-community/typst-[os]-[arch] not found for ${process.platform}-${process.arch}`, | ||
); | ||
}); | ||
export default getTypstPath; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { $ } from "execa"; | ||
import getTypstPath from "./lib/getTypstPath.js"; | ||
|
||
export default async function version(options: { signal?: AbortSignal } = {}) { | ||
const { stdout } = await $({ | ||
signal: options.signal, | ||
})`${getTypstPath()} --version`; | ||
const version = stdout.match(/\d+\.\d+\.\d+/)[0]; | ||
return version; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import test from "node:test"; | ||
import assert from "node:assert/strict"; | ||
import * as typst from "../dist/index.js"; | ||
|
||
test("help", async () => { | ||
const r = await typst.help(); | ||
console.log(`${r.length} chars`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import test from "node:test"; | ||
import assert from "node:assert/strict"; | ||
import * as typst from "../dist/index.js"; | ||
|
||
test("version", async () => { | ||
const r = await typst.version(); | ||
console.log(`got typst v${r}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -ex | ||
tuple=$(node -p '`${process.platform}-${process.arch}`') | ||
npm link "./packages/typst-community+typst-$tuple" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -ex | ||
for tuple in win32-x64 darwin-x64 darwin-arm64 linux-arm64 linux-x64; do | ||
pushd "./packages/typst-community+typst-$tuple" | ||
npm publish | ||
popd | ||
done |