@equinor/roma-nx-plugin 1.1.0 → 2.0.0-BETA.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/migrations.json +80 -0
- package/package.json +7 -6
- package/src/executors/build/build.d.ts +4 -0
- package/src/executors/build/build.js +76 -0
- package/src/executors/build/build.js.map +1 -0
- package/src/executors/build/executor.d.ts +5 -0
- package/src/executors/build/executor.js +8 -0
- package/src/executors/build/executor.js.map +1 -0
- package/src/executors/build/minify.d.ts +2 -0
- package/src/executors/build/minify.js +22 -0
- package/src/executors/build/minify.js.map +1 -0
- package/src/executors/component-test/executor.d.ts +4 -0
- package/src/executors/component-test/executor.js +48 -0
- package/src/executors/component-test/executor.js.map +1 -0
- package/src/executors/create-vite-config.d.ts +3 -0
- package/src/executors/create-vite-config.js +106 -0
- package/src/executors/create-vite-config.js.map +1 -0
- package/src/executors/executor-context.d.ts +2 -0
- package/src/executors/executor-context.js +101 -0
- package/src/executors/executor-context.js.map +1 -0
- package/src/executors/publish/executor.d.ts +5 -0
- package/src/executors/publish/executor.js +24 -0
- package/src/executors/publish/executor.js.map +1 -0
- package/src/executors/publish/manifest-model.d.ts +29 -0
- package/src/executors/publish/manifest-model.js +3 -0
- package/src/executors/publish/manifest-model.js.map +1 -0
- package/src/executors/publish/publish-script.d.ts +8 -0
- package/src/executors/publish/publish-script.js +193 -0
- package/src/executors/publish/publish-script.js.map +1 -0
- package/src/executors/serve/executor.d.ts +3 -0
- package/src/executors/serve/executor.js +17 -0
- package/src/executors/serve/executor.js.map +1 -0
- package/src/executors/serve/get-manifest.d.ts +4 -0
- package/src/executors/serve/get-manifest.js +20 -0
- package/src/executors/serve/get-manifest.js.map +1 -0
- package/src/executors/serve/server.d.ts +3 -0
- package/src/executors/serve/server.js +179 -0
- package/src/executors/serve/server.js.map +1 -0
- package/src/executors/utils/get-vite-config.d.ts +1 -0
- package/src/executors/utils/get-vite-config.js +13 -0
- package/src/executors/utils/get-vite-config.js.map +1 -0
- package/src/executors/utils/logger.d.ts +24 -0
- package/src/executors/utils/logger.js +69 -0
- package/src/executors/utils/logger.js.map +1 -0
- package/src/generators/app/data/modules.d.ts +19 -0
- package/src/generators/app/data/modules.js +23 -0
- package/src/generators/app/data/modules.js.map +1 -0
- package/src/generators/app/generator.d.ts +5 -0
- package/src/generators/app/generator.js +101 -0
- package/src/generators/app/generator.js.map +1 -0
- package/src/generators/component-test/files/cypress/support/commands.d.ts +0 -0
- package/src/generators/component-test/files/cypress/support/{commands.ts → commands.js} +2 -1
- package/src/generators/component-test/files/cypress/support/commands.js.map +1 -0
- package/src/generators/component-test/files/cypress/support/component.d.ts +9 -0
- package/src/generators/component-test/files/cypress/support/{component.ts → component.js} +7 -21
- package/src/generators/component-test/files/cypress/support/component.js.map +1 -0
- package/src/generators/component-test/generator.d.ts +4 -0
- package/src/generators/component-test/generator.js +36 -0
- package/src/generators/component-test/generator.js.map +1 -0
- package/src/generators/preset/generator.d.ts +4 -0
- package/src/generators/preset/generator.js +13 -0
- package/src/generators/preset/generator.js.map +1 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -0
- package/src/migrations/add-publish-target/add-publish-target.d.ts +2 -0
- package/src/migrations/add-publish-target/add-publish-target.js +32 -0
- package/src/migrations/add-publish-target/add-publish-target.js.map +1 -0
- package/src/migrations/migrate-fusion-manifest/migrate-fusion-manifest.d.ts +2 -0
- package/src/migrations/migrate-fusion-manifest/migrate-fusion-manifest.js +15 -0
- package/src/migrations/migrate-fusion-manifest/migrate-fusion-manifest.js.map +1 -0
- package/src/migrations/migrate-fusion-manifest/old-format.json +21 -0
- package/src/migrations/migrate-fusion-manifest/update-manifest.d.ts +6 -0
- package/src/migrations/migrate-fusion-manifest/update-manifest.js +26 -0
- package/src/migrations/migrate-fusion-manifest/update-manifest.js.map +1 -0
- package/src/migrations/move-fusion-manifest/move-fusion-manifest.d.ts +2 -0
- package/src/migrations/move-fusion-manifest/move-fusion-manifest.js +30 -0
- package/src/migrations/move-fusion-manifest/move-fusion-manifest.js.map +1 -0
- package/src/migrations/remove-fusion-cli/remove-fusion-cli.d.ts +2 -0
- package/src/migrations/remove-fusion-cli/remove-fusion-cli.js +48 -0
- package/src/migrations/remove-fusion-cli/remove-fusion-cli.js.map +1 -0
- package/.eslintrc.json +0 -37
- package/jest.config.ts +0 -13
- package/manifest-schema.json +0 -80
- package/project.json +0 -65
- package/src/executors/build/build.ts +0 -100
- package/src/executors/build/executor.spec.ts +0 -13
- package/src/executors/build/executor.ts +0 -10
- package/src/executors/build/minify.ts +0 -20
- package/src/executors/component-test/executor.spec.ts +0 -18
- package/src/executors/component-test/executor.ts +0 -57
- package/src/executors/create-vite-config.ts +0 -133
- package/src/executors/executor-context.ts +0 -102
- package/src/executors/publish/executor.ts +0 -29
- package/src/executors/publish/manifest-model.ts +0 -33
- package/src/executors/publish/publish-script.spec.ts +0 -118
- package/src/executors/publish/publish-script.ts +0 -210
- package/src/executors/serve/executor.ts +0 -19
- package/src/executors/serve/get-manifest.ts +0 -20
- package/src/executors/serve/server.ts +0 -250
- package/src/executors/utils/get-vite-config.ts +0 -9
- package/src/executors/utils/logger.ts +0 -90
- package/src/generators/app/data/modules.ts +0 -19
- package/src/generators/app/generator.spec.ts +0 -86
- package/src/generators/app/generator.ts +0 -141
- package/src/generators/component-test/generator.spec.ts +0 -79
- package/src/generators/component-test/generator.ts +0 -67
- package/src/generators/preset/generator.spec.ts +0 -38
- package/src/generators/preset/generator.ts +0 -18
- package/src/migrations/add-publish-target/add-publish-target.spec.ts +0 -60
- package/src/migrations/add-publish-target/add-publish-target.ts +0 -28
- package/src/migrations/move-fusion-manifest/move-fusion-manifest.ts +0 -35
- package/src/migrations/remove-fusion-cli/remove-fusion-cli.ts +0 -70
- package/tsconfig.json +0 -17
- package/tsconfig.lib.json +0 -20
- package/tsconfig.spec.json +0 -26
- package/vite.config.ts +0 -31
- /package/src/{index.ts → index.d.ts} +0 -0
package/project.json
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "roma",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "plugins/roma/src",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"targets": {
|
|
7
|
-
"build": {
|
|
8
|
-
"executor": "@nx/js:tsc",
|
|
9
|
-
"outputs": ["{options.outputPath}"],
|
|
10
|
-
"options": {
|
|
11
|
-
"outputPath": "dist/plugins/roma",
|
|
12
|
-
"main": "plugins/roma/src/index.ts",
|
|
13
|
-
"tsConfig": "plugins/roma/tsconfig.lib.json",
|
|
14
|
-
"assets": [
|
|
15
|
-
"plugins/roma/*.md",
|
|
16
|
-
{
|
|
17
|
-
"input": "./plugins/roma/src",
|
|
18
|
-
"glob": "**/!(*.ts)",
|
|
19
|
-
"output": "./src"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"input": "./plugins/roma/src",
|
|
23
|
-
"glob": "**/*.d.ts",
|
|
24
|
-
"output": "./src"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"input": "./plugins/roma",
|
|
28
|
-
"glob": "generators.json",
|
|
29
|
-
"output": "."
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"input": "./plugins/roma",
|
|
33
|
-
"glob": "executors.json",
|
|
34
|
-
"output": "."
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"input": "./plugins/roma",
|
|
38
|
-
"glob": "migrations.json",
|
|
39
|
-
"output": "."
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"publish": {
|
|
45
|
-
"command": "node tools/scripts/publish.mjs roma {args.ver} {args.tag}",
|
|
46
|
-
"dependsOn": ["build"]
|
|
47
|
-
},
|
|
48
|
-
"lint": {
|
|
49
|
-
"executor": "@nx/eslint:lint",
|
|
50
|
-
"outputs": ["{options.outputFile}"]
|
|
51
|
-
},
|
|
52
|
-
"test": {
|
|
53
|
-
"executor": "@nx/vite:test",
|
|
54
|
-
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"]
|
|
55
|
-
},
|
|
56
|
-
"version": {
|
|
57
|
-
"executor": "@jscutlery/semver:version",
|
|
58
|
-
"options": {
|
|
59
|
-
"preset": "angular",
|
|
60
|
-
"push": true
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"tags": ["plugin"]
|
|
65
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { createRomaViteConfig } from '../create-vite-config';
|
|
2
|
-
import { build, loadConfigFromFile } from 'vite';
|
|
3
|
-
import { parse as parseSemver } from 'semver';
|
|
4
|
-
import { readdirSync, writeFileSync } from 'node:fs';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import { ExecutorContext, readJsonFile } from '@nx/devkit';
|
|
7
|
-
import { resolve } from 'path';
|
|
8
|
-
import { RollupWatcher } from 'rollup';
|
|
9
|
-
import { Logger } from '../utils/logger';
|
|
10
|
-
import { Manifest, ManifestFile } from '../publish/manifest-model';
|
|
11
|
-
import { PackageJson } from 'nx/src/utils/package-json';
|
|
12
|
-
|
|
13
|
-
const logger = new Logger();
|
|
14
|
-
|
|
15
|
-
function getViteConfig(root: string) {
|
|
16
|
-
const files = readdirSync(root);
|
|
17
|
-
const file = files.find((f) => f.startsWith('vite.config'));
|
|
18
|
-
if (!file) throw new Error(`No vite config found!`);
|
|
19
|
-
return resolve(root, file);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export default async function (
|
|
23
|
-
context: ExecutorContext,
|
|
24
|
-
watch = false
|
|
25
|
-
): Promise<{ success: boolean }> {
|
|
26
|
-
const projectName = context.projectName;
|
|
27
|
-
const project = context.workspace.projects[projectName];
|
|
28
|
-
const base = resolve(context.root, project.root);
|
|
29
|
-
// const viteConfigPath = resolve(base, 'vite.config.ts');
|
|
30
|
-
const viteConfigPath = getViteConfig(base);
|
|
31
|
-
const userConfig = await loadConfigFromFile(
|
|
32
|
-
{
|
|
33
|
-
command: 'build',
|
|
34
|
-
mode: 'production',
|
|
35
|
-
},
|
|
36
|
-
viteConfigPath
|
|
37
|
-
);
|
|
38
|
-
const viteConfig = userConfig.config;
|
|
39
|
-
|
|
40
|
-
const config = createRomaViteConfig(viteConfig, context, watch);
|
|
41
|
-
console.log(JSON.stringify(config, null, 2));
|
|
42
|
-
|
|
43
|
-
const normalizeVersion = (version: string) => {
|
|
44
|
-
const semverVersion = parseSemver(version);
|
|
45
|
-
|
|
46
|
-
const { major, minor, patch } = semverVersion;
|
|
47
|
-
return { major, minor, patch };
|
|
48
|
-
};
|
|
49
|
-
try {
|
|
50
|
-
const result = await build(config).then((r) => {
|
|
51
|
-
const out = config.build.outDir;
|
|
52
|
-
let manifest: ManifestFile;
|
|
53
|
-
try {
|
|
54
|
-
const packageJson = readJsonFile(
|
|
55
|
-
join(config.root, 'package.json')
|
|
56
|
-
) as PackageJson & { roma?: Manifest };
|
|
57
|
-
if (packageJson.roma) {
|
|
58
|
-
manifest = {
|
|
59
|
-
...packageJson.roma,
|
|
60
|
-
version: packageJson.version,
|
|
61
|
-
};
|
|
62
|
-
} else {
|
|
63
|
-
manifest = readJsonFile(join(config.root, 'fusion-manifest.json'));
|
|
64
|
-
}
|
|
65
|
-
} catch {
|
|
66
|
-
manifest = readJsonFile(join(config.root, 'fusion-manifest.json'));
|
|
67
|
-
}
|
|
68
|
-
const normalizedVersion = normalizeVersion(manifest.version);
|
|
69
|
-
writeFileSync(
|
|
70
|
-
join(out, 'manifest.json'),
|
|
71
|
-
JSON.stringify(
|
|
72
|
-
{
|
|
73
|
-
...manifest,
|
|
74
|
-
version: normalizedVersion,
|
|
75
|
-
},
|
|
76
|
-
null,
|
|
77
|
-
2
|
|
78
|
-
),
|
|
79
|
-
'utf8'
|
|
80
|
-
);
|
|
81
|
-
return r as unknown as RollupWatcher;
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
return new Promise((resolve) => {
|
|
85
|
-
if (watch) {
|
|
86
|
-
result.on('change', (e) => logger.info(e));
|
|
87
|
-
result.on('close', () => {
|
|
88
|
-
logger.info('Stopping watch');
|
|
89
|
-
resolve({ success: true });
|
|
90
|
-
});
|
|
91
|
-
} else {
|
|
92
|
-
resolve({ success: true });
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
} catch (ex) {
|
|
96
|
-
logger.error(`Failed to build ${projectName}:`);
|
|
97
|
-
logger.error(ex);
|
|
98
|
-
return { success: false };
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BuildExecutorSchema } from './schema';
|
|
2
|
-
import executor from './executor';
|
|
3
|
-
import { executorContext } from '../executor-context';
|
|
4
|
-
import { it, describe, expect } from 'vitest';
|
|
5
|
-
|
|
6
|
-
const options: BuildExecutorSchema = {};
|
|
7
|
-
|
|
8
|
-
describe('Build Executor', () => {
|
|
9
|
-
it('can build a project', async () => {
|
|
10
|
-
const output = await executor(options, executorContext);
|
|
11
|
-
expect(output.success).toBe(true);
|
|
12
|
-
}, 20_000); // Long timeout
|
|
13
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BuildExecutorSchema } from './schema';
|
|
2
|
-
import type { ExecutorContext } from '@nx/devkit';
|
|
3
|
-
import build from './build';
|
|
4
|
-
|
|
5
|
-
export default async function runExecutor(
|
|
6
|
-
options: BuildExecutorSchema,
|
|
7
|
-
context: ExecutorContext
|
|
8
|
-
) {
|
|
9
|
-
return build(context, options.watch);
|
|
10
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Plugin } from 'vite';
|
|
2
|
-
import { transform } from 'esbuild';
|
|
3
|
-
|
|
4
|
-
export function minifyEs() {
|
|
5
|
-
return {
|
|
6
|
-
name: 'minifyEs',
|
|
7
|
-
renderChunk: {
|
|
8
|
-
order: 'post',
|
|
9
|
-
async handler(code, chunk, outputOptions) {
|
|
10
|
-
if (outputOptions.format === 'es') {
|
|
11
|
-
return await transform(code, {
|
|
12
|
-
minifyWhitespace: true,
|
|
13
|
-
minifySyntax: true,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return code;
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
} as Plugin;
|
|
20
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
|
|
3
|
-
import { ComponentTestExecutorSchema } from './schema';
|
|
4
|
-
import executor from './executor';
|
|
5
|
-
|
|
6
|
-
const options: ComponentTestExecutorSchema = {};
|
|
7
|
-
const context: ExecutorContext = {
|
|
8
|
-
root: '',
|
|
9
|
-
cwd: process.cwd(),
|
|
10
|
-
isVerbose: false,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
describe('ComponentTest Executor', () => {
|
|
14
|
-
it('can run', async () => {
|
|
15
|
-
const output = await executor(options, context);
|
|
16
|
-
expect(output.success).toBe(true);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
import { PromiseExecutor } from '@nx/devkit';
|
|
3
|
-
import { ComponentTestExecutorSchema } from './schema';
|
|
4
|
-
const cypress = require('cypress');
|
|
5
|
-
// import cypress from 'cypress';
|
|
6
|
-
import { join } from 'path';
|
|
7
|
-
import { exec as execCb } from 'node:child_process';
|
|
8
|
-
import { promisify } from 'node:util';
|
|
9
|
-
import { execCommand } from 'nx/src/command-line/release/utils/exec-command';
|
|
10
|
-
|
|
11
|
-
const exec = promisify(execCb);
|
|
12
|
-
|
|
13
|
-
const runExecutor: PromiseExecutor<ComponentTestExecutorSchema> = async (
|
|
14
|
-
options,
|
|
15
|
-
context
|
|
16
|
-
) => {
|
|
17
|
-
const { projectName, projectsConfigurations, root } = context;
|
|
18
|
-
const workdir = join(root, projectsConfigurations.projects[projectName].root);
|
|
19
|
-
let success = true;
|
|
20
|
-
const config = {
|
|
21
|
-
project: workdir,
|
|
22
|
-
quiet: options.quiet,
|
|
23
|
-
testingType: 'component',
|
|
24
|
-
};
|
|
25
|
-
try {
|
|
26
|
-
const testRun = await (options.watch
|
|
27
|
-
? cypress.open(config)
|
|
28
|
-
: cypress.run(config));
|
|
29
|
-
if (testRun.totalFailed > 0) success = false;
|
|
30
|
-
const report = testRun.runs.map((run) => {
|
|
31
|
-
const { start, end, ...stats } = run.reporterStats;
|
|
32
|
-
return {
|
|
33
|
-
name: run.spec.name,
|
|
34
|
-
...stats,
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
console.table(report);
|
|
38
|
-
} catch (err) {
|
|
39
|
-
console.error(err);
|
|
40
|
-
success = false;
|
|
41
|
-
}
|
|
42
|
-
if (success && options.coverage) {
|
|
43
|
-
process.chdir(workdir);
|
|
44
|
-
const r = await exec(`npx nyc report --reporter=text-summary`);
|
|
45
|
-
console.log(r.stdout);
|
|
46
|
-
}
|
|
47
|
-
console.log(
|
|
48
|
-
success
|
|
49
|
-
? `Successfully ran component tests`
|
|
50
|
-
: `Failed to run component tests`
|
|
51
|
-
);
|
|
52
|
-
return {
|
|
53
|
-
success,
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export default runExecutor;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { defineConfig, UserConfig, mergeConfig, LibraryOptions } from 'vite';
|
|
2
|
-
import ViteRestart from 'vite-plugin-restart';
|
|
3
|
-
import viteEnv from 'vite-plugin-environment';
|
|
4
|
-
import { resolve, join } from 'path';
|
|
5
|
-
import react from '@vitejs/plugin-react';
|
|
6
|
-
import { Logger } from './utils/logger';
|
|
7
|
-
import type { ExecutorContext } from '@nx/devkit';
|
|
8
|
-
import { TargetConfiguration } from 'nx/src/config/workspace-json-project-json';
|
|
9
|
-
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
10
|
-
import { minifyEs } from './build/minify';
|
|
11
|
-
import { ServeExecutorSchema } from './serve/schema';
|
|
12
|
-
|
|
13
|
-
type BuildConfiguration = TargetConfiguration & {
|
|
14
|
-
outputPath?: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const createRomaViteConfig = (
|
|
18
|
-
config: UserConfig,
|
|
19
|
-
context: ExecutorContext,
|
|
20
|
-
watch = false,
|
|
21
|
-
hmrPort = 42000
|
|
22
|
-
) => {
|
|
23
|
-
const isServe = context.targetName === 'serve';
|
|
24
|
-
const projectName = context.projectName;
|
|
25
|
-
const project = context.workspace.projects[projectName];
|
|
26
|
-
const workspaceRoot = context.root;
|
|
27
|
-
const serveConfig = project.targets.serve;
|
|
28
|
-
const options = serveConfig.options as ServeExecutorSchema;
|
|
29
|
-
let base: string;
|
|
30
|
-
let entry: string | Record<string, string>;
|
|
31
|
-
let viteConfigPath: string;
|
|
32
|
-
let projectRoot = project.root;
|
|
33
|
-
let appDir = '';
|
|
34
|
-
if (isServe) {
|
|
35
|
-
const [appDirectory, ...rest] = projectRoot.split('/');
|
|
36
|
-
projectRoot = rest.join('/');
|
|
37
|
-
appDir = appDirectory;
|
|
38
|
-
base = resolve(context.root, appDirectory);
|
|
39
|
-
entry = {
|
|
40
|
-
self: join(projectRoot, 'src/index.ts'),
|
|
41
|
-
};
|
|
42
|
-
viteConfigPath = resolve(base, projectRoot, 'vite.config.ts');
|
|
43
|
-
} else {
|
|
44
|
-
base = resolve(context.root, projectRoot);
|
|
45
|
-
entry = '/src/index.ts';
|
|
46
|
-
viteConfigPath = resolve(base, 'vite.config.ts');
|
|
47
|
-
}
|
|
48
|
-
if (
|
|
49
|
-
isServe &&
|
|
50
|
-
options.additionalProjects &&
|
|
51
|
-
options.additionalProjects.length > 0
|
|
52
|
-
) {
|
|
53
|
-
options.additionalProjects.forEach((project) => {
|
|
54
|
-
const projectConfig = context.workspace.projects[project];
|
|
55
|
-
const path = join(
|
|
56
|
-
projectConfig.root.replace(appDir + '/', ''),
|
|
57
|
-
'src',
|
|
58
|
-
'index.ts'
|
|
59
|
-
);
|
|
60
|
-
console.log('Adding project', path, 'to server-list');
|
|
61
|
-
entry[`${project}`] = path;
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
const buildConfig = project.targets.build as BuildConfiguration;
|
|
65
|
-
const outputPath = buildConfig.outputPath ?? `dist/apps/${projectName}`;
|
|
66
|
-
|
|
67
|
-
const devPortalPath = resolve(
|
|
68
|
-
process.cwd(),
|
|
69
|
-
'node_modules/@equinor/roma-framework/dev-portal'
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
if (!config.build) {
|
|
73
|
-
config.build = {
|
|
74
|
-
lib: {
|
|
75
|
-
entry: 'src/index.ts',
|
|
76
|
-
fileName: 'app-bundle',
|
|
77
|
-
formats: ['es'],
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
(config.build.lib as LibraryOptions).entry = entry;
|
|
82
|
-
|
|
83
|
-
const minifyPlugin = [];
|
|
84
|
-
|
|
85
|
-
if (config.build.minify) {
|
|
86
|
-
minifyPlugin.push(minifyEs());
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const build = context.targetName === 'build';
|
|
90
|
-
const romaConfig = {
|
|
91
|
-
customLogger: new Logger(),
|
|
92
|
-
cacheDir: resolve(
|
|
93
|
-
context.root,
|
|
94
|
-
'node_modules',
|
|
95
|
-
'.vite',
|
|
96
|
-
context.projectName
|
|
97
|
-
),
|
|
98
|
-
assetsInclude: [`${devPortalPath}/roma-framework.umd.js`],
|
|
99
|
-
root: base,
|
|
100
|
-
server: {
|
|
101
|
-
middlewareMode: true,
|
|
102
|
-
hmr: {
|
|
103
|
-
port: hmrPort,
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
appType: 'custom',
|
|
107
|
-
define: {
|
|
108
|
-
'process.env': {},
|
|
109
|
-
},
|
|
110
|
-
build: {
|
|
111
|
-
outDir: resolve(workspaceRoot, outputPath),
|
|
112
|
-
watch: watch
|
|
113
|
-
? {
|
|
114
|
-
clearScreen: true,
|
|
115
|
-
}
|
|
116
|
-
: undefined,
|
|
117
|
-
},
|
|
118
|
-
plugins: [
|
|
119
|
-
react(),
|
|
120
|
-
nxViteTsPaths(),
|
|
121
|
-
viteEnv({
|
|
122
|
-
NODE_ENV: build ? 'production' : 'development',
|
|
123
|
-
}),
|
|
124
|
-
ViteRestart({
|
|
125
|
-
restart: ['package.json', viteConfigPath].filter(
|
|
126
|
-
(x): x is string => !!x
|
|
127
|
-
),
|
|
128
|
-
}),
|
|
129
|
-
...minifyPlugin,
|
|
130
|
-
],
|
|
131
|
-
} as UserConfig;
|
|
132
|
-
return defineConfig(mergeConfig(config, romaConfig));
|
|
133
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
|
|
3
|
-
const projects = {
|
|
4
|
-
administration: {
|
|
5
|
-
name: 'administration',
|
|
6
|
-
root: 'apps/applications/administration',
|
|
7
|
-
$schema: '../../../node_modules/nx/schemas/project-schema.json',
|
|
8
|
-
sourceRoot: 'apps/applications/administration/src',
|
|
9
|
-
projectType: 'application',
|
|
10
|
-
targets: {
|
|
11
|
-
build: {
|
|
12
|
-
dependsOn: ['^build'],
|
|
13
|
-
inputs: ['production', '^production'],
|
|
14
|
-
executor: '@equinor/roma-nx-plugin:build',
|
|
15
|
-
options: {},
|
|
16
|
-
configurations: {},
|
|
17
|
-
},
|
|
18
|
-
serve: {
|
|
19
|
-
executor: '@equinor/roma-nx-plugin:serve',
|
|
20
|
-
options: {
|
|
21
|
-
port: 3001,
|
|
22
|
-
portal: 'http://localhost:3000',
|
|
23
|
-
devPortal: 'dist/libs/roma-framework/dev-portal',
|
|
24
|
-
},
|
|
25
|
-
configurations: {},
|
|
26
|
-
},
|
|
27
|
-
portal: {
|
|
28
|
-
executor: '@equinor/roma-nx-plugin:portal',
|
|
29
|
-
options: {
|
|
30
|
-
additionalProxyTargets: {
|
|
31
|
-
'/tradeadministration': {
|
|
32
|
-
target:
|
|
33
|
-
'https://api-dev.gateway.equinor.com/tradeadministration/v1',
|
|
34
|
-
headers: {
|
|
35
|
-
'Ocp-Apim-Subscription-Key': 'RATSCORE_SUB_KEY',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
configurations: {},
|
|
41
|
-
},
|
|
42
|
-
test: {
|
|
43
|
-
inputs: [
|
|
44
|
-
'default',
|
|
45
|
-
'^production',
|
|
46
|
-
'{workspaceRoot}/jest.preset.js',
|
|
47
|
-
'{workspaceRoot}/jest.preset.js',
|
|
48
|
-
],
|
|
49
|
-
executor: '@nx/vite:test',
|
|
50
|
-
outputs: ['{options.reportsDirectory}'],
|
|
51
|
-
options: {
|
|
52
|
-
passWithNoTests: true,
|
|
53
|
-
reportsDirectory:
|
|
54
|
-
'../../../coverage/apps/applications/administration',
|
|
55
|
-
},
|
|
56
|
-
configurations: {},
|
|
57
|
-
},
|
|
58
|
-
lint: {
|
|
59
|
-
inputs: [
|
|
60
|
-
'default',
|
|
61
|
-
'{workspaceRoot}/.eslintrc.json',
|
|
62
|
-
'{workspaceRoot}/.eslintignore',
|
|
63
|
-
'{workspaceRoot}/eslint.config.js',
|
|
64
|
-
],
|
|
65
|
-
executor: '@nx/eslint:eslint',
|
|
66
|
-
outputs: ['{options.outputFile}'],
|
|
67
|
-
options: {
|
|
68
|
-
lintFilePatterns: [
|
|
69
|
-
'apps/applications/administration/**/*.{ts,tsx,js,jsx}',
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
configurations: {},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
tags: ['roma-application'],
|
|
76
|
-
implicitDependencies: [],
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const executorContext = {
|
|
81
|
-
root: '/Users/RHENRI/dev/tops-roma/roma-workbench',
|
|
82
|
-
target: {
|
|
83
|
-
dependsOn: ['^build'],
|
|
84
|
-
inputs: ['production', '^production'],
|
|
85
|
-
executor: '@equinor/roma-nx-plugin:build',
|
|
86
|
-
options: {},
|
|
87
|
-
configurations: {},
|
|
88
|
-
},
|
|
89
|
-
projectsConfigurations: {
|
|
90
|
-
projects,
|
|
91
|
-
version: 2,
|
|
92
|
-
},
|
|
93
|
-
workspace: {
|
|
94
|
-
projects,
|
|
95
|
-
version: 2,
|
|
96
|
-
$schema: './node_modules/nx/schemas/nx-schema.json',
|
|
97
|
-
},
|
|
98
|
-
projectName: 'administration',
|
|
99
|
-
targetName: 'build',
|
|
100
|
-
cwd: '/Users/RHENRI/dev/tops-roma/roma-workbench',
|
|
101
|
-
isVerbose: false,
|
|
102
|
-
} as ExecutorContext;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import { ProjectConfiguration } from 'nx/src/config/workspace-json-project-json';
|
|
3
|
-
import { publishApplication } from './publish-script';
|
|
4
|
-
import { PublishExecutorSchema } from './schema';
|
|
5
|
-
|
|
6
|
-
type BuildConfiguration = ProjectConfiguration & {
|
|
7
|
-
outputPath?: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default async function runExecutor(
|
|
11
|
-
options: PublishExecutorSchema,
|
|
12
|
-
context: ExecutorContext
|
|
13
|
-
) {
|
|
14
|
-
const projectName = context.projectName;
|
|
15
|
-
const project = context.workspace.projects[projectName] as BuildConfiguration;
|
|
16
|
-
const buildConfig = project.targets.build as BuildConfiguration;
|
|
17
|
-
const outputPath = buildConfig.outputPath ?? `dist/apps/${projectName}`;
|
|
18
|
-
let success = true;
|
|
19
|
-
try {
|
|
20
|
-
await publishApplication(outputPath, options);
|
|
21
|
-
} catch (ex) {
|
|
22
|
-
console.error(`Error when publishing ${projectName}`);
|
|
23
|
-
console.error(ex);
|
|
24
|
-
success = false;
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
success,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export type Manifest = {
|
|
2
|
-
key: string;
|
|
3
|
-
version: Version;
|
|
4
|
-
shortName: string;
|
|
5
|
-
name: string;
|
|
6
|
-
description: string;
|
|
7
|
-
tags: Array<string>;
|
|
8
|
-
hide: boolean;
|
|
9
|
-
order: number;
|
|
10
|
-
type: string;
|
|
11
|
-
accentColor: string;
|
|
12
|
-
icon: string;
|
|
13
|
-
categoryId: string;
|
|
14
|
-
category: Category;
|
|
15
|
-
entry?: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type ManifestFile = Omit<Manifest, 'version'> & {
|
|
19
|
-
version: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type Version = {
|
|
23
|
-
major: number;
|
|
24
|
-
minor: number;
|
|
25
|
-
patch: number;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type Category = {
|
|
29
|
-
id: string;
|
|
30
|
-
name: string;
|
|
31
|
-
color: string;
|
|
32
|
-
defaultIcon: string;
|
|
33
|
-
};
|