-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize Monorepo by Reducing Artifact and Build Sizes through Package Cleanup and Dependency Updates #110
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM, tested on the test server and everything worked fine
Also 0 vulnerabilities now with npm install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good but does not transpile for me, I did a clean clone and I'm using node v20.14.0
Do you have the same issues after deleting the node_modules
? Or is it on my end?
1] > server@1.0.0 start
[1] > ts-node-dev src/main/server.ts
[1]
[1] [INFO] 01:11:56 ts-node-dev ver. 2.0.0 (using ts-node ver. 10.9.2, typescript ver. 5.6.3)
[0] <i> [webpack-dev-server] [HPM] Proxy created: / -> http://localhost:8080
[0] <i> [webpack-dev-server] Project is running at:
[0] <i> [webpack-dev-server] Loopback: http://localhost:8888/, http://[::1]:8888/
[0] <i> [webpack-dev-server] On Your Network (IPv4): http://192.168.2.65:8888/
[0] <i> [webpack-dev-server] Content not from webpack is served from '/Users/felixdietrich/Documents/Apollon_standalone/packages/build/webapp' directory
[1] Compilation error in /Users/felixdietrich/Documents/Apollon_standalone/packages/server/src/main/resources/diagram-resource.ts
[1] [ERROR] 01:11:58 ⨯ Unable to compile TypeScript:
[1] src/main/resources/diagram-resource.ts(4,28): error TS2307: Cannot find module 'shared' or its corresponding type declarations.
[1]
[0] assets by path images/ 398 KiB
[0] assets by path images/help/ 395 KiB
[0] asset images/help/help-update-element.jpg 130 KiB [emitted] [from: assets/images/help/help-update-element.jpg] [copied]
[0] asset images/help/help-create-relationship.jpg 70 KiB [emitted] [from: assets/images/help/help-create-relationship.jpg] [copied]
[0] asset images/help/help-reconnect-relationship.jpg 69 KiB [emitted] [from: assets/images/help/help-reconnect-relationship.jpg] [copied]
[0] + 3 assets
[0] asset images/logo.png 2.48 KiB [emitted] [from: assets/images/logo.png] [copied]
[0] asset images/favicon.ico 585 bytes [emitted] [from: assets/images/favicon.ico] [copied]
[0] assets by path *.js 14.8 MiB
[0] asset vendors.js 14.1 MiB [emitted] [big] (name: vendors) (id hint: defaultVendors)
[0] asset main.js 593 KiB [emitted] [big] (name: main)
[0] asset runtime.js 104 KiB [emitted] (name: runtime)
[0] asset theme-switcher.svg 736 bytes [emitted] [from: assets/theme-switcher.svg] [copied]
[0] asset favicon.ico 585 bytes [emitted]
[0] asset index.html 518 bytes [emitted]
[0] Entrypoint main [big] 14.8 MiB = runtime.js 104 KiB vendors.js 14.1 MiB main.js 593 KiB
[0] orphan modules 6.42 MiB [orphan] 2399 modules
[0] runtime modules 30.7 KiB 16 modules
[0] cacheable modules 5.09 MiB
[0] modules by path ../../node_modules/ 4.83 MiB
[0] javascript modules 4.82 MiB 983 modules
[0] json modules 11.4 KiB 3 modules
[0] modules by path ./ 258 KiB
[0] javascript modules 105 KiB 57 modules
[0] json modules 153 KiB 8 modules
[0] asset modules 5.04 KiB
[0] data:image/svg+xml,%3csvg xmlns=%27.. 281 bytes [built] [code generated]
[0] data:image/svg+xml,%3csvg xmlns=%27.. 281 bytes [built] [code generated]
[0] + 17 modules
[0] ../../root_config.ts 365 bytes [built] [code generated]
[0] ../../package.json 1.88 KiB [built] [code generated]
[0]
[0] ERROR in ./src/main/components/apollon-editor-component/ApollonEditorComponentWithConnection.tsx 4:0-37
[0] Module not found: Error: Can't resolve 'shared' in '/Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/main/components/apollon-editor-component'
[0] resolve 'shared' in '/Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/main/components/apollon-editor-component'
[0] Parsed request is a module
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/package.json (relative path: ./src/main/components/apollon-editor-component)
[0] Field 'browser' doesn't contain a valid alias configuration
[0] resolve as module
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/main/components/apollon-editor-component/node_modules doesn't exist or is not a directory
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/main/components/node_modules doesn't exist or is not a directory
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/main/node_modules doesn't exist or is not a directory
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/node_modules doesn't exist or is not a directory
[0] looking for modules in /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/node_modules
[0] single file module
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/package.json (relative path: ./node_modules/shared)
[0] no extension
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/node_modules/shared doesn't exist
[0] .js
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/node_modules/shared.js doesn't exist
[0] .ts
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/node_modules/shared.ts doesn't exist
[0] .tsx
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/node_modules/shared.tsx doesn't exist
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/node_modules/shared doesn't exist
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/node_modules doesn't exist or is not a directory
[0] looking for modules in /Users/felixdietrich/Documents/Apollon_standalone/node_modules
[0] single file module
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/package.json (relative path: ./node_modules/shared)
[0] no extension
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared is not a file
[0] .js
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared.js doesn't exist
[0] .ts
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared.ts doesn't exist
[0] .tsx
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared.tsx doesn't exist
[0] existing directory /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/package.json (relative path: .)
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/package.json (relative path: ./node_modules/shared)
[0] no extension
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared is not a file
[0] .js
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared.js doesn't exist
[0] .ts
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared.ts doesn't exist
[0] .tsx
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared.tsx doesn't exist
[0] as directory
[0] existing directory /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared
using description file: /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/package.json (relative path: .)
[0] use ./dist/index.js from main in package.json
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/package.json (relative path: ./dist/index.js)
[0] no extension
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/dist/index.js doesn't exist
[0] .js
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/dist/index.js.js doesn't exist
[0] .ts
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/dist/index.js.ts doesn't exist
[0] .tsx
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/dist/index.js.tsx doesn't exist
[0] as directory
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/dist/index.js doesn't exist
[0] using path: /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/index
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/package.json (relative path: ./index)
[0] no extension
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/index doesn't exist
[0] .js
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/index.js doesn't exist
[0] .ts
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/index.ts doesn't exist
[0] .tsx
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/index.tsx doesn't exist
[0] /Users/felixdietrich/Documents/node_modules doesn't exist or is not a directory
[0] /Users/felixdietrich/node_modules doesn't exist or is not a directory
[0] /Users/node_modules doesn't exist or is not a directory
[0] /node_modules doesn't exist or is not a directory
[0] @ ./src/main/application.tsx 13:0-130 31:99-135
[0] @ ./src/main/index.tsx 3:0-50 37:32-49
[0]
[0] ERROR in ./src/main/components/modals/share-modal/share-modal.tsx 5:0-37
[0] Module not found: Error: Can't resolve 'shared' in '/Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/main/components/modals/share-modal'
[0] resolve 'shared' in '/Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/main/components/modals/share-modal'
[0] Parsed request is a module
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/package.json (relative path: ./src/main/components/modals/share-modal)
[0] Field 'browser' doesn't contain a valid alias configuration
[0] resolve as module
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/main/components/modals/share-modal/node_modules doesn't exist or is not a directory
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/main/components/modals/node_modules doesn't exist or is not a directory
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/main/components/node_modules doesn't exist or is not a directory
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/main/node_modules doesn't exist or is not a directory
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/src/node_modules doesn't exist or is not a directory
[0] looking for modules in /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/node_modules
[0] single file module
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/package.json (relative path: ./node_modules/shared)
[0] no extension
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/node_modules/shared doesn't exist
[0] .js
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/node_modules/shared.js doesn't exist
[0] .ts
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/node_modules/shared.ts doesn't exist
[0] .tsx
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/node_modules/shared.tsx doesn't exist
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/webapp/node_modules/shared doesn't exist
[0] /Users/felixdietrich/Documents/Apollon_standalone/packages/node_modules doesn't exist or is not a directory
[0] looking for modules in /Users/felixdietrich/Documents/Apollon_standalone/node_modules
[0] single file module
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/package.json (relative path: ./node_modules/shared)
[0] no extension
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared is not a file
[0] .js
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared.js doesn't exist
[0] .ts
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared.ts doesn't exist
[0] .tsx
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared.tsx doesn't exist
[0] existing directory /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/package.json (relative path: .)
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/package.json (relative path: ./node_modules/shared)
[0] no extension
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared is not a file
[0] .js
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared.js doesn't exist
[0] .ts
Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared.ts doesn't exist
[0] .tsx
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared.tsx doesn't exist
[0] as directory
[0] existing directory /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/package.json (relative path: .)
[0] use ./dist/index.js from main in package.json
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/package.json (relative path: ./dist/index.js)
[0] no extension
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/dist/index.js doesn't exist
[0] .js
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/dist/index.js.js doesn't exist
[0] .ts
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/dist/index.js.ts doesn't exist
[0] .tsx
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/dist/index.js.tsx doesn't exist
[0] as directory
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/dist/index.js doesn't exist
[0] using path: /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/index
[0] using description file: /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/package.json (relative path: ./index)
[0] no extension
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/index doesn't exist
[0] .js
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/index.js doesn't exist
[0] .ts
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/index.ts doesn't exist
[0] .tsx
[0] Field 'browser' doesn't contain a valid alias configuration
[0] /Users/felixdietrich/Documents/Apollon_standalone/node_modules/shared/index.tsx doesn't exist
[0] /Users/felixdietrich/Documents/node_modules doesn't exist or is not a directory
[0] /Users/felixdietrich/node_modules doesn't exist or is not a directory
[0] /Users/node_modules doesn't exist or is not a directory
[0] /node_modules doesn't exist or is not a directory
[0] @ ./src/main/components/modals/application-modal-content.ts 8:0-55 17:35-45
[0] @ ./src/main/components/modals/application-modal.tsx 4:0-70 29:25-48
[0] @ ./src/main/application.tsx 9:0-73 28:40-56
[0] @ ./src/main/index.tsx 3:0-50 37:32-49
[0]
[0] webpack 5.95.0 compiled with 2 errors in 3463 ms
[0] ERROR in ./src/main/components/apollon-editor-component/ApollonEditorComponentWithConnection.tsx:4:29
[0] TS2307: Cannot find module 'shared' or its corresponding type declarations.
[0] 2 | import React, { useEffect, useRef, useContext } from 'react';
[0] 3 | import styled from 'styled-components';
[0] > 4 | import { DiagramView } from 'shared';
[0] | ^^^^^^^^
[0] 5 | import { IMessageEvent, w3cwebsocket as W3CWebSocket } from 'websocket';
[0] 6 | import { APPLICATION_SERVER_VERSION, DEPLOYMENT_URL, NO_HTTP_URL, WS_PROTOCOL } from '../../constant';
[0] 7 | import { DiagramRepository } from '../../services/diagram/diagram-repository';
[0]
[0] ERROR in ./src/main/components/modals/share-modal/share-modal.tsx:5:29
[0] TS2307: Cannot find module 'shared' or its corresponding type declarations.
[0] 3 | import { DiagramRepository } from '../../../services/diagram/diagram-repository';
[0] 4 | import { DEPLOYMENT_URL } from '../../../constant';
[0] > 5 | import { DiagramView } from 'shared';
[0] | ^^^^^^^^
[0] 6 | import { ModalContentProps } from '../application-modal-types';
[0] 7 | import { LocalStorageRepository } from '../../../services/local-storage/local-storage-repository';
[0] 8 | import { toast } from 'react-toastify';
[0]
[0] ERROR in ./src/main/services/diagram/diagram-repository.ts:2:28
[0] TS2307: Cannot find module 'shared' or its corresponding type declarations.
[0] 1 | import { BASE_URL } from '../../constant';
[0] > 2 | import { DiagramDTO } from 'shared';
[0] | ^^^^^^^^
[0] 3 | import { Diagram } from './diagramSlice';
[0] 4 |
[0] 5 | export const DiagramRepository = {
[0]
[0] ERROR in ./src/main/services/share/shareSlice.ts:2:30
[0] TS2307: Cannot find module 'shared' or its corresponding type declarations.
[0] 1 | import { createSlice, PayloadAction } from '@reduxjs/toolkit';
[0] > 2 | import { Collaborator } from 'shared';
[0] | ^^^^^^^^
[0] 3 | import { localStorageCollaborationName, localStorageCollaborationColor } from '../../constant';
[0] 4 |
[0] 5 | export type ShareState = {
[0]
[0] ERROR in ./src/main/utils/collaboration-message-type.ts:1:55
[0] TS2307: Cannot find module 'shared' or its corresponding type declarations.
[0] > 1 | import { CollaboratorType, SelectionChangeType } from 'shared';
[0] | ^^^^^^^^
[0] 2 | import { Patch } from '@ls1intum/apollon';
[0] 3 | import { Diagram } from '../services/diagram/diagramSlice';
[0] 4 |
[0]
[0] ERROR in ./src/main/utils/selection-diff.ts:2:37
[0] TS2307: Cannot find module 'shared' or its corresponding type declarations.
[0] 1 | import { Selection } from '@ls1intum/apollon';
[0] > 2 | import { SelectionChangeType } from 'shared';
[0] | ^^^^^^^^
[0] 3 |
[0] 4 | export function selectionDiff(src: Selection, dest: Selection): SelectionChangeType {
[0] 5 | const selected = new Set<string>();
[0]
[0] Found 6 errors in 3757 ms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I figured it out. I'm not used having an extra build command for starting the application.
Looks good and works as expected
Summary
This pull request streamlines the monorepo by updating and removing unnecessary packages, aiming to reduce the artifact size and optimize the build process. The key improvements are:
Reduction in Bamboo artifact size:
Local Build Optimization:
npm run build
): 40.9 MB build foldernpm run build
): 20 MB build folderAlso I tested with clean after removing all node_modules with
npx rimraf '**/node_modules'
I run
npm install && npm run build:local && npm start
andin main branch it takes 48 seconds
with this changes it takes 28 seconds
Removed unused API endpoint:
Following endpoints are removed because they were not used by Apollon Standalone and Artemis
Changes
shared
package to ensure consistency and avoid redundancy across packages in the monorepo.Impact
Testing