Using jspm 0.16.13, I've noticed that in addition to mapping "a module alias to a location or package" config.js map also seems to be defining a module's dependencies. For example, see the snippet below. However, in this particular example, at least on my generated config.js, this module doesn't appear anywhere else in the map.
"github:aurelia/logging-console#0.7.1": {
"aurelia-logging": "github:aurelia/logging#0.7.0"
}
What I'm trying to do is create a "vendor" bundle using jspm... put all "third party" dependencies into it's own bundle. I need to manually list the modules because I'm using aurelia---including the "main aurelia module" won't automagically include it's dependencies. (That's probably true of other libraries as well.)
Can someone explain config.js map? Or provide a better way to list all of an app's dependencies?
You can use bundle arithmetic to bundle your app dependencies into a vendor.js:
jspm bundle app/**/* - [app/**/*] vendor.js
Explanation of the syntax by Guy Bedford: https://github.com/jspm/jspm-cli/issues/1109#issuecomment-141385673
An alternative solution is to bundle all modules listed in the package.json:
https://github.com/jspm/jspm-cli/issues/1109#issuecomment-139529178
As for the map, it defines aliases (or dependencies, does not really matter) so that import statements can refer to a module using a short name. In the future, it will be possible to import a module using an URL.
Related
The documentation says that there is file api/config/api_platform/resources.yaml where I can map entities using yml. But neither in the distribution nor when I install API-platform as a package I can't find this file. Creation of the directory and file manually doesn't help.
In the context of a Symfony 4 project, the file can be located at config/api_platform/resources.yaml. If it doesn't exist, simply create it.
You can also use several files in order to define your mappings:
config/api_platform/resources/entity1.yaml
config/api_platform/resources/entity2.yaml
I suggest to use separate files since it's simpler to maintain than one big file.
You'll have to configure these paths in the config/packages/api_platform.yaml file:
api_platform:
mapping:
paths: ['%kernel.project_dir%/config/api_platform/resources']
See Nek's answer for a complete example.
I find the documentation a little bit confusing about this, because in a Symfony project there's no api/ directory at the root of the project.
I'm using the Immutable library (v4.0.0-rc2) and am trying to setup flow to use the typedefs included with the library. The typedefs are located at immutable/dist/immutable.js.flow, which I've duplicated under my project's ./flow-typed/npm directory.
The problem that I have is that flow works with every other module but Immutable and I keep getting an error whenever I attempt to include the module: required module not found.
Having inspected the contents of immutable.js.flow, there is no declare module block anywhere to be found, which I believe to be the cause of the error. There are a bunch of export statements at the end of the file though.
How can I include the typedefs so the thing just works? IOW, what can I do that doesn't involve providing the typedefs under a manually-created declare module block?
As you are using latest version of immutablejs library, all you need to do is install flow-typed library
Then just run
yarn flow-typed install
This should install all flow-typed dependencies based on your project's package.json and it will also create module declarations for any packages which don't have flow types yet.
And you don't need to copy any immutable flow definitions from node_modules to flow-typed/npm directory, because flow-typed will resolve automatically the flow types either from node_modules or from flow-typed/npm directory.
I have a simple sbt application that uses typesafe-config library and is build using sbt-native-packager.
I build it using following command:
sbt universal:packageBin
Within the src directory I have following hierarchy:
main/resources/application.conf
test/resources/application.conf
staging/resources/application.conf
And my archive always ends up containing only the main version of application.conf
I'm looking for a easy way to include specific application.conf file based on for example java property passed during project build, but I'm unable to find anything.
Have you taken a look at the mappings facility, which allows you to add/remove files from the base layout? See Change-Remove Top Level Directory In Output in the official docs.
When using leiningen to build Clojure applications, how can certain dependencies be excluded from being included in the JAR file when using lein uberjar?
Use the provided entry for the leiningen profile.
:profiles {:dev {:dependencies [[ring-mock "0.1.5"]
[prismatic/dommy "0.1.3"]
[org.bouncycastle/bcprov-jdk15on "1.50"]]}
:provided {:dependencies [[org.bouncycastle/bcprov-jdk15on "1.50"]]}}
One common use case is bouncycastle that needs to be excluded from the signed JAR and provided externally using its own jar file in runtime.
Similar to what Guillermo suggested modify your project's :profiles to include something along the lines of:
:provided {:dependencies [[org.bouncycastle/bcprov-jdk15on "1.50"]
[org.bouncycastle/bcpg-jdk15on "1.50"]]}
(The specific versions may vary.)
Trouble is that if you use a Clojure wrapper library (such as clj-pgp or thi.ng/crypto), it forces inclusion of the jar in the uberjar, breaking the process.
My solution was to fork the library and push it to clojars after modifying its project.clj to uses provided dependencies.
More details here: http://side-effects-bang.blogspot.com/2015/02/deploying-uberjars-that-use-bouncy.html
In the project.clj under :dependencies you can add exclusions for specific jars like this:
[test/test-jar "1.0" :exclusions [sample-exclusion/test-exclusions]]
I want to put some code that I shall use in different projects outside the app's bundles. I put it in a new folder in the vendor folder but I can't included in the project. Which are the steps?
Should I follow a special structure of folder and namespaces
How do I included in my project.
On Google I found a lot of ambiguous answers. I tried also this but it did not work.
You need to get your library loaded. You do this by telling composer where to find your library.
The best thing would be to set up a git repository for this source code and then use composer to load it, keep it up to date and include it into the autoloader. You may need to get used to composer to do this, but as composer is getting the default dependency management tool for php, the time is not wasted. You can find the docs here: http://getcomposer.org/doc/
If you don't want to do this, you can add a new src code folder to composer. Let's say your folder structure is like this:
symfony2/
vendor/
yourlibrary/
Bla/
Blub/
MyClass.php
First, the MyClass.php should have the namespace Bla/Blub defined. Else Then you can add your library like this to the composer.json file:
"autoload": {
"psr-0": {
"": "src/",
"Bla": "vendor/yourlibrary/"
}
}
You already have autoload defined, so you need to overwrite it!
If your library doesn't have namespaces, you can define composer to load it nonetheless. I am not using this, so I can just link the docs where you can read it up: http://getcomposer.org/doc/04-schema.md#autoload