From 88f1dddf5809c24cdf79723854269859344ff9c3 Mon Sep 17 00:00:00 2001 From: Pavel <14926950+prichodko@users.noreply.github.com> Date: Thu, 24 Feb 2022 16:44:09 +0100 Subject: [PATCH] Use Parcel for building of packages (#227) * Use Parcel for building packages * Make package exports explicit * Fix missing dependencies --- package.json | 3 ++ packages/status-core/package.json | 14 ++++---- packages/status-core/src/index.ts | 16 ++++++--- packages/status-react/package.json | 16 ++++----- .../components/Modals/ProfileFoundModal.tsx | 6 ++-- packages/status-react/src/index.ts | 10 +++--- yarn.lock | 34 +++++++++++++++++-- 7 files changed, 69 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index f82b2cc0..e609c3ad 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,10 @@ "test": "wsrun -e -c -s test" }, "devDependencies": { + "@parcel/packager-ts": "2.3.2", + "@parcel/transformer-typescript-types": "2.3.2", "npm-run-all": "^4.1.5", + "parcel": "^2.3.2", "prettier": "^2.5.1", "typescript": "^4.5.5", "wsrun": "^5.2.4" diff --git a/packages/status-core/package.json b/packages/status-core/package.json index 536a331d..71cee12d 100644 --- a/packages/status-core/package.json +++ b/packages/status-core/package.json @@ -10,13 +10,13 @@ "bugs": { "url": "https://github.com/status-im/status-web/issues" }, - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", + "source": "src/index.ts", + "main": "dist/index.js", + "module": "dist/index.esm.js", + "types": "dist/index.d.ts", "scripts": { - "build": "run-s 'build:*'", - "build:esm": "tsc --module es2020 --target es2017 --outDir dist/esm", - "build:cjs": "tsc --outDir dist/cjs", + "prebuild": "rm -rf dist", + "build": "parcel build", "build:types": "tsc --emitDeclarationOnly", "fix": "run-s 'fix:*'", "fix:lint": "eslint src --ext .ts --fix", @@ -53,10 +53,12 @@ "dependencies": { "bn.js": "^5.2.0", "buffer": "^6.0.3", + "debug": "^4.3.3", "ecies-geth": "^1.5.3", "elliptic": "^6.5.4", "js-sha3": "^0.8.0", "js-waku": "^0.16.0", + "long": "^5.2.0", "pbkdf2": "^3.1.2", "protobufjs": "^6.11.2", "secp256k1": "^4.0.2", diff --git a/packages/status-core/src/index.ts b/packages/status-core/src/index.ts index b20b847d..849d0641 100644 --- a/packages/status-core/src/index.ts +++ b/packages/status-core/src/index.ts @@ -3,12 +3,18 @@ export { Messenger } from './messenger' export { Community } from './community' export { Contacts } from './contacts' export { Chat } from './chat' -export * from './groupChats' -export * as utils from './utils' -export * from './utils' -export { ApplicationMetadataMessage } from './wire/application_metadata_message' +export { GroupChats } from './groupChats' +export type { GroupChat, GroupChatsType } from './groupChats' export { - ChatMessage, + bufToHex, + hexToBuf, + genPrivateKeyWithEntropy, + getLatestUserNickname, + compressPublicKey, +} from './utils' +export { ApplicationMetadataMessage } from './wire/application_metadata_message' +export { ChatMessage } from './wire/chat_message' +export type { ContentType, Content, StickerContent, diff --git a/packages/status-react/package.json b/packages/status-react/package.json index 147355ff..911ca774 100644 --- a/packages/status-react/package.json +++ b/packages/status-react/package.json @@ -11,13 +11,13 @@ "bugs": { "url": "https://github.com/status-im/status-web/issues" }, - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", + "source": "src/index.ts", + "main": "dist/index.js", + "module": "dist/index.esm.js", + "types": "dist/types.d.ts", "scripts": { - "build": "run-s 'build:*'", - "build:esm": "tsc --module es2020 --target es2017 --outDir dist/esm", - "build:cjs": "tsc --outDir dist/cjs", + "prebuild": "rm -rf dist", + "build": "parcel build", "build:types": "tsc --emitDeclarationOnly", "fix": "run-s 'fix:*'", "fix:lint": "eslint './{src,test}/**/*.{ts,tsx}' --fix", @@ -29,7 +29,6 @@ "typecheck": "tsc --noEmit" }, "devDependencies": { - "@hcaptcha/react-hcaptcha": "^1.0.0", "@types/chai": "^4.2.21", "@types/emoji-mart": "^3.0.6", "@types/hcaptcha__react-hcaptcha": "^0.1.5", @@ -49,12 +48,13 @@ "mocha": "^9.0.3", "npm-run-all": "^4.1.5", "npm-watch": "^0.11.0", - "qrcode.react": "^1.0.1", "rimraf": "^3.0.2", "ts-node": "^10.1.0" }, "dependencies": { "@status-im/core": "^0.0.0", + "@hcaptcha/react-hcaptcha": "^1.0.0", + "qrcode.react": "^1.0.1", "emoji-mart": "^3.0.1", "html-entities": "^2.3.2", "js-sha3": "^0.8.0", diff --git a/packages/status-react/src/components/Modals/ProfileFoundModal.tsx b/packages/status-react/src/components/Modals/ProfileFoundModal.tsx index 8dcbfcab..9c53c8bf 100644 --- a/packages/status-react/src/components/Modals/ProfileFoundModal.tsx +++ b/packages/status-react/src/components/Modals/ProfileFoundModal.tsx @@ -1,4 +1,4 @@ -import { Identity, utils } from '@status-im/core' +import { Identity, bufToHex } from '@status-im/core' import React, { useEffect, useMemo, useState } from 'react' import styled from 'styled-components' @@ -58,9 +58,9 @@ export function ProfileFoundModal() {