chore: convert types utils and wallet to esm imports
This commit is contained in:
parent
b1a8473131
commit
1b518bb559
28
.verdaccio/config.yml
Normal file
28
.verdaccio/config.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# path to a directory with all packages
|
||||||
|
storage: ../tmp/local-registry/storage
|
||||||
|
|
||||||
|
# a list of other known repositories we can talk to
|
||||||
|
uplinks:
|
||||||
|
npmjs:
|
||||||
|
url: https://registry.yarnpkg.com
|
||||||
|
maxage: 60m
|
||||||
|
|
||||||
|
packages:
|
||||||
|
'**':
|
||||||
|
# give all users (including non-authenticated users) full access
|
||||||
|
# because it is a local registry
|
||||||
|
access: $all
|
||||||
|
publish: $all
|
||||||
|
unpublish: $all
|
||||||
|
|
||||||
|
# if package is not available locally, proxy requests to npm registry
|
||||||
|
proxy: npmjs
|
||||||
|
|
||||||
|
# log settings
|
||||||
|
logs:
|
||||||
|
type: stdout
|
||||||
|
format: pretty
|
||||||
|
level: warn
|
||||||
|
|
||||||
|
publish:
|
||||||
|
allow_offline: true # set offline to true to allow publish offline
|
@ -1,4 +1,4 @@
|
|||||||
const { getJestProjects } = require('@nx/jest');
|
import { getJestProjects } from '@nx/jest';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
projects: getJestProjects(),
|
projects: getJestProjects(),
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"presets": [
|
|
||||||
[
|
|
||||||
"@nx/react/babel",
|
|
||||||
{
|
|
||||||
"runtime": "automatic",
|
|
||||||
"useBuiltIns": "usage"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"plugins": []
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
|
"extends": ["../../.eslintrc.json"],
|
||||||
"ignorePatterns": ["!**/*", "__generated__"],
|
"ignorePatterns": ["!**/*", "__generated__"],
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
@ -13,6 +13,18 @@
|
|||||||
{
|
{
|
||||||
"files": ["*.js", "*.jsx"],
|
"files": ["*.js", "*.jsx"],
|
||||||
"rules": {}
|
"rules": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["*.json"],
|
||||||
|
"parser": "jsonc-eslint-parser",
|
||||||
|
"rules": {
|
||||||
|
"@nx/dependency-checks": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"ignoredFiles": ["{projectRoot}/rollup.config.{js,ts,mjs,mts}"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
29
libs/types/.swcrc
Normal file
29
libs/types/.swcrc
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"jsc": {
|
||||||
|
"target": "es2017",
|
||||||
|
"parser": {
|
||||||
|
"syntax": "typescript",
|
||||||
|
"decorators": true,
|
||||||
|
"dynamicImport": true
|
||||||
|
},
|
||||||
|
"transform": {
|
||||||
|
"decoratorMetadata": true,
|
||||||
|
"legacyDecorator": true
|
||||||
|
},
|
||||||
|
"keepClassNames": true,
|
||||||
|
"externalHelpers": true,
|
||||||
|
"loose": true
|
||||||
|
},
|
||||||
|
"module": {
|
||||||
|
"type": "es6"
|
||||||
|
},
|
||||||
|
"sourceMaps": true,
|
||||||
|
"exclude": [
|
||||||
|
"jest.config.ts",
|
||||||
|
".*\\.spec.tsx?$",
|
||||||
|
".*\\.test.tsx?$",
|
||||||
|
"./src/jest-setup.ts$",
|
||||||
|
"./**/jest-setup.ts$",
|
||||||
|
".*.js$"
|
||||||
|
]
|
||||||
|
}
|
@ -1,11 +1,30 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
import { readFileSync } from 'fs';
|
||||||
|
|
||||||
|
// Reading the SWC compilation config and remove the "exclude"
|
||||||
|
// for the test files to be compiled by SWC
|
||||||
|
const { exclude: _, ...swcJestConfig } = JSON.parse(
|
||||||
|
readFileSync(`${__dirname}/.swcrc`, 'utf-8')
|
||||||
|
);
|
||||||
|
|
||||||
|
// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves.
|
||||||
|
// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude"
|
||||||
|
if (swcJestConfig.swcrc === undefined) {
|
||||||
|
swcJestConfig.swcrc = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uncomment if using global setup/teardown files being transformed via swc
|
||||||
|
// https://nx.dev/packages/jest/documents/overview#global-setup/teardown-with-nx-libraries
|
||||||
|
// jest needs EsModule Interop to find the default exported setup/teardown functions
|
||||||
|
// swcJestConfig.module.noInterop = false;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
displayName: 'types',
|
displayName: 'types',
|
||||||
preset: '../../jest.preset.js',
|
preset: '../../jest.preset.js',
|
||||||
transform: {
|
transform: {
|
||||||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
|
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
|
||||||
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
|
|
||||||
},
|
},
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
moduleFileExtensions: ['ts', 'js', 'html'],
|
||||||
|
testEnvironment: 'node',
|
||||||
coverageDirectory: '../../coverage/libs/types',
|
coverageDirectory: '../../coverage/libs/types',
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@vegaprotocol/types",
|
"name": "@vegaprotocol/types",
|
||||||
"version": "0.0.6"
|
"version": "0.0.6",
|
||||||
|
"dependencies": {},
|
||||||
|
"type": "module",
|
||||||
|
"module": "./index.js"
|
||||||
}
|
}
|
||||||
|
@ -3,48 +3,38 @@
|
|||||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
"sourceRoot": "libs/types/src",
|
"sourceRoot": "libs/types/src",
|
||||||
"projectType": "library",
|
"projectType": "library",
|
||||||
"tags": [],
|
|
||||||
"targets": {
|
"targets": {
|
||||||
"build": {
|
"build": {
|
||||||
"executor": "@nx/rollup:rollup",
|
"executor": "@nx/rollup:rollup",
|
||||||
"outputs": ["{options.outputPath}"],
|
"outputs": ["{options.outputPath}"],
|
||||||
"options": {
|
"options": {
|
||||||
"outputPath": "dist/libs/types",
|
"outputPath": "dist/libs/types",
|
||||||
|
"main": "libs/types/src/index.ts",
|
||||||
"tsConfig": "libs/types/tsconfig.lib.json",
|
"tsConfig": "libs/types/tsconfig.lib.json",
|
||||||
|
"assets": [],
|
||||||
"project": "libs/types/package.json",
|
"project": "libs/types/package.json",
|
||||||
"entryFile": "libs/types/src/index.ts",
|
"compiler": "swc",
|
||||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
"format": ["esm"]
|
||||||
"compiler": "babel",
|
|
||||||
"format": ["esm", "cjs"],
|
|
||||||
"assets": [
|
|
||||||
{
|
|
||||||
"glob": "libs/types/README.md",
|
|
||||||
"input": ".",
|
|
||||||
"output": "."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"publish": {
|
||||||
|
"command": "node tools/scripts/publish.mjs types {args.ver} {args.tag}",
|
||||||
|
"dependsOn": ["build"]
|
||||||
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"executor": "@nx/eslint:lint",
|
"executor": "@nx/eslint:lint",
|
||||||
"outputs": ["{options.outputFile}"],
|
"outputs": ["{options.outputFile}"],
|
||||||
"options": {
|
"options": {
|
||||||
"lintFilePatterns": ["libs/types/**/*.{ts,tsx,js,jsx}"]
|
"lintFilePatterns": ["libs/types/**/*.ts", "libs/types/package.json"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"executor": "@nx/jest:jest",
|
"executor": "@nx/jest:jest",
|
||||||
"outputs": ["{workspaceRoot}/coverage/libs/types"],
|
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||||
"options": {
|
"options": {
|
||||||
"jestConfig": "libs/types/jest.config.ts"
|
"jestConfig": "libs/types/jest.config.ts"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"generate": {
|
|
||||||
"executor": "nx:run-commands",
|
|
||||||
"options": {
|
|
||||||
"commands": ["npx graphql-codegen --config=libs/types/codegen.yml"],
|
|
||||||
"parallel": false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"tags": []
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"jsx": "react-jsx",
|
"module": "esnext",
|
||||||
"allowJs": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitOverride": true,
|
"noImplicitOverride": true,
|
||||||
"noPropertyAccessFromIndexSignature": false,
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noFallthroughCasesInSwitch": true
|
"noFallthroughCasesInSwitch": true
|
||||||
},
|
},
|
||||||
|
"files": [],
|
||||||
"include": [],
|
"include": [],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
|
@ -2,22 +2,9 @@
|
|||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../../dist/out-tsc",
|
"outDir": "../../dist/out-tsc",
|
||||||
|
"declaration": true,
|
||||||
"types": ["node"]
|
"types": ["node"]
|
||||||
},
|
},
|
||||||
"files": [
|
"include": ["src/**/*.ts"],
|
||||||
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
|
||||||
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/*.spec.ts",
|
|
||||||
"**/*.test.ts",
|
|
||||||
"**/*.spec.tsx",
|
|
||||||
"**/*.test.tsx",
|
|
||||||
"**/*.spec.js",
|
|
||||||
"**/*.test.js",
|
|
||||||
"**/*.spec.jsx",
|
|
||||||
"**/*.test.jsx",
|
|
||||||
"jest.config.ts"
|
|
||||||
],
|
|
||||||
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,9 @@
|
|||||||
"types": ["jest", "node"]
|
"types": ["jest", "node"]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"**/*.test.ts",
|
"jest.config.ts",
|
||||||
"**/*.spec.ts",
|
"src/**/*.test.ts",
|
||||||
"**/*.test.tsx",
|
"src/**/*.spec.ts",
|
||||||
"**/*.spec.tsx",
|
"src/**/*.d.ts"
|
||||||
"**/*.test.js",
|
|
||||||
"**/*.spec.js",
|
|
||||||
"**/*.test.jsx",
|
|
||||||
"**/*.spec.jsx",
|
|
||||||
"**/*.d.ts",
|
|
||||||
"jest.config.ts"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extends": ["../../.eslintrc.json"],
|
"extends": ["../../.eslintrc.json"],
|
||||||
"ignorePatterns": ["!**/*"],
|
"ignorePatterns": ["!**/*", "__generated__"],
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||||
@ -32,6 +32,18 @@
|
|||||||
{
|
{
|
||||||
"files": ["*.js", "*.jsx"],
|
"files": ["*.js", "*.jsx"],
|
||||||
"rules": {}
|
"rules": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["*.json"],
|
||||||
|
"parser": "jsonc-eslint-parser",
|
||||||
|
"rules": {
|
||||||
|
"@nx/dependency-checks": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"ignoredFiles": ["{projectRoot}/rollup.config.{js,ts,mjs,mts}"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,7 @@
|
|||||||
"loose": true
|
"loose": true
|
||||||
},
|
},
|
||||||
"module": {
|
"module": {
|
||||||
"type": "commonjs",
|
"type": "es6"
|
||||||
"strict": true,
|
|
||||||
"noInterop": true
|
|
||||||
},
|
},
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
@ -1,16 +1,30 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
import { readFileSync } from 'fs';
|
||||||
|
|
||||||
|
// Reading the SWC compilation config and remove the "exclude"
|
||||||
|
// for the test files to be compiled by SWC
|
||||||
|
const { exclude: _, ...swcJestConfig } = JSON.parse(
|
||||||
|
readFileSync(`${__dirname}/.swcrc`, 'utf-8')
|
||||||
|
);
|
||||||
|
|
||||||
|
// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves.
|
||||||
|
// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude"
|
||||||
|
if (swcJestConfig.swcrc === undefined) {
|
||||||
|
swcJestConfig.swcrc = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uncomment if using global setup/teardown files being transformed via swc
|
||||||
|
// https://nx.dev/packages/jest/documents/overview#global-setup/teardown-with-nx-libraries
|
||||||
|
// jest needs EsModule Interop to find the default exported setup/teardown functions
|
||||||
|
// swcJestConfig.module.noInterop = false;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
displayName: 'utils',
|
displayName: 'utils',
|
||||||
preset: '../../jest.preset.js',
|
preset: '../../jest.preset.js',
|
||||||
globals: {},
|
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.[tj]s$': [
|
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
|
||||||
'ts-jest',
|
|
||||||
{
|
|
||||||
tsconfig: '<rootDir>/tsconfig.spec.json',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
moduleFileExtensions: ['ts', 'js', 'html'],
|
moduleFileExtensions: ['ts', 'js', 'html'],
|
||||||
|
testEnvironment: 'node',
|
||||||
coverageDirectory: '../../coverage/libs/utils',
|
coverageDirectory: '../../coverage/libs/utils',
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@vegaprotocol/utils",
|
"name": "@vegaprotocol/utils",
|
||||||
"version": "0.0.10",
|
"version": "0.0.10",
|
||||||
"type": "commonjs"
|
"dependencies": {},
|
||||||
|
"type": "module",
|
||||||
|
"module": "./index.js"
|
||||||
}
|
}
|
||||||
|
@ -5,37 +5,32 @@
|
|||||||
"projectType": "library",
|
"projectType": "library",
|
||||||
"targets": {
|
"targets": {
|
||||||
"build": {
|
"build": {
|
||||||
"executor": "@nx/js:swc",
|
"executor": "@nx/rollup:rollup",
|
||||||
"outputs": ["{options.outputPath}"],
|
"outputs": ["{options.outputPath}"],
|
||||||
"format": ["esm", "cjs"],
|
|
||||||
"options": {
|
"options": {
|
||||||
"outputPath": "dist/libs/utils",
|
"outputPath": "dist/libs/utils",
|
||||||
"main": "libs/utils/src/index.ts",
|
"main": "libs/utils/src/index.ts",
|
||||||
"tsConfig": "libs/utils/tsconfig.lib.json",
|
"tsConfig": "libs/utils/tsconfig.lib.json",
|
||||||
"assets": ["libs/utils/*.md"]
|
"assets": [],
|
||||||
|
"project": "libs/utils/package.json",
|
||||||
|
"compiler": "swc",
|
||||||
|
"format": ["esm"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"publish": {
|
"publish": {
|
||||||
"executor": "nx:run-commands",
|
"command": "node tools/scripts/publish.mjs utils {args.ver} {args.tag}",
|
||||||
"options": {
|
"dependsOn": ["build"]
|
||||||
"command": "node tools/scripts/publish.mjs utils {args.ver} {args.tag}"
|
|
||||||
},
|
|
||||||
"dependsOn": [
|
|
||||||
{
|
|
||||||
"target": "build"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"executor": "@nx/eslint:lint",
|
"executor": "@nx/eslint:lint",
|
||||||
"outputs": ["{options.outputFile}"],
|
"outputs": ["{options.outputFile}"],
|
||||||
"options": {
|
"options": {
|
||||||
"lintFilePatterns": ["libs/utils/**/*.ts"]
|
"lintFilePatterns": ["libs/utils/**/*.ts", "libs/utils/package.json"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"executor": "@nx/jest:jest",
|
"executor": "@nx/jest:jest",
|
||||||
"outputs": ["{workspaceRoot}/coverage/libs/utils"],
|
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||||
"options": {
|
"options": {
|
||||||
"jestConfig": "libs/utils/jest.config.ts"
|
"jestConfig": "libs/utils/jest.config.ts"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as Schema from '@vegaprotocol/types';
|
import { type StopOrder, StopOrderTriggerDirection } from '@vegaprotocol/types';
|
||||||
import { addDecimalsFormatNumber } from './number';
|
import { addDecimalsFormatNumber } from './number';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { useT } from '../use-t';
|
import { useT } from '../use-t';
|
||||||
@ -7,14 +7,14 @@ export const useFormatTrigger = () => {
|
|||||||
const t = useT();
|
const t = useT();
|
||||||
return useCallback(
|
return useCallback(
|
||||||
(
|
(
|
||||||
data: Pick<Schema.StopOrder, 'trigger' | 'triggerDirection'> | undefined,
|
data: Pick<StopOrder, 'trigger' | 'triggerDirection'> | undefined,
|
||||||
marketDecimalPlaces: number,
|
marketDecimalPlaces: number,
|
||||||
defaultValue = '-'
|
defaultValue = '-'
|
||||||
) => {
|
) => {
|
||||||
if (data && data?.trigger?.__typename === 'StopOrderPrice') {
|
if (data && data?.trigger?.__typename === 'StopOrderPrice') {
|
||||||
return `${t('Mark')} ${
|
return `${t('Mark')} ${
|
||||||
data?.triggerDirection ===
|
data?.triggerDirection ===
|
||||||
Schema.StopOrderTriggerDirection.TRIGGER_DIRECTION_FALLS_BELOW
|
StopOrderTriggerDirection.TRIGGER_DIRECTION_FALLS_BELOW
|
||||||
? '<'
|
? '<'
|
||||||
: '>'
|
: '>'
|
||||||
} ${addDecimalsFormatNumber(data.trigger.price, marketDecimalPlaces)}`;
|
} ${addDecimalsFormatNumber(data.trigger.price, marketDecimalPlaces)}`;
|
||||||
@ -25,7 +25,7 @@ export const useFormatTrigger = () => {
|
|||||||
) {
|
) {
|
||||||
return `${t('Mark')} ${
|
return `${t('Mark')} ${
|
||||||
data?.triggerDirection ===
|
data?.triggerDirection ===
|
||||||
Schema.StopOrderTriggerDirection.TRIGGER_DIRECTION_FALLS_BELOW
|
StopOrderTriggerDirection.TRIGGER_DIRECTION_FALLS_BELOW
|
||||||
? '+'
|
? '+'
|
||||||
: '-'
|
: '-'
|
||||||
}${(Number(data?.trigger.trailingPercentOffset) * 100).toFixed(1)}%`;
|
}${(Number(data?.trigger.trailingPercentOffset) * 100).toFixed(1)}%`;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "esnext",
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitOverride": true,
|
"noImplicitOverride": true,
|
||||||
"noPropertyAccessFromIndexSignature": false,
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"esModuleInterop": true
|
"allowSyntheticDefaultImports": true
|
||||||
},
|
},
|
||||||
"files": [],
|
"files": [],
|
||||||
"include": [],
|
"include": [],
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../../dist/out-tsc",
|
"outDir": "../../dist/out-tsc",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"types": []
|
"types": ["node"]
|
||||||
},
|
},
|
||||||
"include": ["**/*.ts"],
|
"include": ["src/**/*.ts"],
|
||||||
"exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"]
|
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,10 @@
|
|||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"types": ["jest", "node"]
|
"types": ["jest", "node"]
|
||||||
},
|
},
|
||||||
"include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
|
"include": [
|
||||||
|
"jest.config.ts",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"presets": [
|
|
||||||
[
|
|
||||||
"@nx/react/babel",
|
|
||||||
{
|
|
||||||
"runtime": "automatic",
|
|
||||||
"useBuiltIns": "usage"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"plugins": []
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
|
"extends": ["../../.eslintrc.json"],
|
||||||
"ignorePatterns": ["!**/*", "__generated__"],
|
"ignorePatterns": ["!**/*", "__generated__"],
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
@ -13,6 +13,18 @@
|
|||||||
{
|
{
|
||||||
"files": ["*.js", "*.jsx"],
|
"files": ["*.js", "*.jsx"],
|
||||||
"rules": {}
|
"rules": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["*.json"],
|
||||||
|
"parser": "jsonc-eslint-parser",
|
||||||
|
"rules": {
|
||||||
|
"@nx/dependency-checks": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"ignoredFiles": ["{projectRoot}/rollup.config.{js,ts,mjs,mts}"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
29
libs/wallet/.swcrc
Normal file
29
libs/wallet/.swcrc
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"jsc": {
|
||||||
|
"target": "es2017",
|
||||||
|
"parser": {
|
||||||
|
"syntax": "typescript",
|
||||||
|
"decorators": true,
|
||||||
|
"dynamicImport": true
|
||||||
|
},
|
||||||
|
"transform": {
|
||||||
|
"decoratorMetadata": true,
|
||||||
|
"legacyDecorator": true
|
||||||
|
},
|
||||||
|
"keepClassNames": true,
|
||||||
|
"externalHelpers": true,
|
||||||
|
"loose": true
|
||||||
|
},
|
||||||
|
"module": {
|
||||||
|
"type": "es6"
|
||||||
|
},
|
||||||
|
"sourceMaps": true,
|
||||||
|
"exclude": [
|
||||||
|
"jest.config.ts",
|
||||||
|
".*\\.spec.tsx?$",
|
||||||
|
".*\\.test.tsx?$",
|
||||||
|
"./src/jest-setup.ts$",
|
||||||
|
"./**/jest-setup.ts$",
|
||||||
|
".*.js$"
|
||||||
|
]
|
||||||
|
}
|
@ -1,12 +1,30 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
import { readFileSync } from 'fs';
|
||||||
|
|
||||||
|
// Reading the SWC compilation config and remove the "exclude"
|
||||||
|
// for the test files to be compiled by SWC
|
||||||
|
const { exclude: _, ...swcJestConfig } = JSON.parse(
|
||||||
|
readFileSync(`${__dirname}/.swcrc`, 'utf-8')
|
||||||
|
);
|
||||||
|
|
||||||
|
// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves.
|
||||||
|
// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude"
|
||||||
|
if (swcJestConfig.swcrc === undefined) {
|
||||||
|
swcJestConfig.swcrc = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uncomment if using global setup/teardown files being transformed via swc
|
||||||
|
// https://nx.dev/packages/jest/documents/overview#global-setup/teardown-with-nx-libraries
|
||||||
|
// jest needs EsModule Interop to find the default exported setup/teardown functions
|
||||||
|
// swcJestConfig.module.noInterop = false;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
displayName: 'wallet',
|
displayName: 'wallet',
|
||||||
preset: '../../jest.preset.js',
|
preset: '../../jest.preset.js',
|
||||||
transform: {
|
transform: {
|
||||||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
|
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
|
||||||
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
|
|
||||||
},
|
},
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
moduleFileExtensions: ['ts', 'js', 'html'],
|
||||||
|
testEnvironment: 'node',
|
||||||
coverageDirectory: '../../coverage/libs/wallet',
|
coverageDirectory: '../../coverage/libs/wallet',
|
||||||
setupFilesAfterEnv: ['./src/setup-tests.ts'],
|
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@vegaprotocol/wallet",
|
"name": "@vegaprotocol/wallet",
|
||||||
"version": "0.0.2"
|
"version": "0.0.1",
|
||||||
|
"dependencies": {},
|
||||||
|
"type": "module",
|
||||||
|
"module": "./index.js"
|
||||||
}
|
}
|
||||||
|
@ -3,55 +3,38 @@
|
|||||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
"sourceRoot": "libs/wallet/src",
|
"sourceRoot": "libs/wallet/src",
|
||||||
"projectType": "library",
|
"projectType": "library",
|
||||||
"tags": [],
|
|
||||||
"targets": {
|
"targets": {
|
||||||
"build": {
|
"build": {
|
||||||
"executor": "@nx/rollup:rollup",
|
"executor": "@nx/rollup:rollup",
|
||||||
"outputs": ["{options.outputPath}"],
|
"outputs": ["{options.outputPath}"],
|
||||||
"options": {
|
"options": {
|
||||||
"outputPath": "dist/libs/wallet",
|
"outputPath": "dist/libs/wallet",
|
||||||
|
"main": "libs/wallet/src/index.ts",
|
||||||
"tsConfig": "libs/wallet/tsconfig.lib.json",
|
"tsConfig": "libs/wallet/tsconfig.lib.json",
|
||||||
|
"assets": [],
|
||||||
"project": "libs/wallet/package.json",
|
"project": "libs/wallet/package.json",
|
||||||
"entryFile": "libs/wallet/src/index.ts",
|
|
||||||
"external": [
|
|
||||||
"react",
|
|
||||||
"react-dom",
|
|
||||||
"react/jsx-runtime",
|
|
||||||
"@vegaprotocol/types",
|
|
||||||
"@vegaprotocol/utils"
|
|
||||||
],
|
|
||||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
|
||||||
"compiler": "swc",
|
"compiler": "swc",
|
||||||
"format": ["esm", "cjs"],
|
"format": ["esm"]
|
||||||
"assets": [
|
|
||||||
{
|
|
||||||
"glob": "libs/wallet/README.md",
|
|
||||||
"input": ".",
|
|
||||||
"output": "."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"publish": {
|
||||||
|
"command": "node tools/scripts/publish.mjs wallet {args.ver} {args.tag}",
|
||||||
|
"dependsOn": ["build"]
|
||||||
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"executor": "@nx/eslint:lint",
|
"executor": "@nx/eslint:lint",
|
||||||
"outputs": ["{options.outputFile}"],
|
"outputs": ["{options.outputFile}"],
|
||||||
"options": {
|
"options": {
|
||||||
"lintFilePatterns": ["libs/wallet/**/*.{ts,tsx,js,jsx}"]
|
"lintFilePatterns": ["libs/wallet/**/*.ts", "libs/wallet/package.json"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"executor": "@nx/jest:jest",
|
"executor": "@nx/jest:jest",
|
||||||
"outputs": ["{workspaceRoot}/coverage/libs/wallet"],
|
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||||
"options": {
|
"options": {
|
||||||
"jestConfig": "libs/wallet/jest.config.ts"
|
"jestConfig": "libs/wallet/jest.config.ts"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"build-spec": {
|
|
||||||
"executor": "nx:run-commands",
|
|
||||||
"outputs": [],
|
|
||||||
"options": {
|
|
||||||
"command": "yarn tsc --project ./libs/wallet/tsconfig.spec.json"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"tags": []
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"jsx": "react-jsx",
|
"module": "esnext",
|
||||||
"allowJs": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitOverride": true,
|
"noImplicitOverride": true,
|
||||||
"noPropertyAccessFromIndexSignature": false,
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noFallthroughCasesInSwitch": true
|
"noFallthroughCasesInSwitch": true
|
||||||
},
|
},
|
||||||
|
"files": [],
|
||||||
"include": [],
|
"include": [],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
|
@ -2,23 +2,9 @@
|
|||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../../dist/out-tsc",
|
"outDir": "../../dist/out-tsc",
|
||||||
|
"declaration": true,
|
||||||
"types": ["node"]
|
"types": ["node"]
|
||||||
},
|
},
|
||||||
"files": [
|
"include": ["src/**/*.ts"],
|
||||||
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
|
||||||
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/*.spec.ts",
|
|
||||||
"**/*.test.ts",
|
|
||||||
"**/*.spec.tsx",
|
|
||||||
"**/*.test.tsx",
|
|
||||||
"**/*.spec.js",
|
|
||||||
"**/*.test.js",
|
|
||||||
"**/*.spec.jsx",
|
|
||||||
"**/*.test.jsx",
|
|
||||||
"jest.config.ts",
|
|
||||||
"__mocks__"
|
|
||||||
],
|
|
||||||
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
|
||||||
}
|
}
|
||||||
|
@ -3,18 +3,12 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../../dist/out-tsc",
|
"outDir": "../../dist/out-tsc",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"types": ["jest", "node", "@testing-library/jest-dom"]
|
"types": ["jest", "node"]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"**/*.test.ts",
|
"jest.config.ts",
|
||||||
"**/*.spec.ts",
|
"src/**/*.test.ts",
|
||||||
"**/*.test.tsx",
|
"src/**/*.spec.ts",
|
||||||
"**/*.spec.tsx",
|
"src/**/*.d.ts"
|
||||||
"**/*.test.js",
|
|
||||||
"**/*.spec.js",
|
|
||||||
"**/*.test.jsx",
|
|
||||||
"**/*.spec.jsx",
|
|
||||||
"**/*.d.ts",
|
|
||||||
"jest.config.ts"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
"@sentry/nextjs": "^6.19.3",
|
"@sentry/nextjs": "^6.19.3",
|
||||||
"@sentry/react": "^6.19.2",
|
"@sentry/react": "^6.19.2",
|
||||||
"@sentry/tracing": "^6.19.2",
|
"@sentry/tracing": "^6.19.2",
|
||||||
|
"@swc/helpers": "~0.5.2",
|
||||||
"@walletconnect/ethereum-provider": "^2.6.0",
|
"@walletconnect/ethereum-provider": "^2.6.0",
|
||||||
"@web3-react/coinbase-wallet": "8.1.2-beta.0",
|
"@web3-react/coinbase-wallet": "8.1.2-beta.0",
|
||||||
"@web3-react/core": "^8.1.2-beta.0",
|
"@web3-react/core": "^8.1.2-beta.0",
|
||||||
@ -201,6 +202,7 @@
|
|||||||
"jest": "29.4.3",
|
"jest": "29.4.3",
|
||||||
"jest-canvas-mock": "^2.3.1",
|
"jest-canvas-mock": "^2.3.1",
|
||||||
"jest-environment-jsdom": "^29.4.1",
|
"jest-environment-jsdom": "^29.4.1",
|
||||||
|
"jest-environment-node": "^29.4.1",
|
||||||
"jest-websocket-mock": "^2.3.0",
|
"jest-websocket-mock": "^2.3.0",
|
||||||
"lint-staged": "^12.3.3",
|
"lint-staged": "^12.3.3",
|
||||||
"mock-apollo-client": "^1.2.0",
|
"mock-apollo-client": "^1.2.0",
|
||||||
@ -227,6 +229,7 @@
|
|||||||
"type-fest": "^3.8.0",
|
"type-fest": "^3.8.0",
|
||||||
"typescript": "5.2.2",
|
"typescript": "5.2.2",
|
||||||
"url-loader": "^4.1.1",
|
"url-loader": "^4.1.1",
|
||||||
|
"verdaccio": "^5.0.4",
|
||||||
"webpack": "5.89.0",
|
"webpack": "5.89.0",
|
||||||
"webpack-merge": "^5.8.0"
|
"webpack-merge": "^5.8.0"
|
||||||
},
|
},
|
||||||
@ -238,5 +241,8 @@
|
|||||||
"graphql": "15.8.0",
|
"graphql": "15.8.0",
|
||||||
"//": "workaround storybook issue: https://github.com/storybookjs/storybook/issues/21642",
|
"//": "workaround storybook issue: https://github.com/storybookjs/storybook/issues/21642",
|
||||||
"@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.cd77847.0"
|
"@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.cd77847.0"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"includedScripts": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
14
project.json
Normal file
14
project.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "nx-monorepo",
|
||||||
|
"$schema": "node_modules/nx/schemas/project-schema.json",
|
||||||
|
"targets": {
|
||||||
|
"local-registry": {
|
||||||
|
"executor": "@nx/js:verdaccio",
|
||||||
|
"options": {
|
||||||
|
"port": 4873,
|
||||||
|
"config": ".verdaccio/config.yml",
|
||||||
|
"storage": "tmp/local-registry/storage"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user