Skip to content

Commit

Permalink
v2.0.0 ready for publish
Browse files Browse the repository at this point in the history
  • Loading branch information
liplylie committed Jan 22, 2022
1 parent 15829b9 commit aa2e71a
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ local.properties
buck-out/
\.buckd/
*.keystore

dist
1 change: 0 additions & 1 deletion example/src/Home/AlarmList.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class AlarmList extends Component {

async componentDidMount() {
const alarms = await getAlarms();
console.log('alarms', alarms);
// eslint-disable-next-line react/no-did-mount-set-state
this.setState({
alarms,
Expand Down
3 changes: 0 additions & 3 deletions index.js

This file was deleted.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"title": "React Native Simple Alarm",
"version": "2.0.0",
"description": "Alarm clock functionality for react native ios and android using react-native-push-notification and react-native-community/async-storage",
"main": "index.js",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist/**"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/helpers/Alarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// libs
import { Platform } from "react-native";

import { Alarm as AlarmType } from "../../Types";
import { Alarm as AlarmType } from "../Types";

const emptyProperty = Platform.select({ ios: "", android: null });

Expand Down
2 changes: 1 addition & 1 deletion src/helpers/cancelAlarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import PushNotificationIOS from "@react-native-community/push-notification-ios";
// local
import { getAlarmById } from "./getAlarms";
import { editAlarm } from "./editAlarm";
import { Alarm as AlarmType } from "../../Types";
import { Alarm as AlarmType } from "../Types";

export const cancelAlarm = (alarm: AlarmType): void => {
if (!alarm) {
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/createAlarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Alarm from "./Alarm";
import uuid from "./uuid";
import { activateAlarmWithoutEdit } from "./libraryOnlyHelpers/activateAlarmWithoutEdit";
import { alarmStorage } from "./constants";
import { Alarm as AlarmType } from "../../Types";
import { Alarm as AlarmType } from "../Types";

export const createAlarm = async ({
active = false,
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/deleteAlarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import AsyncStorage from "@react-native-community/async-storage";
// local
import { alarmStorage } from "./constants";
import { cancelAlarmWithoutEdit } from "./libraryOnlyHelpers/cancelAlarmWithoutEdit";
import { Alarm as AlarmType } from "../../Types";
import { Alarm as AlarmType } from "../Types";

export const deleteAlarm = async (alarm: AlarmType): Promise<AlarmType[]> => {
if (!alarm) {
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/editAlarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { alarmStorage } from "./constants";
import { getAlarmById } from "./getAlarms";
import { activateAlarmWithoutEdit } from "./libraryOnlyHelpers/activateAlarmWithoutEdit";
import { cancelAlarmWithoutEdit } from "./libraryOnlyHelpers/cancelAlarmWithoutEdit";
import { Alarm as AlarmType } from "../../Types";
import { Alarm as AlarmType } from "../Types";

export const editAlarm = async (alarm: AlarmType): Promise<AlarmType> => {
if (!alarm) {
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/getAlarms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AsyncStorage from "@react-native-community/async-storage";

// local
import { alarmStorage } from "./constants";
import { Alarm as AlarmType } from "../../Types";
import { Alarm as AlarmType } from "../Types";

export const getAlarms = async (): Promise<AlarmType[] | []> => {
const storage = await AsyncStorage.getItem(alarmStorage);
Expand All @@ -15,7 +15,7 @@ export const getAlarms = async (): Promise<AlarmType[] | []> => {
}
};

export const getAlarmById = async (id: string | number): Promise<AlarmType> | null=> {
export const getAlarmById = async (id: string | number)=> {
if (!id) {
throw new Error("Please enter an id");
}
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/libraryOnlyHelpers/activateAlarmWithoutEdit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import moment from "moment";
// local
import { getAlarmById } from "../getAlarms";
import { editAlarmWithoutActivateAlarm } from "./editAlarmWithoutActivateAlarm";
import { Alarm as AlarmType } from "../../../Types";
import { Alarm as AlarmType } from "../../Types";

// doesn't call edit alarm again
// should only be used within the library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import AsyncStorage from "@react-native-community/async-storage";
// local
import { alarmStorage } from "../constants";
import { getAlarmById } from "../getAlarms";
import { Alarm as AlarmType } from "../../../Types";
import { Alarm as AlarmType } from "../../Types";

// doesn't call activateAlarm again
export const editAlarmWithoutActivateAlarm = async (alarm: AlarmType): Promise<AlarmType[]> => {
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/uuid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Platform } from "react-native";

export const uuid = () => {
if (Platform.OS === "ios") {
function s4() {
const s4 = () => {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
Expand Down
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as SimpleAlarm from "./helpers";
export * from "./helpers";
export default SimpleAlarm;
12 changes: 12 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib": ["es2017", "es7", "es6", "dom"],
"outDir": "./dist",
"rootDir": "./src",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true ,
"declaration": true
}
}

0 comments on commit aa2e71a

Please sign in to comment.