@equinor/roma-nx-plugin 1.1.0 → 1.1.1

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.
Files changed (109) hide show
  1. package/package.json +4 -3
  2. package/src/executors/build/build.d.ts +4 -0
  3. package/src/executors/build/build.js +77 -0
  4. package/src/executors/build/build.js.map +1 -0
  5. package/src/executors/build/executor.d.ts +5 -0
  6. package/src/executors/build/executor.js +8 -0
  7. package/src/executors/build/executor.js.map +1 -0
  8. package/src/executors/build/minify.d.ts +2 -0
  9. package/src/executors/build/minify.js +22 -0
  10. package/src/executors/build/minify.js.map +1 -0
  11. package/src/executors/component-test/executor.d.ts +4 -0
  12. package/src/executors/component-test/executor.js +48 -0
  13. package/src/executors/component-test/executor.js.map +1 -0
  14. package/src/executors/create-vite-config.d.ts +3 -0
  15. package/src/executors/create-vite-config.js +106 -0
  16. package/src/executors/create-vite-config.js.map +1 -0
  17. package/src/executors/executor-context.d.ts +2 -0
  18. package/src/executors/executor-context.js +101 -0
  19. package/src/executors/executor-context.js.map +1 -0
  20. package/src/executors/publish/executor.d.ts +5 -0
  21. package/src/executors/publish/executor.js +24 -0
  22. package/src/executors/publish/executor.js.map +1 -0
  23. package/src/executors/publish/manifest-model.d.ts +30 -0
  24. package/src/executors/publish/manifest-model.js +3 -0
  25. package/src/executors/publish/manifest-model.js.map +1 -0
  26. package/src/executors/publish/publish-script.d.ts +9 -0
  27. package/src/executors/publish/publish-script.js +185 -0
  28. package/src/executors/publish/publish-script.js.map +1 -0
  29. package/src/executors/serve/executor.d.ts +3 -0
  30. package/src/executors/serve/executor.js +17 -0
  31. package/src/executors/serve/executor.js.map +1 -0
  32. package/src/executors/serve/get-manifest.d.ts +2 -0
  33. package/src/executors/serve/get-manifest.js +20 -0
  34. package/src/executors/serve/get-manifest.js.map +1 -0
  35. package/src/executors/serve/server.d.ts +3 -0
  36. package/src/executors/serve/server.js +175 -0
  37. package/src/executors/serve/server.js.map +1 -0
  38. package/src/executors/utils/get-vite-config.d.ts +1 -0
  39. package/src/executors/utils/get-vite-config.js +13 -0
  40. package/src/executors/utils/get-vite-config.js.map +1 -0
  41. package/src/executors/utils/logger.d.ts +24 -0
  42. package/src/executors/utils/logger.js +69 -0
  43. package/src/executors/utils/logger.js.map +1 -0
  44. package/src/generators/app/data/modules.d.ts +19 -0
  45. package/src/generators/app/data/modules.js +23 -0
  46. package/src/generators/app/data/modules.js.map +1 -0
  47. package/src/generators/app/generator.d.ts +5 -0
  48. package/src/generators/app/generator.js +101 -0
  49. package/src/generators/app/generator.js.map +1 -0
  50. package/src/generators/component-test/files/cypress/support/commands.d.ts +0 -0
  51. package/src/generators/component-test/files/cypress/support/{commands.ts → commands.js} +2 -1
  52. package/src/generators/component-test/files/cypress/support/commands.js.map +1 -0
  53. package/src/generators/component-test/files/cypress/support/component.d.ts +9 -0
  54. package/src/generators/component-test/files/cypress/support/{component.ts → component.js} +7 -21
  55. package/src/generators/component-test/files/cypress/support/component.js.map +1 -0
  56. package/src/generators/component-test/generator.d.ts +4 -0
  57. package/src/generators/component-test/generator.js +36 -0
  58. package/src/generators/component-test/generator.js.map +1 -0
  59. package/src/generators/preset/generator.d.ts +4 -0
  60. package/src/generators/preset/generator.js +13 -0
  61. package/src/generators/preset/generator.js.map +1 -0
  62. package/src/index.js +5 -0
  63. package/src/index.js.map +1 -0
  64. package/src/migrations/add-publish-target/add-publish-target.d.ts +2 -0
  65. package/src/migrations/add-publish-target/add-publish-target.js +32 -0
  66. package/src/migrations/add-publish-target/add-publish-target.js.map +1 -0
  67. package/src/migrations/move-fusion-manifest/move-fusion-manifest.d.ts +2 -0
  68. package/src/migrations/move-fusion-manifest/move-fusion-manifest.js +30 -0
  69. package/src/migrations/move-fusion-manifest/move-fusion-manifest.js.map +1 -0
  70. package/src/migrations/remove-fusion-cli/remove-fusion-cli.d.ts +2 -0
  71. package/src/migrations/remove-fusion-cli/remove-fusion-cli.js +48 -0
  72. package/src/migrations/remove-fusion-cli/remove-fusion-cli.js.map +1 -0
  73. package/.eslintrc.json +0 -37
  74. package/jest.config.ts +0 -13
  75. package/manifest-schema.json +0 -80
  76. package/project.json +0 -65
  77. package/src/executors/build/build.ts +0 -100
  78. package/src/executors/build/executor.spec.ts +0 -13
  79. package/src/executors/build/executor.ts +0 -10
  80. package/src/executors/build/minify.ts +0 -20
  81. package/src/executors/component-test/executor.spec.ts +0 -18
  82. package/src/executors/component-test/executor.ts +0 -57
  83. package/src/executors/create-vite-config.ts +0 -133
  84. package/src/executors/executor-context.ts +0 -102
  85. package/src/executors/publish/executor.ts +0 -29
  86. package/src/executors/publish/manifest-model.ts +0 -33
  87. package/src/executors/publish/publish-script.spec.ts +0 -118
  88. package/src/executors/publish/publish-script.ts +0 -210
  89. package/src/executors/serve/executor.ts +0 -19
  90. package/src/executors/serve/get-manifest.ts +0 -20
  91. package/src/executors/serve/server.ts +0 -250
  92. package/src/executors/utils/get-vite-config.ts +0 -9
  93. package/src/executors/utils/logger.ts +0 -90
  94. package/src/generators/app/data/modules.ts +0 -19
  95. package/src/generators/app/generator.spec.ts +0 -86
  96. package/src/generators/app/generator.ts +0 -141
  97. package/src/generators/component-test/generator.spec.ts +0 -79
  98. package/src/generators/component-test/generator.ts +0 -67
  99. package/src/generators/preset/generator.spec.ts +0 -38
  100. package/src/generators/preset/generator.ts +0 -18
  101. package/src/migrations/add-publish-target/add-publish-target.spec.ts +0 -60
  102. package/src/migrations/add-publish-target/add-publish-target.ts +0 -28
  103. package/src/migrations/move-fusion-manifest/move-fusion-manifest.ts +0 -35
  104. package/src/migrations/remove-fusion-cli/remove-fusion-cli.ts +0 -70
  105. package/tsconfig.json +0 -17
  106. package/tsconfig.lib.json +0 -20
  107. package/tsconfig.spec.json +0 -26
  108. package/vite.config.ts +0 -31
  109. /package/src/{index.ts → index.d.ts} +0 -0
