Skip to content

Commit

Permalink
fix(TDP-12694): jest and cdn script configs broken after pnpm use-case (
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume NICOLAS authored Nov 24, 2023
1 parent 4dc277f commit 06598a0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
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

0 comments on commit 06598a0

Please sign in to comment.