From cf5868b3cb9a3fa900f611b232b80db64d7b1ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alvarez=20Sordo?= Date: Tue, 24 May 2022 16:10:13 +0200 Subject: [PATCH 01/76] feat(packages/sui-bundler): add ts support --- packages/sui-bundler/.swcrc | 78 +++++++++++++++++++ packages/sui-bundler/package.json | 7 +- .../sui-bundler/shared/module-rules-babel.js | 58 ++++++++------ packages/sui-bundler/webpack.config.dev.js | 76 ++++++++++++++---- 4 files changed, 181 insertions(+), 38 deletions(-) create mode 100644 packages/sui-bundler/.swcrc diff --git a/packages/sui-bundler/.swcrc b/packages/sui-bundler/.swcrc new file mode 100644 index 000000000..177eda41f --- /dev/null +++ b/packages/sui-bundler/.swcrc @@ -0,0 +1,78 @@ +[ + { + "test": ".tsx?$", + "minify": true, + "jsc": { + "parser": { + "syntax": "typescript", + "tsx": true, + "dynamicImport": true, + "privateMethod": true, + "functionBind": true, + "exportDefaultFrom": true, + "exportNamespaceFrom": true, + "decorators": true, + "decoratorsBeforeExport": true, + "topLevelAwait": true, + "importMeta": true + }, + "transform": { + "legacyDecorator": true, + "react": { + "useBuiltins": true, + "runtime": "automatic" + } + }, + "target": "es5", + "loose": true, + "externalHelpers": true + }, + "env": { + "targets": { + "ie": "11" + }, + "dynamicImport": true, + "loose": true, + "mode": "entry", + "coreJs": 3 + } + }, + { + "test": ".jsx?$", + "minify": true, + "jsc": { + "parser": { + "syntax": "ecmascript", + "jsx": true, + "dynamicImport": true, + "privateMethod": true, + "functionBind": true, + "exportDefaultFrom": true, + "exportNamespaceFrom": true, + "decorators": true, + "decoratorsBeforeExport": true, + "topLevelAwait": true, + "importMeta": true + }, + "transform": { + "legacyDecorator": true, + "react": { + "useBuiltins": true, + "runtime": "automatic" + } + }, + "target": "es5", + "loose": true, + "externalHelpers": true + }, + "env": { + "targets": { + "ie": "11" + }, + "dynamicImport": true, + "loose": true, + "mode": "entry", + "coreJs": 3 + } + } +] diff --git a/packages/sui-bundler/package.json b/packages/sui-bundler/package.json index 4d13ef89a..97f5b365b 100644 --- a/packages/sui-bundler/package.json +++ b/packages/sui-bundler/package.json @@ -50,6 +50,9 @@ "webpack": "5.72.0", "webpack-dev-server": "4.8.1", "webpack-manifest-plugin": "5.0.0", - "webpack-node-externals": "3.0.0" + "webpack-node-externals": "3.0.0", + "@swc/core": "^1.2.189", + "@swc/helpers": "^0.3.15", + "swc-loader": "^0.2.1" } -} +} \ No newline at end of file diff --git a/packages/sui-bundler/shared/module-rules-babel.js b/packages/sui-bundler/shared/module-rules-babel.js index 6b8e5381e..f45163435 100644 --- a/packages/sui-bundler/shared/module-rules-babel.js +++ b/packages/sui-bundler/shared/module-rules-babel.js @@ -1,26 +1,40 @@ const {sep} = require('path') const {config} = require('./') -module.exports = { - test: /\.jsx?$/, - exclude: new RegExp(`node_modules(?!${sep}@s-ui${sep}studio${sep}src)`), - use: [ - { - loader: require.resolve('babel-loader'), - options: { - cacheDirectory: true, - cacheCompression: false, - babelrc: false, - compact: true, - presets: [ - [ - require.resolve('babel-preset-sui'), - { - targets: config.targets - } - ] - ] - } +const {TS: isTypeScript = false} = process.env + +const exclude = new RegExp(`node_modules(?!${sep}@s-ui${sep}studio${sep}src)`) + +module.exports = isTypeScript + ? { + test: /\.(js|ts)x?$/, + exclude, + use: [ + { + loader: require.resolve('swc-loader') + } + ] + } + : { + test: /\.jsx?$/, + exclude, + use: [ + { + loader: require.resolve('babel-loader'), + options: { + cacheDirectory: true, + cacheCompression: false, + babelrc: false, + compact: true, + presets: [ + [ + require.resolve('babel-preset-sui'), + { + targets: config.targets + } + ] + ] + } + } + ] } - ] -} diff --git a/packages/sui-bundler/webpack.config.dev.js b/packages/sui-bundler/webpack.config.dev.js index 6273b6c6e..5e634d6fe 100644 --- a/packages/sui-bundler/webpack.config.dev.js +++ b/packages/sui-bundler/webpack.config.dev.js @@ -22,7 +22,7 @@ const EXCLUDED_FOLDERS_REGEXP = new RegExp( ) const outputPath = path.join(process.cwd(), 'dist') -const {CI = false} = process.env +const {CI = false, TS: isTypeScript = false} = process.env process.env.NODE_ENV = 'development' @@ -81,20 +81,68 @@ const webpackConfig = { resolveLoader, module: { rules: cleanList([ - { - test: /\.jsx?$/, - exclude: EXCLUDED_FOLDERS_REGEXP, - use: [ - { - loader: require.resolve('babel-loader'), - options: { - babelrc: false, - cacheDirectory: true, - presets: [require.resolve('babel-preset-sui')] - } + isTypeScript + ? { + test: /\.(js|ts)x?$/, + exclude: EXCLUDED_FOLDERS_REGEXP, + use: [ + { + loader: require.resolve('swc-loader'), + options: { + test: '.jsx?$', + minify: true, + jsc: { + parser: { + syntax: 'ecmascript', + jsx: true, + dynamicImport: true, + privateMethod: true, + functionBind: true, + exportDefaultFrom: true, + exportNamespaceFrom: true, + decorators: true, + decoratorsBeforeExport: true, + topLevelAwait: true, + importMeta: true + }, + transform: { + legacyDecorator: true, + react: { + useBuiltins: true, + runtime: 'automatic' + } + }, + target: 'es5', + loose: true, + externalHelpers: true + }, + env: { + targets: { + ie: '11' + }, + dynamicImport: true, + loose: true, + mode: 'entry', + coreJs: 3 + } + } + } + ] } - ] - }, + : { + test: /\.jsx?$/, + exclude: EXCLUDED_FOLDERS_REGEXP, + use: [ + { + loader: require.resolve('babel-loader'), + options: { + babelrc: false, + cacheDirectory: true, + presets: [require.resolve('babel-preset-sui')] + } + } + ] + }, { test: /(\.css|\.scss)$/, use: cleanList([ From 1782cdc030f64e0c44900b942f26874212dab26f Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Tue, 24 May 2022 17:17:41 +0200 Subject: [PATCH 02/76] feat: add support for tsx --- .../sui-bundler/loaders/linkLoaderConfigBuilder.js | 2 +- packages/sui-bundler/webpack.config.dev.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/sui-bundler/loaders/linkLoaderConfigBuilder.js b/packages/sui-bundler/loaders/linkLoaderConfigBuilder.js index 166e4681e..775fecb45 100644 --- a/packages/sui-bundler/loaders/linkLoaderConfigBuilder.js +++ b/packages/sui-bundler/loaders/linkLoaderConfigBuilder.js @@ -49,7 +49,7 @@ module.exports = ({config, packagesToLink, linkAll}) => { * if neccesary */ const linkLoader = { - test: /\.(jsx?|scss)$/, + test: /\.(jsx?|tsx?|scss)$/, enforce: 'pre', // this will ensure is execute before transformations use: { loader: require.resolve('./LinkLoader'), diff --git a/packages/sui-bundler/webpack.config.dev.js b/packages/sui-bundler/webpack.config.dev.js index 5e634d6fe..00f22aa46 100644 --- a/packages/sui-bundler/webpack.config.dev.js +++ b/packages/sui-bundler/webpack.config.dev.js @@ -45,7 +45,7 @@ const webpackConfig = { url: require.resolve('url/') }, modules: ['node_modules', path.resolve(process.cwd())], - extensions: ['.js', '.json'] + extensions: ['.js', '.tsx', '.ts', '.json'] }, stats: 'errors-only', entry: cleanList([ @@ -83,18 +83,18 @@ const webpackConfig = { rules: cleanList([ isTypeScript ? { - test: /\.(js|ts)x?$/, + test: /\.(ts|js)x?$/, exclude: EXCLUDED_FOLDERS_REGEXP, use: [ { loader: require.resolve('swc-loader'), options: { - test: '.jsx?$', - minify: true, + // test: '.(ts|js)x?$', + // minify: true, jsc: { parser: { - syntax: 'ecmascript', - jsx: true, + syntax: "typescript", + tsx: true, dynamicImport: true, privateMethod: true, functionBind: true, From d317f4c011e18f92014d5312293186319d279019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alvarez=20Sordo?= Date: Thu, 25 Aug 2022 13:57:38 +0200 Subject: [PATCH 03/76] feat(packages/sui-bundler): update config --- packages/sui-bundler/bin/sui-bundler-dev.js | 7 +- packages/sui-bundler/webpack.config.dev.js | 104 +++++++++----------- 2 files changed, 45 insertions(+), 66 deletions(-) diff --git a/packages/sui-bundler/bin/sui-bundler-dev.js b/packages/sui-bundler/bin/sui-bundler-dev.js index 30596949a..8b639ef9b 100755 --- a/packages/sui-bundler/bin/sui-bundler-dev.js +++ b/packages/sui-bundler/bin/sui-bundler-dev.js @@ -67,12 +67,7 @@ const start = async ({ } = {}) => { clearConsole() // Warn and crash if required files are missing - if ( - !checkRequiredFiles([ - path.join(config.context, 'index.html'), - path.join(config.context, 'app.js') - ]) - ) { + if (!checkRequiredFiles([path.join(config.context, 'index.html')])) { log.error( `✖ Required files are missing, create and index.html and app.js inside your src folder.` ) diff --git a/packages/sui-bundler/webpack.config.dev.js b/packages/sui-bundler/webpack.config.dev.js index 00f22aa46..94b29053d 100644 --- a/packages/sui-bundler/webpack.config.dev.js +++ b/packages/sui-bundler/webpack.config.dev.js @@ -22,7 +22,7 @@ const EXCLUDED_FOLDERS_REGEXP = new RegExp( ) const outputPath = path.join(process.cwd(), 'dist') -const {CI = false, TS: isTypeScript = false} = process.env +const {CI = false} = process.env process.env.NODE_ENV = 'development' @@ -81,68 +81,52 @@ const webpackConfig = { resolveLoader, module: { rules: cleanList([ - isTypeScript - ? { - test: /\.(ts|js)x?$/, - exclude: EXCLUDED_FOLDERS_REGEXP, - use: [ - { - loader: require.resolve('swc-loader'), - options: { - // test: '.(ts|js)x?$', - // minify: true, - jsc: { - parser: { - syntax: "typescript", - tsx: true, - dynamicImport: true, - privateMethod: true, - functionBind: true, - exportDefaultFrom: true, - exportNamespaceFrom: true, - decorators: true, - decoratorsBeforeExport: true, - topLevelAwait: true, - importMeta: true - }, - transform: { - legacyDecorator: true, - react: { - useBuiltins: true, - runtime: 'automatic' - } - }, - target: 'es5', - loose: true, - externalHelpers: true - }, - env: { - targets: { - ie: '11' - }, - dynamicImport: true, - loose: true, - mode: 'entry', - coreJs: 3 + { + test: /\.(ts|js)x?$/, + exclude: EXCLUDED_FOLDERS_REGEXP, + use: [ + { + loader: require.resolve('swc-loader'), + options: { + minify: true, + jsc: { + parser: { + syntax: 'typescript', + tsx: true, + dynamicImport: true, + privateMethod: true, + functionBind: true, + exportDefaultFrom: true, + exportNamespaceFrom: true, + decorators: true, + decoratorsBeforeExport: true, + topLevelAwait: true, + importMeta: true + }, + transform: { + legacyDecorator: true, + react: { + useBuiltins: true, + runtime: 'automatic' } - } + }, + target: 'es5', + loose: true, + externalHelpers: true + }, + env: { + targets: { + ie: '11' + }, + dynamicImport: true, + loose: true, + mode: 'entry', + coreJs: 3 } - ] + } } - : { - test: /\.jsx?$/, - exclude: EXCLUDED_FOLDERS_REGEXP, - use: [ - { - loader: require.resolve('babel-loader'), - options: { - babelrc: false, - cacheDirectory: true, - presets: [require.resolve('babel-preset-sui')] - } - } - ] - }, + ] + }, { test: /(\.css|\.scss)$/, use: cleanList([ From c88abfd1882b3b600f3ffbb33ee79150d975b43b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alvarez=20Sordo?= Date: Thu, 25 Aug 2022 13:58:16 +0200 Subject: [PATCH 04/76] feat(packages/sui-studio): add initial typescript support --- packages/sui-studio/bin/sui-studio-dev.js | 4 ++-- packages/sui-studio/src/components/layout/index.js | 5 +++-- packages/sui-studio/src/components/tryRequire.js | 8 ++++---- .../sui-studio/workbench/src/components/Root/index.js | 3 ++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/sui-studio/bin/sui-studio-dev.js b/packages/sui-studio/bin/sui-studio-dev.js index 7a05fbadc..22e243f3c 100755 --- a/packages/sui-studio/bin/sui-studio-dev.js +++ b/packages/sui-studio/bin/sui-studio-dev.js @@ -5,8 +5,8 @@ const path = require('path') const fs = require('fs') const webpack = require('webpack') -const config = require('@s-ui/bundler/webpack.config.dev') -const startDevServer = require('@s-ui/bundler/bin/sui-bundler-dev') +const config = require('../../sui-bundler/webpack.config.dev.js') +const startDevServer = require('../../sui-bundler/bin/sui-bundler-dev.js') const {componentsFullPath} = require('./helpers/walker.js') diff --git a/packages/sui-studio/src/components/layout/index.js b/packages/sui-studio/src/components/layout/index.js index 6d72777fc..315773665 100644 --- a/packages/sui-studio/src/components/layout/index.js +++ b/packages/sui-studio/src/components/layout/index.js @@ -1,9 +1,10 @@ import React, {useEffect, useState} from 'react' -import PropTypes from 'prop-types' + import cx from 'classnames' +import PropTypes from 'prop-types' -import {iconClose, iconMenu} from '../icons' import Markdown from '../documentation/Markdown' +import {iconClose, iconMenu} from '../icons' import Navigation from '../navigation' import {fetchComponentsReadme} from '../tryRequire.js' diff --git a/packages/sui-studio/src/components/tryRequire.js b/packages/sui-studio/src/components/tryRequire.js index d7ace763c..ce7464a5b 100644 --- a/packages/sui-studio/src/components/tryRequire.js +++ b/packages/sui-studio/src/components/tryRequire.js @@ -48,8 +48,8 @@ export const importReactComponent = ({ importFile: () => import( /* webpackChunkName: "src-[request]" */ - /* webpackExclude: /\/node_modules\/(.*)\/src\/index.js$/ */ - `${__BASE_DIR__}/components/${category}/${component}/src/index.js` + /* webpackExclude: /\/node_modules\/(.*)\/src\/index.tsx$/ */ + `${__BASE_DIR__}/components/${category}/${component}/src/index.tsx` ) }) @@ -58,8 +58,8 @@ const importDemo = ({category, component}) => importFile: () => import( /* webpackChunkName: "demo-[request]" */ - /* webpackExclude: /\/node_modules\/(.*)\/demo\/index.js$/ */ - `${__BASE_DIR__}/components/${category}/${component}/demo/index.js` + /* webpackExclude: /\/node_modules\/(.*)\/demo\/index.tsx$/ */ + `${__BASE_DIR__}/components/${category}/${component}/demo/index.tsx` ) }) diff --git a/packages/sui-studio/workbench/src/components/Root/index.js b/packages/sui-studio/workbench/src/components/Root/index.js index ca6fc0c6f..c829a6e6d 100644 --- a/packages/sui-studio/workbench/src/components/Root/index.js +++ b/packages/sui-studio/workbench/src/components/Root/index.js @@ -1,11 +1,12 @@ import React, {useState} from 'react' + import PropTypes from 'prop-types' import Header from '../Header' import Select from '../Select' import Test from '../Test' -const importComponent = () => import('component/index.js') +const importComponent = () => import('component/index.tsx') const importTest = () => import('test/index.test.js') const getFromStorage = (key, defaultValue) => From ecb5b24eb791b17de695c6302aa95b47a030e826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alvarez=20Sordo?= Date: Thu, 1 Sep 2022 12:58:51 +0200 Subject: [PATCH 05/76] feat(packages/sui-studio): remove index extension to support typescript files --- packages/sui-studio/src/components/tryRequire.js | 8 ++++---- .../sui-studio/workbench/src/components/Root/index.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/sui-studio/src/components/tryRequire.js b/packages/sui-studio/src/components/tryRequire.js index ce7464a5b..1c633e9ba 100644 --- a/packages/sui-studio/src/components/tryRequire.js +++ b/packages/sui-studio/src/components/tryRequire.js @@ -48,8 +48,8 @@ export const importReactComponent = ({ importFile: () => import( /* webpackChunkName: "src-[request]" */ - /* webpackExclude: /\/node_modules\/(.*)\/src\/index.tsx$/ */ - `${__BASE_DIR__}/components/${category}/${component}/src/index.tsx` + /* webpackExclude: /\/node_modules\/(.*)\/src\/index$/ */ + `${__BASE_DIR__}/components/${category}/${component}/src/index` ) }) @@ -58,8 +58,8 @@ const importDemo = ({category, component}) => importFile: () => import( /* webpackChunkName: "demo-[request]" */ - /* webpackExclude: /\/node_modules\/(.*)\/demo\/index.tsx$/ */ - `${__BASE_DIR__}/components/${category}/${component}/demo/index.tsx` + /* webpackExclude: /\/node_modules\/(.*)\/demo\/index$/ */ + `${__BASE_DIR__}/components/${category}/${component}/demo/index` ) }) diff --git a/packages/sui-studio/workbench/src/components/Root/index.js b/packages/sui-studio/workbench/src/components/Root/index.js index c829a6e6d..c198e381b 100644 --- a/packages/sui-studio/workbench/src/components/Root/index.js +++ b/packages/sui-studio/workbench/src/components/Root/index.js @@ -6,8 +6,8 @@ import Header from '../Header' import Select from '../Select' import Test from '../Test' -const importComponent = () => import('component/index.tsx') -const importTest = () => import('test/index.test.js') +const importComponent = () => import('component/index') +const importTest = () => import('test/index.test') const getFromStorage = (key, defaultValue) => window.sessionStorage[key] || defaultValue From 70bc6ef08c22243a2aa5eeebb35fd819b7ee873c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alvarez=20Sordo?= Date: Fri, 9 Sep 2022 11:57:12 +0200 Subject: [PATCH 06/76] feat(packages/sui-bundler): remove not needed app extension --- packages/sui-bundler/shared/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-bundler/shared/index.js b/packages/sui-bundler/shared/index.js index a112101ea..2c9c59415 100644 --- a/packages/sui-bundler/shared/index.js +++ b/packages/sui-bundler/shared/index.js @@ -1,6 +1,6 @@ const {config} = require('./config.js') -exports.MAIN_ENTRY_POINT = './app.js' +exports.MAIN_ENTRY_POINT = './app' exports.config = config exports.cleanList = list => list.filter(Boolean) From f5e3f27b6c12a8df34caa3b5a0d62ba1ec6d2a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alvarez=20Sordo?= Date: Mon, 12 Sep 2022 15:29:24 +0200 Subject: [PATCH 07/76] feat(packages/sui-studio): update package import --- packages/sui-studio/bin/sui-studio-dev.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sui-studio/bin/sui-studio-dev.js b/packages/sui-studio/bin/sui-studio-dev.js index 22e243f3c..c711a608d 100755 --- a/packages/sui-studio/bin/sui-studio-dev.js +++ b/packages/sui-studio/bin/sui-studio-dev.js @@ -5,8 +5,8 @@ const path = require('path') const fs = require('fs') const webpack = require('webpack') -const config = require('../../sui-bundler/webpack.config.dev.js') -const startDevServer = require('../../sui-bundler/bin/sui-bundler-dev.js') +const config = require('@s-ui/sui-bundler/webpack.config.dev.js') +const startDevServer = require('@s-ui/sui-bundler/bin/sui-bundler-dev.js') const {componentsFullPath} = require('./helpers/walker.js') From 9205c4857cefffbfe1dcb07c9411c44f222c7c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alvarez=20Sordo?= Date: Mon, 12 Sep 2022 16:10:39 +0200 Subject: [PATCH 08/76] feat(packages/sui-studio): update studio import --- packages/sui-studio/bin/sui-studio-dev.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sui-studio/bin/sui-studio-dev.js b/packages/sui-studio/bin/sui-studio-dev.js index c711a608d..7a05fbadc 100755 --- a/packages/sui-studio/bin/sui-studio-dev.js +++ b/packages/sui-studio/bin/sui-studio-dev.js @@ -5,8 +5,8 @@ const path = require('path') const fs = require('fs') const webpack = require('webpack') -const config = require('@s-ui/sui-bundler/webpack.config.dev.js') -const startDevServer = require('@s-ui/sui-bundler/bin/sui-bundler-dev.js') +const config = require('@s-ui/bundler/webpack.config.dev') +const startDevServer = require('@s-ui/bundler/bin/sui-bundler-dev') const {componentsFullPath} = require('./helpers/walker.js') From 85ce3506d7c97ae57e09815503a40cb7209cf8f6 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Mon, 17 Oct 2022 15:28:20 +0200 Subject: [PATCH 09/76] chore: ts overrides changes --- packages/sui-lint/eslintrc.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/sui-lint/eslintrc.js b/packages/sui-lint/eslintrc.js index c8c6810ae..b6b69188d 100644 --- a/packages/sui-lint/eslintrc.js +++ b/packages/sui-lint/eslintrc.js @@ -146,14 +146,20 @@ module.exports = { overrides: [ { files: ['**/*.+(ts|tsx)'], - extends: ['standard-with-typescript'], + extends: ['standard-with-typescript', 'standard-react', 'prettier'], parserOptions: { project: './tsconfig.json' }, rules: { 'no-return-await': RULES.OFF, 'prettier/prettier': RULES.OFF, - 'react/react-in-jsx-scope': RULES.OFF + 'react/react-in-jsx-scope': RULES.OFF, + 'react/no-unused-prop-types': RULES.OFF, + '@typescript-eslint/explicit-function-return-type': [ + RULES.OFF, + {allowTypedFunctionExpressions: false} + ], + 'no-unused-expression-chai': true } } ] From b853f92121bfde957f2cdde9fe8af625ce9052ff Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Tue, 13 Dec 2022 16:24:33 +0100 Subject: [PATCH 10/76] feat(packages/sui-test): add jest command for sui-test --- packages/sui-test/bin/jest/config.js | 3 +++ packages/sui-test/bin/jest/utils.js | 19 +++++++++++++++++++ packages/sui-test/bin/sui-test-jest.js | 7 +++++++ packages/sui-test/bin/sui-test.js | 2 ++ packages/sui-test/package.json | 2 ++ 5 files changed, 33 insertions(+) create mode 100644 packages/sui-test/bin/jest/config.js create mode 100644 packages/sui-test/bin/jest/utils.js create mode 100755 packages/sui-test/bin/sui-test-jest.js diff --git a/packages/sui-test/bin/jest/config.js b/packages/sui-test/bin/jest/config.js new file mode 100644 index 000000000..fbd31eff4 --- /dev/null +++ b/packages/sui-test/bin/jest/config.js @@ -0,0 +1,3 @@ +const jestConfig = {} + +module.exports = jestConfig diff --git a/packages/sui-test/bin/jest/utils.js b/packages/sui-test/bin/jest/utils.js new file mode 100644 index 000000000..4d515fdda --- /dev/null +++ b/packages/sui-test/bin/jest/utils.js @@ -0,0 +1,19 @@ +const path = require('path') +const fs = require('fs') +const readPkgUp = require('read-pkg-up') + +const {path: pkgPath} = readPkgUp.sync({ + cwd: fs.realpathSync(process.cwd()) +}) + +const appDirectory = path.dirname(pkgPath) + +const fromRoot = (...p) => path.join(appDirectory, ...p) + +const hasFile = (...p) => fs.existsSync(fromRoot(...p)) + +module.exports = { + appDirectory, + fromRoot, + hasFile +} diff --git a/packages/sui-test/bin/sui-test-jest.js b/packages/sui-test/bin/sui-test-jest.js new file mode 100755 index 000000000..23a7d7a8e --- /dev/null +++ b/packages/sui-test/bin/sui-test-jest.js @@ -0,0 +1,7 @@ +#!/usr/bin/env node + +const args = process.argv.slice(2) + +const config = [] + +require('jest').run([...config, ...args]) diff --git a/packages/sui-test/bin/sui-test.js b/packages/sui-test/bin/sui-test.js index 44a975b0a..b908b0248 100755 --- a/packages/sui-test/bin/sui-test.js +++ b/packages/sui-test/bin/sui-test.js @@ -10,4 +10,6 @@ program.command('browser', 'Run tests in the browser').alias('b') program.command('server', 'Run tests in node').alias('s') +program.command('jest', 'Run tests with jest').alias('j') + program.parse(process.argv) diff --git a/packages/sui-test/package.json b/packages/sui-test/package.json index ef94eedb5..500b4d809 100644 --- a/packages/sui-test/package.json +++ b/packages/sui-test/package.json @@ -28,6 +28,7 @@ "babel-plugin-istanbul": "6.0.0", "babel-preset-sui": "3", "commander": "8.3.0", + "jest": "29.3.1", "karma": "6.4.0", "karma-chrome-launcher": "3.1.1", "karma-coverage": "2.2.0", @@ -37,6 +38,7 @@ "karma-webpack": "5.0.0", "mocha": "10.0.0", "process": "0.11.10", + "read-pkg-up": "7.0.1", "stream-browserify": "3.0.0", "tty-browserify": "0.0.1", "util": "0.12.4", From f4c7c51d1ece9495c87f69d5654779e2c71ff35c Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 14 Dec 2022 08:42:13 +0100 Subject: [PATCH 11/76] chore(Root): add npmrc for allow isolated npm config --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3a906dd8e..18fe87d62 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ packages/sui-studio/test/server/integration/empty-studio/components/fake/compone !packages/sui-sass-loader/test/server/fixtures/**/node_modules -contract/logs/pact.log \ No newline at end of file +contract/logs/pact.log +.npmrc \ No newline at end of file From 798a5d48af020bb3d1b598c02fc161acc3fd9d03 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 14 Dec 2022 09:00:55 +0100 Subject: [PATCH 12/76] chore(packages/sui-test): add jest dependencies --- packages/sui-test/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/sui-test/package.json b/packages/sui-test/package.json index 500b4d809..2b7397f32 100644 --- a/packages/sui-test/package.json +++ b/packages/sui-test/package.json @@ -23,12 +23,15 @@ "@babel/plugin-transform-modules-commonjs": "7.18.6", "@babel/register": "7.18.9", "@s-ui/helpers": "1", + "@types/jest": "29.2.4", + "babel-jest": "29.3.1", "babel-loader": "8.2.5", "babel-plugin-dynamic-import-node": "2.3.3", "babel-plugin-istanbul": "6.0.0", "babel-preset-sui": "3", "commander": "8.3.0", "jest": "29.3.1", + "jest-environment-jsdom": "29.3.1", "karma": "6.4.0", "karma-chrome-launcher": "3.1.1", "karma-coverage": "2.2.0", From a00b2517583a6ca7b8f87de7b777ba983b375f36 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 14 Dec 2022 09:03:10 +0100 Subject: [PATCH 13/76] feat(packages/sui-test): add default sui jest config --- packages/sui-test/bin/sui-test-jest.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/sui-test/bin/sui-test-jest.js b/packages/sui-test/bin/sui-test-jest.js index 23a7d7a8e..c8a1288f0 100755 --- a/packages/sui-test/bin/sui-test-jest.js +++ b/packages/sui-test/bin/sui-test-jest.js @@ -1,7 +1,14 @@ #!/usr/bin/env node +const {hasFile} = require('./jest/utils.js') + +process.env.BABEL_ENV = 'test' +process.env.NODE_ENV = 'test' const args = process.argv.slice(2) -const config = [] +const config = + !args.includes('--config') && !hasFile('jest.config.js') + ? ['--config', JSON.stringify(require('./jest/config.js'))] + : [] require('jest').run([...config, ...args]) From 0e3c577af97c7521207037a8a945902806b96cbe Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 14 Dec 2022 12:05:26 +0100 Subject: [PATCH 14/76] chore(packages/sui-test): add swc jest --- packages/sui-test/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/sui-test/package.json b/packages/sui-test/package.json index 2b7397f32..bee73bbf1 100644 --- a/packages/sui-test/package.json +++ b/packages/sui-test/package.json @@ -23,6 +23,7 @@ "@babel/plugin-transform-modules-commonjs": "7.18.6", "@babel/register": "7.18.9", "@s-ui/helpers": "1", + "@swc/jest": "0.2.24", "@types/jest": "29.2.4", "babel-jest": "29.3.1", "babel-loader": "8.2.5", From ec0b8c019342197b78615e37a25921dde505e96e Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 14 Dec 2022 15:13:50 +0100 Subject: [PATCH 15/76] chore(packages/sui-test): remove babel-jest dependency --- packages/sui-test/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/sui-test/package.json b/packages/sui-test/package.json index bee73bbf1..b23b1f8c1 100644 --- a/packages/sui-test/package.json +++ b/packages/sui-test/package.json @@ -25,7 +25,6 @@ "@s-ui/helpers": "1", "@swc/jest": "0.2.24", "@types/jest": "29.2.4", - "babel-jest": "29.3.1", "babel-loader": "8.2.5", "babel-plugin-dynamic-import-node": "2.3.3", "babel-plugin-istanbul": "6.0.0", From bb1c1537a8e14c4dfd364b22a06587aee636a657 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Thu, 15 Dec 2022 09:59:34 +0100 Subject: [PATCH 16/76] docs(packages/sui-test): add todo comment --- packages/sui-test/bin/jest/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/sui-test/bin/jest/config.js b/packages/sui-test/bin/jest/config.js index fbd31eff4..da7374f58 100644 --- a/packages/sui-test/bin/jest/config.js +++ b/packages/sui-test/bin/jest/config.js @@ -1,3 +1,4 @@ +// TODO: add sui jest common config const jestConfig = {} module.exports = jestConfig From 751f91f37b19fee7bb865d8c4304a17327c77604 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Tue, 20 Dec 2022 08:59:53 +0100 Subject: [PATCH 17/76] feat(packages/sui-js-compiler): use latest swc helpers version --- packages/sui-js-compiler/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sui-js-compiler/package.json b/packages/sui-js-compiler/package.json index 93e126a86..054d8c1cd 100644 --- a/packages/sui-js-compiler/package.json +++ b/packages/sui-js-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/js-compiler", - "version": "1.19.0", + "version": "1.19.2", "description": "JavaScript Compiler", "main": "index.js", "bin": { @@ -14,7 +14,7 @@ "license": "ISC", "dependencies": { "@swc/core": "1.2.194", - "@swc/helpers": "0.3.16", + "@swc/helpers": "0.4.12", "commander": "8.3.0", "fast-glob": "3.2.11", "fs-extra": "10.1.0" From 3ed25f515fcfc1f88c6e80a2ee09585e6230c4a7 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Tue, 20 Dec 2022 09:01:40 +0100 Subject: [PATCH 18/76] feat(packages/sui-studio): remove extensions from imports --- packages/sui-studio/package.json | 2 +- packages/sui-studio/workbench/src/components/Root/index.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/sui-studio/package.json b/packages/sui-studio/package.json index 624339f77..9f49202c1 100644 --- a/packages/sui-studio/package.json +++ b/packages/sui-studio/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/studio", - "version": "11.21.0", + "version": "11.21.1", "description": "Develop, maintain and publish your SUI components.", "main": "index.js", "bin": { diff --git a/packages/sui-studio/workbench/src/components/Root/index.js b/packages/sui-studio/workbench/src/components/Root/index.js index 67048dfab..2ea0e4041 100644 --- a/packages/sui-studio/workbench/src/components/Root/index.js +++ b/packages/sui-studio/workbench/src/components/Root/index.js @@ -2,9 +2,9 @@ import {useState} from 'react' import PropTypes from 'prop-types' -import Header from '../Header/index.js' -import Select from '../Select/index.js' -import Test from '../Suite/index.js' +import Header from '../Header/index' +import Select from '../Select/index' +import Test from '../Suite/index' const importComponent = () => import('component/index') const importTest = () => import('test/index.test') From 3330883fdfd4b77c3bc6d9cefdb330c21d223e66 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Tue, 20 Dec 2022 09:02:30 +0100 Subject: [PATCH 19/76] feat(packages/sui-lint): fix rule value --- packages/sui-lint/eslintrc.js | 2 +- packages/sui-lint/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sui-lint/eslintrc.js b/packages/sui-lint/eslintrc.js index b6b69188d..0b68bc0c6 100644 --- a/packages/sui-lint/eslintrc.js +++ b/packages/sui-lint/eslintrc.js @@ -159,7 +159,7 @@ module.exports = { RULES.OFF, {allowTypedFunctionExpressions: false} ], - 'no-unused-expression-chai': true + 'no-unused-expression-chai': RULES.ERROR } } ] diff --git a/packages/sui-lint/package.json b/packages/sui-lint/package.json index 85aa39c0b..fb69764b7 100644 --- a/packages/sui-lint/package.json +++ b/packages/sui-lint/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/lint", - "version": "4.28.0", + "version": "4.28.1", "description": "Linting CLI for sui packages", "main": "./bin/sui-lint.js", "bin": { From 2909eebaf0f11b7119125c4d562a79b6dd949823 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Tue, 20 Dec 2022 09:04:44 +0100 Subject: [PATCH 20/76] feat(packages/sui-bundler): use latest swc helpers --- packages/sui-bundler/package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/sui-bundler/package.json b/packages/sui-bundler/package.json index 8c8e9d105..61af24e83 100644 --- a/packages/sui-bundler/package.json +++ b/packages/sui-bundler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/bundler", - "version": "9.36.0", + "version": "9.36.2", "description": "Config-free bundler for ES6 React apps.", "bin": { "sui-bundler": "./bin/sui-bundler.js" @@ -24,6 +24,8 @@ "@babel/core": "7.18.10", "@s-ui/helpers": "1", "@s-ui/sass-loader": "1", + "@swc/core": "^1.2.189", + "@swc/helpers": "0.4.12", "address": "1.2.0", "autoprefixer": "10.4.8", "babel-loader": "8.2.5", @@ -46,13 +48,11 @@ "stream-http": "3.2.0", "strip-ansi": "6.0.1", "style-loader": "3.3.1", + "swc-loader": "^0.2.1", "url": "0.11.0", "webpack": "5.74.0", "webpack-dev-server": "4.10.0", "webpack-manifest-plugin": "5.0.0", - "webpack-node-externals": "3.0.0", - "@swc/core": "^1.2.189", - "@swc/helpers": "^0.3.15", - "swc-loader": "^0.2.1" + "webpack-node-externals": "3.0.0" } -} \ No newline at end of file +} From 5caa961a52e4aed7022b43dd2c449557248433e8 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Mon, 9 Jan 2023 12:01:25 +0100 Subject: [PATCH 21/76] chore(packages/sui-test): add beta --- packages/sui-test/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-test/package.json b/packages/sui-test/package.json index b23b1f8c1..cc2793a1e 100644 --- a/packages/sui-test/package.json +++ b/packages/sui-test/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/test", - "version": "8.23.0", + "version": "8.24.0-beta.0", "description": "", "bin": { "sui-test": "bin/sui-test.js" From 2d63279933a555076066be2c5a750552702cb6fa Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Mon, 9 Jan 2023 16:29:03 +0100 Subject: [PATCH 22/76] chore(packages/sui-bundler): add typescript tag --- packages/sui-bundler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-bundler/package.json b/packages/sui-bundler/package.json index 61af24e83..84ce3c278 100644 --- a/packages/sui-bundler/package.json +++ b/packages/sui-bundler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/bundler", - "version": "9.36.2", + "version": "9.37.0-typescript.0", "description": "Config-free bundler for ES6 React apps.", "bin": { "sui-bundler": "./bin/sui-bundler.js" From 7fffe91ab85aad8e02c72c9b8ad5a07f5070488d Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Mon, 9 Jan 2023 16:29:19 +0100 Subject: [PATCH 23/76] chore(packages/sui-js-compiler): add typescript tag --- packages/sui-js-compiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-js-compiler/package.json b/packages/sui-js-compiler/package.json index 054d8c1cd..a52c4f751 100644 --- a/packages/sui-js-compiler/package.json +++ b/packages/sui-js-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/js-compiler", - "version": "1.19.2", + "version": "1.20.0-typescript.0", "description": "JavaScript Compiler", "main": "index.js", "bin": { From 96ec6e2f37d7ff64c8426084bf0d76c1431cb2fb Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Mon, 9 Jan 2023 16:29:33 +0100 Subject: [PATCH 24/76] chore(packages/sui-lint): add typescript tag --- packages/sui-lint/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-lint/package.json b/packages/sui-lint/package.json index fb69764b7..c9726a67d 100644 --- a/packages/sui-lint/package.json +++ b/packages/sui-lint/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/lint", - "version": "4.28.1", + "version": "4.29.0-typescript.0", "description": "Linting CLI for sui packages", "main": "./bin/sui-lint.js", "bin": { From 7fd4957d8f2c5f69b08bab6fc9baffe19dd8ab2f Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Mon, 9 Jan 2023 16:29:47 +0100 Subject: [PATCH 25/76] chore(packages/sui-studio): add typescript tag --- packages/sui-studio/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-studio/package.json b/packages/sui-studio/package.json index 9f49202c1..a1be495d3 100644 --- a/packages/sui-studio/package.json +++ b/packages/sui-studio/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/studio", - "version": "11.21.1", + "version": "11.22.0-typescript.0", "description": "Develop, maintain and publish your SUI components.", "main": "index.js", "bin": { From 8c5afa4e93324bd8f65b36154f7fa844e90d89f2 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Wed, 11 Jan 2023 14:04:15 +0100 Subject: [PATCH 26/76] feat(packages/sui-bundler): read typescript mode from package json config --- packages/sui-bundler/shared/module-rules-babel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-bundler/shared/module-rules-babel.js b/packages/sui-bundler/shared/module-rules-babel.js index 86b044961..f2731f317 100644 --- a/packages/sui-bundler/shared/module-rules-babel.js +++ b/packages/sui-bundler/shared/module-rules-babel.js @@ -1,7 +1,7 @@ const path = require('path') const {config} = require('./index.js') -const {TS: isTypeScript = false} = process.env +const isTypeScript = config?.parser?.syntax === 'typescript' const EXCLUDED_FOLDERS_REGEXP = new RegExp( `node_modules(?!${path.sep}@s-ui(${path.sep}studio)(${path.sep}workbench)?${path.sep}src)` From 12b84c8c38405dd31de2183fe3ce419744d4f2e9 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Thu, 12 Jan 2023 09:25:48 +0100 Subject: [PATCH 27/76] chore(packages/sui-bundler): add version typescript number --- packages/sui-bundler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-bundler/package.json b/packages/sui-bundler/package.json index 84ce3c278..6aad8b75a 100644 --- a/packages/sui-bundler/package.json +++ b/packages/sui-bundler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/bundler", - "version": "9.37.0-typescript.0", + "version": "9.37.0-typescript.1", "description": "Config-free bundler for ES6 React apps.", "bin": { "sui-bundler": "./bin/sui-bundler.js" From 0988f8be8b569b9ecbb64c1cb6a24bbf0fc170f6 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Thu, 12 Jan 2023 09:27:53 +0100 Subject: [PATCH 28/76] chore(packages/sui-test): create jest tag beta version --- packages/sui-test/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-test/package.json b/packages/sui-test/package.json index cc2793a1e..7de158608 100644 --- a/packages/sui-test/package.json +++ b/packages/sui-test/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/test", - "version": "8.24.0-beta.0", + "version": "8.24.0-jest.0", "description": "", "bin": { "sui-test": "bin/sui-test.js" From 36a13a7b5df63f158367ede446f0dc7184e66184 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Mon, 30 Jan 2023 16:39:38 +0100 Subject: [PATCH 29/76] feat(packages/sui-lint): add eslint rules overrides for chai tests --- packages/sui-lint/eslintrc.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/sui-lint/eslintrc.js b/packages/sui-lint/eslintrc.js index 0b68bc0c6..cddfcdc1e 100644 --- a/packages/sui-lint/eslintrc.js +++ b/packages/sui-lint/eslintrc.js @@ -159,7 +159,8 @@ module.exports = { RULES.OFF, {allowTypedFunctionExpressions: false} ], - 'no-unused-expression-chai': RULES.ERROR + '@typescript-eslint/no-unused-expressions': RULES.OFF, + 'chai-friendly/no-unused-expressions': RULES.ERROR } } ] From 6dba47a806af2d5df0996110dcba0515a959bfe0 Mon Sep 17 00:00:00 2001 From: Marc Benito Date: Mon, 6 Feb 2023 17:00:36 +0100 Subject: [PATCH 30/76] feat(packages/sui-lint): Disabled the rule return-await ( for typescript to give consistency with js --- packages/sui-lint/eslintrc.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/sui-lint/eslintrc.js b/packages/sui-lint/eslintrc.js index cddfcdc1e..686eea452 100644 --- a/packages/sui-lint/eslintrc.js +++ b/packages/sui-lint/eslintrc.js @@ -159,8 +159,9 @@ module.exports = { RULES.OFF, {allowTypedFunctionExpressions: false} ], + 'chai-friendly/no-unused-expressions': RULES.ERROR, '@typescript-eslint/no-unused-expressions': RULES.OFF, - 'chai-friendly/no-unused-expressions': RULES.ERROR + '@typescript-eslint/return-await': RULES.OFF } } ] From 113e4810e32f6e8a32869489dce966907e932fa8 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 8 Feb 2023 11:21:59 +0100 Subject: [PATCH 31/76] feat(packages/sui-js-compiler): add new test folder to ignore --- packages/sui-js-compiler/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/sui-js-compiler/index.js b/packages/sui-js-compiler/index.js index 2bcc9bf67..3f68f08b8 100755 --- a/packages/sui-js-compiler/index.js +++ b/packages/sui-js-compiler/index.js @@ -35,7 +35,8 @@ program }) .parse(process.argv) -const {ignore = []} = program.opts() +const {ignoreOpts = []} = program.opts() +const ignore = [...ignoreOpts, '**/__tests__'] ;(async () => { console.time('[sui-js-compiler]') From 621e364d2d8793a673387240ed1c30f137089399 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 8 Feb 2023 11:25:39 +0100 Subject: [PATCH 32/76] chore(packages/sui-js-compiler): add jest beta tag --- packages/sui-js-compiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-js-compiler/package.json b/packages/sui-js-compiler/package.json index 350baf211..5b767178d 100644 --- a/packages/sui-js-compiler/package.json +++ b/packages/sui-js-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/js-compiler", - "version": "1.21.0", + "version": "1.22.0-jest.0", "description": "JavaScript Compiler", "type": "module", "exports": "./src/index.js", From 8e4769ef056e64c651b14aca35aa4682d04064cd Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 8 Feb 2023 12:28:23 +0100 Subject: [PATCH 33/76] feat(packages/sui-js-compiler): use ignore name for destructuring and new test folder --- packages/sui-js-compiler/index.js | 2 +- .../test/server/src/__tests__/other-example.test.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 packages/sui-js-compiler/test/server/src/__tests__/other-example.test.js diff --git a/packages/sui-js-compiler/index.js b/packages/sui-js-compiler/index.js index 3f68f08b8..1cb3d480d 100755 --- a/packages/sui-js-compiler/index.js +++ b/packages/sui-js-compiler/index.js @@ -35,7 +35,7 @@ program }) .parse(process.argv) -const {ignoreOpts = []} = program.opts() +const {ignore: ignoreOpts = []} = program.opts() const ignore = [...ignoreOpts, '**/__tests__'] ;(async () => { diff --git a/packages/sui-js-compiler/test/server/src/__tests__/other-example.test.js b/packages/sui-js-compiler/test/server/src/__tests__/other-example.test.js new file mode 100644 index 000000000..466d67930 --- /dev/null +++ b/packages/sui-js-compiler/test/server/src/__tests__/other-example.test.js @@ -0,0 +1 @@ +// File to ignore From c2af7b7c8c85f159ebcea5a5e005f850fa1b1e2e Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 8 Feb 2023 12:29:12 +0100 Subject: [PATCH 34/76] chore(packages/sui-js-compiler): upgrade version --- packages/sui-js-compiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-js-compiler/package.json b/packages/sui-js-compiler/package.json index 5b767178d..56da44df7 100644 --- a/packages/sui-js-compiler/package.json +++ b/packages/sui-js-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/js-compiler", - "version": "1.22.0-jest.0", + "version": "1.22.0-jest.1", "description": "JavaScript Compiler", "type": "module", "exports": "./src/index.js", From 3e3dcaa24a926be7c462dcb9fcdb00de84c43dce Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 8 Feb 2023 16:42:45 +0100 Subject: [PATCH 35/76] feat(packages/sui-lint): add jest rules --- packages/sui-lint/eslintrc.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/sui-lint/eslintrc.js b/packages/sui-lint/eslintrc.js index 57d2167c7..2b92e0e76 100644 --- a/packages/sui-lint/eslintrc.js +++ b/packages/sui-lint/eslintrc.js @@ -83,7 +83,8 @@ module.exports = { env: { es6: true, - mocha: true + mocha: true, + 'jest/globals': true }, globals: { @@ -116,7 +117,8 @@ module.exports = { 'prettier', 'react', 'react-hooks', - 'simple-import-sort' + 'simple-import-sort', + 'jest' ], rules: { ...REACT_RULES, From 5b6280024743c855a3ebc180296a8564abc95868 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 8 Feb 2023 16:43:16 +0100 Subject: [PATCH 36/76] chore(packages/sui-lint): add eslint jest dependency --- packages/sui-lint/package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/sui-lint/package.json b/packages/sui-lint/package.json index 38edfccc6..ff215f9ad 100644 --- a/packages/sui-lint/package.json +++ b/packages/sui-lint/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/lint", - "version": "4.29.0", + "version": "4.29.0-jest.0", "description": "Linting CLI for sui packages", "main": "./bin/sui-lint.js", "bin": { @@ -27,12 +27,13 @@ "eslint-plugin-chai-friendly": "0.7.2", "eslint-plugin-cypress": "2.12.1", "eslint-plugin-import": "2.26.0", - "eslint-plugin-no-only-tests": "3.0.0", + "eslint-plugin-jest": "27.2.1", "eslint-plugin-n": "15.2.5", + "eslint-plugin-no-only-tests": "3.0.0", "eslint-plugin-prettier": "4.2.1", "eslint-plugin-promise": "6.0.0", - "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-react": "7.30.1", + "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-simple-import-sort": "7.0.0", "postcss-scss": "4.0.4", "prettier": "2.7.1", From f0ac5b38ad0563f6ec0801fbc8b98f67606cc0a5 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Mon, 13 Feb 2023 17:10:36 +0100 Subject: [PATCH 37/76] chore(packages/sui-lint): upgrade version --- packages/sui-lint/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-lint/package.json b/packages/sui-lint/package.json index c9726a67d..4d074cd57 100644 --- a/packages/sui-lint/package.json +++ b/packages/sui-lint/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/lint", - "version": "4.29.0-typescript.0", + "version": "4.29.0-typescript.1", "description": "Linting CLI for sui packages", "main": "./bin/sui-lint.js", "bin": { From fb8f526b24b43f7303cab6ca7c9871ce60faa758 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Wed, 8 Mar 2023 09:25:04 +0100 Subject: [PATCH 38/76] chore(packages/sui-react-context): use package types from lib folder --- packages/sui-react-context/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sui-react-context/package.json b/packages/sui-react-context/package.json index 2e1831862..b7394109d 100644 --- a/packages/sui-react-context/package.json +++ b/packages/sui-react-context/package.json @@ -1,9 +1,9 @@ { "name": "@s-ui/react-context", - "version": "1.8.0", + "version": "1.8.1-typescript.0", "description": "", "main": "lib/index", - "types": "src/index.tsx", + "types": "lib/index.d.ts", "scripts": { "lib": "rm -rf ./lib && tsc", "prepublishOnly": "npm run lib" From ef67cf8fe6e8d917db2032795559402a08c0134c Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Wed, 8 Mar 2023 11:45:35 +0100 Subject: [PATCH 39/76] feat(packages/sui-lint): add eslint-config-standard-react dependency --- packages/sui-lint/package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/sui-lint/package.json b/packages/sui-lint/package.json index 4d074cd57..a1c7a7270 100644 --- a/packages/sui-lint/package.json +++ b/packages/sui-lint/package.json @@ -23,16 +23,17 @@ "eslint": "8.20.0", "eslint-config-prettier": "8.5.0", "eslint-config-standard": "17.0.0", + "eslint-config-standard-react": "13.0.0", "eslint-config-standard-with-typescript": "22.0.0", "eslint-plugin-chai-friendly": "0.7.2", "eslint-plugin-cypress": "2.12.1", "eslint-plugin-import": "2.26.0", - "eslint-plugin-no-only-tests": "3.0.0", "eslint-plugin-n": "15.2.5", + "eslint-plugin-no-only-tests": "3.0.0", "eslint-plugin-prettier": "4.2.1", "eslint-plugin-promise": "6.0.0", - "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-react": "7.30.1", + "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-simple-import-sort": "7.0.0", "postcss-scss": "4.0.4", "prettier": "2.7.1", From d0451afeafffde950b9547479bf91c8b1c3b7b9c Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Wed, 8 Mar 2023 11:48:58 +0100 Subject: [PATCH 40/76] feat(packages/sui-bundler): bump version after master merge --- packages/sui-bundler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-bundler/package.json b/packages/sui-bundler/package.json index 6aad8b75a..56c94abfd 100644 --- a/packages/sui-bundler/package.json +++ b/packages/sui-bundler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/bundler", - "version": "9.37.0-typescript.1", + "version": "9.37.0-typescript.2", "description": "Config-free bundler for ES6 React apps.", "bin": { "sui-bundler": "./bin/sui-bundler.js" From 1bd063d0a74495b4e1c682b84f8d66d61381ce64 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Wed, 8 Mar 2023 11:49:25 +0100 Subject: [PATCH 41/76] feat(packages/sui-js-compiler): bump version after master merge --- packages/sui-js-compiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-js-compiler/package.json b/packages/sui-js-compiler/package.json index 86172d4e9..c840bbef5 100644 --- a/packages/sui-js-compiler/package.json +++ b/packages/sui-js-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/js-compiler", - "version": "1.20.0-typescript.0", + "version": "1.21.0-typescript.1", "description": "JavaScript Compiler", "type": "module", "exports": "./src/index.js", From 66e6fe29f5c9ea8f3eb28611d0520625f7d15f58 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Wed, 8 Mar 2023 11:49:47 +0100 Subject: [PATCH 42/76] feat(packages/sui-lint): bump version after master merge --- packages/sui-lint/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-lint/package.json b/packages/sui-lint/package.json index a1c7a7270..0d88a0604 100644 --- a/packages/sui-lint/package.json +++ b/packages/sui-lint/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/lint", - "version": "4.29.0-typescript.1", + "version": "4.29.0-typescript.2", "description": "Linting CLI for sui packages", "main": "./bin/sui-lint.js", "bin": { From 6fed8fe336d0d1ea8e7ec4a7769e1d9819c11e1e Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Wed, 8 Mar 2023 11:50:11 +0100 Subject: [PATCH 43/76] feat(packages/sui-studio): bump version after master merge --- packages/sui-studio/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-studio/package.json b/packages/sui-studio/package.json index 63d875ef4..1a6d3621b 100644 --- a/packages/sui-studio/package.json +++ b/packages/sui-studio/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/studio", - "version": "11.22.0-typescript.0", + "version": "11.33.0-typescript.1", "description": "Develop, maintain and publish your SUI components.", "main": "index.js", "bin": { From b6e6bcc978da14d90360e2fddffe275fdc01bd23 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Thu, 30 Mar 2023 11:43:06 +0200 Subject: [PATCH 44/76] feat(packages/sui-lint): upgrade to latest eslint ts plugin --- packages/sui-lint/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sui-lint/package.json b/packages/sui-lint/package.json index 0d88a0604..fcf3809d7 100644 --- a/packages/sui-lint/package.json +++ b/packages/sui-lint/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/lint", - "version": "4.29.0-typescript.2", + "version": "4.29.0-typescript.3", "description": "Linting CLI for sui packages", "main": "./bin/sui-lint.js", "bin": { @@ -18,7 +18,7 @@ "@babel/eslint-parser": "7.18.9", "@babel/eslint-plugin": "7.18.10", "@s-ui/helpers": "1", - "@typescript-eslint/eslint-plugin": "5.33.0", + "@typescript-eslint/eslint-plugin": "5.57.0", "commander": "8.3.0", "eslint": "8.20.0", "eslint-config-prettier": "8.5.0", From ecdc2b9a7fc45f6d2c51e5994525b19c9d136d71 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Thu, 20 Apr 2023 08:30:20 +0200 Subject: [PATCH 45/76] feat(packages/sui-bundler): use latest swc versions --- packages/sui-bundler/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sui-bundler/package.json b/packages/sui-bundler/package.json index 56c94abfd..4e7cc8bdd 100644 --- a/packages/sui-bundler/package.json +++ b/packages/sui-bundler/package.json @@ -24,8 +24,8 @@ "@babel/core": "7.18.10", "@s-ui/helpers": "1", "@s-ui/sass-loader": "1", - "@swc/core": "^1.2.189", - "@swc/helpers": "0.4.12", + "@swc/core": "1.3.52", + "@swc/helpers": "0.5.0", "address": "1.2.0", "autoprefixer": "10.4.8", "babel-loader": "8.2.5", From 7833cac31a9bdee8455ccd1cd1a5a75f38f38068 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Thu, 20 Apr 2023 08:30:37 +0200 Subject: [PATCH 46/76] feat(packages/sui-js-compiler): use latest swc versions --- packages/sui-js-compiler/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sui-js-compiler/package.json b/packages/sui-js-compiler/package.json index c840bbef5..aa301fb7d 100644 --- a/packages/sui-js-compiler/package.json +++ b/packages/sui-js-compiler/package.json @@ -12,8 +12,8 @@ }, "license": "MIT", "dependencies": { - "@swc/core": "1.3.14", - "@swc/helpers": "0.4.12", + "@swc/core": "1.3.52", + "@swc/helpers": "0.5.0", "commander": "8.3.0", "fast-glob": "3.2.11", "fs-extra": "10.1.0" From e1114b35dc8b5c6857b95f728fef9e58ccdd2653 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Thu, 20 Apr 2023 08:32:22 +0200 Subject: [PATCH 47/76] feat(packages/sui-bundler): bump version for latest swc --- packages/sui-bundler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-bundler/package.json b/packages/sui-bundler/package.json index 4e7cc8bdd..4abd98f7c 100644 --- a/packages/sui-bundler/package.json +++ b/packages/sui-bundler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/bundler", - "version": "9.37.0-typescript.2", + "version": "9.37.0-typescript.3", "description": "Config-free bundler for ES6 React apps.", "bin": { "sui-bundler": "./bin/sui-bundler.js" From 32dc648e7d474796b14985fe9427af37fa559783 Mon Sep 17 00:00:00 2001 From: Daniel Lucaci Date: Thu, 20 Apr 2023 08:32:42 +0200 Subject: [PATCH 48/76] feat(packages/sui-js-compiler): bump version for latest swc --- packages/sui-js-compiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-js-compiler/package.json b/packages/sui-js-compiler/package.json index aa301fb7d..8e0c2cd6b 100644 --- a/packages/sui-js-compiler/package.json +++ b/packages/sui-js-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/js-compiler", - "version": "1.21.0-typescript.1", + "version": "1.21.0-typescript.2", "description": "JavaScript Compiler", "type": "module", "exports": "./src/index.js", From 77c71808656fde8714428f8a754814fe37e4beea Mon Sep 17 00:00:00 2001 From: Kiko Ruiz Lloret Date: Wed, 17 May 2023 12:44:08 +0200 Subject: [PATCH 49/76] feat(packages/sui-bundler): adapt bundler to new changes --- packages/sui-bundler/.swcrc | 78 ------------------- packages/sui-bundler/package.json | 12 +-- .../sui-bundler/shared/module-rules-babel.js | 15 +++- 3 files changed, 19 insertions(+), 86 deletions(-) delete mode 100644 packages/sui-bundler/.swcrc diff --git a/packages/sui-bundler/.swcrc b/packages/sui-bundler/.swcrc deleted file mode 100644 index 177eda41f..000000000 --- a/packages/sui-bundler/.swcrc +++ /dev/null @@ -1,78 +0,0 @@ -[ - { - "test": ".tsx?$", - "minify": true, - "jsc": { - "parser": { - "syntax": "typescript", - "tsx": true, - "dynamicImport": true, - "privateMethod": true, - "functionBind": true, - "exportDefaultFrom": true, - "exportNamespaceFrom": true, - "decorators": true, - "decoratorsBeforeExport": true, - "topLevelAwait": true, - "importMeta": true - }, - "transform": { - "legacyDecorator": true, - "react": { - "useBuiltins": true, - "runtime": "automatic" - } - }, - "target": "es5", - "loose": true, - "externalHelpers": true - }, - "env": { - "targets": { - "ie": "11" - }, - "dynamicImport": true, - "loose": true, - "mode": "entry", - "coreJs": 3 - } - }, - { - "test": ".jsx?$", - "minify": true, - "jsc": { - "parser": { - "syntax": "ecmascript", - "jsx": true, - "dynamicImport": true, - "privateMethod": true, - "functionBind": true, - "exportDefaultFrom": true, - "exportNamespaceFrom": true, - "decorators": true, - "decoratorsBeforeExport": true, - "topLevelAwait": true, - "importMeta": true - }, - "transform": { - "legacyDecorator": true, - "react": { - "useBuiltins": true, - "runtime": "automatic" - } - }, - "target": "es5", - "loose": true, - "externalHelpers": true - }, - "env": { - "targets": { - "ie": "11" - }, - "dynamicImport": true, - "loose": true, - "mode": "entry", - "coreJs": 3 - } - } -] diff --git a/packages/sui-bundler/package.json b/packages/sui-bundler/package.json index dbfb747d2..db4fd7d3e 100644 --- a/packages/sui-bundler/package.json +++ b/packages/sui-bundler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/bundler", - "version": "9.38.0", + "version": "9.39.0-typescript.5", "description": "Config-free bundler for ES6 React apps.", "bin": { "sui-bundler": "./bin/sui-bundler.js" @@ -21,11 +21,11 @@ }, "homepage": "https://github.com/SUI-Components/sui/tree/master/packages/sui-bundler#readme", "dependencies": { - "@babel/core": "7.18.10", + "@babel/core": "7.21.8", "@s-ui/helpers": "1", "@s-ui/sass-loader": "1", - "@swc/core": "1.3.52", - "@swc/helpers": "0.5.0", + "@swc/core": "1.3.58", + "@swc/helpers": "0.5.1", "address": "1.2.0", "autoprefixer": "10.4.8", "babel-loader": "8.2.5", @@ -36,7 +36,7 @@ "css-minimizer-webpack-plugin": "4.0.0", "esbuild": "0.15.5", "escape-string-regexp": "4.0.0", - "fast-glob": "3.2.11", + "fast-glob": "3.2.12", "find-free-ports": "3.0.0", "html-webpack-plugin": "5.5.0", "https-browserify": "1.0.0", @@ -50,7 +50,7 @@ "style-loader": "3.3.1", "swc-loader": "^0.2.1", "url": "0.11.0", - "webpack": "5.74.0", + "webpack": "5.82.1", "webpack-dev-server": "4.10.0", "webpack-manifest-plugin": "5.0.0", "webpack-node-externals": "3.0.0" diff --git a/packages/sui-bundler/shared/module-rules-babel.js b/packages/sui-bundler/shared/module-rules-babel.js index 9fe08b0db..66e6fd7db 100644 --- a/packages/sui-bundler/shared/module-rules-babel.js +++ b/packages/sui-bundler/shared/module-rules-babel.js @@ -1,14 +1,25 @@ +/* eslint-disable no-console */ +const fs = require('fs-extra') const path = require('path') const {config} = require('./index.js') -const isTypeScript = config?.parser?.syntax === 'typescript' +const tsConfigPath = path.join(process.cwd(), 'tsconfig.json') +let isTypeScriptEnabled = false + +try { + if (fs.existsSync(tsConfigPath)) { + isTypeScriptEnabled = true + } +} catch (err) { + console.error(err) +} const EXCLUDED_FOLDERS_REGEXP = new RegExp( `node_modules(?!${path.sep}@s-ui(${path.sep}studio)(${path.sep}workbench)?${path.sep}src)` ) module.exports = ({isServer = false, supportLegacyBrowsers = true} = {}) => - isTypeScript + isTypeScriptEnabled ? { test: /\.(js|ts)x?$/, exclude: EXCLUDED_FOLDERS_REGEXP, From e7d6353823c534907034fd66fefbbd12fa4d026b Mon Sep 17 00:00:00 2001 From: Kiko Ruiz Lloret Date: Mon, 22 May 2023 16:07:53 +0200 Subject: [PATCH 50/76] chore(packages/sui-studio): update deps --- packages/sui-studio/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sui-studio/package.json b/packages/sui-studio/package.json index 1a6d3621b..f71a495d9 100644 --- a/packages/sui-studio/package.json +++ b/packages/sui-studio/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/studio", - "version": "11.33.0-typescript.1", + "version": "11.34.0-typescript.0", "description": "Develop, maintain and publish your SUI components.", "main": "index.js", "bin": { @@ -11,9 +11,9 @@ "license": "MIT", "dependencies": { "@babel/cli": "7", - "@s-ui/bundler": "9", + "@s-ui/bundler": "typescript", "@s-ui/helpers": "1", - "@s-ui/react-context": "1", + "@s-ui/react-context": "typescript", "@s-ui/react-router": "1", "@s-ui/test": "8", "@testing-library/react": "10.4.9", From 16469f794f99cb34e559a3920068c8037b5f9347 Mon Sep 17 00:00:00 2001 From: Kiko Ruiz Lloret Date: Thu, 25 May 2023 13:15:23 +0200 Subject: [PATCH 51/76] fix(packages/sui-bundler): reset swc dependencies versions --- packages/sui-bundler/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sui-bundler/package.json b/packages/sui-bundler/package.json index db4fd7d3e..525eb381b 100644 --- a/packages/sui-bundler/package.json +++ b/packages/sui-bundler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/bundler", - "version": "9.39.0-typescript.5", + "version": "9.39.0-typescript.6", "description": "Config-free bundler for ES6 React apps.", "bin": { "sui-bundler": "./bin/sui-bundler.js" @@ -24,8 +24,8 @@ "@babel/core": "7.21.8", "@s-ui/helpers": "1", "@s-ui/sass-loader": "1", - "@swc/core": "1.3.58", - "@swc/helpers": "0.5.1", + "@swc/core": "1.3.14", + "@swc/helpers": "0.4.12", "address": "1.2.0", "autoprefixer": "10.4.8", "babel-loader": "8.2.5", From 16e2bd78716f3a14f914cd162a2c967704fa3d02 Mon Sep 17 00:00:00 2001 From: Kiko Ruiz Lloret Date: Fri, 2 Jun 2023 11:43:39 +0200 Subject: [PATCH 52/76] chore: update code owners --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 79415f320..6dd3a11d4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # Each line is a file pattern followed by one or more owners. # These owners will be the default owners for everything in the repo. -* @sui-bot @kikoruiz @andresz1 +* @sui-bot @kikoruiz @andresz1 @carlosvillu From 0e2f2a2e9274c7bb7d5e875c5ee029dc0460743f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alvarez=20Sordo?= Date: Tue, 6 Jun 2023 10:45:59 +0200 Subject: [PATCH 53/76] feat(packages/sui-lint): add jest rules --- packages/sui-lint/eslintrc.js | 72 +++++++++++++++++++++++++++++++++- packages/sui-lint/package.json | 1 + 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/packages/sui-lint/eslintrc.js b/packages/sui-lint/eslintrc.js index 2b92e0e76..ceeb38e16 100644 --- a/packages/sui-lint/eslintrc.js +++ b/packages/sui-lint/eslintrc.js @@ -41,7 +41,68 @@ const TESTING_RULES = { RULES.ERROR, {allowShortCircuit: true, allowTernary: true} ], - 'no-only-tests/no-only-tests': RULES.ERROR + 'no-only-tests/no-only-tests': RULES.ERROR, + 'jest/consistent-test-it': RULES.OFF, + 'jest/expect-expect': RULES.OFF, + 'jest/max-expects': RULES.OFF, + 'jest/max-nested-describe': RULES.ERROR, + 'jest/no-alias-methods': RULES.OFF, + 'jest/no-commented-out-tests': RULES.WARNING, + 'jest/no-conditional-expect': RULES.ERROR, + 'jest/no-conditional-in-test': RULES.ERROR, + 'jest/no-deprecated-functions': RULES.ERROR, + 'jest/no-disabled-tests': RULES.WARNING, + 'jest/no-done-callback': RULES.ERROR, + 'jest/no-duplicate-hooks': RULES.OFF, + 'jest/no-export': RULES.ERROR, + 'jest/no-focused-tests': RULES.ERROR, + 'jest/no-hooks': RULES.OFF, + 'jest/no-identical-title': RULES.ERROR, + 'jest/no-if': RULES.ERROR, + 'jest/no-interpolation-in-snapshots': RULES.ERROR, + 'jest/no-jasmine-globals': RULES.OFF, + 'jest/no-large-snapshots': [RULES.WARNING, {maxSize: 300}], + 'jest/no-mocks-import': RULES.ERROR, + 'jest/no-restricted-matchers': RULES.OFF, + 'jest/no-standalone-expect': RULES.OFF, + 'jest/no-test-prefixes': RULES.ERROR, + 'jest/no-test-return-statement': RULES.OFF, + 'jest/prefer-called-with': RULES.ERROR, + 'jest/prefer-comparison-matcher': RULES.ERROR, + 'jest/prefer-each': RULES.ERROR, + 'jest/prefer-equality-matcher': RULES.ERROR, + 'jest/prefer-expect-assertions': RULES.OFF, + 'jest/prefer-expect-resolves': RULES.OFF, + 'jest/prefer-hooks-in-order': RULES.ERROR, + 'jest/prefer-hooks-on-top': RULES.ERROR, + 'jest/prefer-lowercase-title': RULES.OFF, + 'jest/prefer-mock-promise-shorthand': RULES.ERROR, + 'jest/prefer-snapshot-hint': RULES.ERROR, + 'jest/prefer-spy-on': RULES.OFF, + 'jest/prefer-strict-equal': RULES.OFF, + 'jest/prefer-to-be': RULES.OFF, + 'jest/prefer-to-contain': RULES.WARNING, + 'jest/prefer-to-have-length': RULES.WARNING, + 'jest/prefer-todo': RULES.WARNING, + 'jest/require-hook': RULES.OFF, + 'jest/require-to-throw-message': RULES.OFF, + 'jest/require-top-level-describe': RULES.OFF, + 'jest/unbound-method': RULES.OFF, + 'jest/valid-describe-callback': RULES.ERROR, + 'jest/valid-expect': RULES.ERROR, + 'jest/valid-expect-in-promise': RULES.ERROR, + 'jest/valid-title': RULES.WARNING, + 'jest-dom/prefer-checked': RULES.ERROR, + 'jest-dom/prefer-empty': RULES.ERROR, + 'jest-dom/prefer-enabled-disabled': RULES.ERROR, + 'jest-dom/prefer-focus': RULES.ERROR, + 'jest-dom/prefer-in-document': RULES.ERROR, + 'jest-dom/prefer-required': RULES.ERROR, + 'jest-dom/prefer-to-have-attribute': RULES.ERROR, + 'jest-dom/prefer-to-have-class': RULES.ERROR, + 'jest-dom/prefer-to-have-style': RULES.ERROR, + 'jest-dom/prefer-to-have-text-content': RULES.ERROR, + 'jest-dom/prefer-to-have-value': RULES.ERROR } const IMPORT_SORT_GROUPS = [ @@ -118,7 +179,8 @@ module.exports = { 'react', 'react-hooks', 'simple-import-sort', - 'jest' + 'jest', + 'jest-dom' ], rules: { ...REACT_RULES, @@ -158,6 +220,12 @@ module.exports = { 'prettier/prettier': RULES.OFF, 'react/react-in-jsx-scope': RULES.OFF } + }, + { + files: ['**/__tests__/**/*.js'], + rules: { + 'react/display-name': RULES.OFF // we don't need a display name in test files + } } ] } diff --git a/packages/sui-lint/package.json b/packages/sui-lint/package.json index d581b9f05..be119a5db 100644 --- a/packages/sui-lint/package.json +++ b/packages/sui-lint/package.json @@ -28,6 +28,7 @@ "eslint-plugin-cypress": "2.12.1", "eslint-plugin-import": "2.26.0", "eslint-plugin-jest": "27.2.1", + "eslint-plugin-jest-dom": "4.0.3", "eslint-plugin-n": "15.2.5", "eslint-plugin-no-only-tests": "3.0.0", "eslint-plugin-prettier": "4.2.1", From f15be4c48d8b1ade07a407c0781c79b181b4a52b Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 7 Jun 2023 11:19:14 +0200 Subject: [PATCH 54/76] feat(packages/sui-jest): add wrapper for jest --- packages/sui-jest/.npmignore | 2 ++ packages/sui-jest/CHANGELOG.md | 1 + packages/sui-jest/README.md | 9 +++++++++ packages/sui-jest/bin/config.js | 4 ++++ packages/sui-jest/bin/sui-jest.js | 14 ++++++++++++++ packages/sui-jest/bin/utils.js | 19 +++++++++++++++++++ packages/sui-jest/package.json | 29 +++++++++++++++++++++++++++++ 7 files changed, 78 insertions(+) create mode 100644 packages/sui-jest/.npmignore create mode 100644 packages/sui-jest/CHANGELOG.md create mode 100644 packages/sui-jest/README.md create mode 100644 packages/sui-jest/bin/config.js create mode 100755 packages/sui-jest/bin/sui-jest.js create mode 100644 packages/sui-jest/bin/utils.js create mode 100644 packages/sui-jest/package.json diff --git a/packages/sui-jest/.npmignore b/packages/sui-jest/.npmignore new file mode 100644 index 000000000..29693447a --- /dev/null +++ b/packages/sui-jest/.npmignore @@ -0,0 +1,2 @@ +src +test \ No newline at end of file diff --git a/packages/sui-jest/CHANGELOG.md b/packages/sui-jest/CHANGELOG.md new file mode 100644 index 000000000..a0cf709bc --- /dev/null +++ b/packages/sui-jest/CHANGELOG.md @@ -0,0 +1 @@ +# CHANGELOG diff --git a/packages/sui-jest/README.md b/packages/sui-jest/README.md new file mode 100644 index 000000000..4007523f0 --- /dev/null +++ b/packages/sui-jest/README.md @@ -0,0 +1,9 @@ +# sui-jest + +It is mainly a wrapper around [Jest](https://jestjs.io/). + +## Installation + +```sh +npm install @s-ui/jest --save-dev +``` diff --git a/packages/sui-jest/bin/config.js b/packages/sui-jest/bin/config.js new file mode 100644 index 000000000..da7374f58 --- /dev/null +++ b/packages/sui-jest/bin/config.js @@ -0,0 +1,4 @@ +// TODO: add sui jest common config +const jestConfig = {} + +module.exports = jestConfig diff --git a/packages/sui-jest/bin/sui-jest.js b/packages/sui-jest/bin/sui-jest.js new file mode 100755 index 000000000..b5a45fd54 --- /dev/null +++ b/packages/sui-jest/bin/sui-jest.js @@ -0,0 +1,14 @@ +#!/usr/bin/env node +const {hasFile} = require('./utils.js') + +process.env.BABEL_ENV = 'test' +process.env.NODE_ENV = 'test' + +const args = process.argv.slice(2) + +const config = + !args.includes('--config') && !hasFile('jest.config.js') + ? ['--config', JSON.stringify(require('./config.js'))] + : [] + +require('jest').run([...config, ...args]) diff --git a/packages/sui-jest/bin/utils.js b/packages/sui-jest/bin/utils.js new file mode 100644 index 000000000..4d515fdda --- /dev/null +++ b/packages/sui-jest/bin/utils.js @@ -0,0 +1,19 @@ +const path = require('path') +const fs = require('fs') +const readPkgUp = require('read-pkg-up') + +const {path: pkgPath} = readPkgUp.sync({ + cwd: fs.realpathSync(process.cwd()) +}) + +const appDirectory = path.dirname(pkgPath) + +const fromRoot = (...p) => path.join(appDirectory, ...p) + +const hasFile = (...p) => fs.existsSync(fromRoot(...p)) + +module.exports = { + appDirectory, + fromRoot, + hasFile +} diff --git a/packages/sui-jest/package.json b/packages/sui-jest/package.json new file mode 100644 index 000000000..a263d15ab --- /dev/null +++ b/packages/sui-jest/package.json @@ -0,0 +1,29 @@ +{ + "name": "@s-ui/jest", + "version": "1.0.0", + "description": "jest wrapper", + "bin": { + "sui-jest": "bin/sui-jest.js" + }, + "files": [ + "/bin" + ], + "keywords": [], + "author": "", + "license": "MIT", + "dependencies": { + "@swc/jest": "0.2.24", + "@types/jest": "29.2.4", + "jest": "29.3.1", + "jest-environment-jsdom": "29.3.1", + "read-pkg-up": "7.0.1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/SUI-Components/sui.git" + }, + "bugs": { + "url": "https://github.com/SUI-Components/sui/issues" + }, + "homepage": "https://github.com/SUI-Components/sui/tree/master/packages/sui-mock-provider#readme" +} From edbeccdab0e585a198e758636b2b194e27b90f4c Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 7 Jun 2023 11:22:31 +0200 Subject: [PATCH 55/76] chore(packages/sui-jest): update homepage url --- package.json | 2 +- packages/sui-jest/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e41587415..f0951fa56 100644 --- a/package.json +++ b/package.json @@ -79,4 +79,4 @@ "stylelint": { "extends": "./node_modules/@s-ui/lint/stylelint.config.js" } -} +} \ No newline at end of file diff --git a/packages/sui-jest/package.json b/packages/sui-jest/package.json index a263d15ab..a15611c61 100644 --- a/packages/sui-jest/package.json +++ b/packages/sui-jest/package.json @@ -25,5 +25,5 @@ "bugs": { "url": "https://github.com/SUI-Components/sui/issues" }, - "homepage": "https://github.com/SUI-Components/sui/tree/master/packages/sui-mock-provider#readme" + "homepage": "https://github.com/SUI-Components/sui/tree/master/packages/sui-jest#readme" } From 8b99407fe8373d223908a135289967aed9df770b Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 7 Jun 2023 12:00:37 +0200 Subject: [PATCH 56/76] chore(packages/sui-jest): improve package description --- packages/sui-jest/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-jest/package.json b/packages/sui-jest/package.json index a15611c61..2e10079ae 100644 --- a/packages/sui-jest/package.json +++ b/packages/sui-jest/package.json @@ -1,7 +1,7 @@ { "name": "@s-ui/jest", "version": "1.0.0", - "description": "jest wrapper", + "description": "CLI that abstracts from jest", "bin": { "sui-jest": "bin/sui-jest.js" }, From 46ea335150a328726393c8741ff1a4fb58b1acd6 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 7 Jun 2023 12:01:26 +0200 Subject: [PATCH 57/76] docs(packages/sui-jest): add basic usage and config description --- packages/sui-jest/README.md | 65 +++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/packages/sui-jest/README.md b/packages/sui-jest/README.md index 4007523f0..ee256d246 100644 --- a/packages/sui-jest/README.md +++ b/packages/sui-jest/README.md @@ -1,9 +1,70 @@ # sui-jest -It is mainly a wrapper around [Jest](https://jestjs.io/). +This is a CLI that abstracts away all configuration for [Jest](https://jestjs.io/). ## Installation ```sh -npm install @s-ui/jest --save-dev +npm install -D @s-ui/jest ``` + +## Usage + +This CLI exposes a bin called `sui-jest` with all options that [Jest CLI Options](https://jestjs.io/docs/cli) supports. + +**From node** + +```sh +node ./node_modules/.bin/sui-jest [Jest CLI Options] +``` + +**From npm script** + +```json +// package.json +{ + scripts: { + "test:jest": "sui-jest", + } +} +``` +```sh +npm run test:jest -- [Jest CLI Options] +``` + +### Overriding Config + +`sui-jest` allows you to specify your own configuration. There are various ways that it works, but basically if you want to have your own config for something, just add the configuration and `sui-jest` will use that instead of it's own internal config. + +**Specific** + +Add the `config` flag with the specific jest config file path. + +```sh +node ./node_modules/.bin/sui-jest --config .jest.config.[*] +``` + +**Automatic** + +Create a `jest.config.[*]` config file in your root project or within the `packages/*`, and `sui-jest` will use the jest config file closest to where it has been executed. + +```js +// jest.config.js + +module.exports = { + testEnvironment: 'jsdom', + testMatch: ['**/__tests__/**/*.test.js'], + // ... +} +``` + +*In construction* + +In addition, `sui-jest` will expose its basic configuration so you can use it and override only the parts of the config you need to. + + +## Inspiration + +This is inspired by [kcd-scripts](https://github.com/kentcdodds/kcd-scripts). + + From 4a0050dfdf6d21ee8042d437fd4e0a737c47cc99 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 7 Jun 2023 12:07:00 +0200 Subject: [PATCH 58/76] chore(packages/sui-jest): modify package description --- packages/sui-jest/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-jest/package.json b/packages/sui-jest/package.json index 2e10079ae..152586e5b 100644 --- a/packages/sui-jest/package.json +++ b/packages/sui-jest/package.json @@ -1,7 +1,7 @@ { "name": "@s-ui/jest", "version": "1.0.0", - "description": "CLI that abstracts from jest", + "description": "CLI that abstracts away all configuration for Jest", "bin": { "sui-jest": "bin/sui-jest.js" }, From 17893520ca286f8d9c5a9bc274e0d0d099f3b261 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 7 Jun 2023 12:10:57 +0200 Subject: [PATCH 59/76] feat(packages/sui-test): remove jest since it has been moved to a new package --- packages/sui-test/bin/jest/config.js | 4 ---- packages/sui-test/bin/jest/utils.js | 19 ------------------- packages/sui-test/bin/sui-test-jest.js | 14 -------------- packages/sui-test/bin/sui-test.js | 2 -- packages/sui-test/package.json | 7 +------ 5 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 packages/sui-test/bin/jest/config.js delete mode 100644 packages/sui-test/bin/jest/utils.js delete mode 100755 packages/sui-test/bin/sui-test-jest.js diff --git a/packages/sui-test/bin/jest/config.js b/packages/sui-test/bin/jest/config.js deleted file mode 100644 index da7374f58..000000000 --- a/packages/sui-test/bin/jest/config.js +++ /dev/null @@ -1,4 +0,0 @@ -// TODO: add sui jest common config -const jestConfig = {} - -module.exports = jestConfig diff --git a/packages/sui-test/bin/jest/utils.js b/packages/sui-test/bin/jest/utils.js deleted file mode 100644 index 4d515fdda..000000000 --- a/packages/sui-test/bin/jest/utils.js +++ /dev/null @@ -1,19 +0,0 @@ -const path = require('path') -const fs = require('fs') -const readPkgUp = require('read-pkg-up') - -const {path: pkgPath} = readPkgUp.sync({ - cwd: fs.realpathSync(process.cwd()) -}) - -const appDirectory = path.dirname(pkgPath) - -const fromRoot = (...p) => path.join(appDirectory, ...p) - -const hasFile = (...p) => fs.existsSync(fromRoot(...p)) - -module.exports = { - appDirectory, - fromRoot, - hasFile -} diff --git a/packages/sui-test/bin/sui-test-jest.js b/packages/sui-test/bin/sui-test-jest.js deleted file mode 100755 index c8a1288f0..000000000 --- a/packages/sui-test/bin/sui-test-jest.js +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env node -const {hasFile} = require('./jest/utils.js') - -process.env.BABEL_ENV = 'test' -process.env.NODE_ENV = 'test' - -const args = process.argv.slice(2) - -const config = - !args.includes('--config') && !hasFile('jest.config.js') - ? ['--config', JSON.stringify(require('./jest/config.js'))] - : [] - -require('jest').run([...config, ...args]) diff --git a/packages/sui-test/bin/sui-test.js b/packages/sui-test/bin/sui-test.js index b908b0248..44a975b0a 100755 --- a/packages/sui-test/bin/sui-test.js +++ b/packages/sui-test/bin/sui-test.js @@ -10,6 +10,4 @@ program.command('browser', 'Run tests in the browser').alias('b') program.command('server', 'Run tests in node').alias('s') -program.command('jest', 'Run tests with jest').alias('j') - program.parse(process.argv) diff --git a/packages/sui-test/package.json b/packages/sui-test/package.json index 0f48cd870..fb6fea183 100644 --- a/packages/sui-test/package.json +++ b/packages/sui-test/package.json @@ -23,15 +23,11 @@ "@babel/plugin-transform-modules-commonjs": "7.18.6", "@babel/register": "7.18.9", "@s-ui/helpers": "1", - "@swc/jest": "0.2.24", - "@types/jest": "29.2.4", "babel-loader": "8.2.5", "babel-plugin-dynamic-import-node": "2.3.3", "babel-plugin-istanbul": "6.0.0", "babel-preset-sui": "3", "commander": "8.3.0", - "jest": "29.3.1", - "jest-environment-jsdom": "29.3.1", "karma": "6.4.0", "karma-chrome-launcher": "3.1.1", "karma-coverage": "2.2.0", @@ -41,10 +37,9 @@ "karma-webpack": "5.0.0", "mocha": "10.0.0", "process": "0.11.10", - "read-pkg-up": "7.0.1", "stream-browserify": "3.0.0", "tty-browserify": "0.0.1", "util": "0.12.4", "webpack": "5.74.0" } -} \ No newline at end of file +} From a5fa72a1b5229993dd5908707f579a6ae5b10667 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Wed, 7 Jun 2023 12:18:08 +0200 Subject: [PATCH 60/76] docs(packages/sui-jest): update specific config option --- packages/sui-jest/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sui-jest/README.md b/packages/sui-jest/README.md index ee256d246..ac3f65755 100644 --- a/packages/sui-jest/README.md +++ b/packages/sui-jest/README.md @@ -34,14 +34,14 @@ npm run test:jest -- [Jest CLI Options] ### Overriding Config -`sui-jest` allows you to specify your own configuration. There are various ways that it works, but basically if you want to have your own config for something, just add the configuration and `sui-jest` will use that instead of it's own internal config. +`sui-jest` allows you to specify your own configuration. There are various ways that it works, but basically if you want to have your own config for something, just add the configuration and `sui-jest` will use it instead of its own internal config. **Specific** -Add the `config` flag with the specific jest config file path. +From CLI using the `--config` flag with the path of the specific jest config file. ```sh -node ./node_modules/.bin/sui-jest --config .jest.config.[*] +node ./node_modules/.bin/sui-jest --config jest.config.[*] ``` **Automatic** From c7f672146e5077ab49abee3bb1b1dab8e4a25f7f Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Thu, 8 Jun 2023 08:06:59 +0200 Subject: [PATCH 61/76] chore(packages/sui-js-compiler): apply format --- packages/sui-js-compiler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-js-compiler/package.json b/packages/sui-js-compiler/package.json index 89f986d61..cba7bf2c5 100644 --- a/packages/sui-js-compiler/package.json +++ b/packages/sui-js-compiler/package.json @@ -19,4 +19,4 @@ "fs-extra": "10.1.0", "typescript": "5.0.4" } -} \ No newline at end of file +} From da1b99a5210fefd972eeab425be607dbc85db896 Mon Sep 17 00:00:00 2001 From: Giorgio de la Barrera Date: Thu, 8 Jun 2023 08:13:51 +0200 Subject: [PATCH 62/76] docs(Root): add sui-jest for available packages --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 21a22c5ce..2dfc8ba13 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ SUI is a set of packages which goal to ease development of SUI-based components | [sui-helpers](./packages/sui-helpers) | A set of internal helpers used by sui-related packages. | | [sui-hoc](./packages/sui-hoc) | React utility belt for function components and higher-order components | | [sui-i18n](./packages/sui-i18n) | Isomorphic i18n service for browser and node | +| [sui-jest](./packages/sui-jest) | CLI to work with Jest | | [sui-js](./packages/sui-js) | Javascript utilities | | [sui-js-compiler](./packages/sui-js-compiler) | Javascript compiler | | [sui-lint](./packages/sui-lint) | CLI to lint your code and make it compliant to SUI official rules | From df148e5f86429baa424d5a082937b2e53fe0e5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alvarez=20Sordo?= Date: Thu, 8 Jun 2023 08:31:40 +0200 Subject: [PATCH 63/76] feat(packages/sui-lint): remove comment --- packages/sui-lint/eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-lint/eslintrc.js b/packages/sui-lint/eslintrc.js index ceeb38e16..31f5cede9 100644 --- a/packages/sui-lint/eslintrc.js +++ b/packages/sui-lint/eslintrc.js @@ -224,7 +224,7 @@ module.exports = { { files: ['**/__tests__/**/*.js'], rules: { - 'react/display-name': RULES.OFF // we don't need a display name in test files + 'react/display-name': RULES.OFF } } ] From bf530911331d5f17c573cd9a24e195191176f3eb Mon Sep 17 00:00:00 2001 From: "jordi.munoz@adevinta.com" Date: Fri, 9 Jun 2023 12:16:31 +0200 Subject: [PATCH 64/76] feat(packages/sui-mono): upgrade git-url-parse dependency to major 13 --- packages/sui-mono/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-mono/package.json b/packages/sui-mono/package.json index b842ba482..d8c127860 100644 --- a/packages/sui-mono/package.json +++ b/packages/sui-mono/package.json @@ -12,7 +12,7 @@ "commander": "8.3.0", "conventional-changelog": "3.1.25", "enquirer": "2.3.6", - "git-url-parse": "12.0.0", + "git-url-parse": "13.0.0", "glob": "8.0.3", "word-wrap": "1.2.3" }, From f261932c3029848f62e1f726fe5b7e0e8a5ab2db Mon Sep 17 00:00:00 2001 From: sui-bot Date: Fri, 9 Jun 2023 11:08:42 +0000 Subject: [PATCH 65/76] release(packages/sui-mono): v2.35.0 [skip ci] --- packages/sui-mono/CHANGELOG.md | 9 +++++++++ packages/sui-mono/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/sui-mono/CHANGELOG.md b/packages/sui-mono/CHANGELOG.md index 794d94442..d45cfd9a9 100644 --- a/packages/sui-mono/CHANGELOG.md +++ b/packages/sui-mono/CHANGELOG.md @@ -1,5 +1,14 @@ # CHANGELOG +# 2.35.0 (2023-06-09) + + +### Features + +* **packages/sui-mono:** upgrade git-url-parse dependency to major 13 ([bf53091](https://github.com/SUI-Components/sui/commit/bf530911331d5f17c573cd9a24e195191176f3eb)) + + + # 2.34.0 (2022-10-05) diff --git a/packages/sui-mono/package.json b/packages/sui-mono/package.json index d8c127860..617448607 100644 --- a/packages/sui-mono/package.json +++ b/packages/sui-mono/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/mono", - "version": "2.34.0", + "version": "2.35.0", "description": "Commit and release manager", "main": "index.js", "bin": { From 879f30d6e5bd21ee246ad3d63ebe79930981cd86 Mon Sep 17 00:00:00 2001 From: sui-bot Date: Mon, 12 Jun 2023 06:12:45 +0000 Subject: [PATCH 66/76] release(packages/sui-jest): v1.1.0 [skip ci] --- packages/sui-jest/CHANGELOG.md | 10 ++++++++++ packages/sui-jest/package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/sui-jest/CHANGELOG.md b/packages/sui-jest/CHANGELOG.md index a0cf709bc..e099ccf43 100644 --- a/packages/sui-jest/CHANGELOG.md +++ b/packages/sui-jest/CHANGELOG.md @@ -1 +1,11 @@ # CHANGELOG + +# 1.1.0 (2023-06-12) + + +### Features + +* **packages/sui-jest:** add wrapper for jest ([f15be4c](https://github.com/SUI-Components/sui/commit/f15be4c48d8b1ade07a407c0781c79b181b4a52b)) + + + diff --git a/packages/sui-jest/package.json b/packages/sui-jest/package.json index 152586e5b..fd7cf7240 100644 --- a/packages/sui-jest/package.json +++ b/packages/sui-jest/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/jest", - "version": "1.0.0", + "version": "1.1.0", "description": "CLI that abstracts away all configuration for Jest", "bin": { "sui-jest": "bin/sui-jest.js" From 29202e4b03c19c9c405d5b697d3da5c8b914b64a Mon Sep 17 00:00:00 2001 From: sui-bot Date: Mon, 12 Jun 2023 06:12:52 +0000 Subject: [PATCH 67/76] release(packages/sui-js-compiler): v1.24.0 [skip ci] --- packages/sui-js-compiler/CHANGELOG.md | 6 ++++++ packages/sui-js-compiler/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/sui-js-compiler/CHANGELOG.md b/packages/sui-js-compiler/CHANGELOG.md index 4739b05b9..aff24ab82 100644 --- a/packages/sui-js-compiler/CHANGELOG.md +++ b/packages/sui-js-compiler/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +# 1.24.0 (2023-06-12) + + + # 1.23.0 (2023-05-25) @@ -25,8 +29,10 @@ ### Features * **packages/sui-js-compiler:** add legacy option ([b4d234e](https://github.com/SUI-Components/sui/commit/b4d234e980492de24d6bb30450c7586ab64a9cc0)) +* **packages/sui-js-compiler:** add new test folder to ignore ([113e481](https://github.com/SUI-Components/sui/commit/113e4810e32f6e8a32869489dce966907e932fa8)) * **packages/sui-js-compiler:** change to modern option ([86101a6](https://github.com/SUI-Components/sui/commit/86101a63560f3f818f9f64f8821ad48933360db4)) * **packages/sui-js-compiler:** set typescript support from tsconfig ([78a155c](https://github.com/SUI-Components/sui/commit/78a155cdde96f52b5bec9c1ebb1c11469a7f2923)) +* **packages/sui-js-compiler:** use ignore name for destructuring and new test folder ([8e4769e](https://github.com/SUI-Components/sui/commit/8e4769ef056e64c651b14aca35aa4682d04064cd)) diff --git a/packages/sui-js-compiler/package.json b/packages/sui-js-compiler/package.json index cba7bf2c5..aefab147d 100644 --- a/packages/sui-js-compiler/package.json +++ b/packages/sui-js-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/js-compiler", - "version": "1.23.0", + "version": "1.24.0", "description": "JavaScript & TypeScript Compiler", "type": "module", "exports": "./src/index.js", From d1a99f3c4d49287f4645f657a0b01b2453199ee1 Mon Sep 17 00:00:00 2001 From: sui-bot Date: Mon, 12 Jun 2023 06:13:00 +0000 Subject: [PATCH 68/76] release(packages/sui-lint): v4.31.0 [skip ci] --- packages/sui-lint/CHANGELOG.md | 9 +++++++++ packages/sui-lint/package.json | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/sui-lint/CHANGELOG.md b/packages/sui-lint/CHANGELOG.md index 83bf3ccb2..49e9d022d 100644 --- a/packages/sui-lint/CHANGELOG.md +++ b/packages/sui-lint/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +# 4.31.0 (2023-06-12) + + + # 4.30.0 (2023-05-18) @@ -9,6 +13,11 @@ * **packages/sui-lint:** use version 8 for stylelint-config-recommended-scss ([60a1179](https://github.com/SUI-Components/sui/commit/60a1179effcc998e9a5c7fb1ca5b88b1e97fd7bb)) +### Features + +* **packages/sui-lint:** add jest rules ([3e3dcaa](https://github.com/SUI-Components/sui/commit/3e3dcaa24a926be7c462dcb9fcdb00de84c43dce)) + + # 4.29.0 (2022-12-29) diff --git a/packages/sui-lint/package.json b/packages/sui-lint/package.json index d581b9f05..26e70e9bc 100644 --- a/packages/sui-lint/package.json +++ b/packages/sui-lint/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/lint", - "version": "4.30.0", + "version": "4.31.0", "description": "Linting CLI for sui packages", "main": "./bin/sui-lint.js", "bin": { @@ -42,4 +42,4 @@ "stylelint-config-recommended-scss": "8.0.0", "stylelint-prettier": "2.0.0" } -} \ No newline at end of file +} From 130d67afc1092d2c347f5ed78d6a4f974ea894ff Mon Sep 17 00:00:00 2001 From: sui-bot Date: Mon, 12 Jun 2023 06:13:09 +0000 Subject: [PATCH 69/76] release(packages/sui-test): v8.26.0 [skip ci] --- packages/sui-test/CHANGELOG.md | 4 ++++ packages/sui-test/package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/sui-test/CHANGELOG.md b/packages/sui-test/CHANGELOG.md index 1b5ee6617..d52d098cf 100644 --- a/packages/sui-test/CHANGELOG.md +++ b/packages/sui-test/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +# 8.26.0 (2023-06-12) + + + # 8.25.0 (2023-05-24) diff --git a/packages/sui-test/package.json b/packages/sui-test/package.json index fb6fea183..6859a51c8 100644 --- a/packages/sui-test/package.json +++ b/packages/sui-test/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/test", - "version": "8.25.0", + "version": "8.26.0", "description": "", "bin": { "sui-test": "bin/sui-test.js" From a851c59bc0ef53e466a79a45c250b46ee1a3deb6 Mon Sep 17 00:00:00 2001 From: Javier Auso Date: Mon, 12 Jun 2023 14:12:29 +0200 Subject: [PATCH 70/76] fix(packages/sui-i18n): fix missed key warning when i18n.url --- packages/sui-i18n/src/i18n.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/sui-i18n/src/i18n.js b/packages/sui-i18n/src/i18n.js index 1d836b662..ac2c50547 100644 --- a/packages/sui-i18n/src/i18n.js +++ b/packages/sui-i18n/src/i18n.js @@ -193,6 +193,7 @@ export default class Rosetta { url(urlPattern, allowQueryParams) { return urlPattern .split('/') + .filter(Boolean) .map(token => slugify(this.t(token), allowQueryParams)) .join('/') } From 46957a2bd8a0e229a9f80f85f77536f8daa13c49 Mon Sep 17 00:00:00 2001 From: sui-bot Date: Mon, 12 Jun 2023 13:44:20 +0000 Subject: [PATCH 71/76] release(packages/sui-i18n): v1.33.0 [skip ci] --- packages/sui-i18n/CHANGELOG.md | 9 +++++++++ packages/sui-i18n/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/sui-i18n/CHANGELOG.md b/packages/sui-i18n/CHANGELOG.md index e846be60f..75fbd33ae 100644 --- a/packages/sui-i18n/CHANGELOG.md +++ b/packages/sui-i18n/CHANGELOG.md @@ -1,5 +1,14 @@ # CHANGELOG +# 1.33.0 (2023-06-12) + + +### Bug Fixes + +* **packages/sui-i18n:** fix missed key warning when i18n.url ([a851c59](https://github.com/SUI-Components/sui/commit/a851c59bc0ef53e466a79a45c250b46ee1a3deb6)) + + + # 1.32.0 (2023-03-03) diff --git a/packages/sui-i18n/package.json b/packages/sui-i18n/package.json index 9c0d8f5cc..e3b6cd839 100644 --- a/packages/sui-i18n/package.json +++ b/packages/sui-i18n/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/i18n", - "version": "1.32.0", + "version": "1.33.0", "type": "module", "main": "lib/index.js", "description": "> Isomorphic i18n service for browser and node.", From b8bed2ba10c7708cf7a56c85a60d2cdf02b561db Mon Sep 17 00:00:00 2001 From: sui-bot Date: Tue, 13 Jun 2023 08:12:14 +0000 Subject: [PATCH 72/76] release(packages/sui-lint): v4.32.0 [skip ci] --- packages/sui-lint/CHANGELOG.md | 10 ++++++++++ packages/sui-lint/package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/sui-lint/CHANGELOG.md b/packages/sui-lint/CHANGELOG.md index 49e9d022d..798a72637 100644 --- a/packages/sui-lint/CHANGELOG.md +++ b/packages/sui-lint/CHANGELOG.md @@ -1,8 +1,18 @@ # CHANGELOG +# 4.32.0 (2023-06-13) + + + # 4.31.0 (2023-06-12) +### Features + +* **packages/sui-lint:** add jest rules ([0e2f2a2](https://github.com/SUI-Components/sui/commit/0e2f2a2e9274c7bb7d5e875c5ee029dc0460743f)) +* **packages/sui-lint:** remove comment ([df148e5](https://github.com/SUI-Components/sui/commit/df148e5f86429baa424d5a082937b2e53fe0e5b9)) + + # 4.30.0 (2023-05-18) diff --git a/packages/sui-lint/package.json b/packages/sui-lint/package.json index 293f8a1db..17f1b2317 100644 --- a/packages/sui-lint/package.json +++ b/packages/sui-lint/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/lint", - "version": "4.31.0", + "version": "4.32.0", "description": "Linting CLI for sui packages", "main": "./bin/sui-lint.js", "bin": { From 316c987e3b5c06a068e0edf493520c139b07cdfa Mon Sep 17 00:00:00 2001 From: Javier Auso Date: Tue, 13 Jun 2023 11:03:22 +0200 Subject: [PATCH 73/76] fix(packages/sui-i18n): restore slash when token is validated in i18n.url --- packages/sui-i18n/src/i18n.js | 3 +-- packages/sui-i18n/test/fixtures/languages.js | 12 +++++++++--- packages/sui-i18n/test/i18nSpec.js | 6 ++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/sui-i18n/src/i18n.js b/packages/sui-i18n/src/i18n.js index ac2c50547..a81657c25 100644 --- a/packages/sui-i18n/src/i18n.js +++ b/packages/sui-i18n/src/i18n.js @@ -193,8 +193,7 @@ export default class Rosetta { url(urlPattern, allowQueryParams) { return urlPattern .split('/') - .filter(Boolean) - .map(token => slugify(this.t(token), allowQueryParams)) + .map(token => token && slugify(this.t(token), allowQueryParams)) .join('/') } diff --git a/packages/sui-i18n/test/fixtures/languages.js b/packages/sui-i18n/test/fixtures/languages.js index 9573291c2..a3592b431 100644 --- a/packages/sui-i18n/test/fixtures/languages.js +++ b/packages/sui-i18n/test/fixtures/languages.js @@ -1,15 +1,21 @@ export const LANGUAGES = { 'es-ES': { literalOne: 'TranslateOneEsES', - withPlural: 'uno |||| varios' + withPlural: 'uno |||| varios', + profilePathSegment: 'mi-perfil', + privacyPathSegment: 'privacidad' }, 'en-GB': { literalOne: 'TranslateOneEnGB', - withPlural: 'one |||| many' + withPlural: 'one |||| many', + profilePathSegment: 'my-profile', + privacyPathSegment: 'privacy' }, 'ca-ES': { literalOne: 'TranslateOneCaES', - withPlural: 'un |||| varis' + withPlural: 'un |||| varis', + profilePathSegment: 'meu-perfil', + privacyPathSegment: 'privacitat' } } diff --git a/packages/sui-i18n/test/i18nSpec.js b/packages/sui-i18n/test/i18nSpec.js index 0fe0643a4..cab34e50c 100644 --- a/packages/sui-i18n/test/i18nSpec.js +++ b/packages/sui-i18n/test/i18nSpec.js @@ -79,6 +79,12 @@ describe('I18N', () => { expect(i18n.n(1000000)).to.eql('1,000,000') }) + it('generate url properly', () => { + expect(i18n.url('/profilePathSegment/privacyPathSegment')).to.eql( + '/my-profile/privacy' + ) + }) + describe('with pound sterling (GBP) as currency type', () => { beforeEach(() => { i18n.currency = 'GBP' From eb9cc8d17b350b6fed55f81fc989309988d78551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alvarez=20Sordo?= Date: Tue, 13 Jun 2023 11:40:05 +0200 Subject: [PATCH 74/76] fix(packages/sui-lint): update jest rules --- packages/sui-lint/eslintrc.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/sui-lint/eslintrc.js b/packages/sui-lint/eslintrc.js index 31f5cede9..bf62bca3b 100644 --- a/packages/sui-lint/eslintrc.js +++ b/packages/sui-lint/eslintrc.js @@ -41,7 +41,11 @@ const TESTING_RULES = { RULES.ERROR, {allowShortCircuit: true, allowTernary: true} ], - 'no-only-tests/no-only-tests': RULES.ERROR, + 'no-only-tests/no-only-tests': RULES.ERROR +} + +const JEST_TESTING_RULES = { + 'react/display-name': RULES.OFF, 'jest/consistent-test-it': RULES.OFF, 'jest/expect-expect': RULES.OFF, 'jest/max-expects': RULES.OFF, @@ -223,9 +227,7 @@ module.exports = { }, { files: ['**/__tests__/**/*.js'], - rules: { - 'react/display-name': RULES.OFF - } + rules: JEST_TESTING_RULES } ] } From f8e57a127503d941902e73b7c0476a98cd1aeffb Mon Sep 17 00:00:00 2001 From: sui-bot Date: Tue, 13 Jun 2023 09:51:53 +0000 Subject: [PATCH 75/76] release(packages/sui-lint): v4.33.0 [skip ci] --- packages/sui-lint/CHANGELOG.md | 9 +++++++++ packages/sui-lint/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/sui-lint/CHANGELOG.md b/packages/sui-lint/CHANGELOG.md index 798a72637..7c2270d9d 100644 --- a/packages/sui-lint/CHANGELOG.md +++ b/packages/sui-lint/CHANGELOG.md @@ -1,5 +1,14 @@ # CHANGELOG +# 4.33.0 (2023-06-13) + + +### Bug Fixes + +* **packages/sui-lint:** update jest rules ([eb9cc8d](https://github.com/SUI-Components/sui/commit/eb9cc8d17b350b6fed55f81fc989309988d78551)) + + + # 4.32.0 (2023-06-13) diff --git a/packages/sui-lint/package.json b/packages/sui-lint/package.json index 17f1b2317..3023e77a1 100644 --- a/packages/sui-lint/package.json +++ b/packages/sui-lint/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/lint", - "version": "4.32.0", + "version": "4.33.0", "description": "Linting CLI for sui packages", "main": "./bin/sui-lint.js", "bin": { From 6854f78a986b12a26c65da542bf2f2ed94cd8d53 Mon Sep 17 00:00:00 2001 From: sui-bot Date: Tue, 13 Jun 2023 11:16:41 +0000 Subject: [PATCH 76/76] release(packages/sui-i18n): v1.34.0 [skip ci] --- packages/sui-i18n/CHANGELOG.md | 9 +++++++++ packages/sui-i18n/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/sui-i18n/CHANGELOG.md b/packages/sui-i18n/CHANGELOG.md index 75fbd33ae..9179f5eae 100644 --- a/packages/sui-i18n/CHANGELOG.md +++ b/packages/sui-i18n/CHANGELOG.md @@ -1,5 +1,14 @@ # CHANGELOG +# 1.34.0 (2023-06-13) + + +### Bug Fixes + +* **packages/sui-i18n:** restore slash when token is validated in i18n.url ([316c987](https://github.com/SUI-Components/sui/commit/316c987e3b5c06a068e0edf493520c139b07cdfa)) + + + # 1.33.0 (2023-06-12) diff --git a/packages/sui-i18n/package.json b/packages/sui-i18n/package.json index e3b6cd839..7a881c98a 100644 --- a/packages/sui-i18n/package.json +++ b/packages/sui-i18n/package.json @@ -1,6 +1,6 @@ { "name": "@s-ui/i18n", - "version": "1.33.0", + "version": "1.34.0", "type": "module", "main": "lib/index.js", "description": "> Isomorphic i18n service for browser and node.",