mirror of
https://github.com/oceanprotocol/react.git
synced 2025-02-14 21:10:38 +01:00
Merge pull request #56 from oceanprotocol/feature/packaging
build commonjs & esm packages
This commit is contained in:
commit
afd439b17f
13
package.json
13
package.json
@ -2,18 +2,23 @@
|
|||||||
"name": "@oceanprotocol/react",
|
"name": "@oceanprotocol/react",
|
||||||
"version": "0.0.15",
|
"version": "0.0.15",
|
||||||
"description": "React hooks & components on top of squid.js",
|
"description": "React hooks & components on top of squid.js",
|
||||||
"main": "dist/index.js",
|
"main": "dist/cjs/index.js",
|
||||||
"module": "dist/esm/index.js",
|
"module": "dist/esm/index.js",
|
||||||
|
"react-native": "dist/esm/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "tsc --watch",
|
"start": "tsc --watch",
|
||||||
"start-example": "cd example && npm start",
|
"start-example": "cd example && npm start",
|
||||||
"build": "tsc",
|
"watch": "tsc --watch",
|
||||||
"test": "npm run lint",
|
"build": "rm -rf dist && npm run build:cjs && npm run build:esm",
|
||||||
|
"build:cjs": "tsc",
|
||||||
|
"build:esm": "tsc --module esNext --outDir dist/esm",
|
||||||
|
"test": "npm run lint && npm run type-check",
|
||||||
"lint": "eslint --ignore-path .eslintignore --ext .js --ext .ts --ext .tsx .",
|
"lint": "eslint --ignore-path .eslintignore --ext .js --ext .ts --ext .tsx .",
|
||||||
"format": "prettier --ignore-path .gitignore './**/*.{css,yml,js,ts,tsx,json}' --write",
|
"format": "prettier --ignore-path .gitignore './**/*.{css,yml,js,ts,tsx,json}' --write",
|
||||||
"release": "release-it --non-interactive",
|
"release": "release-it --non-interactive",
|
||||||
"changelog": "auto-changelog -p",
|
"changelog": "auto-changelog -p",
|
||||||
"prepublishOnly": "npm run build"
|
"prepublishOnly": "npm run build",
|
||||||
|
"type-check": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
import React, { useContext, useState, useEffect, createContext } from 'react'
|
import React, {
|
||||||
|
useContext,
|
||||||
|
useState,
|
||||||
|
useEffect,
|
||||||
|
createContext,
|
||||||
|
ReactElement
|
||||||
|
} from 'react'
|
||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
import ProviderStatus from './ProviderStatus'
|
import ProviderStatus from './ProviderStatus'
|
||||||
import { Ocean, Logger, Account, Config } from '@oceanprotocol/lib'
|
import { Ocean, Logger, Account, Config } from '@oceanprotocol/lib'
|
||||||
@ -27,7 +33,7 @@ function OceanProvider({
|
|||||||
}: {
|
}: {
|
||||||
config: Config
|
config: Config
|
||||||
children: any
|
children: any
|
||||||
}) {
|
}): ReactElement {
|
||||||
const [web3, setWeb3] = useState<Web3 | undefined>()
|
const [web3, setWeb3] = useState<Web3 | undefined>()
|
||||||
const [web3Provider, setWeb3Provider] = useState<any | undefined>()
|
const [web3Provider, setWeb3Provider] = useState<any | undefined>()
|
||||||
const [ocean, setOcean] = useState<Ocean | undefined>()
|
const [ocean, setOcean] = useState<Ocean | undefined>()
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es5",
|
|
||||||
"lib": ["es2015", "dom"],
|
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"outDir": "dist",
|
"target": "es5",
|
||||||
|
"lib": ["esnext", "dom"],
|
||||||
|
"outDir": "dist/cjs",
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"strictNullChecks": false
|
"strictNullChecks": false,
|
||||||
|
"noEmitOnError": true
|
||||||
},
|
},
|
||||||
"include": ["./src/@types", "./src/index.ts"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["node_modules", "dist", "example"]
|
"exclude": ["node_modules", "dist", "example"]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user