Monday, 24 October 2016

Easy BSP JavaScript development with zMIMESync (Open Source)

Easy BSP JavaScript development with zMIMESync (Open Source)

My colleagues leverage new front-end technologies like JS frameworks. However each time they edit a JavaScript file they have to open the MIME file, edit it and close it to see the change in the web page. This workflow makes me cringe and I feel sorry for my fellow developers. I developed a solution for them and decided to share it with you.
Problem

- Too many actions required changing a single JavaScript file.
- Version control becomes harder since you always change MIME on the server first. You have to get local copies periodically if you want to use SVN or Git.
-You can not use your IDE of choice.

Solution

- Start zMIMESync program. Edit your files in your PC with your favorite IDE/editor. Whenever you save a file zMIMESync instantly sends the file to the MIME repository. You can directly go to the browser and refresh to see the changes! Since files are already on your PC you can use any version control.

Easy BSP JavaScript development with zMIMESync (Open Source)

Features
  • instantly syncs your js file when you save.
  • checks if the file is really changed after the last sync.
  • works well with requests.
  • works with folders.
  • overwrites files.
  • doesn’t delete files.
  • uploads any file type like .js .png …
Installation

zMIMESync consists of two parts.

1-Web Service in SAP system that updates MIMEs.
2-Command line client tool that watches files to upload.

1- Service creation is documented here with the source code:
Creating a Class Handler for SICF Service (with code example)
Hi SCN! This is both a tutorial for creating a SICF service with source code and also the documentation for zMIMESync service class. Check the open source project if you are a BSP developer. Easy BSP … Continue reading
Creating a Class Handler for SICF Service (with code example)

2-Installing client is very easy. If you are developing with Node.js you are already familiar with npm tool. If you don’t have it installed, you can install Node.js from the official website: link .This brings command line tool “npm”. Then you can run:

npm install zmimesync -g

That’s all it takes to install client!

Usage

Create a BSP application

Now it opens file as script.js.txt with Notepad. You have to save&close the file to see the changes. Every time! You can change default program for *.txt files to the beloved Notepad++ but that doesn’t solve open/close, open/close issue… There is a better way 🙂

Open command line and go to your root folder for MIMEs. Execute “zmimesync” it will create a settings file on the first run.

Easy BSP JavaScript development with zMIMESync (Open Source)

mimesync-settings.txt

Easy BSP JavaScript development with zMIMESync (Open Source)

This is the created settings file with explanations in it:

#Settings file for ZMimeSync - Automatic Mime Sync for easier development

#SICF Service for ZMimeSync you can find more info at the documentation
#Example: "http://erpdev.company:8000/sap/bc/zmimesync_s001?sap-client=100"
mimesync_service = "" 

#Username on SAP system.
username = ""

#Password on SAP system. This is optional since you may not want to store it in plaintext.
#If there is no password field the tool asks you for password each time you run it.
password = ""

#Root Mime Path for BSP, etc. This is found at the bottom in BSP properties screen.
#Example: "/sap/bc/bsp/sap/zbsp_mimesync_ex/"
#Please note that you can also sync current folder to an subfolder in MIMEs.
#Example: "/sap/bc/bsp/sap/zbsp_mimesync_ex/my_folder/"
mime_url  = ""

#Request Number for SAP development.
#Example = "ERPK900141"
request_number = ""

Enter the required fields.
You should enter “mimesync_service” url from the SICF service. You can find url by testing it.

Easy BSP JavaScript development with zMIMESync (Open Source)

“mime_url” field is /sap/bc/bsp/sap/$YOUR_BSP_APP_NAME/ . You can also sync the folder on your computer to a sub-folder in BSP.

Easy BSP JavaScript development with zMIMESync (Open Source)

“request_number” is transport request number. It should be same with the BSP application.

Now if you run the client program it will immediately sync your files and continue syncing! You can use Ctrl+c to close the program.

Easy BSP JavaScript development with zMIMESync (Open Source)

1- I changed script.js and saved it automatically synced.
2- I added a line and deleted it again, then saved. Since content didn’t changed the tool didn’t sync.

3 comments:

  1. I have read your blog its very attractive and impressive. I like it your blog.
    hire node js developer

    ReplyDelete

  2. I would like more information about this, because it is very nice...Thanks for sharing. Thanks a lot.

    Anika Digital Media
    seo services
    web design development
    graphic design

    ReplyDelete
  3. kesempatan ke-2 adalah pada disaat semasing pemain telah terima kartu ke-4 atau kartu paling akhir, karena itu taruhan akan di kerjakan untuk mengambil keputusan pemenangnya
    asikqq
    dewaqq
    sumoqq
    interqq
    pionpoker
    bandar ceme terpercaya
    hobiqq
    paito warna oregon
    syair hk
    datahk

    ReplyDelete