Skip to content

Commit

Permalink
Add new files and update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
serifcolakel committed Feb 10, 2024
1 parent 78dd0dc commit 2904e70
Show file tree
Hide file tree
Showing 39 changed files with 11,682 additions and 30,809 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"workbench.colorCustomizations": {
"activityBar.background": "#2B3106",
"titleBar.activeBackground": "#3C4408",
"titleBar.activeForeground": "#F9FCE5"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export default defineConfig({
...nxE2EPreset(__filename, {
cypressDir: 'src',
webServerCommands: {
default: 'nx run mehrzweck:serve',
production: 'nx run mehrzweck:preview',
default: 'nx run container:serve',
production: 'nx run container:preview',
},
ciWebServerCommand: 'nx run mehrzweck:serve-static',
ciWebServerCommand: 'nx run container:serve-static',
}),
baseUrl: 'http://localhost:4200',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "mehrzweck-e2e",
"name": "container-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/mehrzweck-e2e/src",
"sourceRoot": "apps/container-e2e/src",
"targets": {},
"implicitDependencies": ["mehrzweck"],
"implicitDependencies": ["container"],
"tags": []
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getGreeting } from '../support/app.po';

describe('mehrzweck-e2e', () => {
describe('container-e2e', () => {
beforeEach(() => cy.visit('/'));

it('should display welcome message', () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable */
export default {
displayName: 'mehrzweck',
displayName: 'container',
preset: '../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/mehrzweck',
coverageDirectory: '../../coverage/apps/container',
};
25 changes: 25 additions & 0 deletions apps/container/module-federation.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ModuleFederationConfig } from '@nx/webpack';

const config: ModuleFederationConfig = {
name: 'container',
/**
* To use a remote that does not exist in your current Nx Workspace
* You can use the tuple-syntax to define your remote
*
* remotes: [['my-external-remote', 'https://nx-angular-remote.netlify.app']]
*
* You _may_ need to add a `remotes.d.ts` file to your `src/` folder declaring the external remote for tsc, with the
* following content:
*
* declare module 'my-external-remote';
*
*/
remotes: [
['genel-muhasebe', 'http://localhost:3005/remoteEntry.js']
],
exposes: {
'./App': 'apps/container/src/app/app',
},
};

export default config;
93 changes: 93 additions & 0 deletions apps/container/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"name": "container",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/container/src",
"projectType": "application",
"targets": {
"build": {
"executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"compiler": "babel",
"outputPath": "dist/apps/container",
"index": "apps/container/src/index.html",
"baseHref": "/",
"main": "apps/container/src/main.ts",
"tsConfig": "apps/container/tsconfig.app.json",
"assets": [
"apps/container/src/favicon.ico",
"apps/container/src/assets"
],
"styles": ["apps/container/src/styles.css"],
"scripts": [],
"webpackConfig": "apps/container/webpack.config.ts"
},
"configurations": {
"development": {
"extractLicenses": false,
"optimization": false,
"sourceMap": true,
"vendorChunk": true
},
"production": {
"fileReplacements": [
{
"replace": "apps/container/src/environments/environment.ts",
"with": "apps/container/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"webpackConfig": "apps/container/webpack.config.prod.ts"
}
}
},
"serve": {
"executor": "@nx/react:module-federation-dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "container:build",
"hmr": true,
"liveReload": true,
"watch": true,
"port": 3002
},
"configurations": {
"development": {
"buildTarget": "container:build:development",
"hmr": true,
"liveReload": true,
"watch": true,
"port": 3002
},
"production": {
"buildTarget": "container:build:production",
"hmr": false
}
}
},
"serve-static": {
"executor": "@nx/web:file-server",
"defaultConfiguration": "production",
"options": {
"buildTarget": "container:build",
"watch": false,
"port": 3002
},
"configurations": {
"development": {
"buildTarget": "container:build:development"
},
"production": {
"buildTarget": "container:build:production"
}
}
}
},
"tags": []
}
File renamed without changes.
25 changes: 25 additions & 0 deletions apps/container/src/app/app.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { render } from '@testing-library/react';

import { BrowserRouter } from 'react-router-dom';

import App from './app';

describe('App', () => {
it('should render successfully', () => {
const { baseElement } = render(
<BrowserRouter>
<App />
</BrowserRouter>
);
expect(baseElement).toBeTruthy();
});

it('should have a greeting as the title', () => {
const { getByText } = render(
<BrowserRouter>
<App />
</BrowserRouter>
);
expect(getByText(/Welcome container/gi)).toBeTruthy();
});
});
22 changes: 22 additions & 0 deletions apps/container/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as React from 'react';

import NxWelcome from './nx-welcome';

import { Link, Route, Routes } from 'react-router-dom';

export function App() {
return (
<React.Suspense fallback={null}>
<ul>
<li>
<Link to="/">1122222222</Link>
</li>
</ul>
<Routes>
<Route path="/" element={<NxWelcome title="container" />} />
</Routes>
</React.Suspense>
);
}

export default App;
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ export function NxWelcome({ title }: { title: string }) {
<div className="container">
<div id="welcome">
<h1>
<span> Hello there, </span>
<span> Hello there,22222 </span>
Welcome {title} 👋
</h1>
</div>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { StrictMode } from 'react';
import * as ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';

import App from './app/app';

Expand All @@ -8,6 +9,8 @@ const root = ReactDOM.createRoot(
);
root.render(
<StrictMode>
<App />
<BrowserRouter>
<App />
</BrowserRouter>
</StrictMode>
);
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Mehrzweck</title>
<title>Container</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>
Expand Down
1 change: 1 addition & 0 deletions apps/container/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import('./bootstrap').catch((err) => console.error(err));
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions apps/container/webpack.config.prod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { composePlugins, withNx } from '@nx/webpack';
import { withReact } from '@nx/react';
import { withModuleFederation } from '@nx/react/module-federation';
import { ModuleFederationConfig } from '@nx/webpack';

import baseConfig from './module-federation.config';

const prodConfig: ModuleFederationConfig = {
...baseConfig,
/*
* Remote overrides for production.
* Each entry is a pair of a unique name and the URL where it is deployed.
*
* e.g.
* remotes: [
* ['app1', 'http://app1.example.com'],
* ['app2', 'http://app2.example.com'],
* ]
*
* You can also use a full path to the remoteEntry.js file if desired.
*
* remotes: [
* ['app1', 'http://example.com/path/to/app1/remoteEntry.js'],
* ['app2', 'http://example.com/path/to/app2/remoteEntry.js'],
* ]
*/
remotes: [
['genel-muhasebe', 'http://localhost:3005/remoteEntry.js']
]
};

// Nx plugins for webpack to build config object from Nx options and context.
export default composePlugins(
withNx(),
withReact(),
withModuleFederation(prodConfig)
);
21 changes: 21 additions & 0 deletions apps/container/webpack.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { composePlugins, withNx, ModuleFederationConfig } from '@nx/webpack';
import { withReact } from '@nx/react';
import { withModuleFederation } from '@nx/react/module-federation';

import baseConfig from './module-federation.config';

const config: ModuleFederationConfig = {
...baseConfig,
};

// Nx plugins for webpack to build config object from Nx options and context.
export default composePlugins(
withNx(),
withReact(),
withModuleFederation(config),
(config) => {
return {
...config,
};
}
);
8 changes: 0 additions & 8 deletions apps/mehrzweck/project.json

This file was deleted.

15 changes: 0 additions & 15 deletions apps/mehrzweck/src/app/app.spec.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions apps/mehrzweck/src/app/app.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions apps/mehrzweck/webpack.config.js

This file was deleted.

Loading

0 comments on commit 2904e70

Please sign in to comment.