Fix `@status-im/js` build (#389)

* build cjs

* change mod exports

* tmp: add rebuild script

* export peers

* user browser field

* rm tmp changes
This commit is contained in:
Felicio Mununga 2023-05-03 14:48:16 +02:00 committed by GitHub
parent e05c318035
commit f3bb59597e
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
3 changed files with 9 additions and 15 deletions

View File

@ -3,13 +3,9 @@
"version": "0.1.1", "version": "0.1.1",
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"type": "module", "type": "module",
"exports": { "main": "./dist/index.cjs",
"types": "./dist/types/index.d.ts", "module": "./dist/index.js",
"import": "./dist/index.es.js", "types": "./dist/types/index.d.ts",
"default": "./dist/index.es.js"
},
"module": "dist/index.es.js",
"types": "dist/types/index.d.ts",
"repository": { "repository": {
"url": "https://github.com/status-im/status-web.git", "url": "https://github.com/status-im/status-web.git",
"directory": "packages/status-js", "directory": "packages/status-js",
@ -54,5 +50,8 @@
], ],
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
},
"browser": {
"./src/utils/encode-url-data": false
} }
} }

View File

@ -11,6 +11,7 @@ export { createClient } from './client/client'
export type { Community } from './client/community/community' export type { Community } from './client/community/community'
export type { Reaction, Reactions } from './client/community/get-reactions' export type { Reaction, Reactions } from './client/community/get-reactions'
export type { Member } from './client/member' export type { Member } from './client/member'
export { peers } from './consts/peers'
export { EthereumClient } from './ethereum-client/ethereum-client' export { EthereumClient } from './ethereum-client/ethereum-client'
export type { ChannelInfo } from './request-client/map-channel' export type { ChannelInfo } from './request-client/map-channel'
export type { CommunityInfo } from './request-client/map-community' export type { CommunityInfo } from './request-client/map-community'
@ -18,10 +19,6 @@ export type { UserInfo } from './request-client/map-user'
export { RequestClient } from './request-client/request-client' export { RequestClient } from './request-client/request-client'
export { createRequestClient } from './request-client/request-client' export { createRequestClient } from './request-client/request-client'
export { deserializePublicKey } from './utils/deserialize-public-key' export { deserializePublicKey } from './utils/deserialize-public-key'
export { export * from './utils/encode-url-data'
decodeChannelURLData,
decodeCommunityURLData,
decodeUserURLData,
} from './utils/encode-url-data'
export { publicKeyToEmojiHash } from './utils/public-key-to-emoji-hash' export { publicKeyToEmojiHash } from './utils/public-key-to-emoji-hash'
export { verifyEncodedURLData } from './utils/sign-url-data' export { verifyEncodedURLData } from './utils/sign-url-data'

View File

@ -1,5 +1,3 @@
/// <reference types="vitest" />
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import { dependencies } from './package.json' import { dependencies } from './package.json'
@ -30,7 +28,7 @@ export default defineConfig(({ mode }) => {
lib: { lib: {
entry: './src/index.ts', entry: './src/index.ts',
fileName: 'index', fileName: 'index',
formats: ['es'], formats: ['es', 'cjs'],
}, },
sourcemap: true, sourcemap: true,
emptyOutDir: mode === 'production', emptyOutDir: mode === 'production',