I want to import jspdf to my business application studio project without using the index.html since i read that index.html doesnt get called when opening apps from fiori launchpad.
I can get the jspdf part working, but once i call the autotable method it throws an error:
"Uncaught TypeError: doc.autoTable is not a function"
The path with the jspdf libs:
manifest.json:
"resources": {
"css": [
{
"uri": "css/style.css"
}
],
"libs": [
{
"uri": "libs/jspdf.js"
},
{
"uri": "libs/jspdf.min.js"
},
{
"uri": "libs/jspdf.plugin.autotable.js"
},
{
"uri": "libs/jspdf.umd.min.js"
}
]
}
included in my controller like this:
sap.ui.define([
"sap/ui/core/mvc/Controller",
"../model/formatter",
"sap/ui/core/Fragment",
"../libs/jspdf",
"../libs/jspdf.plugin.autotable",
"../libs/jspdf_debug"
],
/**
* #param {typeof sap.ui.core.mvc.Controller} Controller
*/
function (Controller, formatter, Fragment, syncStyleClass,jspdf, jspdf_autotable, jspdf_debug) {
"use strict";
//jQuery.sap.require("libs/jspdf_debug");
//jQuery.sap.require("libs/jspdf.plugin.autotable");
If i put the jquerys back in the app crashes on startup with this error:
"ModuleError: failed to load 'libs/jspdf_debug.js' from resources/libs/jspdf_debug.js"
Hope someone can help me and looking forward to your suggestions!
If you didn't do it already, migrate to ui5-tooling.
Afterwards you can include everything installed via npm.
UI5-Tooling has a very unclear documentation and academic handling...
but there is a example for lodash:
specVersion: "2.5"
type: application
metadata:
name: my.application
--- # Everything below this line could also be put into the ui5.yaml of a standalone extension module
specVersion: "2.5"
kind: extension
type: project-shim
metadata:
name: my.application.thirdparty
shims:
configurations:
lodash: # name as defined in package.json
specVersion: "2.5"
type: module # Use module type
metadata:
name: lodash
resources:
configuration:
paths:
/resources/my/application/thirdparty/: "" # map root directory of lodash module
Basically,
install jspdf also over npm: npm i jspdf --save-dev
check jspdf in ```node_modules`` an find the dist folder
adjust project-shim
if you are unsure about path etc. install temporally lodash, so you can compare path
Once everything is in place, you can access the files via URL. If this works you can also load them with sap.ui.require during runtime and they are part of your build.
Some modules install them self globally so sap.ui.require will return undefined and the imported stuff is found under window.myGlobalUtilSTuff.
Related
As far as I understand, the protractor-cucumber-framework passes through the cucumberOpts object to cucumber, which allows the user to specify cucumber options like strict and tags. I'm trying to use a TeamCity reporter with this framework. According to the instructions for the reporters, (e.g. TeamCity Reporter, to use this reporter you use the --format option to specify the reporter when running cucumber. So my interpretation is that I should specify the format property in the cucumberOpts object in the same way. i.e. cucumber -f TeamCityFormatter::Formatter becomes:
cucumberOpts: {
'format': 'TeamCityFormatter::Formatter'
}
But when I do this, I get the error:
Unhandled rejection Error: ENOENT: no such file or directory, open 'C:\Dev\fork\Billing.Test.Automation.V2\:Formatter':
I thought maybe I just need to specify the name of the module, so I tried:
cucumberOpts: {
'format': 'TeamCityFormatter'
}
Which gave me this error:
Unhandled rejection Error: Cannot find module 'C:\Dev\fork\Billing.Test.Automation.V2\TeamCityFormatter'
So that looks like it is looking for a module, so I tried pointing it to the module in the node_modules folder:
cucumberOpts: {
'format': 'node_modules/teamcity-formatter'
}
And I get this error:
Unhandled rejection TypeError: this.registerHandler is not a function
Is there some special way to use a cucumber reporter via the protractor-cucumber-framework?
Not an answer but an example of how a package can be imported as a plugin
onPrepare:fucntion(){
...
},
// Here the magic happens
plugins: [{
package: 'protractor-multiple-cucumber-html-reporter-plugin',
options: {
automaticallyGenerateReport: true,
removeExistingJsonReportFile: true,
displayDuration: true
}
}],
Trying to run build on CircleCi and it's failing on test. Same stuff is working perfect on my local.
My .babelrc config:
{
"presets": [
"es2015",
"react",
"stage-2"
],
"plugins": [
"transform-class-properties",
"react-hot-loader/babel",
["babel-plugin-transform-builtin-extend", {
"globals": ["Error", "Array"]
}],
["transform-runtime", {
"polyfill": false,
"regenerator": true
}]
]
}
Error I'm getting from circleCI:
yarn test v0.27.5
$ jest
FAIL src/utils/service-helper.test.js
● Test suite failed to run
ReferenceError: [BABEL] /home/circleci/repo/src/utils/service-helper.test.js: Unknown option: /home/circleci/repo/node_modules/react/index.js.Children. Check out http://babeljs.io/docs/usage/options/ for more information about options.
A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:
Invalid:
`{ presets: [{option: value}] }`
Valid:
`{ presets: [['presetName', {option: value}]] }`
Any idea what is going on as the same configuration is working on another project
The error is unhelpful, but the issue is that your config has react in the preset list, but it can't find the babel-preset-react module in your node_modules, so instead it is loading the react module itself as if it were a preset. But since the "react" module isn't a preset, Babel throws.
Most likely, you've forgotten to list babel-preset-react in your package.json.
Been experimenting with jspm and systemjs over the weekend. Everything is working fine except for the bundling jspm offers. I can load individual files, but jsmp refuses to load the bundle file (which is optimized).
I'm creating the bundle file using:
jspm bundle lib/login assets/js/1-login.js --inject
This updates the config.js file which looks like:
System.config({
baseURL: "/",
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"optimisation.modules.system"
]
},
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
},
bundles: {
"1-login.js": [
"lib/login.js",
"lib/sample.js"
]
},
map: {....}
});
lib/login.js
import * as sample from 'lib/sample'
export function test() {
sample.testMethod();
}
lib/sample.js
import $ from 'jquery'
export function testMethod( ) {
console.log( $('body') );
}
So, according to the jsmp docs:
As soon as one of these modules is requested, the request is intercepted and the bundle is loaded dynamically first, before continuing with the module load.
It's my understanding that running
System.import('lib/login.js');
should load the bundle (and optimised file), but is doesn't - it just loads the actual file. What am I missing here? And as a bonus question, why is jquery not in the bundle list?
Well, figured out where I went wrong.
I keep all the generated assets in assets/js, but in my config.json I didn't change the baseUrl to reflect this. I did in fact have the baseUrl set correctly in package.json, which is why jspm didn't throw a lot of errors.
This was the same reason jquery wasn't loading, so problem solved :)
Below is my build configuration file: build.js
{
appDir: '../src',
baseUrl: 'libs',
paths: {
app: 'js'
},
dir: '../prod',
out:"../js/main-built.js",
fileExclusionRegExp: /.less$/,
optimize: "uglify2",
optimizeCss: "standard",
modules: [{
name: '../js/main'
}]
}
I am using "grunt-requirejs": "~0.4.2" as my build npm and Gruntfile requirejs configuration + r.js 2.1.16:
requirejs: {
std: {
options: grunt.file.read('config/build.js')
}
}
Whenever i am try to execute grunt requirejs it is throwing below error on my console:
Error: Error: Missing either an "out" or "dir" config value. If using "appDir" for a full project optimization, use "dir". If you want to optimize to one file, use "out".
at Function.build.createConfig (d:\app\node_modules\grunt-requirejs\node_modules\requirejs\bin\r.js:27717:19)
I want to consolidate some of the JS files like jquery and its plugins etc. into 1 file and i am using AMD pattern similar to project https://github.com/hegdeashwin/Protocore
Can you please help me out here and tell what i have missed in my configuration ?
Thanks & Regards
You're using grunt.file.read which reads a file and returns the file's content as a string.
Use grunt.file.readJSON instead.
I am upgrading my Extjs to 5.0.1 (from 5.0.0 ) and also Sencha Cmd to 5.0.1.231
No compile time errors but on run time it is is not loading the application and giving the following error
Uncaught TypeError: Cannot read property 'baseUrl' of undefined
some other users are having the same issue..
http://www.sencha.com/forum/showthread.php?289872-After-update-to-5.0.1&p=1059537
Is this a bug or we are doing some thing different ?
Thanks
It looks like a bug, but I think Sencha are pushing towards using a microloader rather than just including the app.js file and the css ones. So my short answer is both! :)
Now the long one:
I was playing with setting up an ExtJS application that is to live far away from the webroot and at the same time to be available in both, development and production modes (environments).
Setting the app.json of the Sencha CMD app, so the microloader.js to load the required js and css files, proved a bit of a challenge.
My folder setup is as per below:
(Note, my build folder is outside the Sencha CMD application folder - MyApp - just to have the same path depth)
index.cfm
/far/away/from/web/root
....
/build
/resources
app.js
app.json
microloader.js
...
/MyApp
/.sencha
/ext
app.json
app.js
bootstrap.js
....
MyApp/app.json
{
/**
* The application's namespace.
*/
"name": "MyApp",
/**
* The relative path to the appliaction's markup file (html, jsp, asp, etc.)
*
* Below setting seems relevant for proper loading MyApp/bootstrap.js
*/
"indexHtmlPath": "../../../../../index.cfm",
......
"output": {
"base": "${workspace.build.dir}",
"page": {
/**
* Below is relative path from the build folder to the application markup file
*/
"path": "../../../../../index.cfm",
"enable": false
},
"microloader": {
"path": "microloader.js",
"embed": false,
"enable": true
},
"manifest": {
"path": "app.json",
"embed": false,
"enable": "${app.output.microloader.enable}"
}
},
/**
* Uniquely generated id for this application, used as prefix for localStorage keys.
* Normally you should never change this value.
*/
"id": "f6cd3e2b-6a0c-4359-a452-e07adda808ae"
}
Initially, in order to use the production build, was loading directly /far/away/from/web/root/build/app.js file and it throw the same error:
Uncaught TypeError: Cannot read property 'baseUrl' of undefined
Now, with the app.json configured as per above, I can pick in my index.cfm whether to load:
for production - /far/away/from/web/root/build/microloader.js
for development - /far/away/from/web/root/MyApp/bootstrap.js
I hope this helps someone.
Cheers,
Pencho