Git Product home page Git Product logo

openui5-gulp-starter-kit's Introduction

OpenUI5 Starter Kit

Quickstart

Greenkeeper badge Build Status

Download or clone this repository:

git clone [email protected]:pulseshift/openui5-gulp-starter-kit.git

Please ensure that you have installed node and yarn before you continue.

Install dependencies:

yarn

Start developing: Will build all resources start watcher task and start a HTTP server

yarn start

The app should open in your browser automatically, otherwise open: http://localhost:3000

Info: To get a more detailed logging, just use yarn start:verbose instead.

Overview

OpenUI5 Starter Kit is an opinionated to-do app example as template for OpenUI5 web development. Containing a modern build infrastructure, tools and a set of best practices for building a great development experience and helping you to stay productive.

A solid starting point for both professionals and newcomers to OpenUI5.

Other branches

Please see also the seperated branches of this project, at the time these are:

  • nwabap is the OpenUI5 Starter Kit branch which allows a developer to upload SAPUI5/OpenUI5 sources into a SAP NetWeaver ABAP system as part of the Gulp task chain

Features

Feature Summary
❤ ES6/ES7 via Babel 6.0 Compile ES6/ES7 into ES5 (supported by most browsers) with ease, bringing support for next generation JavaScript, today.
Less support Compile Less into CSS with ease, bringing support for variables, mixins and more.
Consistent code formatting Prettier is an awesome opinionated code formatter used in many well known projects like Webpack, Babel or React. In this starter kit prettier re-formats your files that are marked as "staged" via git add before you commit. We recommend to add also prettier as integration to your Editor during development.
Built-in HTTP Server An extendable built-in server for previewing your site locally while you develop and iterate and the option to add API endpoints via a proxy to get around Access-Control-Allow-Origin (CORS) errors.
Live Browser Reloading Reload the browser in real-time anytime an edit is made without the need for an extension. (Run yarn start and edit your files)
Cross-device Synchronization Synchronize clicks, scrolls, forms and live-reload across multiple devices as you edit your project. Powered by BrowserSync. (Run yarn start and open up the IP provided on other devices on your network)
Production ready builds Pre-configured build pipeline to create optimized assets, UI5 pre-loads etc. just as you would expect from a state of the art build process. All kind of UI5 asets are supported: App Components, Custom Themes, Control Libraries and non-UI5 assets roots. The structure of your project can be configured in your package.json in section ui5. A detailed documentation of all options will follow soon.
⚡️ Reliable UI5 Cache-Buster Ensure your users are always enjoying the latest version of your app. OpenUI5 provides only solutions proprietary for SAP Gateway and SAP Cloud Platform. In this project, we added a more reliable mechanism that is open source and available for any environment. But much more important, with our Gulp build script, it works right out of the box.
A Hackable UI5 Build Process Define in your package.json the source of your OpenUI5 library. Supported options are online CDN link, download URL of a prebuild library or a GitHub release link of OpenUI5. In all cases, the build process will handle the download, unzip and OpenUI5 build task by its own. Lean back and wait relaxed.
Pre-configured linter (ESLint) ESLint is a pluggable linting utility for JavaScript. It is pre-configured to work reliable and hand in hand with babel and prettier.
RealFaviconGenerator support RealFaviconGenerator is a module that auto generates favicons for all platforms based on a single master image.
⚙️ Gzip and Brotli compression ready build Pre-compression of the two most common and modern compression algorithms to minify the used bandwith (your HTTP server must support static serve of gzip and/or brotli files – yarn start:dist is able to serve the compressed files).
🤘 Support for external ui5 npm modules Support for external npm ui5 libraries added via yarn add **npm-module-name** --dev. Ensure the module name matches the exposed name of the external lib and that you point to the prebuild dist folder. (Auto-build of non prebuild modules is in BETA).

Distribution

Start build: Will create a dist directory in your project root.

yarn build

Afterwards, the production app build can be tested by run yarn start:dist. The app should open in your browser automatically, otherwise open: http://localhost:3000

Info: To get a more detailed logging, just use yarn build:verbose instead.

Configuration

package.json

Attention: comments are only for explanation, tehy can't be used in package.json.

