A WXT module that automatically converts Safari extensions to Xcode projects
npm install wxt-module-safari-xcodeA WXT module that automatically converts Safari extensions to Xcode projects and configures related settings after the build is complete.
- Automatically runs xcrun safari-web-extension-converter to convert the extension to an Xcode project
- Updates Xcode project configuration (version number, app category, development team, etc.)
- Updates all Info.plist files
``typescript
import { defineConfig } from 'wxt'
export default defineConfig({
modules: ['wxt-module-safari-xcode'],
safariXcode: {
projectName: 'Your Project Name',
appCategory: 'public.app-category.productivity',
bundleIdentifier: 'com.example.your-extension',
developmentTeam: 'ABC1234567',
},
// ... other configurations
})
`
`bash`
pnpm wxt build -b safari
The module will automatically convert the extension to an Xcode project after the build completes.
| Option | Type | Required | Description |
| ------------------ | -------- | -------- | --------------------------------------------------------------------------------------------- |
| projectName | string | ❌ | Safari project name. Defaults to manifest.name if not provided |appCategory
| | string | ✅ | App category, e.g., 'public.app-category.productivity' |bundleIdentifier
| | string | ✅ | Bundle identifier, e.g., 'com.example.app' |developmentTeam
| | string | ❌ | Apple Developer Team ID, e.g., 'ABC1234567'. If not provided, must be set manually in Xcode |
This module uses WXT's build:done hook to perform the following steps after the build completes:
1. Run xcrun safari-web-extension-converter to convert the extension to a Safari Xcode projectpackage.json
2. Read the version number from .xcodeproj/project.pbxproj
3. Update the Xcode project configuration file ()MARKETING_VERSION
- Set to the version from package.jsonCURRENT_PROJECT_VERSION
- Set to numeric version (major _ 10000 + minor _ 100 + patch)CFBundleVersion
- Configure app category
- Configure development team (if provided)
4. Update all Info.plist files and add
- This module only executes when building for Safari browser (wxt build -b safari).env.local
- Requires macOS and Xcode Command Line Tools
- If you want to read configuration from environment variables, ensure is added to .gitignore
`typescript
import { defineConfig } from 'wxt'
export default defineConfig({
modules: ['@wxt-dev/module-react', 'wxt-module-safari-xcode'],
safariXcode: {
projectName: 'My Awesome Extension',
appCategory: 'public.app-category.productivity',
bundleIdentifier: 'com.mycompany.awesome-extension',
developmentTeam: 'ABC1234567',
},
manifest: {
name: 'My Awesome Extension',
version: '0.1.0',
},
})
`
Generate the Xcode project will be located at: .output/