@@ -1,86 +0,0 @@
1
- import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
2
- import { readProjectConfiguration, Tree } from '@nx/devkit';
3
-
4
- import { appGenerator } from './generator';
5
-
6
- describe('app generator', () => {
7
- let tree: Tree;
8
-
9
- beforeEach(() => {
10
- tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
11
- });
12
-
13
- it('should run successfully when rootFormat is derived', async () => {
14
- expect(() => readProjectConfiguration(tree, 'test')).toThrow();
15
- await appGenerator(tree, {
16
- name: 'test',
17
- fusionModules: [],
18
- projectName: 'test',
19
- appProjectRoot: '',
20
- e2eProjectName: '',
21
- e2eProjectRoot: '',
22
- parsedTags: [],
23
- fileName: '',
24
- styledModule: 'css',
25
- minimal: false,
26
- routing: false,
27
- hasStyles: false,
28
- unitTestRunner: 'none',
29
- style: 'css',
30
- e2eTestRunner: 'none',
31
- linter: null,
32
- projectNameAndRootFormat: 'derived',
33
- });
34
- const config = readProjectConfiguration(tree, 'test');
35
- expect(config).toBeDefined();
36
- });
37
-
38
- it('should run successfully when rootFormat is as-provided', async () => {
39
- expect(() => readProjectConfiguration(tree, 'test')).toThrow();
40
- await appGenerator(tree, {
41
- name: 'test',
42
- fusionModules: [],
43
- projectName: 'test',
44
- appProjectRoot: '',
45
- e2eProjectName: '',
46
- e2eProjectRoot: '',
47
- parsedTags: [],
48
- fileName: '',
49
- styledModule: 'css',
50
- minimal: false,
51
- routing: false,
52
- hasStyles: false,
53
- unitTestRunner: 'none',
54
- style: 'css',
55
- e2eTestRunner: 'none',
56
- linter: null,
57
- projectNameAndRootFormat: 'as-provided',
58
- });
59
- const config = readProjectConfiguration(tree, 'test');
60
- expect(config).toBeDefined();
61
- });
62
-
63
- it('should run successfully when rootFormat is not set', async () => {
64
- expect(() => readProjectConfiguration(tree, 'test')).toThrow();
65
- await appGenerator(tree, {
66
- name: 'test',
67
- fusionModules: [],
68
- projectName: 'test',
69
- appProjectRoot: '',
70
- e2eProjectName: '',
71
- e2eProjectRoot: '',
72
- parsedTags: [],
73
- fileName: '',
74
- styledModule: 'css',
75
- minimal: false,
76
- routing: false,
77
- hasStyles: false,
78
- unitTestRunner: 'none',
79
- style: 'css',
80
- e2eTestRunner: 'none',
81
- linter: null,
82
- });
83
- const config = readProjectConfiguration(tree, 'test');
84
- expect(config).toBeDefined();
85
- });
86
- });
@@ -1,141 +0,0 @@
1
- import {
2
- addDependenciesToPackageJson,
3
- formatFiles,
4
- generateFiles,
5
- getWorkspaceLayout,
6
- installPackagesTask,
7
- runTasksInSerial,
8
- Tree,
9
- updateProjectConfiguration,
10
- readProjectConfiguration,
11
- } from '@nx/devkit';
12
- import * as path from 'path';
13
- import { AppGeneratorSchema } from './schema';
14
- import { applicationGenerator } from '@nx/react';
15
- import { NormalizedSchema } from '@nx/react/src/generators/application/schema';
16
- import { modules } from './data/modules';
17
- import { getRelativeCwd } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
18
-
19
- async function addDependencies(
20
- tree: Tree,
21
- options: AppGeneratorSchema & Omit<NormalizedSchema, 'bundler' | 'minimal'>
22
- ) {
23
- const dependencies: Record<string, string> = {
24
- '@equinor/roma-framework': '^0.0.12',
25
- '@equinor/fusion-framework': '7.0.30',
26
- '@equinor/fusion-framework-module-app': '5.2.13',
27
- '@equinor/eds-core-react': '^0.39.0',
28
- '@equinor/eds-data-grid-react': '^0.6.1',
29
- '@equinor/eds-icons': '^0.21.0',
30
- '@equinor/eds-tokens': '^0.9.2',
31
- '@equinor/fusion-framework-react': '6.0.2',
32
- '@equinor/fusion-framework-react-app': '4.3.3',
33
- '@equinor/fusion-framework-react-module': '3.0.8',
34
- '@equinor/fusion-framework-module-navigation': '3.1.4',
35
- 'styled-components': '^6.0.8',
36
- };
37
- options.fusionModules
38
- .flatMap((module) => module.split(','))
39
- .forEach((module) => {
40
- dependencies[`@equinor/${module}`] = modules[module];
41
- });
42
- const devDependencies = {};
43
- return runTasksInSerial(
44
- ...[
45
- addDependenciesToPackageJson(
46
- tree,
47
- dependencies,
48
- devDependencies,
49
- undefined,
50
- true
51
- ),
52
- ]
53
- );
54
- }
55
-
56
- function updateTargets(
57
- tree: Tree,
58
- options: AppGeneratorSchema & Omit<NormalizedSchema, 'bundler'>
59
- ) {
60
- const existing = readProjectConfiguration(tree, options.name);
61
- updateProjectConfiguration(tree, options.name, {
62
- ...existing,
63
- targets: {
64
- build: {
65
- executor: '@equinor/roma-nx-plugin:build',
66
- options: {},
67
- },
68
- serve: {
69
- executor: '@equinor/roma-nx-plugin:serve',
70
- options: {
71
- port: options.devServerPort ?? 3000,
72
- },
73
- },
74
- portal: {
75
- executor: '@equinor/roma-nx-plugin:portal',
76
- options: {},
77
- },
78
- publish: {
79
- executor: '@equinor/roma-nx-plugin:publish',
80
- dependsOn: ['build'],
81
- configurations: {
82
- production: {
83
- environment: 'production',
84
- },
85
- qa: {
86
- environment: 'qa',
87
- },
88
- dev: {
89
- environment: 'dev',
90
- },
91
- },
92
- defaultConfiguration: 'dev',
93
- },
94
- },
95
- });
96
- }
97
-
98
- export async function appGenerator(
99
- tree: Tree,
100
- options: AppGeneratorSchema & Omit<NormalizedSchema, 'bundler'>
101
- ) {
102
- const derived = options.projectNameAndRootFormat !== 'as-provided';
103
- if (derived && options.directory) {
104
- throw new Error(
105
- 'You cannot provide a directory when using projectNameAndRootFormat = derived '
106
- );
107
- }
108
- const config = getWorkspaceLayout(tree);
109
- const outputDir = derived
110
- ? `${config.appsDir}/${options.name}`
111
- : path.join(getRelativeCwd(), options.directory ?? options.name);
112
-
113
- await applicationGenerator(tree, {
114
- ...options,
115
- tags: [options.tags ?? '', 'roma-application'].join(','),
116
- rootProject: false,
117
- bundler: 'vite',
118
- });
119
- tree.delete(`${outputDir}/vite.config.ts`);
120
- tree.delete(`${outputDir}/index.html`);
121
- updateTargets(tree, options);
122
- generateFiles(tree, path.join(__dirname, 'files'), outputDir, options);
123
- await addDependencies(tree, options);
124
- await formatFiles(tree);
125
- tree.delete(`${outputDir}/src/app`);
126
- tree.delete(`${outputDir}/src/assets`);
127
- tree.delete(`${outputDir}/src/main.tsx`);
128
- tree.delete(`${outputDir}/src/styles.css`);
129
- tree.delete(`${outputDir}/index.html`);
130
- tree.delete(`${outputDir}/public`);
131
-
132
- if (options.skipPackageJson) {
133
- return () => true;
134
- }
135
-
136
- return () => {
137
- installPackagesTask(tree);
138
- };
139
- }
140
-
141
- export default appGenerator;
@@ -1,79 +0,0 @@
1
- import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
2
- import { Tree, readProjectConfiguration } from '@nx/devkit';
3
-
4
- import { componentTestGenerator } from './generator';
5
- import { Linter } from '@nx/eslint/src/generators/utils/linter';
6
- import appGenerator from '../app/generator';
7
- import { AppGeneratorSchema } from '../app/schema';
8
- import { vi } from 'vitest';
9
-
10
- describe('component-test generator', () => {
11
- let tree: Tree;
12
-
13
- vi.mock('@nx/devkit', async (importOriginal) => {
14
- return {
15
- ...(await importOriginal<typeof import('@nx/devkit')>()),
16
- installPackagesTask: vi.fn(() => {
17
- /*intentionally left blank*/
18
- }),
19
- };
20
- });
21
-
22
- const appOptions: AppGeneratorSchema = {
23
- e2ePort: 0,
24
- e2eWebServerAddress: '',
25
- e2eWebServerTarget: '',
26
- appProjectRoot: '',
27
- e2eProjectName: '',
28
- e2eProjectRoot: '',
29
- fileName: '',
30
- hasStyles: false,
31
- parsedTags: [],
32
- projectName: '',
33
- styledModule: undefined,
34
- unitTestRunner: undefined,
35
- style: 'styled-components',
36
- linter: Linter.EsLint,
37
- e2eTestRunner: 'none',
38
- name: 'test',
39
- minimal: true,
40
- routing: false,
41
- fusionModules: [],
42
- };
43
-
44
- beforeEach(async () => {
45
- tree = createTreeWithEmptyWorkspace();
46
- await appGenerator(tree, appOptions);
47
- });
48
-
49
- it('should add the component-test execution target', async () => {
50
- await componentTestGenerator(tree, {
51
- project: 'test',
52
- });
53
- const config = readProjectConfiguration(tree, 'test');
54
- expect(config).toBeDefined();
55
- expect(config.targets).toHaveProperty('component-test');
56
- });
57
-
58
- it('should add the cypress-files', async () => {
59
- await componentTestGenerator(tree, {
60
- project: 'test',
61
- });
62
-
63
- const changes = tree.listChanges();
64
- const expectedChangePaths = [
65
- 'cypress/downloads/.gitkeep',
66
- 'cypress/fixtures/example.json',
67
- 'cypress/screenshots/.gitkeep',
68
- 'cypress/videos/.gitkeep',
69
- 'cypress/support/commands.ts',
70
- 'cypress/support/component.ts',
71
- 'cypress/support/component-index.html',
72
- 'cypress.config.ts',
73
- ];
74
- expectedChangePaths.forEach((pa) => {
75
- const change = changes.find((c) => c.path.endsWith(pa));
76
- expect(change.type).toBe('CREATE');
77
- });
78
- });
79
- });
@@ -1,67 +0,0 @@
1
- import {
2
- readProjectConfiguration,
3
- updateProjectConfiguration,
4
- formatFiles,
5
- generateFiles,
6
- addDependenciesToPackageJson,
7
- installPackagesTask,
8
- Tree,
9
- } from '@nx/devkit';
10
- import * as path from 'path';
11
- import { ComponentTestGeneratorSchema } from './schema';
12
-
13
- export async function componentTestGenerator(
14
- tree: Tree,
15
- options: ComponentTestGeneratorSchema
16
- ) {
17
- const name = options.project;
18
- const currentConfiguration = readProjectConfiguration(tree, name);
19
- if (currentConfiguration.projectType !== 'application') {
20
- throw new Error(
21
- `Generator can only be run on applications - not supported for libraries`
22
- );
23
- }
24
- if (
25
- currentConfiguration.targets['build'].executor !==
26
- '@equinor/roma-nx-plugin:build'
27
- ) {
28
- throw new Error(
29
- `Generator can only be run on applications build with @equinor/roma-nx-plugin:build`
30
- );
31
- }
32
- if (currentConfiguration.targets['component-test']) {
33
- throw new Error(`Component test target already exists`);
34
- }
35
- updateProjectConfiguration(tree, name, {
36
- ...currentConfiguration,
37
- targets: {
38
- ...currentConfiguration.targets,
39
- 'component-test': {
40
- executor: '@equinor/roma-nx-plugin:component-test',
41
- options: {
42
- quiet: true,
43
- watch: false,
44
- },
45
- },
46
- },
47
- });
48
- addDependenciesToPackageJson(
49
- tree,
50
- {},
51
- {
52
- '@cypress/code-coverage': '^3.13.1',
53
- cypress: '^13.14.2',
54
- 'vite-plugin-istanbul': '^6.0.2',
55
- }
56
- );
57
- generateFiles(
58
- tree,
59
- path.join(__dirname, 'files'),
60
- currentConfiguration.root,
61
- options
62
- );
63
- await formatFiles(tree);
64
- return installPackagesTask(tree);
65
- }
66
-
67
- export default componentTestGenerator;
@@ -1,38 +0,0 @@
1
- import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
2
- import { readProjectConfiguration, Tree } from '@nx/devkit';
3
-
4
- import { presetGenerator } from './generator';
5
- import { PresetGeneratorSchema } from './schema';
6
- import { Linter } from '@nx/eslint/src/generators/utils/linter';
7
-
8
- describe('preset generator', () => {
9
- let tree: Tree;
10
- const options: PresetGeneratorSchema = {
11
- appProjectRoot: '',
12
- e2eProjectName: '',
13
- e2eProjectRoot: '',
14
- fileName: '',
15
- hasStyles: false,
16
- parsedTags: [],
17
- projectName: '',
18
- styledModule: undefined,
19
- unitTestRunner: undefined,
20
- style: 'styled-components',
21
- linter: Linter.EsLint,
22
- e2eTestRunner: 'none',
23
- name: 'test',
24
- minimal: true,
25
- routing: false,
26
- fusionModules: [],
27
- };
28
-
29
- beforeEach(() => {
30
- tree = createTreeWithEmptyWorkspace();
31
- });
32
-
33
- it('should run successfully', async () => {
34
- await presetGenerator(tree, options);
35
- const config = readProjectConfiguration(tree, 'test');
36
- expect(config).toBeDefined();
37
- }, 20_000);
38
- });
@@ -1,18 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- import { PresetGeneratorSchema } from './schema';
3
-
4
- export async function presetGenerator(
5
- tree: Tree,
6
- options: PresetGeneratorSchema
7
- ) {
8
- options.directory = 'apps';
9
- options.name = options.appName || options.name;
10
- options.projectName = options.appName || options.name;
11
- options.style = options.style || options.styledModule || 'styled-components';
12
- options.styledModule = options.style;
13
- return await import('../app/generator').then(({ appGenerator }) =>
14
- appGenerator(tree, { ...options })
15
- );
16
- }
17
-
18
- export default presetGenerator;
@@ -1,60 +0,0 @@
1
- import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
2
- import { readProjectConfiguration, Tree } from '@nx/devkit';
3
-
4
- import update from './add-publish-target';
5
- import appGenerator from '../../generators/app/generator';
6
-
7
- describe('add-publish-target migration', () => {
8
- let tree: Tree;
9
-
10
- beforeEach(async () => {
11
- tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
12
- await appGenerator(tree, {
13
- name: 'test-app',
14
- fusionModules: [],
15
- projectName: 'test-app',
16
- appProjectRoot: '',
17
- e2eProjectName: '',
18
- e2eProjectRoot: '',
19
- parsedTags: [],
20
- fileName: '',
21
- styledModule: 'css',
22
- minimal: false,
23
- routing: false,
24
- hasStyles: false,
25
- unitTestRunner: 'none',
26
- style: 'css',
27
- e2eTestRunner: 'none',
28
- linter: null,
29
- });
30
- });
31
-
32
- it('should have publish target by default', async () => {
33
- const config = readProjectConfiguration(tree, 'test-app');
34
- expect(config.targets.publish).toBeDefined();
35
- update(tree);
36
- });
37
-
38
- it('should add publish target', async () => {
39
- let config = readProjectConfiguration(tree, 'test-app');
40
- config.targets.publish = undefined;
41
- expect(config.targets.publish).toBeUndefined();
42
- update(tree);
43
- config = readProjectConfiguration(tree, 'test-app');
44
- expect(config.targets.publish).toEqual({
45
- executor: '@equinor/roma-nx-plugin:publish',
46
- configurations: {
47
- production: {
48
- environment: 'production',
49
- },
50
- qa: {
51
- environment: 'qa',
52
- },
53
- dev: {
54
- environment: 'dev',
55
- },
56
- },
57
- defaultConfiguration: 'dev',
58
- });
59
- });
60
- });
@@ -1,28 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
- import { getProjects, Tree, updateProjectConfiguration } from '@nx/devkit';
3
-
4
- export default function update(tree: Tree) {
5
- const projects = getProjects(tree);
6
-
7
- for (const [name, project] of projects) {
8
- if (project.projectType !== 'application') continue;
9
- if (!project.targets?.portal) {
10
- project.targets.publish = {
11
- executor: '@equinor/roma-nx-plugin:publish',
12
- configurations: {
13
- production: {
14
- environment: 'production',
15
- },
16
- qa: {
17
- environment: 'qa',
18
- },
19
- dev: {
20
- environment: 'dev',
21
- },
22
- },
23
- defaultConfiguration: 'dev',
24
- };
25
- updateProjectConfiguration(tree, name, project);
26
- }
27
- }
28
- }
@@ -1,35 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
- import {
3
- getProjects,
4
- readJson,
5
- Tree,
6
- updateProjectConfiguration,
7
- } from '@nx/devkit';
8
- import { readdirSync } from 'fs';
9
-
10
- export default function update(tree: Tree) {
11
- const projects = getProjects(tree);
12
-
13
- for (const [, project] of projects) {
14
- const contents = readdirSync(project.root);
15
- if (contents && contents.includes('fusion-manifest.json')) {
16
- const manifest = readJson(tree, `${project.root}/fusion-manifest.json`);
17
- const packageJson = readJson(tree, `${project.root}/package.json`);
18
- const { version, ...rest } = manifest;
19
- packageJson.version = version;
20
- packageJson.roma = rest;
21
- tree.exists(`${project.root}/fusion-manifest.json`) &&
22
- tree.delete(`${project.root}/fusion-manifest.json`);
23
- tree.exists(`${project.root}/src/version.ts`) &&
24
- tree.delete(`${project.root}/src/version.ts`);
25
- tree.exists(`${project.root}/app.config.js`) &&
26
- tree.delete(`${project.root}/app.config.js`);
27
- tree.exists(`${project.root}/.env.serve`) &&
28
- tree.delete(`${project.root}/.env.serve`);
29
- tree.write(
30
- `${project.root}/package.json`,
31
- JSON.stringify(packageJson, null, 2)
32
- );
33
- }
34
- }
35
- }
@@ -1,70 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
- import {
3
- getProjects,
4
- removeDependenciesFromPackageJson,
5
- Tree,
6
- updateJson,
7
- updateProjectConfiguration,
8
- } from '@nx/devkit';
9
- import { gitAdd } from 'nx/src/command-line/release/utils/git';
10
-
11
- type ServeTarget = {
12
- options: {
13
- port: number;
14
- portal: string;
15
- devPortal: string;
16
- };
17
- };
18
-
19
- export default async function update(tree: Tree) {
20
- const projects = getProjects(tree);
21
- const remove = removeDependenciesFromPackageJson(
22
- tree,
23
- [],
24
- ['@equinor/fusion-framework-cli']
25
- );
26
-
27
- for (const [name, project] of projects) {
28
- if (project.projectType !== 'application') continue;
29
- if ('portal' in project.targets) {
30
- delete project.targets.portal;
31
- }
32
- if ('serve' in project.targets) {
33
- const target = project.targets.serve as ServeTarget;
34
- if (target.options.portal?.includes('localhost')) {
35
- delete target.options.portal;
36
- project.targets.serve = target;
37
- }
38
- }
39
- if (tree.exists(`${project.root}/vite.config.js`)) {
40
- tree.delete(`${project.root}/vite.config.js`);
41
- }
42
- if (tree.exists(`${project.root}/.eslintrc.json`)) {
43
- updateJson(tree, `${project.root}/.eslintrc.json`, (value) => ({
44
- ...value,
45
- parserOptions: {
46
- sourceType: 'module',
47
- },
48
- }));
49
- }
50
- tree.write(
51
- `${project.root}/vite.config.ts`,
52
- `import { defineConfig } from 'vite';
53
-
54
- export default defineConfig({
55
- build: {
56
- minify: true,
57
- lib: {
58
- entry: 'src/index.ts',
59
- fileName: 'app-bundle',
60
- formats: ['es'],
61
- },
62
- },
63
- });
64
- `
65
- );
66
- updateProjectConfiguration(tree, name, project);
67
- }
68
-
69
- return remove();
70
- }
package/tsconfig.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "module": "commonjs",
5
- "types": ["node"]
6
- },
7
- "files": [],
8
- "include": [],
9
- "references": [
10
- {
11
- "path": "./tsconfig.lib.json"
12
- },
13
- {
14
- "path": "./tsconfig.spec.json"
15
- }
16
- ]
17
- }
package/tsconfig.lib.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "target": "es2017",
5
- "module": "commonjs",
6
- "outDir": "../../dist/out-tsc",
7
- "declaration": true,
8
- "types": [
9
- "node"
10
- ]
11
- },
12
- "include": [
13
- "src/**/*.ts"
14
- ],
15
- "exclude": [
16
- "jest.config.ts",
17
- "src/**/*.spec.ts",
18
- "src/**/*.test.ts"
19
- ]
20
- }
@@ -1,26 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../dist/out-tsc",
5
- "types": [
6
- "vitest/globals",
7
- "vitest/importMeta",
8
- "vite/client",
9
- "node",
10
- "vitest"
11
- ]
12
- },
13
- "include": [
14
- "vite.config.ts",
15
- "vitest.config.ts",
16
- "src/**/*.test.ts",
17
- "src/**/*.spec.ts",
18
- "src/**/*.test.tsx",
19
- "src/**/*.spec.tsx",
20
- "src/**/*.test.js",
21
- "src/**/*.spec.js",
22
- "src/**/*.test.jsx",
23
- "src/**/*.spec.jsx",
24
- "src/**/*.d.ts"
25
- ]
26
- }