Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TDOPS-5327): prepare TUI to pnpm and solve some missing deps in packages #4929

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions fork/dynamic-cdn-webpack-plugin/src/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ function findPackagesFromScopeFolder(scope, name, scopeFolderPath) {
// just add the path to the found list
return accu.concat(subFolderPath);
}
// NOT COMPATIBLE WITH PNPM
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not compatible with PNPM, it should be ok to go without it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Not sure of the impact of this change

Copy link
Collaborator

@jmfrancois jmfrancois Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fix, we can't merge that. It was the only way to find all versions of a given modules.
For example if you have prop-types twice and one of them can not be hoisted.
But it is ok to keep the diff to work on the PR

// the scope or package name is not the one we look for
// if there is a nested node modules folder, we dive into it for the search
const nestedNodeModulesPath = path.join(subFolderPath, 'node_modules');
if (fs.existsSync(nestedNodeModulesPath)) {
return accu.concat(
findPackagesFromNonScopeFolder(scope, name, nestedNodeModulesPath, []),
);
// eslint-disable-next-line no-use-before-define
return accu.concat(findPackagesFromNonScopeFolder(scope, name, nestedNodeModulesPath, []));
}
return accu;
}, []);
Expand All @@ -58,25 +58,15 @@ function findPackagesFromNonScopeFolder(scope, name, nonScopeFolderPath) {
// for scope folders, we need a special treatment to avoid getting scoped packages when we don't want a scoped one.
// ex: search for `classnames`, we don't want to find `@types/classnames` in the result
return accu.concat(
findPackagesFromScopeFolder(
scope,
name,
path.join(nonScopeFolderPath, subFolder.name),
),
findPackagesFromScopeFolder(scope, name, path.join(nonScopeFolderPath, subFolder.name)),
);
} else if (!scope && subFolder.name === name) {
// we want a NON scoped package, we are in a non scoped folder, and the names match
return accu.concat(path.join(nonScopeFolderPath, subFolder.name));
}
const nestedNodeModulesPath = path.join(
nonScopeFolderPath,
subFolder.name,
'node_modules',
);
const nestedNodeModulesPath = path.join(nonScopeFolderPath, subFolder.name, 'node_modules');
if (fs.existsSync(nestedNodeModulesPath)) {
return accu.concat(
findPackagesFromNonScopeFolder(scope, name, nestedNodeModulesPath),
);
return accu.concat(findPackagesFromNonScopeFolder(scope, name, nestedNodeModulesPath));
}
return accu;
}, []);
Expand Down
12 changes: 4 additions & 8 deletions fork/dynamic-cdn-webpack-plugin/src/find.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ describe('findPackages', () => {
'/node_modules/react/index.js': 'console.log("react");',
'/node_modules/react/package.json': '{"name": "react", "version": "16.14.0"}',
'/node_modules/@types/classnames/index.js': 'console.log("@types/classnames");',
'/node_modules/@talend/react-components/index.js':
'console.log("@talend/react-components");',
'/node_modules/@talend/react-components/node_modules/react/index.js':
'console.log("react");',
'/node_modules/@talend/react-containers/index.js':
'console.log("@talend/react-containers");',
'/node_modules/@talend/react-components/index.js': 'console.log("@talend/react-components");',
'/node_modules/@talend/react-components/node_modules/react/index.js': 'console.log("react");',
'/node_modules/@talend/react-containers/index.js': 'console.log("@talend/react-containers");',
};

beforeEach(() => {
Expand All @@ -35,9 +32,8 @@ describe('findPackages', () => {
const result = findPackages(undefined, 'react');

// then
expect(result.length).toBe(2);
expect(result.length).toBe(1);
expect(result[0]).toBe('/node_modules/react');
expect(result[1]).toBe('/node_modules/@talend/react-components/node_modules/react');
});

test('should find non scoped package', () => {
Expand Down
4 changes: 1 addition & 3 deletions fork/module-to-cdn/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{
"extends": "../../node_modules/@talend/scripts-config-babel/.babelrc.json"
}
{}
3 changes: 1 addition & 2 deletions fork/module-to-cdn/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"root": true,
"extends": "@talend"
"root": true
}
2 changes: 1 addition & 1 deletion fork/module-to-cdn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"scripts": {
"test": "jest index.test.js",
"test:cron": "jest modules.test.js",
"lint": "talend-scripts lint ./"
"lint": "echo \"Not possible to use talend-scripts here (risk of circular dependency)\" && exit 0"
},
"files": [
"index.js",
Expand Down
2 changes: 1 addition & 1 deletion fork/react-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"devDependencies": {
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
"@talend/scripts-config-react-webpack": "^16.1.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^13.5.0",
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
{
"devDependencies": {
"@changesets/cli": "^2.26.2",
"cross-env": "^7.0.3",
"cross-spawn": "^7.0.3",
"eslint": "^7.32.0",
"husky": "^8.0.3",
"i18next-scanner": "^4.4.0",
"lint-staged": "^13.3.0",
"prettier": "^2.8.8"
},
"scripts": {
"postinstall": "talend-yarn-workspace run build:lib",
"pre-release": "talend-yarn-workspace run pre-release",
Expand Down Expand Up @@ -57,9 +47,19 @@
"prettier --write"
]
},
"dependencies": {
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@talend/scripts-config-prettier": "^12.0.0",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.20",
"cross-env": "^7.0.3",
"cross-spawn": "^7.0.3",
"eslint": "^7.32.0",
"husky": "^8.0.3",
"i18next-scanner": "^4.4.0",
"lint-staged": "^13.3.0",
"prettier": "^3.0.3",
"rimraf": "^3.0.2",
"terser-webpack-plugin": "^5.3.9",
"typescript": "^5.0.4",
"webpack": "^5.73.0"
Expand Down
2 changes: 2 additions & 0 deletions packages/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
},
"devDependencies": {
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-prettier": "^12.0.0",
"@talend/scripts-config-typescript": "^11.1.0",
"@testing-library/react": "^12.1.5",
"react": "^17.0.2",
"react-dom": "^17.0.2"
Expand Down
4 changes: 4 additions & 0 deletions packages/assets-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
},
"dependencies": {},
"devDependencies": {
"@talend/babel-plugin-import-from-index": "^1.5.1",
"@talend/icons": "^6.60.1",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-babel": "^13.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
"@talend/scripts-config-typescript": "^11.1.0",
"read-pkg-up": "^7.0.1"
},
"publishConfig": {
Expand Down
5 changes: 3 additions & 2 deletions packages/assets-api/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ describe('assets-api', () => {
it('should prevent // as start url', () => {
const original = window.Talend.CDN_URL;
window.Talend.CDN_URL = '/cdn';
const mockedBaseElement = { getAttribute: jest.fn().mockReturnValueOnce('/') };
// @ts-ignore
const mockedBaseElement = {
getAttribute: jest.fn().mockReturnValueOnce('/'),
} as unknown as Element;
jest.spyOn(document, 'querySelector').mockImplementation(() => mockedBaseElement);
const url = assetsApi.getURL(bundlePath, '@talend/icons', iconsInfo?.packageJson.version);
expect(url).toBe(`/cdn/@talend/icons/${iconsInfo?.packageJson.version}${bundlePath}`);
Expand Down
5 changes: 3 additions & 2 deletions packages/cmf-cqrs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@
"homepage": "https://github.com/Talend/ui/cmf-cqrs#readme",
"dependencies": {
"@talend/react-cmf": "^7.3.0",
"@talend/utils": "2.6.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:o

"@talend/utils": "^2.6.0",
"immutable": "^3.8.2",
"redux-saga": "^1.2.3"
},
"devDependencies": {
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
"@talend/scripts-config-react-webpack": "^16.1.0",
"@talend/scripts-config-typescript": "^11.1.0",
"@testing-library/react-hooks": "^8.0.1",
"mock-socket": "^9.3.1",
"prop-types": "^15.8.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cmf-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"devDependencies": {
"@redux-saga/testing-utils": "^1.1.5",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
"@talend/scripts-config-react-webpack": "^16.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"redux-saga-tester": "^1.0.874"
Expand Down
2 changes: 1 addition & 1 deletion packages/cmf/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const defaults = require('../../node_modules/@talend/scripts-config-jest/jest.config.js');
const defaults = require('@talend/scripts-config-jest/jest.config.js');

module.exports = {
...defaults,
Expand Down
3 changes: 2 additions & 1 deletion packages/cmf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"devDependencies": {
"@redux-saga/testing-utils": "^1.1.5",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
"@talend/scripts-config-jest": "^12.2.0",
"@talend/scripts-config-react-webpack": "^16.1.0",
"@testing-library/react": "^12.1.5",
"jest-in-case": "^1.0.2",
"jsdoc": "^3.6.11",
Expand Down
5 changes: 4 additions & 1 deletion packages/cmf/src/reduxstorage/reduxLocalStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import createEngine from 'redux-storage-engine-localstorage';
import filter from 'redux-storage-decorator-filter';
import immutablejs from './redux-storage-decorator-immutablejs';

const CMF_IMMUTABLE_PATHS = [['cmf', 'components'], ['cmf', 'collections']];
const CMF_IMMUTABLE_PATHS = [
['cmf', 'components'],
['cmf', 'collections'],
];

const CMF_MIDDLEWARE_BLACK_LIST = ['@@INIT', '@@router/LOCATION_CHANGE'];

Expand Down
3 changes: 3 additions & 0 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
},
"dependencies": {
"@popperjs/core": "^2.11.8",
"@talend/assets-api": "^1.2.2",
"@talend/bootstrap-theme": "^8.2.0",
"@talend/design-tokens": "^2.9.0",
"@talend/react-a11y": "^1.1.0",
Expand Down Expand Up @@ -74,8 +75,10 @@
"@talend/icons": "^6.60.1",
"@talend/locales-design-system": "^7.3.0",
"@talend/locales-tui-components": "^9.5.0",
"@talend/scripts-config-stylelint": "^4.0.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not part of core but it should, so not here

"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-react-webpack": "^16.1.0",
"@talend/scripts-config-typescript": "^11.1.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is already part of scripts core.

"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^13.5.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/containers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"url": "https://github.com/Talend/ui.git"
},
"dependencies": {
"@talend/design-system": "^7.15.1",
"@talend/react-bootstrap": "^1.35.2",
"@talend/react-cmf": "^7.3.0",
"@talend/react-components": "^11.4.0",
Expand All @@ -50,12 +51,12 @@
},
"devDependencies": {
"@storybook/addon-actions": "^7.4.1",
"@talend/bootstrap-theme": "^8.1.3",
"@talend/bootstrap-theme": "^8.2.0",
"@talend/icons": "^6.60.1",
"@talend/locales-tui-containers": "^8.0.2",
"@talend/react-storybook-cmf": "^7.2.0",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
"@talend/scripts-config-react-webpack": "^16.1.0",
"i18next": "^20.6.1",
"jest-in-case": "^1.0.2",
"prop-types": "^15.8.1",
Expand Down
6 changes: 4 additions & 2 deletions packages/dataviz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@
"devDependencies": {
"@cypress/react": "^7.0.3",
"@cypress/webpack-dev-server": "^3.6.1",
"@talend/bootstrap-theme": "^8.1.3",
"@talend/bootstrap-theme": "^8.2.0",
"@talend/design-system": "^7.15.1",
"@talend/icons": "^6.60.1",
"@talend/locales-tui-components": "^9.5.0",
"@talend/locales-tui-dataviz": "^0.4.6",
"@talend/react-components": "^11.4.0",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
"@talend/scripts-config-react-webpack": "^16.1.0",
"@talend/scripts-config-typescript": "^11.1.0",
"@testing-library/react": "^12.1.5",
"@types/classnames": "^2.3.1",
"@types/d3": "^7.4.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/dataviz/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

"rootDirs": ["cypress", "@testing-library/cypress", "src"],
"target": "es5",
"lib": ["es5", "dom"],
"lib": ["es6", "dom", "ES2017"],
"types": ["cypress", "node"]
}
}
30 changes: 16 additions & 14 deletions packages/design-docs/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import path from 'path';
import { packageDirectorySync } from 'pkg-dir';

const iconConfig = require('@talend/icons/.storybook/main.js');
const rootPath = require.resolve('@talend/design-docs').replace('src/index.ts', '');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@talend/design-docs should not depends on itself

const rootPath = packageDirectorySync();
const {
getJSAndTSLoader,
} = require('@talend/scripts-config-react-webpack/config/webpack.config.common');
Expand All @@ -11,19 +13,19 @@ const monoRepoFixSourceMap = ['./src', '../design-system/src'];
const srcDirectories = monoRepoFixSourceMap.map(src => path.resolve(process.cwd(), src));

const STORIES = [
`${rootPath}src/Welcome.mdx`,
`${rootPath}src/GettingStarted.mdx`,
`${rootPath}src/Principles.mdx`,
`${rootPath}src/Statuses.mdx`,
// `${rootPath}src/Catalog.mdx`,
`${rootPath}src/content/VoiceAndTone.@(js|tsx|mdx)`,
`${rootPath}src/content/Internationalization.@(js|tsx|mdx)`,
`${rootPath}src/content/Conventions.@(js|tsx|mdx)`,
`${rootPath}src/content/Capitalization.@(js|tsx|mdx)`,
`${rootPath}src/content/Wording.@(js|tsx|mdx)`,
`${rootPath}src/tokens/**/*.mdx`,
`${rootPath}../design-system/src/stories/**/*.@(stories.tsx|mdx)`,
// `${rootPath}src/components/**/*.@(stories.tsx|mdx)`,
`${rootPath}/src/Welcome.mdx`,
`${rootPath}/src/GettingStarted.mdx`,
`${rootPath}/src/Principles.mdx`,
`${rootPath}/src/Statuses.mdx`,
// `${rootPath}/src/Catalog.mdx`,
`${rootPath}/src/content/VoiceAndTone.@(js|tsx|mdx)`,
`${rootPath}/src/content/Internationalization.@(js|tsx|mdx)`,
`${rootPath}/src/content/Conventions.@(js|tsx|mdx)`,
`${rootPath}/src/content/Capitalization.@(js|tsx|mdx)`,
`${rootPath}/src/content/Wording.@(js|tsx|mdx)`,
`${rootPath}/src/tokens/**/*.mdx`,
`${rootPath}/../design-system/src/stories/**/*.@(stories.tsx|mdx)`,
// `${rootPath}/src/components/**/*.@(stories.tsx|mdx)`,
];

export default {
Expand Down
2 changes: 2 additions & 0 deletions packages/design-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"classnames": "^2.3.1",
"color-contrast-checker": "^2.1.0",
"figma-js": "^1.16.0",
"pkg-dir": "^7.0.0",
"react-hook-form": "^6.15.8",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand All @@ -54,6 +55,7 @@
"@talend/locales-tui-containers": "^8.0.2",
"@talend/locales-tui-faceted-search": "^8.1.2",
"@talend/locales-tui-forms": "^9.0.1",
"@talend/scripts-config-typescript": "^11.1.0",
"@talend/scripts-core": "^15.0.0",
"@types/react": "^17.0.65",
"i18next": "^20.6.1",
Expand Down
6 changes: 4 additions & 2 deletions packages/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@
"@storybook/testing-library": "^0.2.0",
"@storybook/theming": "^7.4.1",
"@svgr/webpack": "^5.5.0",
"@talend/bootstrap-theme": "^8.1.3",
"@talend/bootstrap-theme": "^8.2.0",
"@talend/icons": "^6.60.1",
"@talend/locales-design-system": "^7.3.0",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
"@talend/scripts-config-react-webpack": "^16.1.0",
"@talend/scripts-config-typescript": "^11.1.0",
"@talend/storybook-docs": "^1.2.0",
"@testing-library/cypress": "^9.0.0",
"@types/classnames": "^2.3.1",
"@types/react": "^17.0.65",
Expand Down
5 changes: 4 additions & 1 deletion packages/design-tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
},
"devDependencies": {
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
"@talend/scripts-config-react-webpack": "^16.1.0",
"@talend/scripts-config-typescript": "^11.1.0",
"@talend/babel-plugin-import-from-index": "^1.5.1",
"@talend/babel-plugin-assets-api": "^1.1.0",
"typeface-source-sans-pro": "^1.1.13"
},
"dependencies": {}
Expand Down
Loading
Loading