@rxap/ngx-marker-io 19.0.6 → 21.0.1-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 +17 -0
- package/compodoc/changelog.html +16 -0
- package/compodoc/dependencies.html +7 -7
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +11 -11
- package/docs/html/classes/MarkerIoService.html +2 -2
- package/docs/html/functions/provideMarkerIo.html +1 -1
- package/docs/html/index.html +2 -2
- package/docs/html/modules.html +1 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/MarkerIoService.md +5 -5
- package/docs/markdown/functions/provideMarkerIo.md +2 -2
- package/docs/markdown/globals.md +2 -2
- package/docs/wiki/Class.MarkerIoService.md +4 -4
- package/docs/wiki/Function.provideMarkerIo.md +1 -1
- package/docs/wiki/globals.md +1 -1
- package/fesm2022/rxap-ngx-marker-io.mjs +3 -3
- package/fesm2022/rxap-ngx-marker-io.mjs.map +1 -1
- package/package.json +22 -17
- package/src/generators/init/generator.ts +139 -0
- package/src/generators/init/index.ts +5 -0
- package/src/generators/init/schema.d.ts +2 -0
- package/src/generators/init/schema.json +8 -0
- package/{index.d.ts → src/index.ts} +2 -0
- package/src/test-setup.ts +19 -0
- package/{lib/marker-io.service.d.ts → types/rxap-ngx-marker-io.d.ts} +6 -3
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "21.0.1-dev.0",
|
|
3
3
|
"name": "@rxap/ngx-marker-io",
|
|
4
4
|
"description": "This package provides an Angular service to integrate with marker.io, a visual feedback and bug reporting tool. It allows you to easily load the marker.io widget, set custom data, and manage reporter information within your Angular application. The package also includes an init generator for setting up peer dependencies.\n",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@nx/devkit": "
|
|
7
|
+
"@nx/devkit": "22.7.5",
|
|
8
8
|
"tslib": "2.6.2"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@angular/core": "^
|
|
11
|
+
"@angular/core": "^21.2.9",
|
|
12
12
|
"@marker.io/browser": "^0.20.2",
|
|
13
|
-
"@rxap/config": "^
|
|
14
|
-
"@rxap/environment": "^
|
|
15
|
-
"@rxap/ngx-pub-sub": "^
|
|
16
|
-
"@rxap/utilities": "^16.5.
|
|
17
|
-
"rxjs": "^7.8.
|
|
13
|
+
"@rxap/config": "^21.0.1-dev.0",
|
|
14
|
+
"@rxap/environment": "^21.0.1-dev.0",
|
|
15
|
+
"@rxap/ngx-pub-sub": "^21.0.1-dev.0",
|
|
16
|
+
"@rxap/utilities": "^16.5.2-dev.0",
|
|
17
|
+
"rxjs": "^7.8.2"
|
|
18
18
|
},
|
|
19
19
|
"author": {
|
|
20
20
|
"name": "Merzough Münker",
|
|
@@ -37,27 +37,31 @@
|
|
|
37
37
|
"packageGroup": [
|
|
38
38
|
{
|
|
39
39
|
"package": "@angular/common",
|
|
40
|
-
"version": "
|
|
40
|
+
"version": "21.2.9"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"package": "@angular/compiler",
|
|
44
|
+
"version": "21.2.9"
|
|
41
45
|
},
|
|
42
46
|
{
|
|
43
47
|
"package": "@angular/core",
|
|
44
|
-
"version": "
|
|
48
|
+
"version": "21.2.9"
|
|
45
49
|
},
|
|
46
50
|
{
|
|
47
51
|
"package": "@rxap/config",
|
|
48
|
-
"version": "
|
|
52
|
+
"version": "21.0.1-dev.0"
|
|
49
53
|
},
|
|
50
54
|
{
|
|
51
55
|
"package": "@rxap/environment",
|
|
52
|
-
"version": "
|
|
56
|
+
"version": "21.0.1-dev.0"
|
|
53
57
|
},
|
|
54
58
|
{
|
|
55
59
|
"package": "@rxap/ngx-pub-sub",
|
|
56
|
-
"version": "
|
|
60
|
+
"version": "21.0.1-dev.0"
|
|
57
61
|
},
|
|
58
62
|
{
|
|
59
63
|
"package": "@rxap/utilities",
|
|
60
|
-
"version": "16.5.
|
|
64
|
+
"version": "16.5.2-dev.0"
|
|
61
65
|
}
|
|
62
66
|
]
|
|
63
67
|
},
|
|
@@ -73,15 +77,16 @@
|
|
|
73
77
|
"schematics": "./generators.json",
|
|
74
78
|
"sideEffects": false,
|
|
75
79
|
"module": "fesm2022/rxap-ngx-marker-io.mjs",
|
|
76
|
-
"typings": "
|
|
80
|
+
"typings": "types/rxap-ngx-marker-io.d.ts",
|
|
77
81
|
"exports": {
|
|
78
82
|
"./package.json": {
|
|
79
83
|
"default": "./package.json"
|
|
80
84
|
},
|
|
81
85
|
".": {
|
|
82
|
-
"types": "./
|
|
86
|
+
"types": "./types/rxap-ngx-marker-io.d.ts",
|
|
83
87
|
"default": "./fesm2022/rxap-ngx-marker-io.mjs"
|
|
84
88
|
},
|
|
85
89
|
"./theme": "./theme.css"
|
|
86
|
-
}
|
|
90
|
+
},
|
|
91
|
+
"type": "module"
|
|
87
92
|
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addDependenciesToPackageJson,
|
|
3
|
+
formatFiles,
|
|
4
|
+
installPackagesTask,
|
|
5
|
+
Tree,
|
|
6
|
+
} from '@nx/devkit';
|
|
7
|
+
import { existsSync, readFileSync } from 'fs';
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
import { InitGeneratorSchema } from './schema';
|
|
10
|
+
|
|
11
|
+
export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
|
|
12
|
+
// The package's own package.json lives on disk next to the compiled generator
|
|
13
|
+
// (inside node_modules when installed), which the virtual Tree does not track.
|
|
14
|
+
// Read it directly from the physical filesystem.
|
|
15
|
+
const packageJsonFilePath = join(__dirname, '..', '..', '..', 'package.json');
|
|
16
|
+
if (!existsSync(packageJsonFilePath)) {
|
|
17
|
+
console.error('package.json not found in: ' + packageJsonFilePath);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const { peerDependencies, name: packageName } = JSON.parse(
|
|
21
|
+
readFileSync(packageJsonFilePath, 'utf-8')
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
console.log(`Coerce peer dependencies for package: ${packageName}`);
|
|
25
|
+
if (!peerDependencies || !Object.keys(peerDependencies).length) {
|
|
26
|
+
console.log('No peer dependencies found');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
console.log(`Peer dependencies: ${Object.keys(peerDependencies).join(', ')}`);
|
|
30
|
+
|
|
31
|
+
const rootPackageJson = JSON.parse(tree.read('package.json', 'utf-8')!);
|
|
32
|
+
|
|
33
|
+
let isDevDependency = !!rootPackageJson.devDependencies?.[packageName];
|
|
34
|
+
|
|
35
|
+
if (
|
|
36
|
+
isDevDependency &&
|
|
37
|
+
[/^@rxap\/ngx/, /^@rxap\/nest/].some((rx) => rx.test(packageName))
|
|
38
|
+
) {
|
|
39
|
+
rootPackageJson.dependencies ??= {};
|
|
40
|
+
rootPackageJson.dependencies[packageName] =
|
|
41
|
+
rootPackageJson.devDependencies[packageName];
|
|
42
|
+
delete rootPackageJson.devDependencies[packageName];
|
|
43
|
+
isDevDependency = false;
|
|
44
|
+
tree.write('package.json', JSON.stringify(rootPackageJson, null, 2));
|
|
45
|
+
}
|
|
46
|
+
if (
|
|
47
|
+
!isDevDependency &&
|
|
48
|
+
[
|
|
49
|
+
/^@rxap\/plugin/,
|
|
50
|
+
/^@rxap\/workspace/,
|
|
51
|
+
/@rxap\/schematic/,
|
|
52
|
+
].some((rx) => rx.test(packageName))
|
|
53
|
+
) {
|
|
54
|
+
rootPackageJson.devDependencies ??= {};
|
|
55
|
+
rootPackageJson.devDependencies[packageName] =
|
|
56
|
+
rootPackageJson.dependencies[packageName];
|
|
57
|
+
delete rootPackageJson.dependencies[packageName];
|
|
58
|
+
isDevDependency = true;
|
|
59
|
+
tree.write('package.json', JSON.stringify(rootPackageJson, null, 2));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const missingPeerDependencies = Object.entries(peerDependencies)
|
|
63
|
+
.filter(
|
|
64
|
+
([dep]) =>
|
|
65
|
+
!rootPackageJson.dependencies?.[dep] &&
|
|
66
|
+
!rootPackageJson.devDependencies?.[dep]
|
|
67
|
+
)
|
|
68
|
+
.reduce((acc, [dep, version]) => ({ ...acc, [dep]: version }), {});
|
|
69
|
+
|
|
70
|
+
if (!Object.keys(missingPeerDependencies).length) {
|
|
71
|
+
console.log('No missing peer dependencies');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (isDevDependency) {
|
|
76
|
+
addDependenciesToPackageJson(tree, {}, missingPeerDependencies);
|
|
77
|
+
} else {
|
|
78
|
+
addDependenciesToPackageJson(tree, missingPeerDependencies, {});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
await formatFiles(tree);
|
|
82
|
+
|
|
83
|
+
installPackagesTask(tree);
|
|
84
|
+
|
|
85
|
+
for (const peer of Object.keys(missingPeerDependencies)) {
|
|
86
|
+
console.log(`Peer dependency ${peer} added to package.json`);
|
|
87
|
+
// node_modules is physical and excluded from the virtual Tree, so resolve
|
|
88
|
+
// peer files from disk relative to the workspace root.
|
|
89
|
+
const peerPackageDir = join(tree.root, 'node_modules', ...peer.split('/'));
|
|
90
|
+
const peerPackageJsonFilePath = join(peerPackageDir, 'package.json');
|
|
91
|
+
if (!existsSync(peerPackageJsonFilePath)) {
|
|
92
|
+
console.log(`Peer dependency ${peer} has no package.json`);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const { generators, schematics } = JSON.parse(
|
|
96
|
+
readFileSync(peerPackageJsonFilePath, 'utf-8')
|
|
97
|
+
);
|
|
98
|
+
if (!generators && !schematics) {
|
|
99
|
+
console.log(`Peer dependency ${peer} has no generators or schematics`);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const configFile = generators || schematics;
|
|
103
|
+
const configFilePath = join(peerPackageDir, configFile);
|
|
104
|
+
if (!existsSync(configFilePath)) {
|
|
105
|
+
console.log(
|
|
106
|
+
`Peer dependency ${peer} has no generators or schematics file`
|
|
107
|
+
);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const config = JSON.parse(readFileSync(configFilePath, 'utf-8'));
|
|
111
|
+
if (!config.generators?.init) {
|
|
112
|
+
console.log(`Peer dependency ${peer} has no init generator`);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const initGeneratorFilePath = config.generators.init.factory;
|
|
116
|
+
const fullInitGeneratorFilePath =
|
|
117
|
+
join(peerPackageDir, initGeneratorFilePath) + '.js';
|
|
118
|
+
if (!existsSync(fullInitGeneratorFilePath)) {
|
|
119
|
+
console.log(
|
|
120
|
+
`Peer dependency ${peer} has no init generator file: ` +
|
|
121
|
+
fullInitGeneratorFilePath
|
|
122
|
+
);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
126
|
+
const initGenerator = require(join(
|
|
127
|
+
peerPackageDir,
|
|
128
|
+
initGeneratorFilePath
|
|
129
|
+
))?.default;
|
|
130
|
+
if (typeof initGenerator !== 'function') {
|
|
131
|
+
console.log(`Peer dependency ${peer} has no init generator function`);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
console.log(`Run init generator for peer dependency ${peer}`);
|
|
135
|
+
await initGenerator(tree, options);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export default initGenerator;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
|
|
2
|
+
globalThis.ngJest = {
|
|
3
|
+
testEnvironmentOptions: {
|
|
4
|
+
errorOnUnknownElements: true,
|
|
5
|
+
errorOnUnknownProperties: true,
|
|
6
|
+
},
|
|
7
|
+
};
|
|
8
|
+
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
|
|
9
|
+
|
|
10
|
+
setupZoneTestEnv();
|
|
11
|
+
import { TextDecoder, TextEncoder } from 'util';
|
|
12
|
+
import '@angular/localize/init';
|
|
13
|
+
global.TextEncoder ??= TextEncoder as any;
|
|
14
|
+
global.TextDecoder ??= TextDecoder as any;
|
|
15
|
+
jest.spyOn(global as any, '$localize').mockImplementation((...args: any[]) => {
|
|
16
|
+
// This template tag function just returns the first argument with no transformations.
|
|
17
|
+
// Change this to fit your unit test needs.
|
|
18
|
+
return args[0];
|
|
19
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
1
2
|
import { MarkerReporter } from '@marker.io/browser';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
declare class MarkerIoService {
|
|
4
5
|
private readonly environment;
|
|
5
6
|
private readonly config;
|
|
6
7
|
private readonly pubSub;
|
|
@@ -11,4 +12,6 @@ export declare class MarkerIoService {
|
|
|
11
12
|
static ɵfac: i0.ɵɵFactoryDeclaration<MarkerIoService, never>;
|
|
12
13
|
static ɵprov: i0.ɵɵInjectableDeclaration<MarkerIoService>;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
declare function provideMarkerIo(): i0.EnvironmentProviders[];
|
|
16
|
+
|
|
17
|
+
export { MarkerIoService, provideMarkerIo };
|