chore(trading): migrate nx to latest version (#4196)

This commit is contained in:
Bartłomiej Głownia 2023-07-04 13:01:25 +02:00 committed by GitHub
parent 87b41a30d8
commit 6e0577aee4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
293 changed files with 7626 additions and 8645 deletions

1
.eslintignore Normal file
View File

@ -0,0 +1 @@
node_modules

View File

@ -1,7 +1,7 @@
{ {
"root": true, "root": true,
"ignorePatterns": ["**/*"], "ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx", "eslint-plugin-unicorn", "jsx-a11y", "jest"], "plugins": ["@nx", "eslint-plugin-unicorn", "jsx-a11y", "jest"],
"settings": { "settings": {
"jsx-a11y": { "jsx-a11y": {
"components": { "components": {
@ -18,7 +18,7 @@
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"extends": ["plugin:jsx-a11y/strict"], "extends": ["plugin:jsx-a11y/strict"],
"rules": { "rules": {
"@nrwl/nx/enforce-module-boundaries": [ "@nx/enforce-module-boundaries": [
"error", "error",
{ {
"enforceBuildableLibDependency": true, "enforceBuildableLibDependency": true,
@ -56,7 +56,7 @@
}, },
{ {
"files": ["*.ts", "*.tsx"], "files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"], "extends": ["plugin:@nx/typescript"],
"rules": { "rules": {
"@typescript-eslint/ban-ts-comment": [ "@typescript-eslint/ban-ts-comment": [
"error", "error",
@ -80,14 +80,19 @@
}, },
{ {
"files": ["*.spec.ts", "*.spec.tsx"], "files": ["*.spec.ts", "*.spec.tsx"],
"extends": ["plugin:@nrwl/nx/typescript", "plugin:jest/recommended"], "extends": ["plugin:@nx/typescript", "plugin:jest/recommended"],
"rules": { "rules": {
"jest/consistent-test-it": ["error", { "fn": "it" }] "jest/consistent-test-it": [
"error",
{
"fn": "it"
}
]
} }
}, },
{ {
"files": ["*.js", "*.jsx"], "files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"], "extends": ["plugin:@nx/javascript"],
"rules": {} "rules": {}
} }
] ]

View File

@ -113,19 +113,19 @@ jobs:
- name: Build local dist - name: Build local dist
run: | run: |
flags="" envCmd=""
if [[ ! -z "${{ env.ENV_NAME }}" ]]; then if [[ ! -z "${{ env.ENV_NAME }}" ]]; then
flags="--env=${{ env.ENV_NAME }}" envCmd="yarn env-cmd -f ./apps/${{ matrix.app }}/.env.${{ env.ENV_NAME }}"
fi fi
if [ "${{ matrix.app }}" = "trading" ]; then if [ "${{ matrix.app }}" = "trading" ]; then
yarn nx export trading $flags || (yarn install && yarn nx export trading $flags) $envCmd yarn nx export trading || (yarn install && $envCmd yarn nx export trading)
DIST_LOCATION=dist/apps/trading/exported DIST_LOCATION=dist/apps/trading/exported
elif [ "${{ matrix.app }}" = "ui-toolkit" ]; then elif [ "${{ matrix.app }}" = "ui-toolkit" ]; then
NODE_ENV=production yarn nx run ui-toolkit:build-storybook NODE_ENV=production yarn nx run ui-toolkit:build-storybook
DIST_LOCATION=dist/storybook/ui-toolkit DIST_LOCATION=dist/storybook/ui-toolkit
else else
yarn nx build ${{ matrix.app }} $flags || (yarn install && yarn nx build ${{ matrix.app }} $flags) $envCmd yarn nx build ${{ matrix.app }} || (yarn install && $envCmd yarn nx build ${{ matrix.app }})
DIST_LOCATION=dist/apps/${{ matrix.app }} DIST_LOCATION=dist/apps/${{ matrix.app }}
fi fi
mv $DIST_LOCATION dist-result mv $DIST_LOCATION dist-result

View File

@ -1,29 +0,0 @@
module.exports = {
stories: [],
addons: [
'@storybook/addon-actions',
'@storybook/addon-viewport',
{
name: '@storybook/addon-docs',
options: {
configureJSX: true,
babelOptions: {},
sourceLoaderOptions: null,
transcludeMarkdown: true,
},
},
'@storybook/addon-controls',
'@storybook/addon-backgrounds',
'@storybook/addon-toolbars',
'@storybook/addon-measure',
'@storybook/addon-outline',
'@storybook/addon-a11y',
],
// uncomment the property below if you want to apply some webpack config globally
// webpackFinal: async (config, { configType }) => {
// // Make whatever fine-grained changes you need that should apply to all storybook configs
// // Return the altered config
// return config;
// },
};

View File

@ -1,14 +0,0 @@
{
"extends": "../tsconfig.base.json",
"exclude": [
"../**/*.spec.js",
"../**/*.test.js",
"../**/*.spec.ts",
"../**/*.test.ts",
"../**/*.spec.tsx",
"../**/*.test.tsx",
"../**/*.spec.jsx",
"../**/*.test.jsx"
],
"include": ["../**/*"]
}

View File

@ -1,10 +1,11 @@
{ {
"name": "explorer-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/explorer-e2e/src", "sourceRoot": "apps/explorer-e2e/src",
"projectType": "application", "projectType": "application",
"targets": { "targets": {
"e2e": { "e2e": {
"executor": "@nrwl/cypress:cypress", "executor": "@nx/cypress:cypress",
"options": { "options": {
"cypressConfig": "apps/explorer-e2e/cypress.config.js", "cypressConfig": "apps/explorer-e2e/cypress.config.js",
"devServerTarget": "explorer:serve" "devServerTarget": "explorer:serve"
@ -16,14 +17,14 @@
} }
}, },
"lint": { "lint": {
"executor": "@nrwl/linter:eslint", "executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["apps/explorer-e2e/**/*.{js,ts}"] "lintFilePatterns": ["apps/explorer-e2e/**/*.{js,ts}"]
} }
}, },
"build": { "build": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": [], "outputs": [],
"options": { "options": {
"command": "yarn tsc --project ./apps/explorer-e2e/" "command": "yarn tsc --project ./apps/explorer-e2e/"

View File

@ -27,6 +27,11 @@ context('Home Page', function () {
16: 'Chain ID', 16: 'Chain ID',
}; };
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get('[data-testid="stats-title"]') cy.get('[data-testid="stats-title"]')
.each(($list, index) => { .each(($list, index) => {
cy.wrap($list).should('contain.text', statTitles[index]); cy.wrap($list).should('contain.text', statTitles[index]);

View File

@ -34,6 +34,11 @@ context('Network parameters page', { tags: '@smoke' }, function () {
const parameterName = network_parameter[0]; const parameterName = network_parameter[0];
const parameterValue = network_parameter[1]; const parameterValue = network_parameter[1];
if (this.networkParameterFormat.json.includes(parameterName)) { if (this.networkParameterFormat.json.includes(parameterName)) {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get(tableRows) cy.get(tableRows)
.contains(parameterName) .contains(parameterName)
.should('be.visible') .should('be.visible')
@ -65,6 +70,11 @@ context('Network parameters page', { tags: '@smoke' }, function () {
if (this.networkParameterFormat.percentage.includes(parameterName)) { if (this.networkParameterFormat.percentage.includes(parameterName)) {
const formattedPercentageParameter = const formattedPercentageParameter =
(parseFloat(parameterValue) * 100).toFixed(0) + '%'; (parseFloat(parameterValue) * 100).toFixed(0) + '%';
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get(tableRows) cy.get(tableRows)
.contains(parameterName) .contains(parameterName)
.should('be.visible') .should('be.visible')
@ -148,6 +158,11 @@ context('Network parameters page', { tags: '@smoke' }, function () {
cy.convert_number_to_max_four_decimal(parameterValue) cy.convert_number_to_max_four_decimal(parameterValue)
.add_commas_to_number_if_large_enough() .add_commas_to_number_if_large_enough()
.then((parameterValueFormatted) => { .then((parameterValueFormatted) => {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get(tableRows) cy.get(tableRows)
.contains(parameterName) .contains(parameterName)
.should('be.visible') .should('be.visible')
@ -179,6 +194,11 @@ context('Network parameters page', { tags: '@smoke' }, function () {
cy.convert_number_to_max_eighteen_decimal(parameterValue) cy.convert_number_to_max_eighteen_decimal(parameterValue)
.add_commas_to_number_if_large_enough() .add_commas_to_number_if_large_enough()
.then((parameterValueFormatted) => { .then((parameterValueFormatted) => {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get(tableRows) cy.get(tableRows)
.contains(parameterName) .contains(parameterName)
.should('be.visible') .should('be.visible')

View File

@ -170,6 +170,11 @@ context.skip('Parties page', { tags: '@regression' }, function () {
const sideMenuBackground = '.absolute'; const sideMenuBackground = '.absolute';
// Engage dark mode if not allready set // Engage dark mode if not allready set
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get(sideMenuBackground) cy.get(sideMenuBackground)
.should('have.css', 'background-color') .should('have.css', 'background-color')
.then((background_color) => { .then((background_color) => {

View File

@ -60,16 +60,31 @@ context.skip('Transactions page', function () {
}); });
cy.get('block').should('not.be.empty'); cy.get('block').should('not.be.empty');
cy.get('encoded-tnx').should('not.be.empty'); cy.get('encoded-tnx').should('not.be.empty');
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get('tx-type') cy.get('tx-type')
.should('not.be.empty') .should('not.be.empty')
.invoke('text') .invoke('text')
.then((txTypeTxt) => { .then((txTypeTxt) => {
if (txTypeTxt == 'Order Submission') { if (txTypeTxt == 'Order Submission') {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get('.hljs-attr') cy.get('.hljs-attr')
.should('have.length.at.least', 8) .should('have.length.at.least', 8)
.each(($propertyName) => { .each(($propertyName) => {
cy.wrap($propertyName).should('not.be.empty'); cy.wrap($propertyName).should('not.be.empty');
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get('.hljs-string') cy.get('.hljs-string')
.should('have.length.at.least', 8) .should('have.length.at.least', 8)
.each(($propertyValue) => { .each(($propertyValue) => {

View File

@ -1,7 +1,7 @@
{ {
"presets": [ "presets": [
[ [
"@nrwl/react/babel", "@nx/react/babel",
{ {
"runtime": "automatic" "runtime": "automatic"
} }

View File

@ -1,6 +1,6 @@
{ {
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], "extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "__generated__", "__generated___"], "ignorePatterns": ["!**/*", "__generated__"],
"overrides": [ "overrides": [
{ {
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],

View File

@ -39,7 +39,7 @@ Example configurations are provided here:
For convenience, you can boot the app injecting one of the configurations above by running: For convenience, you can boot the app injecting one of the configurations above by running:
```bash ```bash
yarn nx run explorer:serve --env={env} # e.g. stagnet1 yarn env-cmd -f .\apps\explorer\.env.{env} yarn nx run explorer:serve # e.g. stagnet1
``` ```
There are a few different configuration options offered for this app: There are a few different configuration options offered for this app:

View File

@ -4,8 +4,8 @@ export default {
displayName: 'explorer', displayName: 'explorer',
preset: '../../jest.preset.js', preset: '../../jest.preset.js',
transform: { transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest', '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': 'babel-jest', '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/explorer', coverageDirectory: '../../coverage/apps/explorer',

View File

@ -1,10 +1,11 @@
{ {
"name": "explorer",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/explorer/src", "sourceRoot": "apps/explorer/src",
"projectType": "application", "projectType": "application",
"targets": { "targets": {
"build": { "build": {
"executor": "./tools/executors/webpack:build", "executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"defaultConfiguration": "production", "defaultConfiguration": "production",
"options": { "options": {
@ -38,7 +39,7 @@
} }
}, },
"serve": { "serve": {
"executor": "./tools/executors/webpack:serve", "executor": "@nx/webpack:dev-server",
"options": { "options": {
"port": 3000, "port": 3000,
"buildTarget": "explorer:build:development", "buildTarget": "explorer:build:development",
@ -52,22 +53,28 @@
} }
}, },
"lint": { "lint": {
"executor": "@nrwl/linter:eslint", "executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["apps/explorer/**/*.{ts,tsx,js,jsx}"] "lintFilePatterns": ["apps/explorer/**/*.{ts,tsx,js,jsx}"]
} }
}, },
"test": { "test": {
"executor": "@nrwl/jest:jest", "executor": "@nx/jest:jest",
"outputs": ["coverage/apps/explorer"], "outputs": ["{workspaceRoot}/coverage/apps/explorer"],
"options": { "options": {
"jestConfig": "apps/explorer/jest.config.ts", "jestConfig": "apps/explorer/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
} }
}, },
"generate-types": { "generate-types": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"options": { "options": {
"commands": [ "commands": [
"npx openapi-typescript https://raw.githubusercontent.com/vegaprotocol/documentation/main/specs/v0.71.4/blockexplorer.openapi.json --output apps/explorer/src/types/explorer.d.ts --immutable-types" "npx openapi-typescript https://raw.githubusercontent.com/vegaprotocol/documentation/main/specs/v0.71.4/blockexplorer.openapi.json --output apps/explorer/src/types/explorer.d.ts --immutable-types"
@ -75,7 +82,7 @@
} }
}, },
"build-netlify": { "build-netlify": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"options": { "options": {
"commands": [ "commands": [
"cp apps/explorer/netlify.toml netlify.toml", "cp apps/explorer/netlify.toml netlify.toml",
@ -84,7 +91,7 @@
} }
}, },
"build-spec": { "build-spec": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": [], "outputs": [],
"options": { "options": {
"command": "yarn tsc --project ./apps/explorer/tsconfig.spec.json" "command": "yarn tsc --project ./apps/explorer/tsconfig.spec.json"

View File

@ -1,5 +1,5 @@
const { join } = require('path'); const { join } = require('path');
const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind'); const { createGlobPatternsForDependencies } = require('@nx/react/tailwind');
const theme = require('../../libs/tailwindcss-config/src/theme'); const theme = require('../../libs/tailwindcss-config/src/theme');
const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes'); const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes');

View File

@ -5,8 +5,8 @@
"types": ["node"] "types": ["node"]
}, },
"files": [ "files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts" "../../node_modules/@nx/react/typings/image.d.ts"
], ],
"exclude": [ "exclude": [
"**/*.spec.ts", "**/*.spec.ts",

View File

@ -18,7 +18,7 @@
"jest.config.ts" "jest.config.ts"
], ],
"files": [ "files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts" "../../node_modules/@nx/react/typings/image.d.ts"
] ]
} }

View File

@ -1,6 +1,8 @@
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');
const SentryPlugin = require('@sentry/webpack-plugin'); const SentryPlugin = require('@sentry/webpack-plugin');
module.exports = (config, context) => { module.exports = composePlugins(withNx(), withReact(), (config) => {
const additionalPlugins = process.env.SENTRY_AUTH_TOKEN const additionalPlugins = process.env.SENTRY_AUTH_TOKEN
? [ ? [
new SentryPlugin({ new SentryPlugin({
@ -14,4 +16,4 @@ module.exports = (config, context) => {
...config, ...config,
plugins: [...additionalPlugins, ...config.plugins], plugins: [...additionalPlugins, ...config.plugins],
}; };
}; });

View File

@ -1,10 +1,11 @@
{ {
"name": "governance-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/governance-e2e/src", "sourceRoot": "apps/governance-e2e/src",
"projectType": "application", "projectType": "application",
"targets": { "targets": {
"e2e": { "e2e": {
"executor": "@nrwl/cypress:cypress", "executor": "@nx/cypress:cypress",
"options": { "options": {
"cypressConfig": "apps/governance-e2e/cypress.config.js", "cypressConfig": "apps/governance-e2e/cypress.config.js",
"devServerTarget": "governance:serve" "devServerTarget": "governance:serve"
@ -16,14 +17,14 @@
} }
}, },
"lint": { "lint": {
"executor": "@nrwl/linter:eslint", "executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["apps/governance-e2e/**/*.{js,ts}"] "lintFilePatterns": ["apps/governance-e2e/**/*.{js,ts}"]
} }
}, },
"build": { "build": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": [], "outputs": [],
"options": { "options": {
"command": "yarn tsc --project ./apps/governance-e2e/" "command": "yarn tsc --project ./apps/governance-e2e/"

View File

@ -98,6 +98,11 @@ describe(
.and('have.length', 64); .and('have.length', 64);
cy.getByTestId(proposalTermsToggle).click(); cy.getByTestId(proposalTermsToggle).click();
// 3001-VOTE-052 3001-VOTE-010 // 3001-VOTE-052 3001-VOTE-010
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get('code.language-json') cy.get('code.language-json')
.should('exist') .should('exist')
.within(() => { .within(() => {

View File

@ -117,6 +117,11 @@ context(
cy.getByTestId(submitWithdrawalButton).click(); cy.getByTestId(submitWithdrawalButton).click();
}); });
// assert withdrawal request // assert withdrawal request
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId(toast) cy.getByTestId(toast)
.first(txTimeout) .first(txTimeout)
.should('contain.text', 'Funds unlocked') .should('contain.text', 'Funds unlocked')
@ -130,6 +135,11 @@ context(
cy.getByTestId(toastClose).click(); cy.getByTestId(toastClose).click();
}); });
// withdrawal complete // withdrawal complete
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId(toast) cy.getByTestId(toast)
.first(txTimeout) .first(txTimeout)
.should('contain.text', 'The withdrawal has been approved.') .should('contain.text', 'The withdrawal has been approved.')
@ -139,6 +149,11 @@ context(
'Withdraw 120.00 tUSDC' 'Withdraw 120.00 tUSDC'
); );
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId(toast) cy.getByTestId(toast)
.last(txTimeout) .last(txTimeout)
.should('contain.text', 'Transaction confirmed') .should('contain.text', 'Transaction confirmed')
@ -146,6 +161,11 @@ context(
cy.getByTestId('external-link').should('exist'); cy.getByTestId('external-link').should('exist');
}); });
// withdrawal history for complete withdrawal displayed // withdrawal history for complete withdrawal displayed
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get(tableWithdrawnStatus) cy.get(tableWithdrawnStatus)
.eq(1, txTimeout) .eq(1, txTimeout)
.should('have.text', 'Completed') .should('have.text', 'Completed')
@ -187,6 +207,11 @@ context(
cy.getByTestId(submitWithdrawalButton).click(); cy.getByTestId(submitWithdrawalButton).click();
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId(toast) cy.getByTestId(toast)
.first(txTimeout) .first(txTimeout)
.should('contain.text', 'Funds unlocked') .should('contain.text', 'Funds unlocked')
@ -198,6 +223,11 @@ context(
); );
cy.getByTestId(toastClose).click(); cy.getByTestId(toastClose).click();
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get(tableTxHash) cy.get(tableTxHash)
.eq(1) .eq(1)
.should('have.text', 'Complete withdrawal') .should('have.text', 'Complete withdrawal')
@ -213,18 +243,33 @@ context(
}); });
ethereumWalletConnect(); ethereumWalletConnect();
cy.getByTestId(completeWithdrawalButton).first().click(); cy.getByTestId(completeWithdrawalButton).first().click();
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId(toast) cy.getByTestId(toast)
.last(txTimeout) .last(txTimeout)
.should('contain.text', 'Awaiting confirmation') .should('contain.text', 'Awaiting confirmation')
.within(() => { .within(() => {
cy.getByTestId('external-link').should('exist'); cy.getByTestId('external-link').should('exist');
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId(toast) cy.getByTestId(toast)
.first(txTimeout) .first(txTimeout)
.should('contain.text', 'The withdrawal has been approved.') .should('contain.text', 'The withdrawal has been approved.')
.within(() => { .within(() => {
cy.getByTestId(toastPanel).should('contain.text', '110.00', 'tUSDC'); cy.getByTestId(toastPanel).should('contain.text', '110.00', 'tUSDC');
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId(toast) cy.getByTestId(toast)
.last(txTimeout) .last(txTimeout)
.should('contain.text', 'Transaction confirmed') .should('contain.text', 'Transaction confirmed')
@ -248,6 +293,11 @@ context(
cy.getByTestId(amountInput).click().type('50'); cy.getByTestId(amountInput).click().type('50');
cy.getByTestId(submitWithdrawalButton).click(); cy.getByTestId(submitWithdrawalButton).click();
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId(toast) cy.getByTestId(toast)
.first(txTimeout) .first(txTimeout)
.should('contain.text', 'Funds unlocked') .should('contain.text', 'Funds unlocked')

View File

@ -16,6 +16,11 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () {
}); });
it('should display announcement banner', function () { it('should display announcement banner', function () {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('app-announcement') cy.getByTestId('app-announcement')
.should('contain.text', 'TEST ANNOUNCEMENT!') .should('contain.text', 'TEST ANNOUNCEMENT!')
.within(() => { .within(() => {
@ -35,6 +40,11 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () {
waitForSpinner(); waitForSpinner();
} }
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('proposals-list-item') cy.getByTestId('proposals-list-item')
.should('have.length.at.least', 1) .should('have.length.at.least', 1)
.first() .first()
@ -94,6 +104,11 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () {
}); });
it('should contain link to specific validators', function () { it('should contain link to specific validators', function () {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('validators') cy.getByTestId('validators')
.should('have.length', '2') .should('have.length', '2')
.each(($validator) => { .each(($validator) => {
@ -120,6 +135,11 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () {
}); });
it('should display network data', function () { it('should display network data', function () {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('git-network-data') cy.getByTestId('git-network-data')
.should('contain.text', 'Reading network data from') .should('contain.text', 'Reading network data from')
.within(() => { .within(() => {
@ -131,6 +151,11 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () {
}); });
it('should display eth data', function () { it('should display eth data', function () {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('git-eth-data') cy.getByTestId('git-eth-data')
.should('contain.text', 'Reading Ethereum data from') .should('contain.text', 'Reading Ethereum data from')
.within(() => { .within(() => {

View File

@ -139,6 +139,11 @@ context(
mockNetworkUpgradeProposal(); mockNetworkUpgradeProposal();
navigateTo(navigation.proposals); navigateTo(navigation.proposals);
cy.getByTestId('open-proposals').within(() => { cy.getByTestId('open-proposals').within(() => {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get('li') cy.get('li')
.eq(0) .eq(0)
.should( .should(
@ -201,6 +206,11 @@ context(
.should('contain.text', '99.98% approval (% validator voting power)') .should('contain.text', '99.98% approval (% validator voting power)')
.and('contain.text', '(67% voting power required)'); .and('contain.text', '(67% voting power required)');
cy.get('h2').should('contain.text', 'Approvers (4/4 validators)'); cy.get('h2').should('contain.text', 'Approvers (4/4 validators)');
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('validator-name') cy.getByTestId('validator-name')
.should('have.length', 4) .should('have.length', 4)
.each(($validator) => { .each(($validator) => {

View File

@ -42,6 +42,11 @@ context(
// Skipping due to bug #3471 causing flaky failuress // Skipping due to bug #3471 causing flaky failuress
it.skip('should have option to view go to next and previous page', function () { it.skip('should have option to view go to next and previous page', function () {
waitForBeginningOfEpoch(); waitForBeginningOfEpoch();
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('page-info') cy.getByTestId('page-info')
.should('contain.text', 'Page ') .should('contain.text', 'Page ')
.invoke('text') .invoke('text')

View File

@ -21,6 +21,11 @@ context(
// 1005-VEST-001 // 1005-VEST-001
// 1005-VEST-002 // 1005-VEST-002
it('Able to view tranches', function () { it('Able to view tranches', function () {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('tranche-item') cy.getByTestId('tranche-item')
.should('have.length', 2) .should('have.length', 2)
.first() .first()
@ -51,6 +56,11 @@ context(
cy.get('span').eq(1).should('have.text', 0); cy.get('span').eq(1).should('have.text', 0);
}); });
cy.getByTestId('key-value-table').within(() => { cy.getByTestId('key-value-table').within(() => {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('link') cy.getByTestId('link')
.should('have.length', 8) .should('have.length', 8)
.each((ethLink) => { .each((ethLink) => {
@ -58,6 +68,11 @@ context(
.should('have.attr', 'href') .should('have.attr', 'href')
.and('contain', 'https://sepolia.etherscan.io/address/'); .and('contain', 'https://sepolia.etherscan.io/address/');
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('redeem-link') cy.getByTestId('redeem-link')
.should('have.length', 8) .should('have.length', 8)
.each((redeemLink) => { .each((redeemLink) => {
@ -71,6 +86,11 @@ context(
it('Able to view tranches with less than 10 vega', function () { it('Able to view tranches with less than 10 vega', function () {
navigateTo(navigation.supply); navigateTo(navigation.supply);
cy.getByTestId('show-all-tranches').click(); cy.getByTestId('show-all-tranches').click();
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('tranche-item') cy.getByTestId('tranche-item')
.should('have.length', 8) .should('have.length', 8)
.first() .first()

View File

@ -74,6 +74,11 @@ context('Validators Page - verify elements on page', function () {
function () { function () {
// 1002-STKE-050 // 1002-STKE-050
it('Should be able to see validator names', function () { it('Should be able to see validator names', function () {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get('[col-id="validator"] > div > span') cy.get('[col-id="validator"] > div > span')
.should('have.length.at.least', 1) .should('have.length.at.least', 1)
.each(($name) => { .each(($name) => {
@ -82,6 +87,11 @@ context('Validators Page - verify elements on page', function () {
}); });
it('Should be able to see validator stake', function () { it('Should be able to see validator stake', function () {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('total-stake') cy.getByTestId('total-stake')
.should('have.length.at.least', 1) .should('have.length.at.least', 1)
.each(($stake) => { .each(($stake) => {
@ -105,6 +115,11 @@ context('Validators Page - verify elements on page', function () {
}); });
it('Should be able to see validator normalised voting power', function () { it('Should be able to see validator normalised voting power', function () {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('normalised-voting-power') cy.getByTestId('normalised-voting-power')
.should('have.length.at.least', 1) .should('have.length.at.least', 1)
.each(($vPower) => { .each(($vPower) => {
@ -126,6 +141,11 @@ context('Validators Page - verify elements on page', function () {
// 2002-SINC-018 // 2002-SINC-018
it('Should be able to see validator total penalties', function () { it('Should be able to see validator total penalties', function () {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('total-penalty') cy.getByTestId('total-penalty')
.should('have.length.at.least', 1) .should('have.length.at.least', 1)
.each(($penalties) => { .each(($penalties) => {
@ -146,6 +166,11 @@ context('Validators Page - verify elements on page', function () {
}); });
it('Should be able to see validator pending stake', function () { it('Should be able to see validator pending stake', function () {
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('total-pending-stake') cy.getByTestId('total-pending-stake')
.should('have.length.at.least', 1) .should('have.length.at.least', 1)
.each(($pendingStake) => { .each(($pendingStake) => {

View File

@ -1,7 +1,7 @@
{ {
"presets": [ "presets": [
[ [
"@nrwl/react/babel", "@nx/react/babel",
{ {
"runtime": "automatic" "runtime": "automatic"
} }

View File

@ -1,6 +1,6 @@
{ {
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], "extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "__generated__", "__generated___"], "ignorePatterns": ["!**/*", "__generated__"],
"overrides": [ "overrides": [
{ {
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],

View File

@ -31,7 +31,7 @@ Example configurations are provided here:
For convenience, you can boot the app injecting one of the configurations above by running: For convenience, you can boot the app injecting one of the configurations above by running:
```bash ```bash
yarn nx run governance:serve --env={env} # e.g. stagnet1 yarn env-cmd -f .\apps\governance\.env.{env} yarn nx run governance:serve # e.g. stagnet1
``` ```
There are a few different configuration options offered for this app: There are a few different configuration options offered for this app:

View File

@ -3,8 +3,8 @@ export default {
displayName: 'governance', displayName: 'governance',
preset: '../../jest.preset.js', preset: '../../jest.preset.js',
transform: { transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest', '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': 'babel-jest', '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/governance', coverageDirectory: '../../coverage/apps/governance',
@ -16,6 +16,5 @@ export default {
'**/*.{ts,tsx}', '**/*.{ts,tsx}',
'!**/node_modules/**', '!**/node_modules/**',
'!**/__generated__/**', '!**/__generated__/**',
'!**/__generated___/**',
], ],
}; };

View File

@ -1,10 +1,11 @@
{ {
"name": "governance",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/governance/src", "sourceRoot": "apps/governance/src",
"projectType": "application", "projectType": "application",
"targets": { "targets": {
"build": { "build": {
"executor": "./tools/executors/webpack:build", "executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"defaultConfiguration": "production", "defaultConfiguration": "production",
"options": { "options": {
@ -41,7 +42,7 @@
} }
}, },
"serve": { "serve": {
"executor": "./tools/executors/webpack:serve", "executor": "@nx/webpack:dev-server",
"options": { "options": {
"port": 4210, "port": 4210,
"buildTarget": "governance:build:development", "buildTarget": "governance:build:development",
@ -55,22 +56,28 @@
} }
}, },
"lint": { "lint": {
"executor": "@nrwl/linter:eslint", "executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["apps/governance/**/*.{ts,tsx,js,jsx}"] "lintFilePatterns": ["apps/governance/**/*.{ts,tsx,js,jsx}"]
} }
}, },
"test": { "test": {
"executor": "@nrwl/jest:jest", "executor": "@nx/jest:jest",
"outputs": ["coverage/apps/governance"], "outputs": ["{workspaceRoot}/coverage/apps/governance"],
"options": { "options": {
"jestConfig": "apps/governance/jest.config.ts", "jestConfig": "apps/governance/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
} }
}, },
"build-netlify": { "build-netlify": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"options": { "options": {
"commands": [ "commands": [
"cp apps/governance/netlify.toml netlify.toml", "cp apps/governance/netlify.toml netlify.toml",
@ -79,7 +86,7 @@
} }
}, },
"build-spec": { "build-spec": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": [], "outputs": [],
"options": { "options": {
"command": "yarn tsc --project ./apps/governance/tsconfig.spec.json" "command": "yarn tsc --project ./apps/governance/tsconfig.spec.json"

View File

@ -1,159 +0,0 @@
import * as Types from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type ProposalAssetQueryVariables = Types.Exact<{
assetId: Types.Scalars['ID'];
}>;
export type ProposalAssetQuery = {
__typename?: 'Query';
asset?: {
__typename?: 'Asset';
status: Types.AssetStatus;
source:
| { __typename?: 'BuiltinAsset' }
| { __typename?: 'ERC20'; contractAddress: string };
} | null;
};
export type AssetListBundleQueryVariables = Types.Exact<{
assetId: Types.Scalars['ID'];
}>;
export type AssetListBundleQuery = {
__typename?: 'Query';
erc20ListAssetBundle?: {
__typename?: 'Erc20ListAssetBundle';
assetSource: string;
vegaAssetId: string;
nonce: string;
signatures: string;
} | null;
};
export const ProposalAssetDocument = gql`
query ProposalAsset($assetId: ID!) {
asset(id: $assetId) {
status
source {
... on ERC20 {
contractAddress
}
}
}
}
`;
/**
* __useProposalAssetQuery__
*
* To run a query within a React component, call `useProposalAssetQuery` and pass it any options that fit your needs.
* When your component renders, `useProposalAssetQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useProposalAssetQuery({
* variables: {
* assetId: // value for 'assetId'
* },
* });
*/
export function useProposalAssetQuery(
baseOptions: Apollo.QueryHookOptions<
ProposalAssetQuery,
ProposalAssetQueryVariables
>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<ProposalAssetQuery, ProposalAssetQueryVariables>(
ProposalAssetDocument,
options
);
}
export function useProposalAssetLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
ProposalAssetQuery,
ProposalAssetQueryVariables
>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<ProposalAssetQuery, ProposalAssetQueryVariables>(
ProposalAssetDocument,
options
);
}
export type ProposalAssetQueryHookResult = ReturnType<
typeof useProposalAssetQuery
>;
export type ProposalAssetLazyQueryHookResult = ReturnType<
typeof useProposalAssetLazyQuery
>;
export type ProposalAssetQueryResult = Apollo.QueryResult<
ProposalAssetQuery,
ProposalAssetQueryVariables
>;
export const AssetListBundleDocument = gql`
query AssetListBundle($assetId: ID!) {
erc20ListAssetBundle(assetId: $assetId) {
assetSource
vegaAssetId
nonce
signatures
}
}
`;
/**
* __useAssetListBundleQuery__
*
* To run a query within a React component, call `useAssetListBundleQuery` and pass it any options that fit your needs.
* When your component renders, `useAssetListBundleQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useAssetListBundleQuery({
* variables: {
* assetId: // value for 'assetId'
* },
* });
*/
export function useAssetListBundleQuery(
baseOptions: Apollo.QueryHookOptions<
AssetListBundleQuery,
AssetListBundleQueryVariables
>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<AssetListBundleQuery, AssetListBundleQueryVariables>(
AssetListBundleDocument,
options
);
}
export function useAssetListBundleLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
AssetListBundleQuery,
AssetListBundleQueryVariables
>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<
AssetListBundleQuery,
AssetListBundleQueryVariables
>(AssetListBundleDocument, options);
}
export type AssetListBundleQueryHookResult = ReturnType<
typeof useAssetListBundleQuery
>;
export type AssetListBundleLazyQueryHookResult = ReturnType<
typeof useAssetListBundleLazyQuery
>;
export type AssetListBundleQueryResult = Apollo.QueryResult<
AssetListBundleQuery,
AssetListBundleQueryVariables
>;

View File

@ -5,13 +5,11 @@ import { MockedProvider } from '@apollo/client/testing';
import type { import type {
AssetListBundleQuery, AssetListBundleQuery,
ProposalAssetQuery, ProposalAssetQuery,
} from './__generated___/Asset'; } from './__generated__/Asset';
import { AssetListBundleDocument } from './__generated___/Asset'; import { AssetListBundleDocument } from './__generated__/Asset';
import { ProposalAssetDocument } from './__generated___/Asset'; import { ProposalAssetDocument } from './__generated__/Asset';
import * as Schema from '@vegaprotocol/types'; import * as Schema from '@vegaprotocol/types';
import type { useWeb3React } from '@web3-react/core'; import type { useWeb3React } from '@web3-react/core';
import BigNumber from 'bignumber.js';
import type { AppState } from '../../../../contexts/app-state/app-state-context';
const mockUseEthTx = { const mockUseEthTx = {
perform: jest.fn(), perform: jest.fn(),
@ -47,23 +45,6 @@ jest.mock('@web3-react/core', () => {
}; };
}); });
const mockAppState: AppState = {
totalAssociated: new BigNumber('50063005'),
decimals: 18,
totalSupply: new BigNumber(65000000),
vegaWalletOverlay: false,
vegaWalletManageOverlay: false,
transactionOverlay: false,
bannerMessage: '',
disconnectNotice: false,
};
jest.mock('../../../contexts/app-state/app-state-context', () => ({
useAppState: () => ({
appState: mockAppState,
}),
}));
const ASSET_ID = 'foo'; const ASSET_ID = 'foo';
const DEFAULT__ASSET: ProposalAssetQuery = { const DEFAULT__ASSET: ProposalAssetQuery = {

View File

@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
import { import {
useAssetListBundleQuery, useAssetListBundleQuery,
useProposalAssetQuery, useProposalAssetQuery,
} from './__generated___/Asset'; } from './__generated__/Asset';
import { EthWalletContainer } from '../../../../components/eth-wallet-container'; import { EthWalletContainer } from '../../../../components/eth-wallet-container';
const useListAsset = (assetId: string) => { const useListAsset = (assetId: string) => {

View File

@ -6,7 +6,7 @@ jest.mock('../../../../../components/connect-to-vega', () => ({
ConnectToVega: () => <div data-testid="connect-to-vega" />, ConnectToVega: () => <div data-testid="connect-to-vega" />,
})); }));
jest.mock('../../../../components/eth-connect-prompt', () => ({ jest.mock('../../../../../components/eth-connect-prompt', () => ({
EthConnectPrompt: () => <div data-testid="eth-connect-prompt" />, EthConnectPrompt: () => <div data-testid="eth-connect-prompt" />,
})); }));

View File

@ -1,64 +0,0 @@
import * as Types from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type NodeDataQueryVariables = Types.Exact<{ [key: string]: never }>;
export type NodeDataQuery = {
__typename?: 'Query';
nodeData?: { __typename?: 'NodeData'; stakedTotal: string } | null;
};
export const NodeDataDocument = gql`
query NodeData {
nodeData {
stakedTotal
}
}
`;
/**
* __useNodeDataQuery__
*
* To run a query within a React component, call `useNodeDataQuery` and pass it any options that fit your needs.
* When your component renders, `useNodeDataQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useNodeDataQuery({
* variables: {
* },
* });
*/
export function useNodeDataQuery(
baseOptions?: Apollo.QueryHookOptions<NodeDataQuery, NodeDataQueryVariables>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<NodeDataQuery, NodeDataQueryVariables>(
NodeDataDocument,
options
);
}
export function useNodeDataLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
NodeDataQuery,
NodeDataQueryVariables
>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<NodeDataQuery, NodeDataQueryVariables>(
NodeDataDocument,
options
);
}
export type NodeDataQueryHookResult = ReturnType<typeof useNodeDataQuery>;
export type NodeDataLazyQueryHookResult = ReturnType<
typeof useNodeDataLazyQuery
>;
export type NodeDataQueryResult = Apollo.QueryResult<
NodeDataQuery,
NodeDataQueryVariables
>;

View File

@ -11,7 +11,7 @@ import type { RouteChildProps } from '..';
import Routes from '../routes'; import Routes from '../routes';
import { TokenDetails } from './token-details'; import { TokenDetails } from './token-details';
import { Button } from '@vegaprotocol/ui-toolkit'; import { Button } from '@vegaprotocol/ui-toolkit';
import { useNodeDataQuery } from './__generated___/NodeData'; import { useNodeDataQuery } from './__generated__/NodeData';
const Home = ({ name }: RouteChildProps) => { const Home = ({ name }: RouteChildProps) => {
useDocumentTitle(name); useDocumentTitle(name);

View File

@ -1,5 +1,5 @@
const { join } = require('path'); const { join } = require('path');
const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind'); const { createGlobPatternsForDependencies } = require('@nx/react/tailwind');
const theme = require('../../libs/tailwindcss-config/src/theme'); const theme = require('../../libs/tailwindcss-config/src/theme');
const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes'); const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes');

View File

@ -5,8 +5,8 @@
"types": ["node"] "types": ["node"]
}, },
"files": [ "files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts" "../../node_modules/@nx/react/typings/image.d.ts"
], ],
"exclude": [ "exclude": [
"**/*.spec.ts", "**/*.spec.ts",

View File

@ -18,7 +18,7 @@
"jest.config.ts" "jest.config.ts"
], ],
"files": [ "files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts" "../../node_modules/@nx/react/typings/image.d.ts"
] ]
} }

View File

@ -1,6 +1,8 @@
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');
const SentryPlugin = require('@sentry/webpack-plugin'); const SentryPlugin = require('@sentry/webpack-plugin');
module.exports = (config, context) => { module.exports = composePlugins(withNx(), withReact(), (config, context) => {
const additionalPlugins = process.env.SENTRY_AUTH_TOKEN const additionalPlugins = process.env.SENTRY_AUTH_TOKEN
? [ ? [
new SentryPlugin({ new SentryPlugin({
@ -13,4 +15,4 @@ module.exports = (config, context) => {
...config, ...config,
plugins: [...additionalPlugins, ...config.plugins], plugins: [...additionalPlugins, ...config.plugins],
}; };
}; });

View File

@ -1,7 +1,7 @@
{ {
"presets": [ "presets": [
[ [
"@nrwl/react/babel", "@nx/react/babel",
{ {
"runtime": "automatic" "runtime": "automatic"
} }

View File

@ -1,6 +1,6 @@
{ {
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], "extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "__generated__", "__generated___"], "ignorePatterns": ["!**/*", "__generated__"],
"overrides": [ "overrides": [
{ {
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],

View File

@ -3,8 +3,8 @@ export default {
displayName: 'liquidity-provision-dashboard', displayName: 'liquidity-provision-dashboard',
preset: '../../jest.preset.js', preset: '../../jest.preset.js',
transform: { transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest', '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/next/babel'] }], '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }],
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/liquidity-provision-dashboard', coverageDirectory: '../../coverage/apps/liquidity-provision-dashboard',

View File

@ -1,10 +1,11 @@
{ {
"name": "liquidity-provision-dashboard",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/liquidity-provision-dashboard/src", "sourceRoot": "apps/liquidity-provision-dashboard/src",
"projectType": "application", "projectType": "application",
"targets": { "targets": {
"build": { "build": {
"executor": "@nrwl/web:webpack", "executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"defaultConfiguration": "production", "defaultConfiguration": "production",
"options": { "options": {
@ -21,7 +22,7 @@
], ],
"styles": ["apps/liquidity-provision-dashboard/src/styles.scss"], "styles": ["apps/liquidity-provision-dashboard/src/styles.scss"],
"scripts": [], "scripts": [],
"webpackConfig": "@nrwl/react/plugins/webpack" "webpackConfig": "@nx/react/plugins/webpack"
}, },
"configurations": { "configurations": {
"development": { "development": {
@ -47,7 +48,7 @@
} }
}, },
"serve": { "serve": {
"executor": "./tools/executors/webpack:serve", "executor": "@nx/webpack:dev-server",
"options": { "options": {
"buildTarget": "liquidity-provision-dashboard:build", "buildTarget": "liquidity-provision-dashboard:build",
"hmr": true, "hmr": true,
@ -64,7 +65,7 @@
} }
}, },
"lint": { "lint": {
"executor": "@nrwl/linter:eslint", "executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": [ "lintFilePatterns": [
@ -73,15 +74,23 @@
} }
}, },
"test": { "test": {
"executor": "@nrwl/jest:jest", "executor": "@nx/jest:jest",
"outputs": ["coverage/apps/liquidity-provision-dashboard"], "outputs": [
"{workspaceRoot}/coverage/apps/liquidity-provision-dashboard"
],
"options": { "options": {
"jestConfig": "apps/liquidity-provision-dashboard/jest.config.ts", "jestConfig": "apps/liquidity-provision-dashboard/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
} }
}, },
"build-netlify": { "build-netlify": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"options": { "options": {
"commands": [ "commands": [
"cp apps/liquidity-provision-dashboard/netlify.toml netlify.toml", "cp apps/liquidity-provision-dashboard/netlify.toml netlify.toml",
@ -90,7 +99,7 @@
} }
}, },
"build-spec": { "build-spec": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": [], "outputs": [],
"options": { "options": {
"command": "yarn tsc --project ./apps/liquidity-provision-dashboard/tsconfig.spec.json" "command": "yarn tsc --project ./apps/liquidity-provision-dashboard/tsconfig.spec.json"

View File

@ -1,5 +1,5 @@
const { join } = require('path'); const { join } = require('path');
const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind'); const { createGlobPatternsForDependencies } = require('@nx/react/tailwind');
const theme = require('../../libs/tailwindcss-config/src/theme-lite'); const theme = require('../../libs/tailwindcss-config/src/theme-lite');
const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes'); const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes');
const vegaCustomClassesLite = require('../../libs/tailwindcss-config/src/vega-custom-classes-lite'); const vegaCustomClassesLite = require('../../libs/tailwindcss-config/src/vega-custom-classes-lite');

View File

@ -5,8 +5,8 @@
"types": ["node"] "types": ["node"]
}, },
"files": [ "files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts" "../../node_modules/@nx/react/typings/image.d.ts"
], ],
"exclude": [ "exclude": [
"jest.config.ts", "jest.config.ts",

View File

@ -21,7 +21,7 @@
"**/*.d.ts" "**/*.d.ts"
], ],
"files": [ "files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts" "../../node_modules/@nx/react/typings/image.d.ts"
] ]
} }

View File

@ -1,7 +1,7 @@
{ {
"presets": [ "presets": [
[ [
"@nrwl/react/babel", "@nx/react/babel",
{ {
"runtime": "automatic" "runtime": "automatic"
} }

View File

@ -1,6 +1,6 @@
{ {
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], "extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "__generated__", "__generated___"], "ignorePatterns": ["!**/*", "__generated__"],
"overrides": [ "overrides": [
{ {
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],

View File

@ -26,7 +26,7 @@ Example configurations are provided here:
For convenience, you can boot the app injecting one of the configurations above by running: For convenience, you can boot the app injecting one of the configurations above by running:
```bash ```bash
yarn nx run multisig-signer:serve --env={env} # e.g. stagnet1 yarn env-cmd -f .\apps\multisig-signer\.env.{env} yarn nx run multisig-signer:serve # e.g. stagnet1
``` ```
There are a few different configuration options offered for this app: There are a few different configuration options offered for this app:

View File

@ -3,8 +3,8 @@ export default {
displayName: 'multisig-signer', displayName: 'multisig-signer',
preset: '../../jest.preset.js', preset: '../../jest.preset.js',
transform: { transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest', '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': 'babel-jest', '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/multisig-signer', coverageDirectory: '../../coverage/apps/multisig-signer',

View File

@ -1,10 +1,11 @@
{ {
"name": "multisig-signer",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/multisig-signer/src", "sourceRoot": "apps/multisig-signer/src",
"projectType": "application", "projectType": "application",
"targets": { "targets": {
"build": { "build": {
"executor": "./tools/executors/webpack:build", "executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"defaultConfiguration": "production", "defaultConfiguration": "production",
"options": { "options": {
@ -38,7 +39,7 @@
} }
}, },
"serve": { "serve": {
"executor": "./tools/executors/webpack:serve", "executor": "@nx/webpack:dev-server",
"options": { "options": {
"port": 3000, "port": 3000,
"buildTarget": "multisig-signer:build:development", "buildTarget": "multisig-signer:build:development",
@ -52,22 +53,28 @@
} }
}, },
"lint": { "lint": {
"executor": "@nrwl/linter:eslint", "executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["apps/multisig-signer/**/*.{ts,tsx,js,jsx}"] "lintFilePatterns": ["apps/multisig-signer/**/*.{ts,tsx,js,jsx}"]
} }
}, },
"test": { "test": {
"executor": "@nrwl/jest:jest", "executor": "@nx/jest:jest",
"outputs": ["coverage/apps/multisig-signer"], "outputs": ["{workspaceRoot}/coverage/apps/multisig-signer"],
"options": { "options": {
"jestConfig": "apps/multisig-signer/jest.config.ts", "jestConfig": "apps/multisig-signer/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
} }
}, },
"build-netlify": { "build-netlify": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"options": { "options": {
"commands": [ "commands": [
"cp apps/multisig-signer/netlify.toml netlify.toml", "cp apps/multisig-signer/netlify.toml netlify.toml",
@ -76,7 +83,7 @@
} }
}, },
"build-spec": { "build-spec": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": [], "outputs": [],
"options": { "options": {
"command": "yarn tsc --project ./apps/multisig-signer/tsconfig.spec.json" "command": "yarn tsc --project ./apps/multisig-signer/tsconfig.spec.json"

View File

@ -1,5 +1,5 @@
const { join } = require('path'); const { join } = require('path');
const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind'); const { createGlobPatternsForDependencies } = require('@nx/react/tailwind');
const theme = require('../../libs/tailwindcss-config/src/theme'); const theme = require('../../libs/tailwindcss-config/src/theme');
const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes'); const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes');

View File

@ -5,8 +5,8 @@
"types": ["node"] "types": ["node"]
}, },
"files": [ "files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts" "../../node_modules/@nx/react/typings/image.d.ts"
], ],
"exclude": [ "exclude": [
"**/*.spec.ts", "**/*.spec.ts",

View File

@ -18,7 +18,7 @@
"jest.config.ts" "jest.config.ts"
], ],
"files": [ "files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts" "../../node_modules/@nx/react/typings/image.d.ts"
] ]
} }

View File

@ -1,6 +1,8 @@
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');
const SentryPlugin = require('@sentry/webpack-plugin'); const SentryPlugin = require('@sentry/webpack-plugin');
module.exports = (config, context) => { module.exports = composePlugins(withNx(), withReact(), (config, context) => {
const additionalPlugins = process.env.SENTRY_AUTH_TOKEN const additionalPlugins = process.env.SENTRY_AUTH_TOKEN
? [ ? [
new SentryPlugin({ new SentryPlugin({
@ -14,4 +16,4 @@ module.exports = (config, context) => {
...config, ...config,
plugins: [...additionalPlugins, ...config.plugins], plugins: [...additionalPlugins, ...config.plugins],
}; };
}; });

3
apps/static/.babelrc Normal file
View File

@ -0,0 +1,3 @@
{
"presets": ["@nx/js/babel"]
}

View File

@ -1,11 +1,12 @@
{ {
"name": "static",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application", "projectType": "application",
"sourceRoot": "apps/static/src", "sourceRoot": "apps/static/src",
"tags": [], "tags": [],
"targets": { "targets": {
"build": { "build": {
"executor": "./tools/executors/webpack:build", "executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"defaultConfiguration": "production", "defaultConfiguration": "production",
"options": { "options": {
@ -36,7 +37,7 @@
} }
}, },
"serve": { "serve": {
"executor": "./tools/executors/webpack:serve", "executor": "@nx/webpack:dev-server",
"options": { "options": {
"buildTarget": "static:build" "buildTarget": "static:build"
}, },
@ -47,7 +48,7 @@
} }
}, },
"build-netlify": { "build-netlify": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"options": { "options": {
"commands": [ "commands": [
"cp apps/static/netlify.toml netlify.toml", "cp apps/static/netlify.toml netlify.toml",

View File

@ -1,10 +1,11 @@
{ {
"name": "trading-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/trading-e2e/src", "sourceRoot": "apps/trading-e2e/src",
"projectType": "application", "projectType": "application",
"targets": { "targets": {
"e2e": { "e2e": {
"executor": "@nrwl/cypress:cypress", "executor": "@nx/cypress:cypress",
"options": { "options": {
"cypressConfig": "apps/trading-e2e/cypress.config.js", "cypressConfig": "apps/trading-e2e/cypress.config.js",
"devServerTarget": "trading:serve" "devServerTarget": "trading:serve"
@ -19,14 +20,14 @@
} }
}, },
"lint": { "lint": {
"executor": "@nrwl/linter:eslint", "executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["apps/trading-e2e/**/*.{js,ts}"] "lintFilePatterns": ["apps/trading-e2e/**/*.{js,ts}"]
} }
}, },
"build": { "build": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": [], "outputs": [],
"options": { "options": {
"command": "yarn tsc --project ./apps/trading-e2e/" "command": "yarn tsc --project ./apps/trading-e2e/"

View File

@ -97,6 +97,11 @@ describe('capsule - without MultiSign', { tags: '@slow' }, () => {
cy.get('.ag-cell-value', txTimeout).should('contain.text', btcSymbol); cy.get('.ag-cell-value', txTimeout).should('contain.text', btcSymbol);
cy.get('[col-id="status"]').should('not.have.text', 'Open', txTimeout); cy.get('[col-id="status"]').should('not.have.text', 'Open', txTimeout);
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get('[col-id="txHash"]') cy.get('[col-id="txHash"]')
.should('have.length.above', 2) .should('have.length.above', 2)
.eq(1) .eq(1)
@ -415,6 +420,11 @@ describe('capsule', { tags: '@slow', testIsolation: true }, () => {
.eq(0, txTimeout) .eq(0, txTimeout)
.should('contain.text', 'Completed'); .should('contain.text', 'Completed');
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get('[col-id="txHash"]', txTimeout) cy.get('[col-id="txHash"]', txTimeout)
.should('have.length.above', 1) .should('have.length.above', 1)
.eq(1) .eq(1)
@ -492,6 +502,11 @@ describe('capsule', { tags: '@slow', testIsolation: true }, () => {
cy.get('.ag-cell-value', txTimeout).should('contain.text', vegaSymbol); cy.get('.ag-cell-value', txTimeout).should('contain.text', vegaSymbol);
cy.get('[col-id="status"]').should('not.have.text', 'Open', txTimeout); cy.get('[col-id="status"]').should('not.have.text', 'Open', txTimeout);
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get('[col-id="txHash"]') cy.get('[col-id="txHash"]')
.should('have.length.above', 2) .should('have.length.above', 2)
.eq(1) .eq(1)

View File

@ -201,7 +201,7 @@ describe('no all markets', { tags: '@smoke', testIsolation: true }, () => {
cy.visit('/#/markets/all'); cy.visit('/#/markets/all');
}); });
it('can see no markets message', () => { it.skip('can see no markets message', () => {
// 6001-MARK-048 // 6001-MARK-048
cy.getByTestId('tab-all-markets').should('contain.text', 'No markets'); cy.getByTestId('tab-all-markets').should('contain.text', 'No markets');
}); });

View File

@ -137,6 +137,11 @@ describe('Market trading page', () => {
.realHover(); .realHover();
}); });
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId(expirtyTooltip) cy.getByTestId(expirtyTooltip)
.eq(0) .eq(0)
.should( .should(
@ -170,6 +175,11 @@ describe('Market trading page', () => {
.realHover(); .realHover();
}); });
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId(tradingModeTooltip) cy.getByTestId(tradingModeTooltip)
.should( .should(
'contain.text', 'contain.text',
@ -196,6 +206,11 @@ describe('Market trading page', () => {
cy.getByTestId(itemValue).realHover(); cy.getByTestId(itemValue).realHover();
}); });
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId(liquiditySuppliedTooltip) cy.getByTestId(liquiditySuppliedTooltip)
.should('contain.text', 'Supplied stake') .should('contain.text', 'Supplied stake')
.and('contain.text', 'Target stake') .and('contain.text', 'Target stake')

View File

@ -118,6 +118,11 @@ describe('orders list', { tags: '@smoke', testIsolation: true }, () => {
cy.contains('Reset').click(); cy.contains('Reset').click();
cy.getByTestId('All').click(); cy.getByTestId('All').click();
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.getByTestId('tab-orders') cy.getByTestId('tab-orders')
.get(`.ag-center-cols-container [col-id='${orderSymbol}']`) .get(`.ag-center-cols-container [col-id='${orderSymbol}']`)
.should('have.length.at.least', expectedOrderList.length) .should('have.length.at.least', expectedOrderList.length)
@ -441,6 +446,11 @@ describe('amend and cancel order', { tags: '@smoke' }, () => {
peggedOrder: null, peggedOrder: null,
liquidityProvisionId: null, liquidityProvisionId: null,
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get(`[row-id=${orderId}]`) cy.get(`[row-id=${orderId}]`)
.find('[data-testid="edit"]') .find('[data-testid="edit"]')
.should('have.text', 'Edit') .should('have.text', 'Edit')
@ -470,6 +480,11 @@ describe('amend and cancel order', { tags: '@smoke' }, () => {
peggedOrder: null, peggedOrder: null,
liquidityProvisionId: null, liquidityProvisionId: null,
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get(`[row-id=${orderId}]`) cy.get(`[row-id=${orderId}]`)
.find(`[data-testid="cancel"]`) .find(`[data-testid="cancel"]`)
.should('have.text', 'Cancel') .should('have.text', 'Cancel')
@ -492,6 +507,11 @@ describe('amend and cancel order', { tags: '@smoke' }, () => {
peggedOrder: null, peggedOrder: null,
liquidityProvisionId: null, liquidityProvisionId: null,
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get(`[data-testid="cancelAll"]`) cy.get(`[data-testid="cancelAll"]`)
.should('have.text', 'Cancel all') .should('have.text', 'Cancel all')
.then(($btn) => { .then(($btn) => {
@ -508,6 +528,11 @@ describe('amend and cancel order', { tags: '@smoke' }, () => {
peggedOrder: null, peggedOrder: null,
liquidityProvisionId: null, liquidityProvisionId: null,
}); });
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get(`[row-id=${orderId}]`) cy.get(`[row-id=${orderId}]`)
.find('[data-testid="edit"]') .find('[data-testid="edit"]')
.should('have.text', 'Edit') .should('have.text', 'Edit')

View File

@ -47,6 +47,11 @@ describe('Portfolio page', { tags: '@smoke' }, () => {
cy.get( cy.get(
'[role="columnheader"][col-id="fromAccountType"] .ag-header-cell-menu-button' '[role="columnheader"][col-id="fromAccountType"] .ag-header-cell-menu-button'
).click(); ).click();
/**
* TODO(@nx/cypress): Nesting Cypress commands in a should assertion now throws.
* You should use .then() to chain commands instead.
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should
**/
cy.get('fieldset.ag-simple-filter-body-wrapper') cy.get('fieldset.ag-simple-filter-body-wrapper')
.should('be.visible') .should('be.visible')
.within((fields) => { .within((fields) => {

View File

@ -73,7 +73,7 @@ describe('trades', { tags: '@smoke' }, () => {
it('copy price to deal ticket form', () => { it('copy price to deal ticket form', () => {
// 6005-THIS-007 // 6005-THIS-007
cy.get(colIdPrice).last().click(); cy.get(colIdPrice).last().should('be.visible').click();
cy.getByTestId('order-price').should('have.value', '171.16898'); cy.getByTestId('order-price').should('have.value', '171.16898');
}); });
}); });

View File

@ -1,6 +1,6 @@
{ {
"extends": [ "extends": [
"plugin:@nrwl/nx/react-typescript", "plugin:@nx/react-typescript",
"../../.eslintrc.json", "../../.eslintrc.json",
"next", "next",
"next/core-web-vitals" "next/core-web-vitals"

View File

@ -25,7 +25,7 @@ Example configurations are provided here:
For convenience, you can boot the app injecting one of the configurations above by running: For convenience, you can boot the app injecting one of the configurations above by running:
```bash ```bash
yarn nx run token:serve --env={env} # e.g. stagnet1 yarn env-cmd -f .\apps\token\.env.{env} yarn nx run token:serve # e.g. stagnet1
``` ```
There are a few different configuration options offered for this app: There are a few different configuration options offered for this app:

View File

@ -3,8 +3,8 @@ export default {
displayName: 'trading', displayName: 'trading',
preset: '../../jest.preset.js', preset: '../../jest.preset.js',
transform: { transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest', '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/next/babel'] }], '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }],
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/trading', coverageDirectory: '../../coverage/apps/trading',

View File

@ -1,5 +1,5 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const withNx = require('@nrwl/next/plugins/with-nx'); const withNx = require('@nx/next/plugins/with-nx');
const { withSentryConfig } = require('@sentry/nextjs'); const { withSentryConfig } = require('@sentry/nextjs');
const SENTRY_AUTH_TOKEN = process.env.SENTRY_AUTH_TOKEN; const SENTRY_AUTH_TOKEN = process.env.SENTRY_AUTH_TOKEN;
@ -11,7 +11,7 @@ const sentryWebpackOptions = {
}; };
/** /**
* @type {import('@nrwl/next/plugins/with-nx').WithNxOptions} * @type {import('@nx/next/plugins/with-nx').WithNxOptions}
**/ **/
const nextConfig = { const nextConfig = {
nx: { nx: {

View File

@ -1,14 +1,14 @@
{ {
"name": "trading",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/trading", "sourceRoot": "apps/trading",
"projectType": "application", "projectType": "application",
"targets": { "targets": {
"build": { "build": {
"executor": "./tools/executors/next:build", "executor": "@nx/next:build",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"defaultConfiguration": "production", "defaultConfiguration": "production",
"options": { "options": {
"root": "apps/trading",
"outputPath": "dist/apps/trading" "outputPath": "dist/apps/trading"
}, },
"configurations": { "configurations": {
@ -19,7 +19,7 @@
} }
}, },
"serve": { "serve": {
"executor": "./tools/executors/next:serve", "executor": "@nx/next:server",
"options": { "options": {
"buildTarget": "trading:build", "buildTarget": "trading:build",
"dev": true "dev": true
@ -32,28 +32,34 @@
} }
}, },
"export": { "export": {
"executor": "./tools/executors/next:export", "executor": "@nx/next:export",
"options": { "options": {
"buildTarget": "trading:build:production" "buildTarget": "trading:build:production"
} }
}, },
"test": { "test": {
"executor": "@nrwl/jest:jest", "executor": "@nx/jest:jest",
"outputs": ["coverage/apps/trading"], "outputs": ["{workspaceRoot}/coverage/apps/trading"],
"options": { "options": {
"jestConfig": "apps/trading/jest.config.ts", "jestConfig": "apps/trading/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
} }
}, },
"lint": { "lint": {
"executor": "@nrwl/linter:eslint", "executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["apps/trading/**/*.{ts,tsx,js,jsx}"] "lintFilePatterns": ["apps/trading/**/*.{ts,tsx,js,jsx}"]
} }
}, },
"build-netlify": { "build-netlify": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"options": { "options": {
"commands": [ "commands": [
"cp apps/trading/netlify.toml netlify.toml", "cp apps/trading/netlify.toml netlify.toml",
@ -62,7 +68,7 @@
} }
}, },
"build-spec": { "build-spec": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": [], "outputs": [],
"options": { "options": {
"command": "yarn tsc --project ./apps/trading/tsconfig.spec.json" "command": "yarn tsc --project ./apps/trading/tsconfig.spec.json"

View File

@ -1,5 +1,5 @@
const { join } = require('path'); const { join } = require('path');
const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind'); const { createGlobPatternsForDependencies } = require('@nx/next/tailwind');
const theme = require('../../libs/tailwindcss-config/src/theme'); const theme = require('../../libs/tailwindcss-config/src/theme');
const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes'); const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes');

View File

@ -3,18 +3,19 @@
export PATH="/app/node_modules/.bin:$PATH" export PATH="/app/node_modules/.bin:$PATH"
flags="--network-timeout 100000 --pure-lockfile" flags="--network-timeout 100000 --pure-lockfile"
envCmd=""
if [[ ! -z "${ENV_NAME}" ]]; then if [[ ! -z "${ENV_NAME}" ]]; then
if [[ "${ENV_NAME}" != "ops-vega" ]]; then if [[ "${ENV_NAME}" != "ops-vega" ]]; then
flags="--env=${ENV_NAME} $flags" envCmd="envCmd="yarn env-cmd -f ./apps/${APP}/.env.${ENV_NAME}"
fi fi
fi fi
if [ "${APP}" = "trading" ]; then if [ "${APP}" = "trading" ]; then
yarn nx export ${APP} $flags $envCmd yarn nx export ${APP} $flags
mv /app/dist/apps/trading/exported/ /app/tmp mv /app/dist/apps/trading/exported/ /app/tmp
rm -rf /app/dist/apps/trading rm -rf /app/dist/apps/trading
mv /app/tmp /app/dist/apps/trading mv /app/tmp /app/dist/apps/trading
else else
yarn nx build ${APP} $flags $envCmd yarn nx build ${APP} $flags
fi fi

View File

@ -1,13 +1,13 @@
#!/bin/bash -e #!/bin/bash -e
yarn --pure-lockfile yarn --pure-lockfile
app=${1:-trading} app=${1:-trading}
flags="--env=${2:-mainnet}" envCmd="envCmd="yarn env-cmd -f ./apps/${app}/.env.${2:-mainnet}"
yarn install yarn install
if [ "${app}" = "trading" ]; then if [ "${app}" = "trading" ]; then
yarn nx export trading $flags $envCmd yarn nx export trading
DIST_LOCATION=dist/apps/trading/exported DIST_LOCATION=dist/apps/trading/exported
else else
yarn nx build ${app} $flags $envCmd yarn nx build ${app}
DIST_LOCATION=dist/apps/${app} DIST_LOCATION=dist/apps/${app}
fi fi
cp -r $DIST_LOCATION dist-result cp -r $DIST_LOCATION dist-result

View File

@ -1,4 +1,4 @@
const { getJestProjects } = require('@nrwl/jest'); const { getJestProjects } = require('@nx/jest');
export default { export default {
projects: getJestProjects(), projects: getJestProjects(),

View File

@ -1,3 +1,3 @@
const nxPreset = require('@nrwl/jest/preset').default; const nxPreset = require('@nx/jest/preset').default;
module.exports = { ...nxPreset }; module.exports = { ...nxPreset };

View File

@ -1,4 +1,13 @@
{ {
"presets": ["@nrwl/next/babel"], "sourceType": "unambiguous",
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": [] "plugins": []
} }

View File

@ -1,6 +1,6 @@
{ {
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], "extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "__generated__", "__generated___"], "ignorePatterns": ["!**/*", "__generated__"],
"overrides": [ "overrides": [
{ {
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],

View File

@ -1,28 +1,10 @@
const rootMain = require('../../../.storybook/main'); const config = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
module.exports = { addons: ['@storybook/addon-essentials', '@nx/react/plugins/storybook'],
...rootMain, framework: {
name: '@storybook/react-webpack5',
core: { ...rootMain.core, builder: 'webpack5' }, options: {},
stories: [
...rootMain.stories,
'../src/lib/**/*.stories.mdx',
'../src/lib/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
...rootMain.addons,
'@nrwl/react/plugins/storybook',
'storybook-addon-themes',
],
webpackFinal: async (config, { configType }) => {
// apply any global webpack configs that might have been specified in .storybook/main.js
if (rootMain.webpackFinal) {
config = await rootMain.webpackFinal(config, { configType });
}
// add your own webpack tweaks if needed
return config;
}, },
}; };
export default config;

View File

@ -1,5 +1,5 @@
import './styles.scss'; import './styles.scss';
import { useStorybookThemeObserver } from '@vegaprotocol/utils'; import { useStorybookThemeObserver } from '@vegaprotocol/react-helpers';
export const parameters = { export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' }, actions: { argTypesRegex: '^on[A-Z].*' },
backgrounds: { disable: true }, backgrounds: { disable: true },

View File

@ -5,9 +5,9 @@
"outDir": "" "outDir": ""
}, },
"files": [ "files": [
"../../../node_modules/@nrwl/react/typings/styled-jsx.d.ts", "../../../node_modules/@nx/react/typings/styled-jsx.d.ts",
"../../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../../node_modules/@nrwl/react/typings/image.d.ts" "../../../node_modules/@nx/react/typings/image.d.ts"
], ],
"exclude": [ "exclude": [
"../**/*.spec.ts", "../**/*.spec.ts",

View File

@ -2,13 +2,9 @@
export default { export default {
displayName: 'positions', displayName: 'positions',
preset: '../../jest.preset.js', preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
transform: { transform: {
'^.+\\.[tj]sx?$': 'ts-jest', '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/libs/positions', coverageDirectory: '../../coverage/libs/positions',

View File

@ -1,19 +1,20 @@
{ {
"name": "accounts",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/accounts/src", "sourceRoot": "libs/accounts/src",
"projectType": "library", "projectType": "library",
"tags": [], "tags": [],
"targets": { "targets": {
"build": { "build": {
"executor": "@nrwl/web:rollup", "executor": "@nx/rollup:rollup",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"options": { "options": {
"outputPath": "dist/libs/accounts", "outputPath": "dist/libs/accounts",
"tsConfig": "libs/accounts/tsconfig.lib.json", "tsConfig": "libs/accounts/tsconfig.lib.json",
"project": "libs/accounts/package.json", "project": "libs/accounts/package.json",
"entryFile": "libs/accounts/src/index.ts", "entryFile": "libs/accounts/src/index.ts",
"external": ["react/jsx-runtime"], "external": ["react", "react-dom", "react/jsx-runtime"],
"rollupConfig": "@nrwl/react/plugins/bundle-rollup", "rollupConfig": "@nx/react/plugins/bundle-rollup",
"compiler": "babel", "compiler": "babel",
"assets": [ "assets": [
{ {
@ -25,28 +26,31 @@
} }
}, },
"lint": { "lint": {
"executor": "@nrwl/linter:eslint", "executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["libs/accounts/**/*.{ts,tsx,js,jsx}"] "lintFilePatterns": ["libs/accounts/**/*.{ts,tsx,js,jsx}"]
} }
}, },
"test": { "test": {
"executor": "@nrwl/jest:jest", "executor": "@nx/jest:jest",
"outputs": ["coverage/libs/accounts"], "outputs": ["{workspaceRoot}/coverage/libs/accounts"],
"options": { "options": {
"jestConfig": "libs/accounts/jest.config.ts", "jestConfig": "libs/accounts/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
} }
}, },
"storybook": { "storybook": {
"executor": "@nrwl/storybook:storybook", "executor": "@nx/storybook:storybook",
"options": { "options": {
"uiFramework": "@storybook/react",
"port": 4400, "port": 4400,
"config": { "configDir": "libs/accounts/.storybook"
"configFolder": "libs/accounts/.storybook"
}
}, },
"configurations": { "configurations": {
"ci": { "ci": {
@ -55,14 +59,11 @@
} }
}, },
"build-storybook": { "build-storybook": {
"executor": "@nrwl/storybook:build", "executor": "@nx/storybook:build",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputDir}"],
"options": { "options": {
"uiFramework": "@storybook/react", "configDir": "libs/accounts/.storybook",
"outputPath": "dist/storybook/accounts", "outputDir": "dist/storybook/accounts"
"config": {
"configFolder": "libs/accounts/.storybook"
}
}, },
"configurations": { "configurations": {
"ci": { "ci": {
@ -71,7 +72,7 @@
} }
}, },
"build-spec": { "build-spec": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": [], "outputs": [],
"options": { "options": {
"command": "yarn tsc --project ./libs/accounts/tsconfig.spec.json" "command": "yarn tsc --project ./libs/accounts/tsconfig.spec.json"

View File

@ -23,8 +23,8 @@ const margins: MarginFieldsFragment = {
}, },
}; };
const getMargins = jest.fn(() => margins); const mockGetMargins = jest.fn(() => margins);
const getBalance = jest.fn(() => '0'); const mockGetBalance = jest.fn(() => '0');
jest.mock('./margin-data-provider', () => ({})); jest.mock('./margin-data-provider', () => ({}));
@ -49,7 +49,7 @@ jest.mock('@vegaprotocol/wallet', () => ({
jest.mock('@vegaprotocol/data-provider', () => ({ jest.mock('@vegaprotocol/data-provider', () => ({
useDataProvider: () => { useDataProvider: () => {
return { return {
data: getMargins(), data: mockGetMargins(),
}; };
}, },
})); }));
@ -57,7 +57,7 @@ jest.mock('@vegaprotocol/data-provider', () => ({
jest.mock('./use-account-balance', () => ({ jest.mock('./use-account-balance', () => ({
useAccountBalance: () => { useAccountBalance: () => {
return { return {
accountBalance: getBalance(), accountBalance: mockGetBalance(),
}; };
}, },
})); }));
@ -88,7 +88,7 @@ describe('MarginHealthChart', () => {
}); });
it('should use correct scale', async () => { it('should use correct scale', async () => {
getBalance.mockReturnValueOnce('1300'); mockGetBalance.mockReturnValueOnce('1300');
await act(async () => { await act(async () => {
render(<MarginHealthChart marketId="marketId" assetId="assetId" />); render(<MarginHealthChart marketId="marketId" assetId="assetId" />);
}); });

View File

@ -5,8 +5,8 @@
"types": ["node"] "types": ["node"]
}, },
"files": [ "files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/next/typings/image.d.ts" "../../node_modules/@nx/react/typings/image.d.ts"
], ],
"exclude": [ "exclude": [
"**/*.spec.ts", "**/*.spec.ts",
@ -17,6 +17,10 @@
"**/*.test.js", "**/*.test.js",
"**/*.spec.jsx", "**/*.spec.jsx",
"**/*.test.jsx", "**/*.test.jsx",
"**/*.stories.ts",
"**/*.stories.js",
"**/*.stories.jsx",
"**/*.stories.tsx",
"jest.config.ts" "jest.config.ts"
], ],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]

View File

@ -1,7 +1,8 @@
{ {
"sourceType": "unambiguous",
"presets": [ "presets": [
[ [
"@nrwl/next/babel", "@nx/react/babel",
{ {
"runtime": "automatic", "runtime": "automatic",
"useBuiltIns": "usage" "useBuiltIns": "usage"

View File

@ -1,5 +1,5 @@
{ {
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], "extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "__generated__"], "ignorePatterns": ["!**/*", "__generated__"],
"overrides": [ "overrides": [
{ {

View File

@ -1,28 +1,10 @@
const rootMain = require('../../../.storybook/main'); const config = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
module.exports = { addons: ['@storybook/addon-essentials', '@nx/react/plugins/storybook'],
...rootMain, framework: {
name: '@storybook/react-webpack5',
core: { ...rootMain.core, builder: 'webpack5' }, options: {},
stories: [
...rootMain.stories,
'../src/lib/**/*.stories.mdx',
'../src/lib/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
...rootMain.addons,
'@nrwl/react/plugins/storybook',
'storybook-addon-themes',
],
webpackFinal: async (config, { configType }) => {
// apply any global webpack configs that might have been specified in .storybook/main.js
if (rootMain.webpackFinal) {
config = await rootMain.webpackFinal(config, { configType });
}
// add your own webpack tweaks if needed
return config;
}, },
}; };
export default config;

View File

@ -1,2 +1,2 @@
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries // eslint-disable-next-line @nx/enforce-module-boundaries
export * from '../../ui-toolkit/.storybook/preview'; export * from '../../ui-toolkit/.storybook/preview';

View File

@ -5,9 +5,9 @@
"outDir": "" "outDir": ""
}, },
"files": [ "files": [
"../../../node_modules/@nrwl/react/typings/styled-jsx.d.ts", "../../../node_modules/@nx/react/typings/styled-jsx.d.ts",
"../../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../../node_modules/@nrwl/react/typings/image.d.ts" "../../../node_modules/@nx/react/typings/image.d.ts"
], ],
"exclude": [ "exclude": [
"../**/*.spec.ts", "../**/*.spec.ts",

View File

@ -2,13 +2,10 @@
export default { export default {
displayName: 'announcements', displayName: 'announcements',
preset: '../../jest.preset.js', preset: '../../jest.preset.js',
globals: { globals: {},
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
transform: { transform: {
'^.+\\.[tj]sx?$': 'ts-jest', '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/libs/announcements', coverageDirectory: '../../coverage/libs/announcements',

View File

@ -1,11 +1,12 @@
{ {
"name": "announcements",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/announcements/src", "sourceRoot": "libs/announcements/src",
"projectType": "library", "projectType": "library",
"tags": [], "tags": [],
"targets": { "targets": {
"build": { "build": {
"executor": "@nrwl/web:rollup", "executor": "@nx/rollup:rollup",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"options": { "options": {
"outputPath": "dist/libs/announcements", "outputPath": "dist/libs/announcements",
@ -13,7 +14,7 @@
"project": "libs/announcements/package.json", "project": "libs/announcements/package.json",
"entryFile": "libs/announcements/src/index.ts", "entryFile": "libs/announcements/src/index.ts",
"external": ["react/jsx-runtime"], "external": ["react/jsx-runtime"],
"rollupConfig": "@nrwl/react/plugins/bundle-rollup", "rollupConfig": "@nx/react/plugins/bundle-rollup",
"compiler": "babel", "compiler": "babel",
"assets": [ "assets": [
{ {
@ -25,28 +26,31 @@
} }
}, },
"lint": { "lint": {
"executor": "@nrwl/linter:eslint", "executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["libs/announcements/**/*.{ts,tsx,js,jsx}"] "lintFilePatterns": ["libs/announcements/**/*.{ts,tsx,js,jsx}"]
} }
}, },
"test": { "test": {
"executor": "@nrwl/jest:jest", "executor": "@nx/jest:jest",
"outputs": ["coverage/libs/announcements"], "outputs": ["{workspaceRoot}/coverage/libs/announcements"],
"options": { "options": {
"jestConfig": "libs/announcements/jest.config.ts", "jestConfig": "libs/announcements/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
} }
}, },
"storybook": { "storybook": {
"executor": "@nrwl/storybook:storybook", "executor": "@nx/storybook:storybook",
"options": { "options": {
"uiFramework": "@storybook/react",
"port": 4400, "port": 4400,
"config": { "configDir": "libs/announcements/.storybook"
"configFolder": "libs/announcements/.storybook"
}
}, },
"configurations": { "configurations": {
"ci": { "ci": {
@ -55,14 +59,11 @@
} }
}, },
"build-storybook": { "build-storybook": {
"executor": "@nrwl/storybook:build", "executor": "@nx/storybook:build",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputDir}"],
"options": { "options": {
"uiFramework": "@storybook/react", "configDir": "libs/announcements/.storybook",
"outputPath": "dist/storybook/announcements", "outputDir": "dist/storybook/announcements"
"config": {
"configFolder": "libs/announcements/.storybook"
}
}, },
"configurations": { "configurations": {
"ci": { "ci": {
@ -71,7 +72,7 @@
} }
}, },
"build-spec": { "build-spec": {
"executor": "@nrwl/workspace:run-commands", "executor": "nx:run-commands",
"outputs": [], "outputs": [],
"options": { "options": {
"command": "yarn tsc --project ./libs/announcements/tsconfig.spec.json" "command": "yarn tsc --project ./libs/announcements/tsconfig.spec.json"

View File

@ -5,8 +5,8 @@
"types": ["node"] "types": ["node"]
}, },
"files": [ "files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/next/typings/image.d.ts" "../../node_modules/@nx/next/typings/image.d.ts"
], ],
"exclude": [ "exclude": [
"**/*.spec.ts", "**/*.spec.ts",
@ -17,6 +17,10 @@
"**/*.test.js", "**/*.test.js",
"**/*.spec.jsx", "**/*.spec.jsx",
"**/*.test.jsx", "**/*.test.jsx",
"**/*.stories.ts",
"**/*.stories.js",
"**/*.stories.jsx",
"**/*.stories.tsx",
"jest.config.ts" "jest.config.ts"
], ],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]

View File

@ -1,3 +0,0 @@
{
"presets": [["@nrwl/web/babel", { "useBuiltIns": "usage" }]]
}

View File

@ -2,13 +2,14 @@
export default { export default {
displayName: 'apollo-client', displayName: 'apollo-client',
preset: '../../jest.preset.js', preset: '../../jest.preset.js',
globals: { globals: {},
'ts-jest': { transform: {
'^.+\\.[tj]sx?$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.spec.json', tsconfig: '<rootDir>/tsconfig.spec.json',
}, },
}, ],
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/libs/apollo-client', coverageDirectory: '../../coverage/libs/apollo-client',

View File

@ -1,41 +1,38 @@
{ {
"name": "apollo-client",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/apollo-client/src", "sourceRoot": "libs/apollo-client/src",
"projectType": "library", "projectType": "library",
"targets": { "targets": {
"build": { "build": {
"executor": "@nrwl/web:rollup", "executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"options": { "options": {
"outputPath": "dist/libs/apollo-client", "outputPath": "dist/libs/apollo-client",
"main": "libs/apollo-client/src/index.ts",
"tsConfig": "libs/apollo-client/tsconfig.lib.json", "tsConfig": "libs/apollo-client/tsconfig.lib.json",
"project": "libs/apollo-client/package.json", "assets": ["libs/apollo-client/*.md"]
"entryFile": "libs/apollo-client/src/index.ts",
"external": ["react/jsx-runtime"],
"rollupConfig": "@nrwl/react/plugins/bundle-rollup",
"compiler": "babel",
"assets": [
{
"glob": "libs/apollo-client/README.md",
"input": ".",
"output": "."
}
]
} }
}, },
"lint": { "lint": {
"executor": "@nrwl/linter:eslint", "executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["libs/apollo-client/**/*.ts"] "lintFilePatterns": ["libs/apollo-client/**/*.ts"]
} }
}, },
"test": { "test": {
"executor": "@nrwl/jest:jest", "executor": "@nx/jest:jest",
"outputs": ["coverage/libs/apollo-client"], "outputs": ["{workspaceRoot}/coverage/libs/apollo-client"],
"options": { "options": {
"jestConfig": "libs/apollo-client/jest.config.ts", "jestConfig": "libs/apollo-client/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
} }
} }
}, },

View File

@ -1,7 +1,7 @@
{ {
"presets": [ "presets": [
[ [
"@nrwl/react/babel", "@nx/react/babel",
{ {
"runtime": "automatic", "runtime": "automatic",
"useBuiltIns": "usage" "useBuiltIns": "usage"

View File

@ -1,6 +1,6 @@
{ {
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], "extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "__generated__", "__generated___"], "ignorePatterns": ["!**/*", "__generated__"],
"overrides": [ "overrides": [
{ {
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],

View File

@ -3,7 +3,8 @@ export default {
displayName: 'assets', displayName: 'assets',
preset: '../../jest.preset.js', preset: '../../jest.preset.js',
transform: { transform: {
'^.+\\.[tj]sx?$': 'babel-jest', '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/libs/assets', coverageDirectory: '../../coverage/libs/assets',

Some files were not shown because too many files have changed in this diff Show More