@rxap/plugin-angular 19.3.2-dev.0 → 19.3.3-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/package.json +4 -4
- package/src/lib/coerce-test-setup.js +26 -16
- package/src/lib/coerce-test-setup.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [19.3.3-dev.0](https://gitlab.com/rxap/packages/compare/@rxap/plugin-angular@19.3.2...@rxap/plugin-angular@19.3.3-dev.0) (2024-08-12)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- only add imports and statements if not yet exists ([377712b](https://gitlab.com/rxap/packages/commit/377712b21ff3ffd244126695686507870e880b26))
|
|
11
|
+
- support custom base path ([885931a](https://gitlab.com/rxap/packages/commit/885931a9738cea074c7c3caac3047537685e206e))
|
|
12
|
+
|
|
13
|
+
## [19.3.2](https://gitlab.com/rxap/packages/compare/@rxap/plugin-angular@19.3.2-dev.0...@rxap/plugin-angular@19.3.2) (2024-08-05)
|
|
14
|
+
|
|
15
|
+
**Note:** Version bump only for package @rxap/plugin-angular
|
|
16
|
+
|
|
6
17
|
## [19.3.2-dev.0](https://gitlab.com/rxap/packages/compare/@rxap/plugin-angular@19.3.1...@rxap/plugin-angular@19.3.2-dev.0) (2024-08-05)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @rxap/plugin-angular
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "19.3.
|
|
2
|
+
"version": "19.3.3-dev.0",
|
|
3
3
|
"name": "@rxap/plugin-angular",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@nx/angular": "19.4.2",
|
|
7
7
|
"@nx/devkit": "19.4.2",
|
|
8
8
|
"@rxap/plugin-application": "^19.1.1",
|
|
9
|
-
"@rxap/plugin-library": "^19.4.0",
|
|
9
|
+
"@rxap/plugin-library": "^19.4.1-dev.0",
|
|
10
10
|
"@rxap/plugin-localazy": "^19.0.5",
|
|
11
11
|
"@rxap/plugin-utilities": "^19.0.6",
|
|
12
12
|
"@rxap/ts-morph": "^1.4.3",
|
|
13
13
|
"@rxap/utilities": "^16.3.0",
|
|
14
|
-
"@rxap/workspace-ts-morph": "^19.1.
|
|
14
|
+
"@rxap/workspace-ts-morph": "^19.1.4-dev.0",
|
|
15
15
|
"@rxap/workspace-utilities": "^19.4.0",
|
|
16
16
|
"colors": "1.4.0",
|
|
17
17
|
"semver": "7.5.3",
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
},
|
|
56
56
|
"schematics": "./generators.json",
|
|
57
57
|
"type": "commonjs",
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "d863ca4ed92a09ee4117e529aa6bf58ebac1f6ff",
|
|
59
59
|
"main": "./src/index.js"
|
|
60
60
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.coerceTestSetup = void 0;
|
|
4
|
+
const ts_morph_1 = require("@rxap/ts-morph");
|
|
5
|
+
const workspace_ts_morph_1 = require("@rxap/workspace-ts-morph");
|
|
4
6
|
const workspace_utilities_1 = require("@rxap/workspace-utilities");
|
|
5
7
|
function coerceTestSetup(tree, projectName) {
|
|
6
8
|
const projectSourceRoot = (0, workspace_utilities_1.GetProjectSourceRoot)(tree, projectName);
|
|
@@ -14,25 +16,33 @@ globalThis.ngJest = {
|
|
|
14
16
|
};
|
|
15
17
|
import 'jest-preset-angular/setup-jest';
|
|
16
18
|
`);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
(0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, { project: projectName, basePath: projectSourceRoot }, (_, [sourceFile]) => {
|
|
20
|
+
(0, ts_morph_1.CoerceImports)(sourceFile, [
|
|
21
|
+
{
|
|
22
|
+
moduleSpecifier: 'util',
|
|
23
|
+
namedImports: ['TextDecoder', 'TextEncoder'],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
moduleSpecifier: '@angular/localize/init',
|
|
27
|
+
},
|
|
28
|
+
]);
|
|
29
|
+
const hasTextEncoderStatement = !!sourceFile.getStatement(statement => statement.getText().includes('global.TextEncoder ??= TextEncoder as any;'));
|
|
30
|
+
const hasTextDecoderStatement = !!sourceFile.getStatement(statement => statement.getText().includes('global.TextDecoder ??= TextDecoder as any;'));
|
|
31
|
+
const hasLocalizeInitStatement = !!sourceFile.getStatement(statement => statement.getText().includes('jest.spyOn(global as any, \'$localize\')'));
|
|
32
|
+
if (!hasTextEncoderStatement) {
|
|
33
|
+
sourceFile.addStatements(`global.TextEncoder ??= TextEncoder as any;`);
|
|
34
|
+
}
|
|
35
|
+
if (!hasTextDecoderStatement) {
|
|
36
|
+
sourceFile.addStatements(`global.TextDecoder ??= TextDecoder as any;`);
|
|
37
|
+
}
|
|
38
|
+
if (!hasLocalizeInitStatement) {
|
|
39
|
+
sourceFile.addStatements(`jest.spyOn(global as any, '$localize').mockImplementation((...args: any[]) => {
|
|
29
40
|
// This template tag function just returns the first argument with no transformations.
|
|
30
41
|
// Change this to fit your unit test needs.
|
|
31
42
|
return args[0];
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
(0, workspace_utilities_1.CoerceFile)(tree, testSetupPath, content, true);
|
|
43
|
+
});`);
|
|
44
|
+
}
|
|
45
|
+
}, ['test-setup.ts']);
|
|
36
46
|
}
|
|
37
47
|
exports.coerceTestSetup = coerceTestSetup;
|
|
38
48
|
//# sourceMappingURL=coerce-test-setup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-test-setup.js","sourceRoot":"","sources":["../../../../../../packages/plugin/angular/src/lib/coerce-test-setup.ts"],"names":[],"mappings":";;;AACA,mEAGmC;AAEnC,SAAgB,eAAe,CAAC,IAAU,EAAE,WAAmB;IAC7D,MAAM,iBAAiB,GAAG,IAAA,0CAAoB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAElE,MAAM,aAAa,GAAG,GAAG,iBAAiB,gBAAgB,CAAC;IAC3D,IAAA,gCAAU,EAAC,IAAI,EAAE,aAAa,EAAE;;;;;;;;CAQjC,CAAC,CAAC;IAED,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"coerce-test-setup.js","sourceRoot":"","sources":["../../../../../../packages/plugin/angular/src/lib/coerce-test-setup.ts"],"names":[],"mappings":";;;AACA,6CAA+C;AAC/C,iEAA0E;AAC1E,mEAGmC;AAEnC,SAAgB,eAAe,CAAC,IAAU,EAAE,WAAmB;IAC7D,MAAM,iBAAiB,GAAG,IAAA,0CAAoB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAElE,MAAM,aAAa,GAAG,GAAG,iBAAiB,gBAAgB,CAAC;IAC3D,IAAA,gCAAU,EAAC,IAAI,EAAE,aAAa,EAAE;;;;;;;;CAQjC,CAAC,CAAC;IAED,IAAA,mDAA8B,EAAC,IAAI,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,CAAE,UAAU,CAAE,EAAE,EAAE;QAEhH,IAAA,wBAAa,EAAC,UAAU,EAAE;YACxB;gBACE,eAAe,EAAE,MAAM;gBACvB,YAAY,EAAE,CAAE,aAAa,EAAE,aAAa,CAAE;aAC/C;YACD;gBACE,eAAe,EAAE,wBAAwB;aAC1C;SACF,CAAC,CAAC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