Skip to content

Commit

Permalink
DRAFT PNPM 5 (more fixes) (#4938)
Browse files Browse the repository at this point in the history
* revert fix of find.js for investigation

* fix issue with dynamic-cdn-webpack-plugin

* fix gha setup-node

* fix gha setup-node

* set hoist to false and solve dependency issues

* more fixes

* add missing deps in packages or add in npmrc when no other choice

* fix babel-plugin-assets-api tests

* chore: pnpm-deduplicate

* fix dynamic-cdn-webpackp-plugin test

* fix dynamic-cdn-webpack-plugin tests

* fix lint

* fix lint 2

* try something with script-yarn-workspace

* oops

* chore: pnpm-deduplicate

* just for the fun

* temporary fix of find.js

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
smouillour and github-actions[bot] authored Oct 19, 2023
1 parent f305cfb commit 813cdca
Show file tree
Hide file tree
Showing 66 changed files with 2,308 additions and 428 deletions.
30 changes: 15 additions & 15 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ secrets:
runs:
using: 'composite'
steps:
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Set up Node.js
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d #v3.8.1
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org/'
scope: '@talend'
cache: 'pnpm'

# - name: Get pnpm cache directory path
# id: pnpm-cache-dir-path
# shell: bash
# run: echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Install PNPM
shell: bash
run: npm install -g [email protected]

- name: Get pnpm cache directory path
id: pnpm-cache-dir-path
shell: bash
run: echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT

# - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2
# id: pnpm-cache # use this to check for `cache-hit` (`steps.pnpm-cache.outputs.cache-hit != 'true'`)
# with:
# path: ${{ steps.pnpm-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
# restore-keys: |
# ${{ runner.os }}-pnpm-
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2
id: pnpm-cache # use this to check for `cache-hit` (`steps.pnpm-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.pnpm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
3 changes: 3 additions & 0 deletions .github/workflows/pr-playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ jobs:
- name: Checkout sources
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0

- name: Use Node.js
uses: ./.github/actions/setup-node

- name: Check UMD files size diff
uses: preactjs/compressed-size-action@8119d3d31b6e57b167e09c81dfa877eada3bcb35 #v2.5.0
if: github.ref != 'refs/heads/master'
Expand Down
50 changes: 43 additions & 7 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,44 @@
#shamefully-hoist=true
#node-linker=hoisted
#symlink=false
prefer-workspace-packages=true
#link-workspace-packages=false
#link-workspace-packages=deep
#strict-peer-dependencies=true
#public-hoist-pattern[]=*storybook*

#https://pnpm.io/blog/2020/10/17/node-modules-configuration-options-with-pnpm#plugnplay-the-strictest-configuration
hoist=false
# hoist-pattern[]=autoprefixer
# hoist-pattern[]=redux-mock-store
#########################################
# WARNGING Add public-hoist-pattern ONLY if you don't have other solution
#########################################

# ES LINT
public-hoist-pattern[]=eslint-plugin-angular
public-hoist-pattern[]=eslint-plugin-cypress
public-hoist-pattern[]=eslint-plugin-import
public-hoist-pattern[]=eslint-plugin-jest-dom
public-hoist-pattern[]=eslint-plugin-jsx-a11y
public-hoist-pattern[]=eslint-plugin-mdx
public-hoist-pattern[]=eslint-plugin-prettier
public-hoist-pattern[]=eslint-plugin-react
public-hoist-pattern[]=eslint-plugin-react-hooks
public-hoist-pattern[]=eslint-plugin-storybook
public-hoist-pattern[]=eslint-plugin-testing-library

# STYLE LINT
public-hoist-pattern[]=postcss-scss
public-hoist-pattern[]=stylelint-config-sass-guidelines
#public-hoist-pattern[]=*eslint*

# JEST
public-hoist-pattern[]=jest-environment-jsdom
public-hoist-pattern[]=jest-environment-jsdom-global
public-hoist-pattern[]=jest-serializer-html

# I18N
public-hoist-pattern[]=i18next
public-hoist-pattern[]=react-i18next

# OTHERS
public-hoist-pattern[]=autoprefixer
public-hoist-pattern[]=redux*
public-hoist-pattern[]=reakit

public-hoist-pattern[]=*types*

4 changes: 3 additions & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
nodejs 20.8.0
nodejs 20.8.1
# asdf plugin-add pnpm
pnpm 8.9.2
1 change: 1 addition & 0 deletions fork/dynamic-cdn-webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"webpack": "^5.88.2"
},
"devDependencies": {
"@babel/polyfill": "^7.8.7",
"all-contributors-cli": "^6.26.1",
"codecov": "^3.8.3",
"html-webpack-plugin": "^5.5.3",
Expand Down
7 changes: 5 additions & 2 deletions fork/dynamic-cdn-webpack-plugin/src/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ function findPackagesFromNonScopeFolder(scope, name, nonScopeFolderPath) {
// TODO NOT COMPATIBLE WITH PNPM WHEN deps is @talend/scripts-...
if (
subFolder.name.startsWith('@') &&
!subFolder?.path?.endsWith('tools/scripts-core/node_modules')
!subFolder?.path?.endsWith('tools/scripts-core/node_modules') &&
!subFolder?.path?.endsWith('@talend/scripts-yarn-workspace/node_modules') &&
!subFolder?.path?.endsWith('tools/eslint-config/node_modules')
) {
// 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
Expand Down Expand Up @@ -86,7 +88,8 @@ function findPackages(scope, name, buff = []) {
const result = buff.concat(
...roots.map(root => findPackagesFromNonScopeFolder(scope, name, root)),
);
return [...new Set(result)];
// return [...new Set(result)];
return result;
}

module.exports = {
Expand Down
3 changes: 1 addition & 2 deletions fork/dynamic-cdn-webpack-plugin/src/find.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ describe('findPackages', () => {
require('fs').__setMockFiles(MOCK_FILE_INFO);
});

test.only('should find root and nested package', () => {
test('should find root and nested package', () => {
// when
const result = findPackages(undefined, 'react');

// then
console.log('LIST OF RESULT: ', result);
expect(result.length).toBe(2);
expect(result[0]).toBe('/node_modules/react');
expect(result[1]).toBe('/node_modules/@talend/react-components/node_modules/react');
Expand Down
4 changes: 1 addition & 3 deletions fork/dynamic-cdn-webpack-plugin/test/core.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ describe('core', () => {
expect(output).toContain('module.exports = React');
const manifest = JSON.parse(
fs
.readFileSync(
path.resolve(__dirname, './fixtures/output/basic/app.js.dependencies.json'),
)
.readFileSync(path.resolve(__dirname, './fixtures/output/basic/app.js.dependencies.json'))
.toString(),
);
expect(manifest.react.peerDependency).toBe('^15.6.1');
Expand Down
2 changes: 2 additions & 0 deletions fork/react-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
"react-dom": ">=16.3.0"
},
"devDependencies": {
"@talend/eslint-config": "^12.1.1",
"@talend/eslint-plugin": "^1.0.1",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-babel": "^13.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
Expand Down
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"@changesets/cli": "^2.26.2",
"@talend/scripts-config-prettier": "^12.0.0",
"@talend/scripts-config-babel": "^13.0.0",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.20",
"@talend/scripts-yarn-workspace": "^1.2.0",
"cross-env": "^7.0.3",
"cross-spawn": "^7.0.3",
"eslint": "^7.32.0",
Expand All @@ -13,20 +12,18 @@
"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"
"typescript": "^5.0.4"
},
"scripts": {
"postinstall": "pnpm --sort -r run build:lib",
"postinstall": "pnpm -r --stream run build:lib",
"pre-release": "pnpm -r run pre-release",
"start": "pnpm --filter @talend/ui-playground run start",
"start-storybook": "pnpm --filter @talend/ui-storybook-one run start",
"release": "pnpm run pre-release && pnpm changeset publish",
"lint-staged": "lint-staged",
"lint": "pnpm -r --no-bail run lint",
"lint-merge-report": "pnpm -r lint-merge-report",
"test": "cross-env TZ=Europe/Paris pnpm -r --no-bail run test",
"lint": "pnpm --stream -r --no-bail run lint",
"lint-merge-report": "talend-yarn-workspace lint-merge-report-pnpm",
"test": "cross-env TZ=Europe/Paris pnpm --stream -r --no-bail run test --silent",
"test:update": "cross-env TZ=Europe/Paris pnpm -r --no-bail run test --silent -u",
"test:cov": "cross-env TZ=Europe/Paris pnpm -r --no-bail run test:cov",
"test:demo": "pnpm -r --no-bail run test:demo",
Expand Down
7 changes: 7 additions & 0 deletions packages/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,18 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"@talend/eslint-config": "^12.1.1",
"@talend/eslint-plugin": "^1.0.1",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-typescript": "^11.1.0",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^13.5.0",
"@types/date-fns": "^0.0.2",
"@types/jest": "^29.5.5",
"@types/react": "^17.0.65",
"@types/react-dom": "^17.0.20",
"date-fns": "^1.30.1",
"jest-in-case": "^1.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/a11y/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["src/**/*.test.*", "src/**/*.stories.*", "stories"]
}
2 changes: 2 additions & 0 deletions packages/assets-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"dependencies": {},
"devDependencies": {
"@talend/babel-plugin-import-from-index": "^1.5.1",
"@talend/eslint-config": "^12.1.1",
"@talend/eslint-plugin": "^1.0.1",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
"@talend/scripts-config-typescript": "^11.1.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/cmf-cqrs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"redux-saga": "^1.2.3"
},
"devDependencies": {
"@talend/eslint-config": "^12.1.1",
"@talend/eslint-plugin": "^1.0.1",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-babel": "^13.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/cmf-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
},
"devDependencies": {
"@redux-saga/testing-utils": "^1.1.5",
"@talend/eslint-config": "^12.1.1",
"@talend/eslint-plugin": "^1.0.1",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-babel": "^13.0.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/cmf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@
},
"devDependencies": {
"@redux-saga/testing-utils": "^1.1.5",
"@talend/eslint-config": "^12.1.1",
"@talend/eslint-plugin": "^1.0.1",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-babel": "^13.0.0",
"@talend/scripts-config-jest": "^12.2.0",
"@talend/scripts-config-react-webpack": "^16.0.0",
"@testing-library/react": "^12.1.5",
"jest-in-case": "^1.0.2",
Expand Down
7 changes: 6 additions & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"classnames": "^2.3.2",
"d3": "^7.8.5",
"date-fns": "^1.30.1",
"dom-helpers": "^3.4.0",
"focus-outline-manager": "^1.0.2",
"immutable": "^3.8.2",
"invariant": "^2.2.4",
Expand All @@ -66,12 +67,15 @@
"recharts": "^2.8.0",
"simplebar": "^5.3.9",
"simplebar-react": "^2.4.3",
"styled-components": "^5.3.11"
"styled-components": "^5.3.11",
"warning": "^3.0.0"
},
"devDependencies": {
"@storybook/addon-actions": "^7.4.1",
"@talend/bootstrap-theme": "^8.2.0",
"@talend/design-system": "^7.15.1",
"@talend/eslint-config": "^12.1.1",
"@talend/eslint-plugin": "^1.0.1",
"@talend/locales-design-system": "^7.3.0",
"@talend/locales-tui-components": "^9.5.0",
"@talend/scripts-core": "^15.0.0",
Expand All @@ -82,6 +86,7 @@
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^13.5.0",
"@testing-library/react-hooks": "^8.0.1",
"@types/classnames": "^2.3.1",
"@types/d3": "^7.4.0",
"@types/date-fns": "^0.0.2",
Expand Down
2 changes: 2 additions & 0 deletions packages/containers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
"@talend/icons": "^6.60.1",
"@talend/locales-tui-containers": "^8.0.2",
"@talend/react-storybook-cmf": "^7.2.0",
"@talend/eslint-config": "^12.1.1",
"@talend/eslint-plugin": "^1.0.1",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-babel": "^13.0.0",
"@talend/scripts-config-storybook-lib": "^5.0.0",
Expand Down
7 changes: 0 additions & 7 deletions packages/dataviz/jest.config.js

This file was deleted.

4 changes: 4 additions & 0 deletions packages/dataviz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
"@cypress/webpack-dev-server": "^3.6.1",
"@talend/bootstrap-theme": "^8.1.3",
"@talend/design-system": "^7.15.1",
"@talend/eslint-config": "^12.1.1",
"@talend/eslint-plugin": "^1.0.1",
"@talend/icons": "^6.60.1",
"@talend/locales-tui-components": "^9.5.0",
"@talend/locales-tui-dataviz": "^0.4.6",
Expand All @@ -68,9 +70,11 @@
"@types/cypress": "^1.1.3",
"@types/geojson": "^7946.0.10",
"@types/lodash": "^4.14.198",
"@types/node": "^6.14.13",
"@types/react": "^17.0.65",
"@types/topojson-client": "^3.1.2",
"@types/topojson-specification": "^1.0.3",
"cypress": "^12.17.4",
"cross-env": "^7.0.3",
"i18next": "^20.6.1",
"react": "^17.0.2",
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 @@ -50,6 +50,8 @@
"@storybook/testing-library": "^0.2.0",
"@storybook/testing-react": "^2.0.1",
"@storybook/theming": "^7.4.1",
"@talend/eslint-config": "^12.1.1",
"@talend/eslint-plugin": "^1.0.1",
"@talend/locales-design-system": "^7.3.0",
"@talend/locales-tui-components": "^9.5.0",
"@talend/locales-tui-containers": "^8.0.2",
Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
"@storybook/theming": "^7.4.1",
"@svgr/webpack": "^5.5.0",
"@talend/bootstrap-theme": "^8.1.3",
"@talend/eslint-config": "^12.1.1",
"@talend/eslint-plugin": "^1.0.1",
"@talend/icons": "^6.60.1",
"@talend/locales-design-system": "^7.3.0",
"@talend/scripts-core": "^15.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/design-tokens/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
testEnvironment: 'jest-environment-jsdom',
testRegex: '(/__tests__/.*|src/|scripts/).*\\.test.(js|ts|tsx)$',
};
6 changes: 5 additions & 1 deletion packages/design-tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@
"access": "public"
},
"devDependencies": {
"@talend/eslint-config": "^12.1.1",
"@talend/eslint-plugin": "^1.0.1",
"@talend/scripts-core": "^15.0.0",
"@talend/scripts-config-react-webpack": "^16.0.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",
"jest": "^29.7.0",
"typeface-source-sans-pro": "^1.1.13"
"jest-environment-jsdom": "^29.7.0",
"typeface-source-sans-pro": "^1.1.13",
"webpack": "^5.88.2"
},
"dependencies": {}
}
Loading

0 comments on commit 813cdca

Please sign in to comment.