https://github.com/st-tech/universal-links-test
NPM package to test apple-app-site-association file
https://github.com/st-tech/universal-links-test
aasa apple-app-site-association test universal-links
Last synced: 5 months ago
JSON representation
NPM package to test apple-app-site-association file
- Host: GitHub
- URL: https://github.com/st-tech/universal-links-test
- Owner: st-tech
- License: mit
- Created: 2024-11-26T10:13:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-01-12T02:02:50.000Z (5 months ago)
- Last Synced: 2026-01-12T06:54:30.891Z (5 months ago)
- Topics: aasa, apple-app-site-association, test, universal-links
- Language: TypeScript
- Homepage: https://st-tech.github.io/universal-links-test/
- Size: 124 KB
- Stars: 33
- Watchers: 41
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# universal-links-test
Check apple-app-site-association file to verify universal links.
## Installation
```sh
npm install -D universal-links-test
```
## Usage
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 `universal-links-test/sim` instead that simulates the behavior.
```typescript
import { verify, type AppleAppSiteAssociation } from "universal-links-test";
// import { verify, type AppleAppSiteAssociation } from "universal-links-test/sim";
const json = {
applinks: {
details: [
{
appID: "APP.ID1",
components: [{ "/": "/universal-links/path" }]
},
{
appID: "APP.ID2",
components: [{ "/": "/universal-links/path", exclude: true }]
},
{
appID: "APP.ID3",
components: []
}
]
}
} satisfies AppleAppSiteAssociation;
const result: Map = await verify(json, "/universal-links/path?query#hash");
console.log(result.get("APP.ID1")); // 'match' : Universal links are working
console.log(result.get("APP.ID2")); // 'block' : Universal links are blocked
console.log(result.get("APP.ID3")); // undefined
```
Use `swcutil` command programmatically:
```typescript
import { swcutil } from 'universal-links-test/swcutil';
const { status, stdout, stderr } = await swcutil({
// ...
});
```
## LICENSE
MIT