jspm / registry Goto Github PK
View Code? Open in Web Editor NEWThe jspm registry and package.json override service
Home Page: https://jspm.io
The jspm registry and package.json override service
Home Page: https://jspm.io
decimal.js currently doesn't work in browsers. This is maybe my fault because I have added it into registry, but it has some interesting behavior which I cant define. Before commiting into registry I have tried bellow code and module has been successfully importer:
<html>
<body>
<script src="http://jspm.io/system.js"></script>
<script>
System.import('npm:decimal.js').then(function(m) {
console.log(m);
});
</script>
</body>
</html>
Now, if we change npm:decimal.js
to registry name decimal.js
here is an error:
GET https://registry.jspm.io/decimal.js.js 404 (Not Found)
Same error occurs if module is localy loaded (jspm_packages/system.js
).
In case of jspm install decima.js
here is a bunch of not found libs:
Hi
I'm trying to add https://github.com/necolas/normalize.css to the registry but I can't find out how to test it
I start using
jspm install normalize.css=github:necolas/normalize.css -o "{package override}"
with:
// following https://github.com/jspm/registry/blob/824372c2169cf0333ca7e92f56c00ee36a0b1388/package-overrides/github/twbs/bootstrap%403.1.0.json
{
"name": "normalize.css",
"registry": "jspm",
"dependencies": {
"css": "*"
},
"shim": {
"normalize.css": {
"deps": ["./normalize.css!"]
}
}
}
but it's always trying to load a normalize.css.js
file...
Is it normal ?
The overrides will apply for all versions semver compatible with the override version, with the highest version override taking precedence.
What does this mean exactly? Does semver compatible include minor version changes or only patch versions? And if I try to install a version of a package that is newer than the override that is in the registry, what happens? For example, if the registry contains an override for version r70
of three.js, and I try to jspm install
version r71
, will jspm use the r70
override that it knows about? (I hope so, but it's not clear to me). And how are major versions handled?
Does jspm support umdjs/umd and, if so, what format should be specified for them?
I'm not entirely clear on how shimming works. We should expand the wiki on this.
@guybedford Could you explain what exactly is going on in the shim of this bootstrap example?
{
"registry": "jspm",
"dependencies": {
"jquery": "*",
"css": "*"
},
"shim": {
"js/bootstrap": {
"deps": ["jquery", "../css/bootstrap.css!"],
"exports": "$"
}
}
}
From jspm/jspm-cli#536 -
Hi there,
I'm having a hard time getting something fairly basic to work and hoping for a nudge in the direction. The issue is similar to another issue but the information listed on the ticket don't seem to help me.
I pushed a test repo up as a discussion point and will outline my issues referencing the lines of code in there. I want to load the main JS file from materializecss and with my current code, I get an error: Uncaught ReferenceError: jQuery is not defined
jspm install github:dogfalo/materialize -o "{ main: 'js/bin/materialize.js', shim: { 'js/bin/materialize.js': ['jquery'] } }"
However, running this command (or just jspm install github:dogfalo/materialize
) doesn't seem to describe any hard dependency on jquery
in either package.json
or config.js
package.json
, any jspm install
command removes the changes for whatever reason (tried what is described here)I'd absolutely love any pointers or tips on how to solve this seemingly simple problem.
Thanks
in relation with #224 and jspm/github#6
the installation command to download the first version,
that not containing the css files. (https://github.com/Dogfalo/materialize/releases)
when I : jspm github:lumapps/lumx
I get: 'Try adding an override, or set the package.json "main": false if this is the intention.'
when I : jspm github:lumapps/lumx -o "{main: 'dist/js/lumx'}"
I get: 'Try adding an override, or set the package.json "main": false if this is the intention.'
I don't know what the override does exactly, explanation would be great.
To make this work, I go into jspm_packages/github/lumapps/
and create the appropriate file to module.exports
the entry file. Then I go into dist/js/lumx.js
and at the top "format global"; "exports lumx";
Where lumx
is the angular module I had to save as a global.
I know this is not the right way to get github repos to work, and there must be something I am missing.
Moved to jspm/jspm-cli#176.
System.import("ace").then(function (ace) {
var editor = ace.edit("editor");
editor.getSession().setMode("ace/mode/javascript");
})
GET http://localhost:63342/jshow-ui/mode-javascript.js
no found!
The npm version is currently giving:
Error evaluating file:..../jspm_packages/npm/image-size@0.
3.5/lib/index.js
Module ../lib/detector not declared as a dependency.]
This may need some override work.
//cc @whitecolor
Was there some special intention to override Angular to it's minified version? I really would like to load all my libs unminified during development.
If this is unintended, I will soon prepare a PR which corrects this.
should the hammer package be defined as hammer or hammerjs ?
when installing hammer now from jspm
jspm install hammer
it ends up being defined as hammer and can be required without problems.
but when jquery.hammer is also used then it has to be named hammerjs , because the jquery.hammer.js script requires hammer as hammerjs
in my config.js i actually have to manually change it to hammerjs for this to work.
so should the hammer entry in this repository be changed to hammerjs ? or should hammerjs simply be added as an alias to hammer ?
jspm install npm:react-bootstrap -o "{peerDependencies: {'react': '0.12.2'}}"
If you could use glob so shims can have things like ./*
, **/*.js
, or foo/**/bar/*/baz/*.js
, that'd be great!
hammerjs
is in the registry, is it supposed to install as a dep when I install vue-touch
like such
jspm install github:vuejs/vue-touch
it's listed as a dep in the package.json
of vue-touch
.
If I run
jspm install famous=github:trusktr/famous@trusktr -o '{ "registry": "jspm", "directories": { "lib": "src" }, "dependencies": { "famous-polyfills": "^0.3.0", "css": "^0.1.0" }, "shim": { "*/*": { "deps": ["famous-polyfills", "../core/famous.css!"] } } }'
I get
err ReferenceError: extend is not defined
at /Users/trusktr/src/trusktr/portfolio/node_modules/jspm/node_modules/jspm-registry/registry.js:132:7
at $$$internal$$tryCatch (/Users/trusktr/src/trusktr/portfolio/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:470:16)
at $$$internal$$invokeCallback (/Users/trusktr/src/trusktr/portfolio/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:482:17)
at $$$internal$$publish (/Users/trusktr/src/trusktr/portfolio/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:453:11)
at $$rsvp$asap$$flush (/Users/trusktr/src/trusktr/portfolio/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:1531:9)
at process._tickCallback (node.js:419:13)
at registry.js:132:7
.
I wanted to add an override for https://github.com/hoxton-one/golden-layout. The library seems to be posted to NPM.
Putting this here to track the override so it isn't forgotten. Thanks @jdanyow for working this out.
jspm install github:Breeze/breeze.js -o "{ main: 'build/breeze.min.js', dependencies: { jquery: '^2.1.0', Q: 'npm:q' }, shim: { 'build/breeze.min': { deps: ['jquery', 'Q'] } } }"
I've abandoned trying to use the npm version because it requires some browserify packaging stuff I don't know how to deal with.
The github package actually comes with a build in ./build/auth0-lock.min.js
and I've been trying to create an override for it here: https://github.com/volak/registry/blob/master/package-overrides/github/auth0/lock%407.1.1.json
I am so close, but need help with the final bit.
If I do this:
System.import("lock").then((auth0) => {
var lock = new auth0('key', 'instance.auth0.com');
console.log(lock);
});
It works!
But when I do this:
import {Auth0Lock} from 'lock';
Auth0Lock is undefined
If I run jspm install angular
, it uses github:angular/bower-angular
, as per the registry.json
. However, the file created at /jspm_packages/github/angular/[email protected]
looks like this:
export * from "github:angular/[email protected]/bower-angular";
when it should be
export * from "github:angular/[email protected]/angular";
I'd thought the package.json
override in this repo specifying "main": "angular.min"
should fix this... so I'm not sure where it's breaking down (or if it's just my understanding).
Test and confirm override.
From jspm/jspm-cli#421
The files folder includes the locale
directory - https://github.com/moment/moment/blob/2.8.0/package.json#L68-L79
But the old override is still applying from https://github.com/jspm/registry/blob/6b46ce26972298378337b375b14c01806b1b1d38/package-overrides/github/moment/moment%402.4.0.json.
We need to disable the override by creating a blank override for 2.8.0 (or the first version that does this).
@douglasduteil contributions welcome, that have been tested.
Two issues currently:
From jspm/jspm-cli#483 by @smajl
After jspm install angular-strap
and this line in my code import 'angular-strap'
I realised that the jspm_packages/github/mgcrea/[email protected]
file is missing (does not get created in the process).
So now have to bypass it with:
import 'github:mgcrea/[email protected]/dist/angular-strap'
import 'github:mgcrea/[email protected]/dist/angular-strap.tpl'
Is that problem with jspm, angular-strap package definition or something on my side?
I just tried Backbone and it seemed to be loading fine for me in the browser.
@jason can you explain the code you were using that wasn't working. It would be great to look into it.
Seems the override expired. Needed:
jspm install select2 -o "{ shim: { select2: ['jquery'] }, dependencies: { jquery: '*' } }"
Consider bootstrap for example, it should be possible to load the js file without getting all the css.
Thus if we could define:
package.json:
{
"main": ["js/bootstrap", "css/bootrap.css!"]
}
Then we would have:
jspm.import('bootstrap'); // loads css + js
jspm.import('bootstrap/js/bootstrap'); // loads just the js
When I run jspm install github:angular-ui/ng-grid
, version 2.0.13 is installed. I am trying to figure out how to create an override that will install version 3.0.0-rc.12. It looks like there is not a github release, so should I be doing a jspm install github:angular-ui/ng-grid@master
? Even when I do that, there is no built file to reference. Assistance is appreciated, thanks!
Hi @guybedford
Like I was a bit lost and uncertain of what is actually registered here I wrote some tests (:
I made a little poke and find out that 19 over 155 packages are broken
( testing made by curl
the GitHub API).
It would be cool to validate PR and auto check semver format for example (following #118)
What you think ?
It seems the Famous override isn't working correctly (https://github.com/jspm/registry/blob/master/package-overrides/github/Famous/famous%400.3.0.json).
Note that */*
in a shim is not supported as we don't do support globbing, just a single single-depth wildcard.
I would like to submit a PR for FlowType but have a little question first.
The github repo currently does not have a package.json , only a bower.json.
i forked the repo and added a package.json.
This works but when it is installed the package is registered in the configuration as FlowType.JS
and i can import it as require("FlowType.JS")
Is there any way to change the name from FlowType.JS to just FlowType ?
From systemjs/systemjs#345:
//cc @hgl
import "web-animation-js/web-animations-next.dev";
$ jspm bundle move/main
Building the bundle tree for move/main...
err Error: Error loading "web-animation-js/web-animations-next.dev" at file:/Users/hgl/dev/lab/jspm/web-animation-js/web-animations-next.dev.js
Error loading "web-animation-js/web-animations-next.dev" from "move/main" at file:/Users/hgl/dev/lab/jspm/lib/main.js
ENOENT, open '/Users/hgl/dev/lab/jspm/web-animation-js/web-animations-next.dev.js'
Clearly, jspm is trying to bundle the file from my project root folder (Users/hgl/dev/lab/jspm/).
I have tried another npm package where the main entry point exists, and I can import a specific file like <pkgname>/<file>
with no problem, but no when the entry point is missing in package.json
.
Tried all kinds of variations, bumping requirements to same edge versions. No dice.
When issuing import Request from 'superagent';
I get:
Uncaught TypeError: Object prototype may only be an Object or null: undefined
system.js:1 Uncaught Error evaluating http://localhost:8000/jspm_packages/npm/[email protected]/lib/[email protected]/readable.js
What am I doing wrong here?
Would be good to test and confirm the override for this.
Get it to work...
a) Use e.g. something from http://bower.io/search/?q=bootstrap-less (unfortunately, all outdated, best is 3.3.1).
b) Rather wait for next release of jspm where local overrides get higher priority than remote package config (so you can override directories.lib
) and overrides are persisted.
c) Some other and better idea...?
Because I would really like to use bootstrap LESS mixins today. :)
I'm experimenting with jspm.io. I have some questions:
I'd like to know if config.js
and/or jspm_packages
should be commited to the repository or not.
I prefer not to commit jspm_packages
to the repository, with similar reason for node_modules
.
If I commit only config.js
, I'm not sure if when someone else check out the code, and type jspm install
, will config.js
stay the same or not. If config.js
is so constantly updated, I prefer not to put config.js
inside source tree.
But config.js
also contains some custom configuration such as custom mapping for SystemJS plugins:
"jsx": "app/transformers/jsx",
When I put the "map"
key in package.json
, delete config.js
, and run jspm install
, the "map"
key I specified in the JSON does not show up inside the generated config.js
.
So, is config.js
meant to be edited by human or the CLI?
I noticed that jspm install bootstrap
install [email protected], but the latest version of bootstrap that an override exists for in the registry is 3.1.0. Does that override get used in this case?
auth0-js depends on zuul which has a commit id reference causing
unable to resolve defunctzombie/stacktrace.js#07e7b95
Need to override dependencies to:
"dependencies": {
"Base64": "~0.1.3",
"debug": "~1.0.4",
"json-fallback": "0.0.1",
"jsonp": "~0.0.4",
"packageify": "^0.2.0",
"qs": "git://github.com/jfromaniello/node-querystring.git#fix_ie7_bug_with_arrays",
"reqwest": "^1.1.4",
"trim": "~0.0.1",
"winchan": "^0.1.1",
"xtend": "~2.1.1"
},
The xls.js
script found at https://github.com/SheetJS/js-xls assumes it can use fs
and other node.js modules if it is within a CommonJS environment. This means that running it within a browser environment with JSPM is throwing errors such as fs.js not found
. The readme indicates the script supports running in a browser and will not load nodejs modules or extra functionality such as cpexcel
.
Here are some code snippets:
if(typeof module !== "undefined" && typeof require !== 'undefined') {
if(typeof cptable === 'undefined') cptable = require('./dist/cpexcel');
current_cptable = cptable[current_codepage];
}
...
function readFileSync(filename, options) {
if(fs === undefined) fs = require('fs');
return parse(fs.readFileSync(filename), options);
}
It seems to me the code would have to be changed to work within JSPM and that simple overrides will not solve this problem. Is this true, and if not, any ideas how to make it work?
Using [email protected]:
▶ jspm install mocha
No package.json found, would you like to create one? [yes]:
Would you like jspm to prefix its package.json properties under jspm? [yes]:
Enter packages folder [jspm_packages]:
Enter config file path [config.js]:
Configuration file config.js not found, create it? [yes]:
Updating registry cache
Checking versions for npm:mocha
err TypeError: Invalid Version: 1
at new SemVer (/usr/lib/node_modules/jspm/node_modules/semver/semver.js:271:11)
at SemVer.compare (/usr/lib/node_modules/jspm/node_modules/semver/semver.js:310:13)
at Function.compare (/usr/lib/node_modules/jspm/node_modules/semver/semver.js:424:31)
at /usr/lib/node_modules/jspm/lib/package.js:304:25
at Array.sort (native)
at /usr/lib/node_modules/jspm/lib/package.js:303:6
at $$$internal$$tryCatch (/usr/lib/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:470:16)
at $$$internal$$invoke~/projects/foo Callback (/usr/lib/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:482:17)
at $$$internal$$publish (/usr/lib/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:453:11)
at $$rsvp$asap$$flush (/usr/lib/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:1531:9)
warn Installation changes not saved
Doing jspm install ng-infinite-scroll
doesn't load its override:
$ sudo jspm install ng-infinite-scroll
Updating registry cache...
Looking up github:sroze/ngInfiniteScroll
Downloading github:sroze/[email protected]
warn No main entry point detected for github:sroze/[email protected].
Try adding an override, or set the package.json "main": false if this is the intention.
ok Installed ng-infinite-scroll as github:sroze/ngInfiniteScroll@^1.2.0 (1.2.0)
ok Install tree has no forks.
ok Install complete.
The only way for me to make it work is to use: jspm install ng-infinite-scroll -o "{ main: 'build/ng-infinite-scroll' }"
.
I couldn't find where in jspm
the overriding files are being loaded.
Thanks for the help :)
We have mocha@^1.21.5
working, but not the latest version. It would be good to get an override going for that.
//cc @stuartc
@Jarreddebeer has been working on an override generation tool at http://jarreddebeer.github.io/jspm-package-override-generator/public/.
Any feedback on the above would be really welcome.
I have thought today about why there are two places to describe dependencies in package overrides files (shim/deps and dependences). For example (ionic again, sorry :D):
{
"directories": {
"lib": "release"
},
"main": "js/ionic",
"shim": {
"js/ionic": {
"deps": ["../css/ionic.css!"]
},
"js/ionic-angular": {
"deps": ["angular", "./ionic"]
}
},
"registry": "jspm",
"dependencies": {
"css": "0.1.0",
"angular": "^1.3.2",
"angular-animate": "^1.3.2",
"angular-sanitize": "^1.3.2",
"angular-ui-router": "0.2.10"
}
}
does it mean that import "ionic" will pull only ionic.css? but why dependencies section have 5 references if they are not imported with ionic (or any other defined in main section)? If all of them are dependencies, they are necessary to make main lib works? I guess I haven't understood it in right way because I've just found that my sample jspm project doesn't work if I comment this tree lines on top of this, no matter what there is configuration in registry package dependencies for this files.
Thanks for you time!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.