@equinor/roma-nx-plugin 1.0.0-BETA.0 → 1.1.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.
Files changed (114) hide show
  1. package/.eslintrc.json +37 -0
  2. package/CHANGELOG.md +42 -0
  3. package/executors.json +5 -0
  4. package/generators.json +5 -0
  5. package/jest.config.ts +13 -0
  6. package/manifest-schema.json +80 -0
  7. package/package.json +12 -11
  8. package/project.json +65 -0
  9. package/src/executors/build/build.ts +100 -0
  10. package/src/executors/build/executor.spec.ts +13 -0
  11. package/src/executors/build/executor.ts +10 -0
  12. package/src/executors/build/minify.ts +20 -0
  13. package/src/executors/component-test/executor.spec.ts +18 -0
  14. package/src/executors/component-test/executor.ts +57 -0
  15. package/src/executors/component-test/schema.d.ts +5 -0
  16. package/src/executors/component-test/schema.json +25 -0
  17. package/src/executors/create-vite-config.ts +133 -0
  18. package/src/executors/executor-context.ts +102 -0
  19. package/src/executors/publish/executor.ts +29 -0
  20. package/src/executors/publish/manifest-model.ts +33 -0
  21. package/src/executors/publish/publish-script.spec.ts +118 -0
  22. package/src/executors/publish/publish-script.ts +210 -0
  23. package/src/executors/serve/executor.ts +19 -0
  24. package/src/executors/serve/get-manifest.ts +20 -0
  25. package/src/executors/serve/schema.d.ts +2 -0
  26. package/src/executors/serve/schema.json +7 -0
  27. package/src/executors/serve/server.ts +250 -0
  28. package/src/executors/utils/get-vite-config.ts +9 -0
  29. package/src/executors/utils/logger.ts +90 -0
  30. package/src/generators/app/data/modules.ts +19 -0
  31. package/src/generators/app/generator.spec.ts +86 -0
  32. package/src/generators/app/generator.ts +141 -0
  33. package/src/generators/component-test/files/cypress/fixtures/example.json +5 -0
  34. package/src/generators/component-test/files/cypress/screenshots/.gitkeep +0 -0
  35. package/src/generators/component-test/files/cypress/support/commands.ts +37 -0
  36. package/src/generators/component-test/files/cypress/support/component-index.html +12 -0
  37. package/src/generators/component-test/files/cypress/support/component.ts +39 -0
  38. package/src/generators/component-test/files/cypress/videos/.gitkeep +0 -0
  39. package/src/generators/component-test/files/cypress.config.ts.template +43 -0
  40. package/src/generators/component-test/generator.spec.ts +79 -0
  41. package/src/generators/component-test/generator.ts +67 -0
  42. package/src/generators/component-test/schema.d.ts +3 -0
  43. package/src/generators/component-test/schema.json +17 -0
  44. package/src/generators/preset/generator.spec.ts +38 -0
  45. package/src/generators/preset/generator.ts +18 -0
  46. package/src/index.ts +1 -0
  47. package/src/migrations/add-publish-target/add-publish-target.spec.ts +60 -0
  48. package/src/migrations/add-publish-target/add-publish-target.ts +28 -0
  49. package/src/migrations/move-fusion-manifest/move-fusion-manifest.ts +35 -0
  50. package/src/migrations/remove-fusion-cli/remove-fusion-cli.ts +70 -0
  51. package/tsconfig.json +17 -0
  52. package/tsconfig.lib.json +20 -0
  53. package/tsconfig.spec.json +26 -0
  54. package/vite.config.ts +31 -0
  55. package/src/executors/build/build.d.ts +0 -4
  56. package/src/executors/build/build.js +0 -76
  57. package/src/executors/build/build.js.map +0 -1
  58. package/src/executors/build/executor.d.ts +0 -5
  59. package/src/executors/build/executor.js +0 -8
  60. package/src/executors/build/executor.js.map +0 -1
  61. package/src/executors/build/minify.d.ts +0 -2
  62. package/src/executors/build/minify.js +0 -22
  63. package/src/executors/build/minify.js.map +0 -1
  64. package/src/executors/create-vite-config.d.ts +0 -3
  65. package/src/executors/create-vite-config.js +0 -73
  66. package/src/executors/create-vite-config.js.map +0 -1
  67. package/src/executors/executor-context.d.ts +0 -2
  68. package/src/executors/executor-context.js +0 -101
  69. package/src/executors/executor-context.js.map +0 -1
  70. package/src/executors/publish/executor.d.ts +0 -5
  71. package/src/executors/publish/executor.js +0 -24
  72. package/src/executors/publish/executor.js.map +0 -1
  73. package/src/executors/publish/manifest-model.d.ts +0 -30
  74. package/src/executors/publish/manifest-model.js +0 -3
  75. package/src/executors/publish/manifest-model.js.map +0 -1
  76. package/src/executors/publish/publish-script.d.ts +0 -9
  77. package/src/executors/publish/publish-script.js +0 -185
  78. package/src/executors/publish/publish-script.js.map +0 -1
  79. package/src/executors/serve/executor.d.ts +0 -3
  80. package/src/executors/serve/executor.js +0 -8
  81. package/src/executors/serve/executor.js.map +0 -1
  82. package/src/executors/serve/get-manifest.d.ts +0 -2
  83. package/src/executors/serve/get-manifest.js +0 -20
  84. package/src/executors/serve/get-manifest.js.map +0 -1
  85. package/src/executors/serve/server.d.ts +0 -3
  86. package/src/executors/serve/server.js +0 -166
  87. package/src/executors/serve/server.js.map +0 -1
  88. package/src/executors/utils/get-vite-config.d.ts +0 -1
  89. package/src/executors/utils/get-vite-config.js +0 -13
  90. package/src/executors/utils/get-vite-config.js.map +0 -1
  91. package/src/executors/utils/logger.d.ts +0 -24
  92. package/src/executors/utils/logger.js +0 -68
  93. package/src/executors/utils/logger.js.map +0 -1
  94. package/src/generators/app/data/modules.d.ts +0 -19
  95. package/src/generators/app/data/modules.js +0 -23
  96. package/src/generators/app/data/modules.js.map +0 -1
  97. package/src/generators/app/generator.d.ts +0 -5
  98. package/src/generators/app/generator.js +0 -101
  99. package/src/generators/app/generator.js.map +0 -1
  100. package/src/generators/preset/generator.d.ts +0 -4
  101. package/src/generators/preset/generator.js +0 -13
  102. package/src/generators/preset/generator.js.map +0 -1
  103. package/src/index.js +0 -1
  104. package/src/index.js.map +0 -1
  105. package/src/migrations/add-publish-target/add-publish-target.d.ts +0 -2
  106. package/src/migrations/add-publish-target/add-publish-target.js +0 -32
  107. package/src/migrations/add-publish-target/add-publish-target.js.map +0 -1
  108. package/src/migrations/move-fusion-manifest/move-fusion-manifest.d.ts +0 -2
  109. package/src/migrations/move-fusion-manifest/move-fusion-manifest.js +0 -30
  110. package/src/migrations/move-fusion-manifest/move-fusion-manifest.js.map +0 -1
  111. package/src/migrations/remove-fusion-cli/remove-fusion-cli.d.ts +0 -2
  112. package/src/migrations/remove-fusion-cli/remove-fusion-cli.js +0 -48
  113. package/src/migrations/remove-fusion-cli/remove-fusion-cli.js.map +0 -1
  114. /package/src/{index.d.ts → generators/component-test/files/cypress/downloads/.gitkeep} +0 -0
