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(TDP-12694): jest and cdn script configs broken after pnpm use-case #5006

Merged
merged 2 commits into from
Nov 24, 2023
Merged
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
5 changes: 5 additions & 0 deletions .changeset/little-mangos-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/scripts-config-cdn': patch
---

fix(TDP-12694): require valid package-lock file path
5 changes: 5 additions & 0 deletions .changeset/tidy-peas-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/scripts-config-jest': patch
---

fix(TDP-12694): broken applyBabelTransformOn after pnpm use-case
2 changes: 1 addition & 1 deletion tools/scripts-config-cdn/cdn.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function getModulesFromLockFile(dir) {

let infos = [];
if (fs.existsSync(lockTypeMap.npm.path)) {
const packagelock = require(lockTypeMap.npm.lockfile);
const packagelock = require(lockTypeMap.npm.path);
infos = getAllFlattenDependencies(packagelock)
.map(({ name, version }) => moduleToCdn(name, version, { env: 'development' }))
.map(addLocal);
Expand Down
15 changes: 15 additions & 0 deletions tools/scripts-config-jest/__tests__/utils.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { applyBabelTransformOn } from '../utils';

describe('utilities', () => {
describe('applyBabelTransformOn', () => {
it('should add babel transform directive', () => {
const config = {
transformIgnorePatterns: ['node_modules/(?!(?:.pnpm/)?(d3|internmap))'],
};
applyBabelTransformOn(config, ['dexie']);
expect(config.transformIgnorePatterns[0]).toBe(
'node_modules/(?!(?:.pnpm/)?(d3|internmap|dexie))',
);
});
});
});
4 changes: 2 additions & 2 deletions tools/scripts-config-jest/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function applyBabelTransformOn(config, pkgs) {
config.transformIgnorePatterns[0] = config.transformIgnorePatterns[0].replace(
')',
`|${pkgs.join('|')})`,
/(\)\)$)/,
`|${pkgs.join('|')}$1`,
);
}

Expand Down
Loading