-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat(deploy-gen): adds new main deploy generator #2891
base: main
Are you sure you want to change the base?
Conversation
cianmSAP
commented
Feb 7, 2025
•
edited by longieirl
Loading
edited by longieirl
- Add new deployment sub generator
- Tests to be added
🦋 Changeset detectedLatest commit: f9f188f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
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.
New module set-up looks good. 1 query.
@@ -0,0 +1,3 @@ | |||
// When deployment generator is bundled the namespacing is relative to the root generator | |||
export const bundledRootGeneratorName = '@sap/fiori:fiori-deployment'; |
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.
Should this be passed in from @sap/generator-fiori
?
@@ -0,0 +1,467 @@ | |||
import { basename, dirname, join } from 'path'; |
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.
Do you think we can we reduce the size of this file perhaps by only including direct lifecycle methods. Refactor the private function out to a new file.
super(args, opts); | ||
// this.env.adapter.promptModule is undefined when running in YUI | ||
this.env.adapter.promptModule?.registerPrompt('autocomplete', autocomplete); | ||
this.launchDeployConfigAsSubGenerator = opts.launchDeployConfigAsSubGenerator ?? false; |
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.
Do we still need this concept launchDeployConfigAsSubGenerator
? If we do then can we determine if there is a caller (composeWith(subgenName')
) programmatically instead of expecting the consumer to set this? Might be a stretch...
* The main deployment configuration generator. | ||
*/ | ||
export default class extends DeploymentGenerator { | ||
private readonly launchDeployConfigAsSubGenerator: boolean; |
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.
Can we document all of these properties as its not clear why they are needed? Should there be instead a deploy 'state' type defined that encapsulates the required state for deploy config generation. This might make for a cleaner implementation.
export default class extends DeploymentGenerator { | ||
private readonly launchDeployConfigAsSubGenerator: boolean; | ||
private readonly launchStandaloneFromYui: boolean; | ||
private readonly abapChoice: Target = { name: TargetName.ABAP, description: 'ABAP' }; |
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.
Is it correct to define inquirer related concepts in a generator constructor. Can these be moved to where they are used?
// Load .env file for api hub config | ||
dotenv.config(); | ||
|
||
// Application Modeler launches Deployment Configuration Generator YUI. |
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.
This refers to a non-open source module here (Application Modeler)? Maybe consider a more generic approach that supports 2 cases: 1) Where this is called as a subgenerator 2) Where its called standalone.
constructor(args: string | string[], opts: DeployConfigOptions) { | ||
super(args, opts); | ||
// this.env.adapter.promptModule is undefined when running in YUI | ||
this.env.adapter.promptModule?.registerPrompt('autocomplete', autocomplete); |
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.
Im not sure this is a valid comment (deploy already uses this plugin in YUI for transport type ahead I think?). Better if the adaptor is passed down to the inquirers (it is a prompting plugin) and registered there. Inquirers may need to register other plugins...seems to be an assumption here that autocomplete
is needed?
/** | ||
* The connected system from the generator | ||
*/ | ||
connectedSystem?: { |
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.
Might be better to use the existing type since thats where this definition originates from:
import { type OdataServiceAnswers } from '@sap-ux/odata-service-inquirer';
...
connectedSystem?: OdataServiceAnswers['connectedSystem'];
...
/** | ||
* Whether the system is a cloud system | ||
*/ | ||
scp?: boolean; |
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.
This property is no longer being passed and should be considered deprecated. It can be calculated internally if required?
} | ||
|
||
public async initializing(): Promise<void> { | ||
await super.initializing(); |
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.
Should we also be initialising the VSCode logging here if this generator can be directly launched in YUI...as is done here:
static configureLogging( |