@@ -0,0 +1,39 @@
1
+ // ***********************************************************
2
+ // This example support/component.ts is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ // Import commands.js using ES2015 syntax:
17
+ import './commands'
18
+
19
+ // Alternatively you can use CommonJS syntax:
20
+ // require('./commands')
21
+
22
+ import { mount } from 'cypress/react18'
23
+
24
+ // Augment the Cypress namespace to include type definitions for
25
+ // your custom command.
26
+ // Alternatively, can be defined in cypress/support/component.d.ts
27
+ // with a <reference path="./component" /> at the top of your spec.
28
+ declare global {
29
+ namespace Cypress {
30
+ interface Chainable {
31
+ mount: typeof mount
32
+ }
33
+ }
34
+ }
35
+
36
+ Cypress.Commands.add('mount', mount)
37
+
38
+ // Example use:
39
+ // cy.mount(<MyComponent />)
@@ -0,0 +1,43 @@
1
+ import { defineConfig } from 'cypress';
2
+ import react from '@vitejs/plugin-react';
3
+ import viteEnv from 'vite-plugin-environment';
4
+ import tsconfigPaths from 'vite-tsconfig-paths';
5
+ import istanbul from 'vite-plugin-istanbul';
6
+ import cc from '@cypress/code-coverage/task';
7
+ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
8
+
9
+ const viteConfig = {
10
+ build: {
11
+ lib: {
12
+ entry: 'src/index.ts',
13
+ },
14
+ },
15
+ plugins: [
16
+ istanbul({
17
+ include: 'src/*',
18
+ exclude: ['node_modules', 'test/'],
19
+ extension: ['.jsx', '.tsx'],
20
+ }),
21
+ react(),
22
+ nxViteTsPaths(),
23
+ tsconfigPaths(),
24
+ viteEnv({
25
+ NODE_ENV: 'development',
26
+ }),
27
+ ],
28
+ };
29
+
30
+ export default defineConfig({
31
+ component: {
32
+ video: true,
33
+ setupNodeEvents(on, config) {
34
+ cc(on, config);
35
+ return config;
36
+ },
37
+ devServer: {
38
+ framework: 'react',
39
+ bundler: 'vite',
40
+ viteConfig: viteConfig,
41
+ },
42
+ },
43
+ });
@@ -0,0 +1,79 @@
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
+ });
@@ -0,0 +1,67 @@
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;
@@ -0,0 +1,3 @@
1
+ export type ComponentTestGeneratorSchema = {
2
+ project: string;
3
+ };
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "ComponentTest",
4
+ "title": "",
5
+ "type": "object",
6
+ "properties": {
7
+ "project": {
8
+ "type": "string",
9
+ "description": "The name of the project to add cypress component testing to",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ },
13
+ "x-prompt": "What project should we add Cypress component testing to?"
14
+ }
15
+ },
16
+ "required": ["project"]
17
+ }
@@ -0,0 +1,38 @@
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
+ });
@@ -0,0 +1,18 @@
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;
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './executors/create-vite-config';
@@ -0,0 +1,60 @@
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
+ });
@@ -0,0 +1,28 @@
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
+ }
@@ -0,0 +1,35 @@
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
+ }
@@ -0,0 +1,70 @@
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 ADDED
@@ -0,0 +1,17 @@
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
+ }
@@ -0,0 +1,20 @@
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
+ }
@@ -0,0 +1,26 @@
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
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,31 @@
1
+ /// <reference types='vitest' />
2
+ import { defineConfig } from 'vite';
3
+
4
+ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
5
+
6
+ export default defineConfig({
7
+ root: __dirname,
8
+ cacheDir: '../../node_modules/.vite/plugins/roma',
9
+
10
+ plugins: [nxViteTsPaths()],
11
+
12
+ // Uncomment this if you are using workers.
13
+ // worker: {
14
+ // plugins: [ nxViteTsPaths() ],
15
+ // },
16
+
17
+ test: {
18
+ globals: true,
19
+ cache: {
20
+ dir: '../../node_modules/.vitest',
21
+ },
22
+ environment: 'node',
23
+ include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
24
+
25
+ reporters: ['default'],
26
+ coverage: {
27
+ reportsDirectory: '../../coverage/plugins/roma',
28
+ provider: 'v8',
29
+ },
30
+ },
31
+ });
@@ -1,4 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- export default function (context: ExecutorContext, watch?: boolean): Promise<{
3
- success: boolean;
4
- }>;