DMC POD Plugin local development environment in VS Code
2023-11-1 00:10:39 Author: blogs.sap.com(查看原文) 阅读量:8 收藏

As developers, we understand the need for efficiency and convenience when working on SAP DMC POD Plugins. Traditionally, the process involved building and deploying plugins, often leading to delays and a less-than-optimal development experience. But there’s a new solution in town – the DMC POD Plugin local development environment.

Complete Documentation

An Evolution in DMC Plugin Development

In the past, developing SAP DMC POD Plugins meant building, deploying, and then waiting to see the results. It was a process that sometimes made experimentation and rapid iteration quite challenging. But we’ve changed the game.

Introducing the Local Development Environment

This local development environment is built upon a Yeoman generator that extends the work of our colleague, @kevin.hunter3. Here’s what you can expect from it:

1. Real-Time Feedback

No more waiting for deployments! With this local development environment, you can instantly see the effects of your changes. This real-time feedback streamlines your development process, allowing for faster progress and decision-making.

2. Seamlessly Integrated APIs

This environment integrates smoothly with both public and internal APIs. This means you can work with real data right in your local setup. No more juggling test environments or dealing with data transfers – everything is at your fingertips.

3. Enhanced Utility Methods

We’ve added a set of handy utility methods, including getPlant, getResource, getUser, and more. These utilities simplify your development tasks and reduce the need for repetitive code.

4. Promise-Based Ajax Requests

To handle asynchronous operations more effectively, we’ve introduced promise-based Ajax requests. This results in cleaner and more readable code.

Now, let’s explore how to get started with this local development environment:

Getting Started

Prerequisites

Before diving in, ensure you have the following configurations handy:

  • User Email: Your SAP DMC access email.
  • SAP DMC Host Address: e.g., ‘yourhost.execution.eu20.dmc.cloud.sap’.
  • CF Endpoint URL: Obtain it from your BTP subaccount page.
  • Manufacturing-Execution-Integration Server URL: Found in your service key configuration file.
  • Public API Endpoint: Located in the service key configuration file under the UAA section.
  • Authorization Token URL: Also in the service key configuration file under the UAA section as ‘url’.
  • Client ID, and Client Secret: Both found in your service key configuration file under the UAA section.

Generating Your Project

  1. Ensure you have Node.js installed on your system.
  2. Globally install Yeoman and the generator-dmcpodplugin-local using npm:
    npm install -g yo
    npm install -g generator-dmcpodplugin-local​
  3. Open your terminal or command prompt.
  4. Run the generator with this command:
    yo dmcpodplugin-local
  5. Follow the prompts, providing the required information. The generator will create the template code based on your responses.

Optional: Installing Build and Deploy Dependencies for VS Code

If you’re using BTP for plugin development, you can skip this step as BTP already includes pre-installed build and deploy tools.

If you’re using a local system and VS Code, you can follow these optional steps:

Windows Users:

  1. Open a command prompt.
  2. Check if ‘choco’ is installed by running ‘choco -v’.
  3. incase you don’t have choco installed, install it from official website
  4. If ‘choco’ exists, install ‘make’ by running this command in PowerShell:
    choco install make

Mac Users:

  1. Open a terminal.
  2. Install ‘make’ by running this command:
    brew install make

Common Steps:

  1. Download and install Cloud Foundry CLI from the official Git repository.
  2. Install ‘mbt’ and ‘multiapps’ globally:
    npm install -g mbt
    cf install-plugin multiapps

Running  Your Project Locally

  1. Once the template is generated, start the application on your localhost by running below command in root folder:
    npm run start
  2. To build the app, run:
    npm run build

    This will generate a new .mtar file in the ‘mta_archives’ folder.

  3. Before deploying the app, log in to Cloud Foundry using below command in new terminal:
    npm run login

    You can set the default org and space by specifying additional arguments in the ‘package.json’ file.

  4. Deploy the plugin to your BTP Space by running this command:
    npm run deploy

    If you want to run build and deploy commands together, use:

    npm run bd

    5. Follow the blog post post to configure the Pod plugin in SAP DMC

    Check my git repository for complete Documentation.

    That’s it! You’re now ready to streamline your SAP DMC POD Plugin development using this local development environment. Enjoy the coding!


文章来源: https://blogs.sap.com/2023/10/31/dmc-pod-plugin-local-development-environment-in-vs-code/
如有侵权请联系:admin#unsafe.sh