{
  // path to an handlebars file used to create the index.html file of this project
  "main": "src/index.hbs",

  // define a master favicon and generate all x-browser fav-icons at once
  "favicon": {
      "src": "src/assets/favicon/master.png"
  },

  // custom section with settings required for the build process
  "ui5": {
    // tite name of the index.html
    "indexTitle": "UI5 Todo App",

    // build settings
    "build": {
        // turn cache buster on to invalidate the users browser cache automatically for changed files
        "cacheBuster": true,

        // turn on compression to minify file size and bandwith of HTTP server (options: boolean or list of compression algorithms)
        "compression": ["gzip", "brotli"]
    },

    // key of the selected UI5 library source (must be available in section ui5.srcLinks)
    "src": "cdn",

    // map of different sources for the UI5 library, only one can be selected to be used in the UI5-bootstrap of the index.html
    "srcLinks": {
      "cdn": {
        // URL or relative path to the UI5 library (it is possible to pass properties in the URL via handlebars notation)
        "url": "https://openui5.hana.ondemand.com/{{version}}/resources/sap-ui-core.js",

        // flag whether or not the UI5 library at the defined URL is a prebuild or not
        "isPrebuild": true,

        // flag whether or not the UI5 library at the defined URL must be unarchived before further processing
        "isArchive": false,

        // list of further attributes that can be used as properties for the URL creation
        "version": "1.50.8"
      }
    },

    // target path for 3rd party npm dependencies
    // e.g. moment.js can then be required via sap.ui.define(['apps/libs/moment']function(moment){ ... });
    "vendor": {
      "name": "app.libs",
      "path": "src/libs"
    },

    // name of the selected UI5 theme for your bootstrap
    "theme": "sap_belize",

    // list with custom ui5-component/app roots consisting of a 'name' and a 'path'
    "apps": [{
      "name": "app.todo",
      "path": "src/openui5-todo-app",

      // abab BSP destination of your app
      "nwabapDestination": {
          "package": "$TMP",
          "bspcontainer": "ZZ_UI5_LOCAL",
          "bspcontainer_text": "UI5 upload local objects",
          "langauage": "EN"
      }
    }],

    // list with custom ui5-library roots consisting of a 'name' and a 'path'
    "libraries": [
      {
        "name": "my.control.lib",
        "path": "src/commons/ui5-controls"
      },{
        // support for external npm ui5 libraries added via 'yarn add xyz --dev' (since starter-kit v0.3.2)
        // ensure the module name matches the exposed name of the external lib
        "name": "npm.control.lib",
        "path": "node_modules/dist/ui5-controls",
        "prebuild": true
      }],

    // list with custom ui5-theme roots consisting of a 'name' and a 'path'
    "themes": [{
      "name": "my_custom_theme_name",
      "path": "src/commons/ui5-themes"
    }],

    // list with non-ui5 resource roots consisting of a 'name' and a 'path'
    "assets": [{
      "name": "commons.images",
      "path": "src/commons/img"
    }]
  },

  // all dependencies installed via 'yarn add ...' will be made available for your UI5 app without need of editing the manifest.json
  "dependencies": {
    // libraries are automatically loaded into the path defined at section ui5.vendor.path,
    // they can be required in your controler via the name defined in ui5.vendor.name
  }
}

Contributing & Troubleshooting

Contributions, questions and comments are all welcome and encouraged.

Check our current issues or, if you have something in mind how to make it better, create your own issue. We would be happy to discuss how they can be solved.

Outlook

Here is a brief overview on what we are working right know and what will follow, soon. We are interested to hear your opinion on what should follow next.

Current idea backlog (unordered):

  • Add a further project based on Webpack
  • Add Facebooks flow type system with help of vagrant to support Windows machines, too
  • Unit test and browser test framework
  • Documentation generation via JSDoc
  • Optimized OpenUI5 library modules (containing only these controls you used)
  • I18N helper integration
  • Detailed README for all package.json (section ui5) configuration options

Credits

Rocket logo created by Hopkins from the Noun Project CC BY 3.0 US.

License

This project is licensed under the MIT license. Copyright 2017 PulseShift GmbH

openui5-gulp-starter-kit's People

Contributors

dell-mic avatar dependabot[bot] avatar fuchsvomwalde avatar greenkeeper[bot] avatar iusemws avatar mdel-cm avatar nimble-123 avatar sonerokur avatar verfehlix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

openui5-gulp-starter-kit's Issues

nwabap uploader integration

hi

the nwabap uplooader do not work for me with this integration. i am not completly into this Promise thing right now, but gulp keeps saying that i forgot to signal async completion of the task.

This is the terminal output i get from yarn deploy command.

[13:25:59] Starting 'ui5Upload'...
[13:25:59] The following tasks did not complete: deploy, ui5Upload
[13:25:59] Did you forget to signal async completion?

