Setting package in dojo build configuration - dojo-build

I am using dojo 1.10 and got 'missing dependency' errors when creating the build.
my profile.js:
var profile = (function(){
return {
......
packages:[{
name: "dojo",
location: "dojo"
},{
name: "dijit",
location: "dijit"
},{
name: "dojox",
location: "dojox"
},{
name: "app",
location: "app"
}],
layers: {
"dojo/dojo": {
include: [ "dojo/dojo", "dojo/i18n", "dojo/domReady", "app/f1/f11/mymodule"],
customBase: true,
boot: true
},
"app/f1/f11/mymodule": {
include: [ "app/f1/f11/myModule" ]
}
}
};
})();
my dojoConfig.js:
var dojoConfig = {
packages: [{
name: "f1",
location: "C:/absolutePathToApp/app/f1"
},{
name: "f2",
location: "C:/absolutePathToApp/app/f2"
}]
};
myModule.js has required dependencies like:
define("f1/f11/myModule", [
"f1/someModule",
"f2/otherModule",
...
When I run the build with --dojoConfig dojoConfig.js in the command line, I got all the dependency error for the modules that are under f1 folder but not f2. I have no idea why it can set the path alias for f2 but not f1, is it because myModule is inside f1?
Any advice or discussion would be much appreciated!

Related

Strapi Plugin localization

I need help figuring this out
debug: ⛔️ Server wasn't able to start properly.
[2022-09-22 11:30:06.580] error: Cannot read property 'routes' of undefined
TypeError: Cannot read property 'routes' of undefined
at Object.addCreateLocalizationAction
An error comes up when i add localization option for my strapi plugin and this is the content scheme, i installed the i18n but it still didnt work
module.exports = {
kind: "collectionType",
collectionName: "tests",
info: {
singularName: "test",
pluralName: "tests",
displayName: "test"
},
options: {
"draftAndPublish": true
},
pluginOptions: {
i18n: {
localized :true
}
},
attributes: {
name: {
pluginOptions: {
i18n: {
localized: true
}
},
type: "string",
required: true
},
}
}

how to integrate ReactJs with Spring MVC in eclipse

I am a new to ReactJS, before I used angularJS for my client side. But now I want to integrate it with the present application on SpringMVC. Now I want to integrate ReactJS as client side instead of angularJS, please help me. If there is any example please help. I am using eclipse ide.
Try to create a view(jsp/html/xhtml) and link the UI build output to that. you may use webpack as a build tool for UI(React) which will return bundle file.
Then it can be included to view using script tag. Please note you can use webpack-dev-server for UI development and try to use Proxy to consume the spring-mvc service. Its a recommended way. A folder containing all the JS under webapp can be used if your using Maven as build tool for java.
webpack reference : https://webpack.js.org/
Sample Webpack.config.js for reference.
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
main: './src/scripts/main.js',
engine: './src/scripts/engine/Engine.js',
debugger: './src/scripts/debug/Debugmain.js',
client: './src/scripts/clientcode/Client.js'
},
output: {
path: path.resolve('./dist/client'),
filename: '[name].js',
publicPath: '/dist/client/',
chunkFilename: '[name].js'
},
devtool: 'inline-sourcemap',
cache: true,
resolve: {
alias: { ByteBuffer: 'bytebuffer' }
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'react-hot-loader'
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
cacheDirectory: true,
presets: ['react', 'es2015'],
compact: false
}
},
{
enforce: 'pre',
test: /\.(js|jsx)$/,
exclude: /node_modules/,
include: [path.join(__dirname, './src', 'scripts')],
loader: 'eslint-loader'
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
loader: 'css-loader?sourceMap!less-loader?sourceMap'
})
},
{
test: /\.(eot|woff|woff2|ttf|otf|png|jpg)$/,
loader: 'file-loader?name=images/[name].[ext]'
}
]
},
devServer: {
port: 8080,
stats: 'errors-only',
proxy: {
'/api': {
target: 'http://localhost:20404', //http://localhost:20403/',
secure: false
}
},
historyApiFallback: {
index: 'debug.html'
}
},
plugins: [
new ExtractTextPlugin({
filename: './styles/main.css',
allChunks: true
})
],
resolve: {
modules: ['src/scripts', 'node_modules'],
extensions: ['.jsx', '.js'],
unsafeCache: true,
alias: {
components: path.resolve(__dirname, 'src', 'scripts', 'components'),
routes: path.resolve(__dirname, '.', 'routes'),
draggable_tab: path.resolve(__dirname, 'src', 'scripts', 'lib'),
utils: path.resolve(__dirname, 'src', 'scripts', 'utils'),
engine: path.resolve(__dirname, 'src', 'scripts', 'engine')
}
}
};

Ember.js - Error while loading route: TypeError: Cannot set property 'store' of undefined

