Aurelia Dependency Injection Testing - dependency-injection

I've been working in aurelia app and I'm getting an error while testing.
I'm trying to use aurelia-dependency-injection which is already a dependency of other packages which I'm including via jspm like aurelia-framework, aurelia-router, aurelia-templating-resources, aurelia-templating-router and when I try to inject it just works fine on my browser. However, when I try to test using Karma, it says
27 05 2016 09:45:18.202:WARN [web-server]: 404: /base/aurelia-dependency-injection.js
Chrome 50.0.2661 (Linux 0.0.0) ERROR
Error: XHR error (404 Not Found) loading /home/cyberkiller/test_project/aurelia-dependency-injection.js
Error loading /home/cyberkiller/test_project/aurelia-dependency-injection.js as "aurelia-dependency-injection" from /home/cyberkiller/test_project/src/users/list.ts
My package.json has the following jspm dependencies:
"jspm": {
"dependencies": {
"aurelia-animator-css": "npm:aurelia-animator-css#^1.0.0-beta.1.1.2",
"aurelia-bootstrapper": "npm:aurelia-bootstrapper#^1.0.0-beta.1.1.4",
"aurelia-fetch-client": "npm:aurelia-fetch-client#^1.0.0-beta.1.1.1",
"aurelia-framework": "npm:aurelia-framework#^1.0.0-beta.1.1.4",
"aurelia-history-browser": "npm:aurelia-history-browser#^1.0.0-beta.1.1.4",
"aurelia-loader-default": "npm:aurelia-loader-default#^1.0.0-beta.1.1.3",
"aurelia-logging-console": "npm:aurelia-logging-console#^1.0.0-beta.1.1.4",
"aurelia-pal-browser": "npm:aurelia-pal-browser#^1.0.0-beta.1.1.4",
"aurelia-polyfills": "npm:aurelia-polyfills#^1.0.0-beta.1.0.3",
"aurelia-router": "npm:aurelia-router#^1.0.0-beta.1.1.3",
"aurelia-templating-binding": "npm:aurelia-templating-binding#^1.0.0-beta.1.1.2",
"aurelia-templating-resources": "npm:aurelia-templating-resources#^1.0.0-beta.1.1.3",
"aurelia-templating-router": "npm:aurelia-templating-router#^1.0.0-beta.1.1.2",
"bootstrap": "github:twbs/bootstrap#^3.3.5",
"fetch": "github:github/fetch#^0.11.0",
"font-awesome": "npm:font-awesome#^4.6.1",
"simple-line-icons": "npm:simple-line-icons#^2.2.4",
"text": "github:systemjs/plugin-text#^0.0.3"
},
"devDependencies": {
"babel": "npm:babel-core#^5.8.24",
"babel-runtime": "npm:babel-runtime#^5.8.24",
"core-js": "npm:core-js#^1.1.4"
}
}
I did find a workaround, which is to add aurelia-dependency-injection explicitly as a dependency in my package.json like
"aurelia-dependency-injection": "npm:aurelia-dependency-injection#1.0.0-beta.1.2.3"
Which makes my package.json look like:
"jspm": {
"dependencies": {
"aurelia-animator-css": "npm:aurelia-animator-css#^1.0.0-beta.1.1.2",
"aurelia-bootstrapper": "npm:aurelia-bootstrapper#^1.0.0-beta.1.1.4",
"aurelia-dependency-injection": "npm:aurelia-dependency-injection#1.0.0-beta.1.2.3",
"aurelia-fetch-client": "npm:aurelia-fetch-client#^1.0.0-beta.1.1.1",
"aurelia-framework": "npm:aurelia-framework#^1.0.0-beta.1.1.4",
"aurelia-history-browser": "npm:aurelia-history-browser#^1.0.0-beta.1.1.4",
"aurelia-loader-default": "npm:aurelia-loader-default#^1.0.0-beta.1.1.3",
"aurelia-logging-console": "npm:aurelia-logging-console#^1.0.0-beta.1.1.4",
"aurelia-pal-browser": "npm:aurelia-pal-browser#^1.0.0-beta.1.1.4",
"aurelia-polyfills": "npm:aurelia-polyfills#^1.0.0-beta.1.0.3",
"aurelia-router": "npm:aurelia-router#^1.0.0-beta.1.1.3",
"aurelia-templating-binding": "npm:aurelia-templating-binding#^1.0.0-beta.1.1.2",
"aurelia-templating-resources": "npm:aurelia-templating-resources#^1.0.0-beta.1.1.3",
"aurelia-templating-router": "npm:aurelia-templating-router#^1.0.0-beta.1.1.2",
"bootstrap": "github:twbs/bootstrap#^3.3.5",
"fetch": "github:github/fetch#^0.11.0",
"font-awesome": "npm:font-awesome#^4.6.1",
"simple-line-icons": "npm:simple-line-icons#^2.2.4",
"text": "github:systemjs/plugin-text#^0.0.3"
},
"devDependencies": {
"babel": "npm:babel-core#^5.8.24",
"babel-runtime": "npm:babel-runtime#^5.8.24",
"core-js": "npm:core-js#^1.1.4"
}
}
When I update everything and build and run test, it no longer complains and it executes successfully. However I'm not sure if this is just a workaround, or the way to do it. Is there any better way to handle this?
Thanks in advanced!