This is the corresponding source which is responsible for the error. I think it has something to do with the way ui5uploader is used here. The project itself could be composite of more than one ui5 application and therefor you want to deploy every ui5 app which is in AppDistPath. There is the problem i think.

Maybe the yarn command has to be more specific which app is to be deployed. So gulp does not need to iterate over all apps and instead just deploy the app specified as a option of the yarn command (yarn deploy:<app_name_here> something like this).

function ui5Upload() {
.
.
.
  const mapPathToDist = sPath => sPath.replace(new RegExp(`^${SRC}`), DIST)
  const aDeployPromise = pkg.ui5.apps.map(oApp => {
    // check if nwabap config is maintained
    if (!oApp.nwabapDestination) {
      return Promise.reject(
        `Option 'nwabapDestination' config was not found for app ${oApp.name} in package.json`
      )
    }
    const sAppDistPath = mapPathToDist(oApp.path)

    return new Promise((resolve, reject) => {
      gulp
        .src([`${sAppDistPath}/**`])
        .pipe(
          ui5uploader({
            root: sAppDistPath,
            // pass conn and auth config
            ...pkg.ui5.nwabapUpload,
            // pass nwabap bsp destination
            ui5: oApp.nwabapDestination
          })
        )
        .on('error', reject)
        .on('end', resolve)
    })
  })
  return Promise.all(aDeployPromise)
}

Using this template for my own apps - issues with yarn start

Hi.
I'm trying to use this template and add it to an existing ui5 app.

I run yarn and the dependencies get installed from the package.json
But when I then run yarn start I get the following error:

