From 7f98fa7cb7ebe8492d1901fc43c3ad3027bc41ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jenifer=20L=C3=B3pez?= Date: Thu, 6 Jun 2024 09:57:11 +0200 Subject: [PATCH 01/21] feat(packages/sui-studio): Add jest compatibility with test path on studio-dev --- packages/sui-studio/bin/sui-studio-dev.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/sui-studio/bin/sui-studio-dev.js b/packages/sui-studio/bin/sui-studio-dev.js index 77707b047..e055c524d 100755 --- a/packages/sui-studio/bin/sui-studio-dev.js +++ b/packages/sui-studio/bin/sui-studio-dev.js @@ -45,8 +45,10 @@ if (!category || !component) { const componentPath = path.join(PWD, 'components', category, component) const legacyTestPath = path.join(PWD, 'test', category, component) +const jestPath = path.join(componentPath, '__tests__') const testPath = fs.existsSync(legacyTestPath) ? legacyTestPath : path.join(componentPath, 'test') +const isJestTest = fs.existsSync(jestPath) const {cache, ...others} = config @@ -59,7 +61,7 @@ const studioDevConfig = { alias: { ...config.resolve.alias, component: path.join(componentPath, 'src'), - test: testPath, + test: isJestTest ? jestPath : testPath, package: path.join(componentPath, 'package.json'), demo: path.join(componentPath, 'demo') } From f89d4fb9b0980af58d1e24c9d8d2117113fe50b5 Mon Sep 17 00:00:00 2001 From: Alfredo Arronte Date: Fri, 7 Jun 2024 11:36:01 +0200 Subject: [PATCH 02/21] feat(packages/sui-domain): Add DomainError class --- packages/sui-domain/src/DomainError.js | 25 +++++++++++++++++++++++++ packages/sui-domain/src/index.js | 1 + 2 files changed, 26 insertions(+) create mode 100644 packages/sui-domain/src/DomainError.js diff --git a/packages/sui-domain/src/DomainError.js b/packages/sui-domain/src/DomainError.js new file mode 100644 index 000000000..9acc335f8 --- /dev/null +++ b/packages/sui-domain/src/DomainError.js @@ -0,0 +1,25 @@ +/** + * Base class for handling errors in the domain layer + */ +export default class DomainError extends Error { + constructor({code, message, cause}) { + super(message, {cause}) + this.name = 'DomainError' + this.code = code + } + + /** + * DomainError factory method + * + * @param {String} code Code to identify the error instance. It's required. + * @param {String} message Description for the error useful for giving more context. + * @param {Object} cause Keeps the original error useful for wrapping uncontrolled errors. + */ + static create({code, message, cause}) { + if (!code) { + throw new Error('[DomainError] The code property is required.') + } + + return new DomainError({code, message, cause}) + } +} diff --git a/packages/sui-domain/src/index.js b/packages/sui-domain/src/index.js index ec5c03a3b..37a6b83c8 100644 --- a/packages/sui-domain/src/index.js +++ b/packages/sui-domain/src/index.js @@ -1,3 +1,4 @@ +export {default as DomainError} from './DomainError.js' export {default as Entity} from './Entity.js' export {default as EntryPointFactory} from './EntryPointFactory.js' export {default as FetcherFactory} from './fetcher/factory.js' From da2a9cdd8a2b2eee534c99dd33f53c801ae4f70e Mon Sep 17 00:00:00 2001 From: Kiko Ruiz Lloret Date: Fri, 7 Jun 2024 12:34:42 +0200 Subject: [PATCH 03/21] fix(packages/lint-repository-sui): fix structure rule --- .../src/rules/structure.js | 38 ++++--------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/packages/lint-repository-sui/src/rules/structure.js b/packages/lint-repository-sui/src/rules/structure.js index b5a808b4d..25fdbad11 100644 --- a/packages/lint-repository-sui/src/rules/structure.js +++ b/packages/lint-repository-sui/src/rules/structure.js @@ -9,34 +9,28 @@ const FILES_AND_FOLDERS = [ '.nvmrc', '.dockerignore', '.gitignore', - 'tsconfig.json', 'README.md', - 'app/src', - 'app/test', 'app/Makefile', 'app/package.json', - 'app/tsconfig.json', - 'app/CHANGELOG.md', - + // 'app/tsconfig.json', 'app/src/pages', 'app/src/app.(t|j)s(x)?', - 'app/src/contextFactory.(t|j)s(x)?', - 'app/src/hooks.(t|j)s(x)?', + 'app/src/contextFactory{.js,.ts,/index.js,/index.ts}', + 'app/src/hooks{.js,.ts,/index.js,/index.ts}', 'app/src/index.html', 'app/src/index.(s)?css', 'app/src/routes.(t|j)s(x)?', + 'packages/domain/test', + 'packages/ui/components/**/test', 'packages/**/src', - 'packages/**/test', 'packages/**/Makefile', 'packages/**/package.json', - 'packages/**/tsconfig.json', - 'packages/**/CHANGELOG.md', - + // 'packages/**/tsconfig.json', + // 'packages/**/CHANGELOG.md', 'deploy/config-(pre|pro).yml', 'deploy/*-(pre|pro)-paas.yml', 'deploy/tags.yml', - 'qa/e2e' ] @@ -64,24 +58,6 @@ module.exports = { create: function (context) { return { ...Object.fromEntries(FILES_AND_FOLDERS.map(pattern => [pattern, () => context.monitoring(true)])), - - '.github/dependabot.yml': matches => { - const [match] = matches - const json = match.parsed - const labels = json?.updates[0]?.labels || [] - const isAutomergeEnabled = labels.find(key => key === 'skynet:merge') - - if (!isAutomergeEnabled) { - context.monitoring(false) - context.report({ - messageId: 'automergeDisabled' - }) - return - } - - context.monitoring(true) - }, - missmatch: key => { context.monitoring(false) context.report({ From 2a4e63b7a50bec046d7ba37ddc2f6fd229fb2764 Mon Sep 17 00:00:00 2001 From: sui-bot Date: Fri, 7 Jun 2024 10:49:34 +0000 Subject: [PATCH 04/21] release(packages/lint-repository-sui): v1.6.0 [skip ci] --- packages/lint-repository-sui/CHANGELOG.md | 9 +++++++++ packages/lint-repository-sui/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/lint-repository-sui/CHANGELOG.md b/packages/lint-repository-sui/CHANGELOG.md index b297db61c..143ac0cc9 100644 --- a/packages/lint-repository-sui/CHANGELOG.md +++ b/packages/lint-repository-sui/CHANGELOG.md @@ -1,5 +1,14 @@ # CHANGELOG +# 1.6.0 (2024-06-07) + + +### Bug Fixes + +* fix structure rule ([da2a9cd](https://github.com/SUI-Components/sui/commit/da2a9cdd8a2b2eee534c99dd33f53c801ae4f70e)) + + + # 1.5.0 (2024-05-10) diff --git a/packages/lint-repository-sui/package.json b/packages/lint-repository-sui/package.json index aaa3e1047..8c9b4be32 100644 --- a/packages/lint-repository-sui/package.json +++ b/packages/lint-repository-sui/package.json @@ -1,7 +1,7 @@ { "name": "lint-repository-sui", "access": "public", - "version": "1.5.0", + "version": "1.6.0", "description": "Set of sui lint rules to lint a repository", "keywords": [], "author": "Sui", From 93d19d3753c6fc4348fbc30903aad783328fd2f4 Mon Sep 17 00:00:00 2001 From: Carlos Villuendas Zambrana Date: Fri, 7 Jun 2024 13:16:38 +0200 Subject: [PATCH 05/21] feat(packages/lint-repository-sui): force deploy --- packages/lint-repository-sui/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lint-repository-sui/package.json b/packages/lint-repository-sui/package.json index 8c9b4be32..8eaa4cf59 100644 --- a/packages/lint-repository-sui/package.json +++ b/packages/lint-repository-sui/package.json @@ -1,7 +1,7 @@ { "name": "lint-repository-sui", "access": "public", - "version": "1.6.0", + "version": "1.9.0", "description": "Set of sui lint rules to lint a repository", "keywords": [], "author": "Sui", From b3a0fdf1e65720b9de921df05cf31b7e7e35f64a Mon Sep 17 00:00:00 2001 From: sui-bot Date: Fri, 7 Jun 2024 11:19:30 +0000 Subject: [PATCH 06/21] release(packages/lint-repository-sui): v1.10.0 [skip ci] --- packages/lint-repository-sui/CHANGELOG.md | 9 +++++++++ packages/lint-repository-sui/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/lint-repository-sui/CHANGELOG.md b/packages/lint-repository-sui/CHANGELOG.md index 143ac0cc9..051e910b8 100644 --- a/packages/lint-repository-sui/CHANGELOG.md +++ b/packages/lint-repository-sui/CHANGELOG.md @@ -1,5 +1,14 @@ # CHANGELOG +# 1.10.0 (2024-06-07) + + +### Features + +* force deploy ([93d19d3](https://github.com/SUI-Components/sui/commit/93d19d3753c6fc4348fbc30903aad783328fd2f4)) + + + # 1.6.0 (2024-06-07) diff --git a/packages/lint-repository-sui/package.json b/packages/lint-repository-sui/package.json index 8eaa4cf59..b1dbb20e0 100644 --- a/packages/lint-repository-sui/package.json +++ b/packages/lint-repository-sui/package.json @@ -1,7 +1,7 @@ { "name": "lint-repository-sui", "access": "public", - "version": "1.9.0", + "version": "1.10.0", "description": "Set of sui lint rules to lint a repository", "keywords": [], "author": "Sui", From 04ba88f6b2fb44eda407f6db6ee39314bbb15a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jenifer=20L=C3=B3pez?= Date: Fri, 7 Jun 2024 13:21:55 +0200 Subject: [PATCH 07/21] feat(packages/sui-studio): Disable Test component if detect jest folder --- packages/sui-studio/bin/sui-studio-dev.js | 5 +++- .../workbench/src/components/Root/index.js | 28 ++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/packages/sui-studio/bin/sui-studio-dev.js b/packages/sui-studio/bin/sui-studio-dev.js index e055c524d..2f2dfc6fd 100755 --- a/packages/sui-studio/bin/sui-studio-dev.js +++ b/packages/sui-studio/bin/sui-studio-dev.js @@ -55,7 +55,10 @@ const {cache, ...others} = config const studioDevConfig = { ...others, context: path.join(__dirname, '..', 'workbench', 'src'), - plugins: [...config.plugins, new webpack.DefinePlugin({__COMPONENT_ID__: JSON.stringify(componentID)})], + plugins: [ + ...config.plugins, + new webpack.DefinePlugin({__COMPONENT_ID__: JSON.stringify(componentID), __DISABLE_TESTS__: isJestTest}) + ], resolve: { ...config.resolve, alias: { diff --git a/packages/sui-studio/workbench/src/components/Root/index.js b/packages/sui-studio/workbench/src/components/Root/index.js index e2b09aea6..e2397341b 100644 --- a/packages/sui-studio/workbench/src/components/Root/index.js +++ b/packages/sui-studio/workbench/src/components/Root/index.js @@ -1,3 +1,4 @@ +/* eslint-disable no-undef */ import {useState} from 'react' import PropTypes from 'prop-types' @@ -7,7 +8,10 @@ import Select from '../Select/index' import Test from '../Suite/index' const importComponent = () => import('component/index') -const importTest = () => import('test/index.test') +let importTest = null +if (!__DISABLE_TESTS__) { + importTest = () => import('test/index.test') +} const getFromStorage = (key, defaultValue) => window.sessionStorage[key] || defaultValue @@ -38,19 +42,23 @@ export default function Root({componentID, contexts = {}, themes}) { initValue={actualStyle} onChange={updateOnChange(setActualStyle, 'actualStyle')} /> - + {importTest ? ( + + ) : null}