Skip to content

Commit

Permalink
feat: transpile code to cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
sverrehagen committed Sep 14, 2022
1 parent 2e0f62c commit 5e3abde
Show file tree
Hide file tree
Showing 8 changed files with 1,451 additions and 63 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
- name: Install NPM packages
run: npm clean-install

- name: Build NPM module
run: npm run build

- name: Publish NPM module and create Github release
run: npx semantic-release
env:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# build
dist

# dependencies
/node_modules

Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default, AccountContext } from "./lib/AccountProvider.js";
export { default as useAccount } from "./lib/useAccount.js";
export { AccountProvider, AccountContext } from "./lib/AccountProvider.js";
export { useAccount } from "./lib/useAccount.js";
4 changes: 2 additions & 2 deletions lib/AccountProvider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import React, {
createContext,
useState,
useEffect,
Expand Down Expand Up @@ -34,7 +34,7 @@ const useIsomorphicLayoutEffect = process?.browser

export const AccountContext = createContext();

export default function AccountProvider({ children }, config) {
export const AccountProvider = ({ children, config}) => {
const account = useMemo(() => process.browser && initIdentity(config), []);
const [user, setUser] = useState(null);

Expand Down
4 changes: 2 additions & 2 deletions lib/useAccount.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useContext } from "react";
import React, { useContext } from "react";

import { AccountContext } from "./AccountProvider";

export default function useAccount() {
export const useAccount = () => {
const { account, user } = useContext(AccountContext);

function login(redirectUrl = window.location.href) {
Expand Down
Loading

0 comments on commit 5e3abde

Please sign in to comment.