Related

Can not find module 'debug

I've been having this issue for a while and I've even opened an issue on electron-builder github page but haven't received any response.
I'm running electron builder version 20.38.4 and trying to package the app for Win 64 environment. Everything works fine when I do "yarn dev" and "yarn compile". Even "yarn dist" works without any issue.
However, when I click on the generated .exe file, I get this error message.
Any ideas?
Here's the link to the issue I've opened with some detailed screenshots and log outputs
https://github.com/electron-userland/electron-builder/issues/3561
Here's the package.json as requested
{
"name": "myproj",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"dev": "electron-webpack dev",
"compile": "electron-webpack",
"dist": "yarn compile && electron-builder",
"dist:dir": "yarn dist --dir -c.compression=store -c.mac.identity=null"
},
"dependencies": {
"#rodrigogs/mysql-events": "^0.5.2",
"electron-online": "^1.0.0",
"mysql": "^2.16.0",
"source-map-support": "^0.5.9"
},
"devDependencies": {
"electron": "3.0.10",
"electron-builder": "^20.38.4",
"electron-webpack": "^2.6.1",
"webpack": "^4.26.0"
},
"build": {
"appId": "com.teamio.app",
"productName": "Teamio",
"buildVersion": "1.0",
"copyright": "Copyright © 2018 Teamio.app",
"nsis": {
"oneClick": false,
"perMachine": true,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"deleteAppDataOnUninstall": true,
"createDesktopShortcut": true,
"installerIcon": "build/icon.ico",
"uninstallerIcon": "build/icon.ico",
"uninstallDisplayName": "Uninstall Teamio"
},
"win": {
"target": "nsis",
"icon": "build/icon.ico"
}
}
}
Sorry to revive an old question, but what is happening is the electron-online package does not properly define its dependencies in its own package.json. So it is missing the debug package, which you have "solved" by placing another package that requires debug in your project dependencies. In reality though, the (long abandoned) package electron-online should update its dependencies and add debug, among others.
As a slightly cleaner workaround, you could add debug to your project dependencies instead of electron-webpack or webpack.
I had the same problem a few hours ago, resolved by not excluding (ignoring) the src folder from package config. Could you paste you package.json file here ?
Ok. Looks like I've solved my own problem. Not sure why exactly but it worked. What I had to do was move 2 dependencies listed below from devDependencies to dependencies section in my package.json
"electron-webpack": "^2.6.1",
"webpack": "^4.26.0"
If someone can shed some light on that, it'd be helpful. I figured I'd post it here in case someone else runs into this issue.

RNAppAuth, iOS build failed, Unknown type name 'namespace', react-native-app-auth

