mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
fix(perf): declare renderer cache output path
This commit is contained in:
1 parent
28ed38906d
commit
2cc7d0acb1
2 files changed
+54
-1
No files matched your search
@@ -1,5 +1,6 @@
|
||||
/* eslint-disable playwright/expect-expect -- These are Node assertion-based configuration contract tests. */
|
||||
import assert from 'node:assert/strict';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import test from 'node:test';
|
||||
@@ -16,6 +17,20 @@ interface ProjectConfiguration {
|
||||
targets: Record<string, TargetConfiguration>;
|
||||
}
|
||||
|
||||
interface NxGraphTask {
|
||||
outputs?: string[];
|
||||
target: {
|
||||
project: string;
|
||||
target: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface NxGraph {
|
||||
tasks: {
|
||||
tasks: Record<string, NxGraphTask>;
|
||||
};
|
||||
}
|
||||
|
||||
const workspaceRoot = fileURLToPath(new URL('../../../../', import.meta.url));
|
||||
|
||||
function readProject(relativePath: string): ProjectConfiguration {
|
||||
@@ -24,6 +39,37 @@ function readProject(relativePath: string): ProjectConfiguration {
|
||||
) as ProjectConfiguration;
|
||||
}
|
||||
|
||||
function readResolvedWebBuildTask(): NxGraphTask | undefined {
|
||||
const environment = {
|
||||
...process.env,
|
||||
FORCE_COLOR: '0',
|
||||
NX_DAEMON: 'false',
|
||||
};
|
||||
delete environment['NO_COLOR'];
|
||||
|
||||
const graph = JSON.parse(
|
||||
execFileSync(
|
||||
process.execPath,
|
||||
[
|
||||
join(workspaceRoot, 'node_modules/nx/dist/bin/nx.js'),
|
||||
'run',
|
||||
'web:build',
|
||||
'--graph=stdout',
|
||||
],
|
||||
{
|
||||
cwd: workspaceRoot,
|
||||
encoding: 'utf8',
|
||||
env: environment,
|
||||
}
|
||||
)
|
||||
) as NxGraph;
|
||||
|
||||
return Object.values(graph.tasks.tasks).find(
|
||||
(task) =>
|
||||
task.target.project === 'web' && task.target.target === 'build'
|
||||
);
|
||||
}
|
||||
|
||||
const e2eProject = readProject('apps/electron-backend-e2e/project.json');
|
||||
const electronProject = readProject('apps/electron-backend/project.json');
|
||||
const remoteControlProject = readProject(
|
||||
@@ -64,6 +110,13 @@ test('the web performance build keeps production renderer behavior with profilin
|
||||
assert.equal(performance['sourceMap'], true);
|
||||
});
|
||||
|
||||
test('the resolved web build cache output is the renderer directory', () => {
|
||||
const task = readResolvedWebBuildTask();
|
||||
|
||||
assert.ok(task, 'the Nx graph must include web:build');
|
||||
assert.deepEqual(task.outputs, ['dist/apps/web']);
|
||||
});
|
||||
|
||||
test('the remote-control performance build keeps optimized hashed output with profiling source maps', () => {
|
||||
const build = remoteControlProject.targets['build'];
|
||||
const production = build.configurations?.['production'];
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@angular/build:application",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"outputs": ["{workspaceRoot}/dist/apps/web"],
|
||||
"options": {
|
||||
"outputPath": {
|
||||
"base": "dist/apps/web",
|
||||
|
||||
Reference in new issue
Block a user