npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ui5-middleware-destination

v2.0.2

Published

Custom Server middleware to provide proxy capabilities and support neo-app.json

Downloads

17

Readme

ui5-middleware-destination

Custom UI5 server middleware for projects using UI5 Tooling

  • Provides proxy capabilities and support for neo-app.json routes
  • Works with destinations from destination files, as WebIDE does
  • Supports serving resources from local system or remote CDN (like the SAPUI5 SDK or an ABAP application server)

Installation

npm i --save-dev ui5-middleware-destination

Pre-requisites

Create a directory to hold the destination files needed for your project -- preferably, out of your project's root so that the same config can be used for multiple projects. This also helps keeping your credentials from being committed.

This middleware will look in that directory for one (or many) json file(s) with a specific structure (check the example json).

As an alternative, the middleware will also look for destination files in the created directory. The structure of these files is the same as the one used in WebIDE destination files (also check the example template).

For the time being, the only properties required in a destination configuration are Name, URL, User, Password and WebIDEUsage.

NOTE: Storing passwords in plain text format is a potential security risk. Please comply with your organization's policy.

Options for SAPUI5 config in destinations file

{
  "Name": "sapui5", // Name is used as an identifier
  "Description": "SAPUI5 Resources",
  "URL": "C:\\Dev\\workspace\\sapui5\\sdk", // Can be used to specify cdn URL e.g. https://sapui5.hana.ondemand.com/
  "preferLocal": false // Flag to determine whether the resources files will be served from local system or cdn remote server
}

Usage

1. Define the dependency in $yourapp/package.json

"devDependencies": {
    // ...
    "ui5-middleware-destination": "*"
    // ...
},
"ui5": {
  "dependencies": [
    // ...
    "ui5-middleware-destination",
    // ...
  ]
}

As the devDependencies are not recognized by the UI5 tooling, they need to be listed in the ui5.dependencies array. In addition, once using the ui5.dependencies array you need to list all UI5 tooling relevant dependencies.

2. Configure it in $yourapp/ui5.yaml

Simplest usage:

server:
  customMiddleware:
    - name: ui5-middleware-destination
      afterMiddleware: cors
      configuration:
  	    destinationsPath: '../path/to/destination/files'

Example config serving from CDN:

server:
  customMiddleware:
    - name: ui5-middleware-destination
      afterMiddleware: cors
      configuration:
        debug: true
        destinationsPath: '../path/to/destination/files'
        resources:
          preferLocal: false
          path: 'https://path/to/CDN/resources'

Example config serving from an ABAP AS with self-signed certificate:

server:
  customMiddleware:
    - name: ui5-middleware-destination
      afterMiddleware: cors
      configuration:
        debug: true
        destinationsPath: '../path/to/destination/files'
        resources:
          preferLocal: false
          path: 'https://<host>:<port>/path/to/ABAP/AS/resources'
        strictSSL: false

Example config serving from local resources:

server:
  customMiddleware:
    - name: ui5-middleware-destination
      afterMiddleware: cors
      configuration:
        destinationsPath: '../path/to/destination/files'
        resources:
          preferLocal: true
          path: '../local/path/to/resources'

Configuration options

ATTENTION: No options are mandatory, EXCEPT for destinationsPath. This option must be provided either in the ui5.yml file or as an environment variable (as in the description below).

Note that relative paths declared in these options are resolved against the project's root.

  • debug (boolean, default: false)
    Enables the logging of each request and where it is served from.

  • destinationsPath (string)
    Absolute or relative path to the destination files.
    If a relative path is provided, it is resolved against the project's root folder.
    If you do not provide this option in the ui5.yml file, you must set the UI5_MIDDLEWARE_DESTINATIONS_PATH environment variable.

  • strictSSL (boolean, default: true)
    When set to false, the proxy does not validate SSL certificates of the resource server.
    This covers the use case of, for example, serving routes from a corporate ABAP AS with a self-signed certificate.

  • resources (object)
    Options regarding SAPUI5 resources:

    • path (string)
      If preferLocal is true, then this is the local absolute or relative path to SAPUI5 resources.
      When preferLocal is false, you can provide a CDN URL for the SAPUI5 resources. or https://sapui5.hana.ondemand.com will be used as CDN source
      This option can be provided either in the ui5.yml file or through the UI5_MIDDLEWARE_RESOURCES_PATH environment variable.

    • preferLocal (boolean, default: false)
      When true, middleware redirects all the ui5 resources requests to local filesystem. This option can be provided through UI5_MIDDLEWARE_RESOURCES_LOCAL environment variable. Possible values in environment variable can be 0 or 1.

How it works

Limitations

Currently only BasicAuthentication is supported.

Contribution Guidelines

Pull Request are welcome. However, if change is complex or huge, Please create an issue and have a discussion on the approach before developing something.

Contributors

LICENSE

Project is distributed under MIT License