Skip to content

Commit

Permalink
2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hyochan committed Sep 1, 2024
1 parent 5bb99bf commit ec72db4
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 39 deletions.
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ assignees: ''
- react-native:
- Platforms (iOS, Android, emulator, simulator, device):

**To Reproduce**
Steps to reproduce the behavior:
**To Reproduce** Steps to reproduce the behavior:

1. Go to '...'
2. Press '...'
Expand Down
35 changes: 19 additions & 16 deletions .github/workflows/publish-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,32 @@ jobs:
deploy:
if: github.event.release.prerelease
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'
node-version: 20.x

- name: Remove example code
run: rm -rf IapExample
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies
run: yarn install --immutable
- name: Install modules
run: bun install --immutable

- name: Build typescript
run: yarn lint:ci
- name: Run lint scripts
run: bun run lint:ci

- name: Verify no files have changed after auto-fix
run: git diff -- ":(exclude)IapExample/*" --exit-code HEAD
run: git diff -- ":(exclude)example/*" --exit-code HEAD

- name: Prepare module
run: yarn prepare

- name: Configure npm for publishing
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- run: npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29 changes: 15 additions & 14 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,28 @@ jobs:
if: '!github.event.release.prerelease'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'
node-version: 20.x

- name: Remove example code
run: rm -rf IapExample
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies
run: yarn install --immutable
- name: Install modules
run: bun install --immutable

- name: Run lint scripts
run: yarn lint:ci
run: bun run lint:ci

- name: Verify no files have changed after auto-fix
run: git diff -- ":(exclude)IapExample/*" --exit-code HEAD
run: git diff -- ":(exclude)example/*" --exit-code HEAD

- name: Configure npm for publishing
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ module.exports = {
singleQuote: true,
jsxSingleQuote: false,
bracketSpacing: false,
proseWrap: "never"
proseWrap: 'never',
};
1 change: 1 addition & 0 deletions example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
purchaseUpdatedListener,
requestPurchase,
requestSubscription,
// eslint-disable-next-line import/no-unresolved
} from 'expo-iap';
import {useEffect, useState} from 'react';
import {
Expand Down
2 changes: 1 addition & 1 deletion example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
presets: ['babel-preset-expo'],
};
};
2 changes: 1 addition & 1 deletion example/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');
const {getDefaultConfig} = require('expo/metro-config');
const path = require('path');

const config = getDefaultConfig(__dirname);
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"name": "expo-iap",
"version": "2.0.0-rc.2",
"version": "2.0.0",
"description": "In App Purchase module in Expo",
"main": "build/index.js",
"types": "build/index.d.ts",
"scripts": {
"build": "expo-module build",
"clean": "expo-module clean",
"lint": "eslint --ext .ts,.tsx,.js,.jsx src",
"lint:eslint": "eslint --fix '**/*.{ts,tsx}'",
"lint:prettier": "prettier --write \"**/*.{md,js,jsx,ts,tsx}\"",
"lint:tsc": "tsc -p tsconfig.json --noEmit --skipLibCheck",
"lint:ci": "yarn lint:tsc && yarn lint:eslint && yarn lint:prettier",
"test": "expo-module test",
"prepare": "expo-module prepare",
"prepublishOnly": "expo-module prepublishOnly",
Expand Down
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import {
SubscriptionPurchase,
} from './ExpoIap.types';
import ExpoIapModule from './ExpoIapModule';
import {RequestPurchaseAndroidProps, RequestSubscriptionAndroidProps} from './types/ExpoIapAndroid.types';
import {
RequestPurchaseAndroidProps,
RequestSubscriptionAndroidProps,
} from './types/ExpoIapAndroid.types';
import {
PaymentDiscount,
ProductIos,
Expand Down
10 changes: 8 additions & 2 deletions src/modules/android.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import {Linking} from 'react-native';
import {Product, PurchaseResult, SubscriptionProduct} from '../ExpoIap.types';
import {ProductAndroid, ReceiptAndroid, SubscriptionProductAndroid} from '../types/ExpoIapAndroid.types';
import {
ProductAndroid,
ReceiptAndroid,
SubscriptionProductAndroid,
} from '../types/ExpoIapAndroid.types';
import ExpoIapModule from '../ExpoIapModule';

export function isProductAndroid(product: Product): product is ProductAndroid {
return (product as ProductAndroid)?.title !== undefined;
}

export function isSubscriptionProductAndroid(product: SubscriptionProduct): product is SubscriptionProductAndroid {
export function isSubscriptionProductAndroid(
product: SubscriptionProduct,
): product is SubscriptionProductAndroid {
return (product as SubscriptionProductAndroid)?.title !== undefined;
}

Expand Down

0 comments on commit ec72db4

Please sign in to comment.