Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename to universal-links-test #14

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# apple-app-site-association
# universal-links-test

Check apple-app-site-association file to verify universal links.

Expand All @@ -7,11 +7,11 @@ Check apple-app-site-association file to verify universal links.
The `verify` function detects provided path lauches the app or not.

It depends on the `swcutil` command (preinstalled in macOS), so you must use this function in macOS and root permission.
If you don't use macOS, you can use `apple-app-site-association/sim` instead that simulates the behavior.
If you don't use macOS, you can use `universal-links-test/sim` instead that simulates the behavior.

```typescript
import { verify, type AppleAppSiteAssociation } from "apple-app-site-association";
// import { verify, type AppleAppSiteAssociation } from "apple-app-site-association/sim";
import { verify, type AppleAppSiteAssociation } from "universal-links-test";
// import { verify, type AppleAppSiteAssociation } from "universal-links-test/sim";

const json = { applinks: { /* ... */ } } satisfies AppleAppSiteAssociation;

Expand All @@ -22,7 +22,7 @@ console.log(result); // 'match' | 'block' | 'unset'
Use `swcutil` command programmatically:

```typescript
import { swcutil } from 'apple-app-site-association/swcutil';
import { swcutil } from 'universal-links-test/swcutil';
const { status, stdout, stderr } = await swcutil({
// ...
});
Expand Down
4 changes: 2 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0lMjJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyUyMiB2aWV3Qm94PSUyMjAgMCAxMDAgMTAwJTIyPjx0ZXh0IHg9JTIyNTAlJTIyIHk9JTIyNTAlJTIyIHN0eWxlPSUyMmRvbWluYW50LWJhc2VsaW5lOmNlbnRyYWw7dGV4dC1hbmNob3I6bWlkZGxlO2ZvbnQtc2l6ZTo5MHB4OyUyMj4mIzEyNzgyMjs8L3RleHQ+PC9zdmc+" />
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48dGV4dCB4PSI1MCUiIHk9IjUwJSIgc3R5bGU9ImRvbWluYW50LWJhc2VsaW5lOmNlbnRyYWw7dGV4dC1hbmNob3I6bWlkZGxlO2ZvbnQtc2l6ZTo5MHB4OyI+JiMxMjc4MjI7PC90ZXh0Pjwvc3ZnPg==" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>apple-app-site-association Demo</title>
<title>universal-links-test Demo</title>
</head>
<body>
<div id="app"></div>
Expand Down
4 changes: 2 additions & 2 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
},
"dependencies": {
"@tailwindcss/vite": "4.0.0-beta.6",
"apple-app-site-association": "workspace:*",
"lz-string": "^1.5.0",
"monaco-editor": "^0.52.0",
"tailwindcss": "4.0.0-beta.6"
"tailwindcss": "4.0.0-beta.6",
"universal-links-test": "workspace:*"
}
}
4 changes: 2 additions & 2 deletions demo/src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { createVerify } from "apple-app-site-association/sim";
import { createVerify } from "universal-links-test/sim";
import Editor from "./Editor.svelte";
import { getHash, parseHash } from "./hash";

Expand Down Expand Up @@ -38,7 +38,7 @@

<div class="grid grid-rows-[auto_1fr] h-screen divide-y">
<header class="flex justify-between p-4">
<h1 class="font-bold">apple-app-site-association check</h1>
<h1 class="font-bold">universal-links-test demo</h1>
<div class="flex gap-2 items-center">
<a
href="http://github.com/st-tech/apple-app-site-association"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "apple-app-site-association",
"name": "universal-links-test",
"description": "Check apple-app-site-association file",
"version": "0.1.0",
"type": "module",
Expand Down Expand Up @@ -28,7 +28,7 @@
"aasa",
"apple-app-site-association",
"swcutil",
"universal-links",
"universal links",
"test"
],
"author": "TOMIKAWA Sotaro",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

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

8 changes: 5 additions & 3 deletions src/sim/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ export function resolveJson(

async function resolveJsonPath(path: string): Promise<Record<string, unknown>> {
// Dyanmic import to make it portable for other environments
const { readFile } = await import("node:fs/promises");
const { cwd } = await import("node:process");
const { join } = await import("node:path");
const [{ readFile }, { cwd }, { join }] = await Promise.all([
import("node:fs/promises"),
import("node:process"),
import("node:path"),
]);
return JSON.parse(await readFile(join(cwd(), path), { encoding: "utf8" }));
}
7 changes: 2 additions & 5 deletions tests/node.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import * as assert from "node:assert";
import { test } from "node:test";
import {
type AppleAppSiteAssociation,
verify,
} from "apple-app-site-association";
import { verify as verifySim } from "apple-app-site-association/sim";
import { type AppleAppSiteAssociation, verify } from "universal-links-test";
import { verify as verifySim } from "universal-links-test/sim";

const json = {
applinks: {
Expand Down
2 changes: 1 addition & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"test:node": "node --test --experimental-strip-types node.test.ts"
},
"devDependencies": {
"apple-app-site-association": "workspace:*"
"universal-links-test": "workspace:*"
}
}
Loading