yarn start v0.27.5
$ gulp --silent
/Users/jason/repos/fiori_ses_create_2/gulpfile.babel.js:15
import pkg from './package.json';
^^^^^^
SyntaxError: Unexpected token import
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at loader (/Users/jason/repos/fiori_ses_create_2/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/jason/repos/fiori_ses_create_2/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
error Command failed with exit code 1.

It seems that gulp does not understand the import pkg statement at the top of the package.json.

Yet if I clone this repo yarn start works fine.

Is there some installation step that I could be missing?!?

error install ui5-lib-util

when the npm install command is run, it would be released throws an error Command failed: / usr / local / bin / git checkout 4.0

verbose argv "/usr/local/Cellar/node/10.11.0/bin/node" "/usr/local/bin/npm" "i" "ui5-lib-util@alpha"
34 verbose node v10.11.0
35 verbose npm v6.4.1
36 error code 1
37 error Command failed: /usr/local/bin/git checkout 4.0

Cross Platform Environment Variables

Yarn scripts in package.json does not work as expected in Windows environment.

"start": "NODE_ENV=development DEV_PORT=3000 babel-node node_modules/gulp/bin/gulp.js --silent",
"start:verbose": "NODE_ENV=development DEV_PORT=3000 babel-node node_modules/gulp/bin/gulp.js",
"start:dist": "NODE_ENV=production DEV_PORT=3000 babel-node node_modules/gulp/bin/gulp.js testDist",
"build": "NODE_ENV=production babel-node node_modules/gulp/bin/gulp.js build --silent",
"build:verbose": "NODE_ENV=production babel-node node_modules/gulp/bin/gulp.js build",

I suggest we can change these scripts for cross-platform support like below.

"start": "env-cmd dev babel-node node_modules/gulp/bin/gulp.js --silent",
"start:verbose": "env-cmd dev babel-node node_modules/gulp/bin/gulp.js",
"start:dist": "env-cmd prod babel-node node_modules/gulp/bin/gulp.js testDist",
"build": "env-cmd prod babel-node node_modules/gulp/bin/gulp.js build --silent",
"build:verbose": "env-cmd prod babel-node node_modules/gulp/bin/gulp.js build",

To use "env-cmd", first we need to run "npm install env-cmd --save-dev" and then create .env_cmdrc file with below lines

{
  "dev": {
    "NODE_ENV": "development",
    "DEV_PORT": 3000
  },
  "prod": {
    "NODE_ENV": "production",
    "DEV_PORT": 3000
  }
}

third party libs do not load properly

Hi there,

i tried using your starter kit with third party libraries. Unfortunately some are working and some are not.

I placed the lib source files into a sub folder called lib and declared the libs in manifest.json descriptor.

"sap.ui5": {
  "resources": {
    "js": [
      {
        "uri": "lib/jszip.js"
      },
      {
        "uri": "lib/moment.js"
      }
    ]
  }
}

The JSZip lib loads as expected and i get access to the libs global name in every controller of my app but the moment.js lib throws an error like

Uncaught (in promise) Error: failed to load 'io/nlsltz/thirdpartytest/lib/moment.js' from webapp/lib/moment.js: TypeError: Cannot set property 'moment' of undefined
    at g (http://localhost:3000/ui5/1.44.19/sap-ui-core.js:2:162118)
    at Object.sap.ui.requireSync (http://localhost:3000/ui5/1.44.19/sap-ui-core.js:2:171780)
    at constructor.loadIncludes (http://localhost:3000/undefined/sap/ui/core/Manifest.js?eval:1:2930)
    at constructor.init (http://localhost:3000/undefined/sap/ui/core/Manifest.js?eval:1:4222)
    at i.s.init (http://localhost:3000/undefined/sap/ui/core/ComponentMetadata.js?eval:1:2085)
    at n.g._initCompositeSupport (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:8105)
    at eval (http://localhost:3000/undefined/sap/ui/base/ManagedObject.js?eval:1:2754)
    at n.constructor (http://localhost:3000/undefined/sap/ui/base/ManagedObject.js?eval:1:2864)
    at n.constructor (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:6649)
    at n.constructor (http://localhost:3000/undefined/sap/ui/core/UIComponent.js?eval:1:443)
    at n [as constructor] (http://localhost:3000/undefined/sap/ui/base/Metadata.js?eval:1:3621)
    at new s (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:1737)
    at a (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:19976)
    at eval (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:20940)
    at c (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:1102)
    at eval (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:20920)
    at <anonymous>
Caused by: TypeError: Cannot set property 'moment' of undefined
    at eval (http://localhost:3000/webapp/lib/moment.js?eval:6:203)
    at eval (http://localhost:3000/webapp/lib/moment.js?eval:7:2)
    at eval (<anonymous>)
    at w (http://localhost:3000/ui5/1.44.19/sap-ui-core.js:2:162770)
    at x (http://localhost:3000/ui5/1.44.19/sap-ui-core.js:2:163613)
    at g (http://localhost:3000/ui5/1.44.19/sap-ui-core.js:2:162073)
    at Object.sap.ui.requireSync (http://localhost:3000/ui5/1.44.19/sap-ui-core.js:2:171780)
    at constructor.loadIncludes (http://localhost:3000/undefined/sap/ui/core/Manifest.js?eval:1:2930)
    at constructor.init (http://localhost:3000/undefined/sap/ui/core/Manifest.js?eval:1:4222)
    at i.s.init (http://localhost:3000/undefined/sap/ui/core/ComponentMetadata.js?eval:1:2085)
    at n.g._initCompositeSupport (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:8105)
    at eval (http://localhost:3000/undefined/sap/ui/base/ManagedObject.js?eval:1:2754)
    at n.constructor (http://localhost:3000/undefined/sap/ui/base/ManagedObject.js?eval:1:2864)
    at n.constructor (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:6649)
    at n.constructor (http://localhost:3000/undefined/sap/ui/core/UIComponent.js?eval:1:443)
    at n [as constructor] (http://localhost:3000/undefined/sap/ui/base/Metadata.js?eval:1:3621)
    at new s (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:1737)
    at a (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:19976)
    at eval (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:20940)
    at c (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:1102)
    at eval (http://localhost:3000/undefined/sap/ui/core/Component.js?eval:1:20920)
    at <anonymous>

I tried the same thing with WebIDE and the provided master/detail template and everythings works as expected. This is why i am asking here and not in the SAP forum.

Could i be missing some config i have to do due to the custom folder and file structure in your starter kit compared to the master/detail template inside the WebIDE?

Any help or hint in the right direction would be nice :)

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Move gulp build script to a ui5 CLI module

All settings used in package.json should be usable as CLI params, too.

Furthermore, the user should be able to decide, wether or not to use CLI params, package.json or a .ui5rc file.

SAPUI5 and FLP

This looks Iike a great setup but I'm wondering how it will work for all of us that are building apps with SAPUI5. I understand we can edit the packag.json to point the build process to the SAPUI5 CDN (soon to be available as a download like openui5 as well); but What about building apps which are to run within the Fiori Launchpad?
In the WebIDE for example a dummy launchpad is created which your app runs within? Would be very cool if the same could be done here - then we can smoothly move between this build tool for local development and the WebIDE.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.