I am trying to add react-native-app-auth to existing, but quite fresh project with Expo.
I'm following your setup guide, so doing following steps:
yarn add react-native-app-auth#2.2.0 --dev
Add pod 'AppAuth', '>= 0.91'
cd iso && pod install
react-native link (EDIT: from root path of the project)
And I get:
rnpm-install info Linking react-native-app-auth ios dependency
rnpm-install WARN ERRGROUP Group 'Libraries' does not exist in your Xcode project. We have created it automatically for you.
rnpm-install info Platform 'ios' module react-native-app-auth has been successfully linked
which looks fine.
Then when I build in XCode i get the following error:
After searching the web I found it may be connected with compilator I changed it use Objective-C++:
and now I get more errors:
I also tried:
Changing Target version to 9.0
Doing it again
Praying 🙏
Nothing helps :( Xcode Version 9.3 (9E145)
app.js
{
"expo": {
"sdkVersion": "26.0.0",
"ios": {
"bundleIdentifier": "com.xxx.xxx",
"publishBundlePath": "ios/mobile-xxx/Supporting/shell-app.bundle",
"publishManifestPath": "ios/mobile-xxx/Supporting/shell-app-manifest.json"
},
"android": {
"package": "com.xxx.xxx"
},
"name": "mobile-xxx",
"slug": "mobile-xxx",
"version": "0.1.0",
"isDetached": true,
"entryPoint": "./index.js",
"detach": {
"scheme": "exp997ce9c6b4fd43cfa14f4eede063ecf5",
"iosExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/ios-v2.4.4-sdk26.0.0-3bd935c7-cdd3-4002-8e44-4df857a675f2.tar.gz",
"androidExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/android-v2.4.0-sdk26.0.0-e63d9209-070c-4118-b06b-c60e82da0b66.tar.gz"
}
}
}
package.js
{
"name": "mobile-xxx",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "26.0.0",
"react-native-app-auth": "2.2.0",
"react-test-renderer": "16.3.0-alpha.1"
},
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^26.0.0",
"prop-types": "^15.6.1",
"react": "16.3.0-alpha.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-26.0.0.tar.gz",
"react-native-app-auth": "^2.2.0",
"react-native-router-flux": "^4.0.0-beta.28",
"react-redux": "^5.0.7",
"redux": "^3.7.2"
}
}
UPDATE: I have just setup a fresh Expo app following this guide and have exactly the same error. 😞
The problem is that there is an import in header search paths, which searches in the whole /ios folder:
$(SRCROOT)/../../../ios/**
If you happen to use Expo and CocoaPods, there will be boost-for-react-native as a dependency inside your Pods folder. In fact, any package depending on boost will cause this problem. XCode tries to build boost as well, but it has some non-ObjC files, so it will fail.
In order to fix the issue:
Open RNAppAuth.xcodeproj, switch to Build Settings tab and search for header search paths. Replace line $(SRCROOT)/../../../ios/** with
"$(SRCROOT)/../../../ios/YOUR_PROJECT_NAME",
"$(SRCROOT)/../../../ios/Pods/AppAuth/**",
Please note that these changes will disappear after using npm install (or yarn). To make these changes permanent, you can use patch-package.
Edit: this issue has been fixed, using the latest version of the package should work now.

npm published yeoman generator not showing under yeoman.io

I have recently written a yeoman generator called 'generator-webvr-decorator'. Following the instructions from this post, I have done all the steps including publishing to npm. However, after four days I do still not see my generator listed under the yeoman generators web page. The number of generators seems to be frozen at 3438.
I have done all the following:
npm test passes.
I have 'yeoman-generator' in the package.json keywords:
```
{
"name": "generator-webvr-decorator",
"version": "0.1.5",
"description": "add WebVr boilerplate to an existing application",
"license": "MIT",
"main": "app/index.js",
"repository": "vt5491/generator-webvr-decorator",
"author": {
"name": "vt5491",
"email": "vt5491#gmail.com",
"url": "https://github.com/vt5491"
},
"scripts": {
"test": "mocha"
},
"files": [
"generators",
"lib"
],
"keywords": [
"yeoman-generator",
"webvr",
"vr",
"angular"
],
"dependencies": {
"async": "^1.5.0",
"chalk": "^1.0.0",
"cheerio": "^0.19.0",
"escope": "^3.3.0",
"esprima": "^2.7.0",
"jquery": "^2.1.4",
"jsonfile": "^2.2.3",
"lodash": "^3.10.1",
"merge": "^1.2.0",
"yeoman-generator": "^0.19.0",
"yosay": "^1.0.2"
},
"devDependencies": {
"mocha": "*"
}
}
```
published to npm. It is found by the npm search:
turner#vturner-virtual-machine ~/vtstuff/github2/generator-webvr-decorator $ npm search
generator-webvr-decorator
NAME DESCRIPTION AUTHOR DATE VERSION KEYWORDS
generator-webvr-decorator add WebVr boilerplate to an existing application =vt5491 2015-12-05 0.1.4 yeoman-generator webvr vr
Manually tested installing from the npm repository under windows and linux, so I know it physically works assuming yeoman does some kind of automated testing i.e checks to see if the generator actually runs.
Can anyone see what I'm doing wrong?
How often is the database of generators under yeoman.io updated?
Should I open a ticket with the yeoman web site?
I don't know what the add rate for generators is, but in the last four days the generator count has stayed constant at 3438.
Many Thanks.
The system fetching new generators is currently down: https://github.com/yeoman/yeoman-generator-list/issues/38 - It'll hopefully be up in the next few days.
We're also currently posting packages with yeoman-generator keywords that we exclude for other reason here: https://github.com/yeoman/yeoman-generator-list/issues/36 (I don't see yours in there, so your generator will show up soon)

Bower is not updating in Visual Studio 2015 CTP 6

I have just installed React using Bower inside Visual Studio 2015 CTP6.
In Dependencies -> Bower -> React (0.13.0)
I do have React package.(js files are also in bower_components/react folder on disk)
When I try to add script <script src="~/lib/ I do not have React in my list of scripts.
Intelligence not working and JavaScript is not loaded.
in this sample I added a simple rule to copy all the .js files:
{
"name": "WebApplication",
"private": true,
"dependencies": {
"bootstrap": "3.0.0",
"jquery": "1.10.2",
"jquery-validation": "1.11.1",
"jquery-validation-unobtrusive": "3.2.2",
"hammer.js": "2.0.4",
"bootstrap-touch-carousel": "0.8.0",
"react": "~0.13.1"
},
"exportsOverride": {
"bootstrap": {
"js": "dist/js/*.*",
"css": "dist/css/*.*",
"fonts": "dist/fonts/*.*"
},
"bootstrap-touch-carousel": {
"js": "dist/js/*.*",
"css": "dist/css/*.*"
},
"hammer": {
"": "hammer.{js,min.js}"
},
"react": {
"": "*.js"
}
}
}
the result is that when you run install bower task you'll find inside the wwwroot/lib a directory named react with just the ,js files.
I think you have configure the exportsOverride section in the bower.json

Why does Bower remove my "resolutions" and how do I stop it

I have a bower.json file
{
"name": "example-project",
"private": true,
"dependencies": {
"angular": "1.2.14",
"angular-scenario": "1.2.14",
"angular-resource": "1.2.14",
"angular-ui-router": "0.2.10",
"angular-strap": "2.0.0"
}
}
When I run grunt (with grunt-bowercopy or grunt-bower-task) I get an error Fatal error: Unable to find suitable version for angular
When I run bower install it says it doesn't know which version of angular to use:
Unable to find a suitable version for angular, please choose one:
1) angular#1.2.14 which resolved to 1.2.14 and is required by angular-scenario#1.2.14, example-project
2) angular#>= 1.0.8 which resolved to 1.2.16 and is required by angular-ui-router#0.2.10
3) angular#~1.2.10 which resolved to 1.2.16 and is required by angular-strap#2.0.0
Prefix the choice with ! to persist it to bower.json
So that explains why grunt was failing - it had transitive dependencies and didn't know which one to select. So I choose 1 (!1 to persist). Now my bower.json looks like this:
{
"name": "example-project",
"private": true,
"dependencies": {
"angular": "1.2.14",
"angular-scenario": "1.2.14",
"angular-resource": "1.2.14",
"angular-ui-router": "0.2.10",
"angular-strap": "2.0.0"
},
"resolutions": {
"angular": "1.2.14"
}
}
Sweet! I run bower install again. This time it succeeds but removes the "resolutions" part. Now it just works for me without resolutions, but my coworkers will get the same error and have to go through the same process.
Why does it do this? Is there any way to stop it from happening?
-Update-
It seems that this is a bug. See bower issues https://github.com/bower/bower/issues/1061 and https://github.com/bower/bower/issues/1272. Hopefully the issue will get some attention and get resolved.
Upgrade to Bower 1.4.0 or greater where this issue is resolved.
Previous Answer:
A workaround suggested by edeustace (see https://github.com/bower/bower/issues/1061) is to add a script to your build (grunt, gulp, etc) that resets the resolutions as they should be after running bower. It's an ugly solution but should do the trick until the issue gets resolved.

Resources