@easy-smart-app-banner/core

中文文档
3.0.0发布于 2026/10/21MITTypeScriptES Module构建来源已验证近 30 天下载 4794

An Easy Smart App Banner for promoting mobile app installs based on the Safari Apple Experience. Includes support for Safari too.

原始使用文档
文档目录12 节
  1. Features
  2. Install
  3. Configuration
  4. Safari Support
  5. Advanced Usage
  6. Platform Specific Overrides
  7. SCSS/Sass Variables
  8. Platform Specific Plugins
  9. Testing if your User Agent (UA) String is Valid
  10. Development
  11. Publish a Release
  12. Licence

Easy Smart App Banner

NPM version TypeScript

An Easy Smart App Banner for promoting mobile app installs based on the Safari Apple Experience.

This isn't for everyone. Most people should probably prefer the PWA approach. However, if you need a 'simple' banner that redirects to a native mobile app then keep reading.

For Safari support see Safari Support. For specific details on iOS and Safari, read here. Likewise for Android see here.

Features

  • Typescript support
  • Standalone/Frameworkless
  • Small! 14.48 kB │ gzip: 4.43 kB │ map: 44.87 kB
  • Platform specific
    • custom banner for iOS (non-Safari) and Android user agents
    • Safari specific config See Safari Support
  • Option, use SCSS/Sass variables to configure the banner as needed
  • Cookie-based dismissal, dismiss once per browser

Install

npm i -S @easy-smart-app-banner/core

Configuration

See the options model.

Safari Support

This libary currently excludes Safari, as it is not possible to support Safari via a library/plugin/etc. Support for the native Safari smart app banner MUST be provided via static meta tags in your site directly. Safari currently only supports parsing this metadata immediately on page load and will not parse any metadata added after this point. If you want to natively include the Safari banner, then read on here.

Advanced Usage

Platform Specific Overrides

Several options have platform specific overrides. These take precedence over any equivalent option when running on the relevant platform.

For specific details on iOS and Safari specifically, read here. For Android see here.

Icon

A single icon is typical, but specific ones can be configured.

{
    icon: '/assets/my-icon.jpeg',
    androidIcon: null,
    appleIcon: null,
}

Price

The price tagline defaults to FREE with platform specific defaults for both Android and iOS platforms.

{
    price: 'FREE',
    androidPrice: 'FREE - On the Google Play Store',
    applePrice: 'GET - On the App Store'
}

Call to Action Button Label

{
    buttonLabel: 'View',
    androidButtonLabel: null,
    appleButtonLabel: null
}

SCSS/Sass Variables

Styles can be overriden using the provided SCSS/Sass variables. See the variables.

You can provide these styles as needed by using the .scss files instead,

@use '@easy-smart-app-banner/core/variables.scss' as *;

// overwrite as needed
$background-color: #000;

Platform Specific Plugins

Looking for a platform that isn't here? Propose a PR to add it!

Testing if your User Agent (UA) String is Valid

UA strings are a dime a dozen, that's why in verbose mode (see Configuration), the platform parsing utility is exposed to the window object for easy testing. In your browser console,

const myUa = window.navigator.userAgent;
getCurrentPlatform(myUa)

This is especially useful when debugging known UA strings that may not be supported. If you think a particular UA should be supported, open a pull request!

Development

To get started, pull the repo and run a build as well as the tests. Development needs Node 22 or later (the current LTS lines).

don't forget to run npm i!

npm run build
npm run test

You can checkout the rest of the commands in the package.json.

The next step would be to boot a demo project. Checkout the Vue demo here.

Publish a Release

Core and the Vue plugin are released together with the same version.

  1. Checkout a new branch release/major.minor.patch
  2. Set the new version in the root package.json and in plugins/vue-plugin/package.json (npm version <version> --no-git-tag-version in each, which also updates the lockfiles)
  3. Update the README's as needed (bump the size note)
  4. Publish the branch and merge the PR
  5. Run the Publish Packages to npmjs workflow manually with dry-run enabled (the default) and check it passes
  6. Create a GitHub release from master with the tag vmajor.minor.patch. The workflow checks the tag against both package versions, then publishes core followed by the plugin, both with provenance. The plugin is built against the core version just published, and its @easy-smart-app-banner/core range is set to that version in the published package.
  7. In a follow-up PR, set the plugin's @easy-smart-app-banner/core range to the new version (npm install @easy-smart-app-banner/core@^major.minor.patch in plugins/vue-plugin), and bump the demo.

Licence

MIT License © 2025-PRESENT Albert Ferguson

版本与发布记录

@easy-smart-app-banner/core 共发布 12 个版本,首次发布于 2025/05/08;过去 12 个月发布了 1 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.0.0latest2026/10/2123 天前
2.1.12025/08/131.3 年前
2.1.02025/08/131.3 年前
2.0.02025/05/131.5 年前
1.0.72025/05/131.5 年前
1.0.62025/05/131.5 年前

关于 @easy-smart-app-banner/core 的常见问题

@easy-smart-app-banner/core 是什么?

An Easy Smart App Banner for promoting mobile app installs based on the Safari Apple Experience. Includes support for Safari too.

如何安装 @easy-smart-app-banner/core?

在项目目录运行 npm install @easy-smart-app-banner/core,或使用 pnpm add / yarn add / bun add。

@easy-smart-app-banner/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@easy-smart-app-banner/core 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@easy-smart-app-banner/core 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@easy-smart-app-banner/core 可以商用吗?

@easy-smart-app-banner/core 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@easy-smart-app-banner/core 的下载量有多少?

根据 npm 官方下载统计,@easy-smart-app-banner/core 在 2026/10/13 – 2026/11/11 这 30 天内被下载 4,794 次,日均约 160 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@easy-smart-app-banner/core 还在维护吗?

最新版本 3.0.0 发布于 2026/10/21(23 天前);至今共发布 12 个版本,其中过去 12 个月发布了 1 个;首次发布于 2025/05/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。