I'm getting the following error in my Ember.js app.
Error while processing route: books Cannot set property 'store' of undefined TypeError: Cannot set property 'store' of undefined
at DS.Store.Ember.Object.extend.modelFor (http://localhost:8080/js/libs/ember-data.js:2986:19)
at DS.Store.Ember.Object.extend.recordForId (http://localhost:8080/js/libs/ember-data.js:2437:17)
at deserializeRecordId (http://localhost:8080/js/libs/ember-data.js:3355:23)
at deserializeRecordIds (http://localhost:8080/js/libs/ember-data.js:3369:5)
at http://localhost:8080/js/libs/ember-data.js:3335:7
at http://localhost:8080/js/libs/ember-data.js:7117:16
at http://localhost:8080/js/libs/ember.js:14899:20
at Object.OrderedSet.forEach (http://localhost:8080/js/libs/ember.js:14741:14)
at Object.Map.forEach (http://localhost:8080/js/libs/ember.js:14897:14)
at Function.DS.Model.reopenClass.eachRelationship (http://localhost:8080/js/libs/ember-data.js:7116:38)
I'm using
ember.js version 1.7.1 and
ember-data.js version 1.0.0-beta.5.
I have the following project:
window.App = Ember.Application.create();
App.ApplicationAdapter = DS.RESTAdapter.extend({
host: 'http://localhost:8080'
});
App.Router.map(function() {
this.resource('books', { path: '/' });
});
App.BooksRoute = Ember.Route.extend({
model: function() {
return this.store.find('book');
}
});
App.Author = DS.Model.extend({
firstname: DS.attr('string'),
lastname: DS.attr('string')
});
App.Book = DS.Model.extend({
title: DS.attr('string'),
authors: DS.hasMany('author')
});
and the following is my JSON response to http://localhost:8080/books.
{
"books":
[
{
"id": 0,
"authors":
[
{
"id": 0,
"firstname": "Andrzej",
"lastname": "Sapkowski"
}
],
"title": "Zaklínač I: Poslední přání"
},
...
]
}
When I remove the Author model and the authors relationship declaration, the application works fine.
The error message I'm getting doesn't reveal the cause and according to what I've found on the Internet, my code seems to be ok.
What's the problem?
Wow, I can't believe I didn't notice this, but your data isn't formatted properly. It should look something like this:
{
"books": [{}, {}, {}],
"authors": [{}, {}, {}]
}
This is explained in the REST adapter guide.

How to setup Karma coverage reporter with multiple types?

I want to get cobertura and html output from the karma coverage reporter. At the moment I have to run the tests twice. One time with this configuration:
reporters: ['progress', 'coverage']
coverageReporter: { type : 'cobertura', dir : 'coverage/', file: 'cobertura.xml' }
The other time with:
coverageReporter: {type : 'html'....
Is there a way to do this in one run?
coverageReporter: {
reporters: [
{ type: 'html', dir: '/' },
{ type: 'cobertura', dir: '...' }
]
}
Should work
coverageReporter: {
dir: 'coverage-report',
reporters: [{
type: 'html',
subdir: 'report-html',
}, {
type: 'lcov',
subdir: 'report-lcov',
}]
}

Extjs PUT url with wrong id

I'm new to senach and ExtJs, and I'm trying to read and write json data. getting the data is already working, but I can't write changed data back to the server.
I'm using a ExtJs 4.2.
I configured one URL in the RestProxy url: /animals/dogs/
GET http://example.com/animals/dogs
PUThttp://example.com/animals/dogs/{id}
Get is working as expected. But the PUT URL is:
example.com/animals/dogs/project.model.dogs-3?dc435453...
The id also contains the model name. How can I change this to the id like above?
This is the store:
Ext.define('project.store.MyJsonStore', {
extend: 'Ext.data.Store',
requires: [
'project.model.dogs',
'Ext.data.proxy.Rest',
'Ext.data.reader.Json'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
autoSync: true,
model: 'project.model.dogs',
storeId: 'MyJsonStore',
proxy: {
type: 'rest',
limitParam: 'count',
url: '/animals/dogs,
reader: {
type: 'json',
idProperty: 'id',
root: 'data'
}
}
}, cfg)]);
}
});
This is the model:
Ext.define('project.model.dogs', {
extend: 'Ext.data.Model',
requires: [
'Ext.data.Field'
],
clientIdProperty: 'id',
fields: [
{
name: 'id',
type: 'int'
},
{
name: 'type',
type: 'string'
}
]
});
GET Respones: (reader root is data)
{
"success": true,
"data":
[
{
"id": 1,
"type": "Some Type",
"url": "/animals/dogs/1"
},
{
"id": 2,
"type": "Some other Type",
"url": "/animals/dogs/2"
},
]
}
The PUT urls look like:
example.com/animals/dogs/project.model.dogs-3?dc...
example.com/animals/dogs/project.model.dogs-7?dc...
example.com/animals/dogs/project.model.dogs-8?dc...
The numbers 3, 7, 8 are the id's, so extjs recognizes the id property in the model.
Regards,
Sencha Beginner