Skip to content

Commit

Permalink
Carpini/fix tsconfig and module imports (#49)
Browse files Browse the repository at this point in the history
* fix: eslint and prettier config

* fix: eslintignore

* fix: prettier format

* fix: tsconfig and module imports

* fix: add parcel

* fix: tsconfig and package json
  • Loading branch information
davidecarpini authored Nov 3, 2023
1 parent 2495829 commit 1e2e280
Show file tree
Hide file tree
Showing 18 changed files with 1,184 additions and 655 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ yarn-error.log*

.idea
.vscode
.parcel-cache
9 changes: 5 additions & 4 deletions apps/sample-vanilla-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"author": "",
"type": "module",
"scripts": {
"dev": "wds --watch",
"dev": "parcel index.html --open",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@vechain/vanilla-wallet-kit": "*",
"@web/dev-server": "^0.1.31",
"@web/dev-server-legacy": "^1.0.0"
"@vechain/vanilla-wallet-kit": "*"
},
"devDependencies": {
"parcel": "^2.10.2"
}
}
26 changes: 0 additions & 26 deletions apps/sample-vanilla-app/web-dev-server.config.js

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "turbo run build",
"build-react-kit": "turbo run build --filter='@vechain/react-wallet-kit'",
"build:deps": "turbo build --no-daemon --filter='@vechain/*'",
"clean": "npx turbo@latest run clean && rm -rf node_modules .turbo",
"clean": "npx turbo@latest run clean && rm -rf node_modules .turbo .parcel-cache",
"dev": "turbo run dev --no-daemon",
"format": "prettier --write \"**/*.{ts,tsx,md,json,js,jsx}\"",
"install:all": "yarn && yarn run build:deps",
Expand Down Expand Up @@ -41,6 +41,7 @@
"husky": "^8.0.0",
"lint-staged": "^15.0.2",
"prettier": "^2.5.1",
"punycode": "^1.4.1",
"turbo": "latest",
"typescript": "4.9.5"
},
Expand Down
1 change: 1 addition & 0 deletions packages/vanilla-wallet-kit/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/*
dist/*
web-dev-server.config.js
tsup.config.ts
18 changes: 8 additions & 10 deletions packages/vanilla-wallet-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,27 @@
"author": "Davide Carpini",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"clean": "yarn rimraf dist && yarn rimraf node_modules",
"dev": "wds --watch",
"build": "tsup",
"clean": "rm -rf dist && rm -rf node_modules",
"dev": "parcel index.html --open",
"format": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --ignore-path ./.eslintignore --write",
"lint": "eslint 'src/**/*.ts'",
"serve": "MODE=prod npm run serve",
"watch": "tsc --watch"
"watch": "tsup --watch"
},
"dependencies": {
"@vechain/wallet-kit": "*",
"lit": "^3.0.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.25.0",
"@typescript-eslint/parser": "^5.25.0",
"@vechain/repo-config": "https://github.com/vechainfoundation/repo-config#v0.0.1",
"@web/dev-server": "^0.1.31",
"@web/dev-server-legacy": "^1.0.0",
"@webcomponents/webcomponentsjs": "^2.8.0",
"eslint": "^8.15.0",
"parcel": "^2.10.2",
"prettier": "^2.6.2",
"rimraf": "^3.0.2",
"tsup": "^7.2.0",
"typescript": "~5.2.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { LitElement, html, css } from 'lit';
import type { TemplateResult } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { Colors, Theme, ThemeMode } from '../../../wallet-kit';
import { Theme, ThemeMode } from '@vechain/wallet-kit';
import { Colors } from '../../../wallet-kit';

@customElement('vwk-base-modal')
class Modal extends LitElement {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { LitElement, html } from 'lit';
import type { TemplateResult } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { Theme, ThemeMode } from '../../wallet-kit';
import { ThemeMode, Theme } from '@vechain/wallet-kit';

@customElement('vwk-connect-button-with-modal')
class ConnectButtonWithModal extends LitElement {
@property({ type: String })
@property()
override title = 'Connect Wallet';

@property({ type: ThemeMode })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { LitElement, html, css } from 'lit';
import type { TemplateResult } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { Theme, ThemeMode, Colors } from '../../wallet-kit';
import { ThemeMode, Theme } from '@vechain/wallet-kit';
import { Colors } from '../../wallet-kit';

@customElement('vwk-connect-button')
class ConnectButton extends LitElement {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { LitElement, html, css, nothing } from 'lit';
import type { TemplateResult } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { ThemeMode, Theme } from '@vechain/wallet-kit';
import { DarkCloseSvg, LightCloseSvg } from '../../assets';
import { Theme, ThemeMode, WalletSources } from '../../wallet-kit';
import { WalletSources } from '../../wallet-kit';
import type { SourceInfo } from '../../wallet-kit';

@customElement('vwk-connect-modal')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { LitElement, html, css } from 'lit';
import type { TemplateResult } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { Colors, Theme, ThemeMode } from '../../wallet-kit';
import { ThemeMode, Theme } from '@vechain/wallet-kit';
import { Colors } from '../../wallet-kit';
import type { SourceInfo } from '../../wallet-kit';

@customElement('vwk-source-card')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
// TODO: use the wallet-kit package instead of this one
export * from './theme';
export * from './colors';
export * from './sources';

This file was deleted.

28 changes: 1 addition & 27 deletions packages/vanilla-wallet-kit/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,7 @@
"extends": "@vechain/repo-config/src/tsconfig/base.json",
"compilerOptions": {
"target": "es2021",
"module": "es2020",
"lib": ["es2021", "DOM", "DOM.Iterable"],
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"inlineSources": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitThis": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"noImplicitOverride": true,
"plugins": [
{
"name": "ts-lit-plugin",
"strict": true
}
],
"types": ["mocha"]
"experimentalDecorators": true
},
"include": ["src/**/*.ts"],
"exclude": []
Expand Down
12 changes: 12 additions & 0 deletions packages/vanilla-wallet-kit/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'tsup';

// eslint-disable-next-line import/no-default-export
export default defineConfig({
entry: ['src/index.ts'],
outDir: 'dist',
format: 'esm',
minify: true,
sourcemap: true,
dts: true,
clean: true,
});
1 change: 1 addition & 0 deletions packages/wallet-connect/src/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export const newWcSigner = ({

const vechainNamespace = session.namespaces.vechain;

// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!vechainNamespace) {
throw new Error(
'Failed to create a vechain session with wallet connect',
Expand Down
10 changes: 7 additions & 3 deletions packages/wallet-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
"name": "@vechain/wallet-kit",
"version": "0.0.0",
"private": true,
"exports": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsup src/index.ts --format cjs --dts",
"build": "tsup src/index.ts --format cjs,esm --dts",
"clean": "rm -rf dist node_modules .turbo",
"dev": "tsup src/index.ts --format cjs --watch --dts",
"lint": "eslint src --ext .js,.jsx,.ts,.tsx"
"lint": "eslint src --ext .js,.jsx,.ts,.tsx",
"watch": "tsup src/index.ts --format cjs,esm --watch --dts"
},
"dependencies": {
"@vechain/connex": "2.1.0",
Expand Down
Loading

0 comments on commit 1e2e280

Please sign in to comment.