Socket
Socket
Sign inDemoInstall

ui5-task-copy-shim-resources

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ui5-task-copy-shim-resources

custom ui5 task for copying runtime shim resources at build time


Version published
Weekly downloads
400
increased by11.73%
Maintainers
1
Install size
9.83 kB
Created
Weekly downloads
 

Readme

Source

JavaScript Style Guide

ui5-task-copy-shim-resources

Custom UI5 task for copying runtime shim resources at build time.

This is especially useful if you have some ProjectShims e.g. for npm dependencies which should also be available in final the build.

Prerequisites

Make sure your project is using the latest UI5 Tooling.

Getting started

Install

Custom task

Add the custom task as development dependency to your project.

With yarn:

yarn add -D ui5-task-copy-shim-resources

Or npm:

npm i -D ui5-task-copy-shim-resources

Additionally the custom task needs to be manually defined as a ui5 dependency in your project's package.json:

{
  "devDependencies": {
    "ui5-task-copy-shim-resources": "^0.1.0"
  },
  "ui5": {
    "dependencies": [
      "ui5-task-copy-shim-resources"
    ]
  }
}

Configure

Custom task

Register the custom task in your project's ui5.yaml under builder/customTasks:

specVersion: "2.2"
metadata:
  name: my-app
type: application
# ...
# further configuration
# ...
builder:
  customTasks:
    - name: ui5-task-copy-shim-resources
      afterTask: replaceVersion
      configuration:
        paths:
          - "/thirdparty/core-js-bundle/minified.js"
          - "/thirdparty/regenerator-runtime/runtime.js"
        globs:
          - "/thirdparty/lodash/*.js"
# ...
# further configuration
# ...
---
# Shims for thirdparty modules
specVersion: "2.2"
kind: extension
type: project-shim
metadata:
  name: thirdparty-shims
shims:
  configurations:
    # polyfill for ECMAScript features
    core-js-bundle:
      specVersion: "2.2"
      type: module
      metadata:
        name: core-js-bundle
      resources:
        configuration:
          paths:
            /thirdparty/core-js-bundle/: ""
    # transpile generator functions (~ async await)
    regenerator-runtime:
      specVersion: "2.2"
      type: module # Use module type
      metadata:
        name: regenerator-runtime
      resources:
        configuration:
          paths:
            /thirdparty/regenerator-runtime/: ""
    # lodash utility library
    lodash:
      specVersion: "2.2"
      type: module
      metadata:
        name: lodash
      resources:
        configuration:
          paths:
            /thirdparty/lodash/: ""

Usage

Simply run e.g. ui5 build --clean-dest to copy your runtime resources during build time. Once the build is completed the copied resources will available in the dist folder.

Additional configuration

Options

The custom task accepts the following configuration options:

nametypeDescriptionmandatorydefaultexamples
enabledbooleanenable/disable the custom tasknotruetrue, false
debugbooleanenable/disable debug logsnofalsetrue, false
pathsstring[]paths for resources to be copiedno[][ "some/resource/path.js" ]
filesstring[]glob pattern for resources to be copiedno[][ "some/resource/glob/**/*.js" ]
builder:
  customTasks:
    - name: ui5-task-copy-shim-resources
      afterTask: replaceVersion
      configuration:
        enabled: true
        debug: true
        paths:
          - "/thirdparty/core-js-bundle/minified.js"
          - "/thirdparty/regenerator-runtime/runtime.js"
        globs:
          - "/thirdparty/lodash/*.js"

Example app

Please have look at bookshop-ui.

Keywords

FAQs

Last updated on 18 Feb 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc