Skip to content

Commit

Permalink
Update plugin to Capacitor 4 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahnuh authored Nov 10, 2022
1 parent ec986f7 commit 622d9b9
Show file tree
Hide file tree
Showing 56 changed files with 174 additions and 7,708 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
dist
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
.DS_Store
# node files
dist
node_modules
dist

# iOS files
Pods
Podfile.lock
Build
xcuserdata

# macOS files
.DS_Store
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
dist
52 changes: 52 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Contributing

This guide provides instructions for contributing to this Capacitor plugin.

## Developing

### Local Setup

1. Fork and clone the repo.
1. Install the dependencies.

```shell
npm install
```

1. Install SwiftLint if you're on macOS.
```shell
brew install swiftlint
```
### Scripts
#### `npm run build`
Build the plugin web assets and generate plugin API documentation using [`@capacitor/docgen`](https://github.com/ionic-team/capacitor-docgen).
It will compile the TypeScript code from `src/` into ESM JavaScript in `dist/esm/`. These files are used in apps with bundlers when your plugin is imported.
Then, Rollup will bundle the code into a single file at `dist/plugin.js`. This file is used in apps without bundlers by including it as a script in `index.html`.
#### `npm run verify`
Build and validate the web and native projects.
This is useful to run in CI to verify that the plugin builds for all platforms.
#### `npm run lint` / `npm run fmt`
Check formatting and code quality, autoformat/autofix if possible.
This template is integrated with ESLint, Prettier, and SwiftLint. Using these tools is completely optional, but the [Capacitor Community](https://github.com/capacitor-community/) strives to have consistent code style and structure for easier cooperation.
## Publishing
There is a `prepublishOnly` hook in `package.json` which prepares the plugin before publishing, so all you need to do is run:
```shell
npm publish
```
> **Note**: The [`files`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#files) array in `package.json` specifies which files get published. If you rename files/directories or add files elsewhere, you may need to update it.
6 changes: 6 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.idea/
node_modules/
.vscode/
*.map
.DS_Store
.sourcemaps
12 changes: 12 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Created with Capacitor Create App

This app was created using [`@capacitor/create-app`](https://github.com/ionic-team/create-capacitor-app),
and comes with a very minimal shell for building an app.

### Running this example

To run the provided example, you can use [serve](https://www.npmjs.com/package/serve):

```bash
npx serve
```
11 changes: 11 additions & 0 deletions example/capacitor.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"appId": "com.example.plugin",
"appName": "example",
"bundledWebRuntime": true,
"webDir": "www",
"plugins": {
"SplashScreen": {
"launchShowDuration": 0
}
}
}
24 changes: 24 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "capacitor-app",
"version": "1.0.0",
"description": "An Amazing Capacitor App",
"main": "index.js",
"keywords": [
"capacitor",
"mobile"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@capacitor/core": "latest",
"@capacitor/camera": "latest",
"@capacitor/splash-screen": "latest",
"@perfood/capacitor-healthkit": "file:.."
},
"devDependencies": {
"@capacitor/cli": "latest"
},
"author": "",
"license": "ISC"
}
14 changes: 5 additions & 9 deletions ios/Plugin.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
03FC29A292ACC40490383A1F /* Pods_Plugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */; };
20C0B05DCFC8E3958A738AF2 /* Pods_PluginTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */; };
2F98D68224C9AAE500613A4C /* CapacitorHealthkit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F98D68124C9AAE400613A4C /* CapacitorHealthkit.swift */; };
50ADFF92201F53D600D50D53 /* Plugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50ADFF88201F53D600D50D53 /* Plugin.framework */; };
50ADFF97201F53D600D50D53 /* CapacitorHealthkitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50ADFF96201F53D600D50D53 /* CapacitorHealthkitTests.swift */; };
50ADFF99201F53D600D50D53 /* CapacitorHealthkitPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ADFF8B201F53D600D50D53 /* CapacitorHealthkitPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand All @@ -29,7 +28,6 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
2F98D68124C9AAE400613A4C /* CapacitorHealthkit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CapacitorHealthkit.swift; sourceTree = "<group>"; };
3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Plugin.framework; sourceTree = BUILT_PRODUCTS_DIR; };
50ADFF88201F53D600D50D53 /* Plugin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Plugin.framework; sourceTree = BUILT_PRODUCTS_DIR; };
50ADFF8B201F53D600D50D53 /* CapacitorHealthkitPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CapacitorHealthkitPlugin.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -93,7 +91,6 @@
isa = PBXGroup;
children = (
50E1A94720377CB70090CE1A /* CapacitorHealthkitPlugin.swift */,
2F98D68124C9AAE400613A4C /* CapacitorHealthkit.swift */,
50ADFF8B201F53D600D50D53 /* CapacitorHealthkitPlugin.h */,
50ADFFA72020EE4F00D50D53 /* CapacitorHealthkitPlugin.m */,
50ADFF8C201F53D600D50D53 /* Info.plist */,
Expand Down Expand Up @@ -191,7 +188,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1160;
LastUpgradeCheck = 1400;
ORGANIZATIONNAME = "Max Lynch";
TargetAttributes = {
50ADFF87201F53D600D50D53 = {
Expand Down Expand Up @@ -307,7 +304,6 @@
buildActionMask = 2147483647;
files = (
50E1A94820377CB70090CE1A /* CapacitorHealthkitPlugin.swift in Sources */,
2F98D68224C9AAE500613A4C /* CapacitorHealthkit.swift in Sources */,
50ADFFA82020EE4F00D50D53 /* CapacitorHealthkitPlugin.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -386,7 +382,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -446,7 +442,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -469,7 +465,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Plugin/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)\n$(FRAMEWORK_SEARCH_PATHS)\n$(FRAMEWORK_SEARCH_PATHS)";
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.Plugin;
Expand All @@ -494,7 +490,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Plugin/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.Plugin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
platform :ios, '12.0'
platform :ios, '13.0'

def capacitor_pods
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
Expand Down
22 changes: 0 additions & 22 deletions ios/Podfile.lock

This file was deleted.

34 changes: 0 additions & 34 deletions ios/Pods/Local Podspecs/Capacitor.podspec.json

This file was deleted.

26 changes: 0 additions & 26 deletions ios/Pods/Local Podspecs/CapacitorCordova.podspec.json

This file was deleted.

22 changes: 0 additions & 22 deletions ios/Pods/Manifest.lock

This file was deleted.

Loading

0 comments on commit 622d9b9

Please sign in to comment.