Is there a .bowerrc equivalent in jspm? When I run jspm install, I'd like jspm to install the packages to client/jspm_packages folder.
How can I configure jspm to change location of jspm_packages folder?
Thanks
I found it. In your package.json, add the path into packages inside directories.
"jspm": {
"directories": {
"packages": "new/path/to/jspm_packages"
}
}
Related
I've been looking into building a go project into a debian package.
I've looked into dh-make-golang and I have a nice and shiny debian folder set up in my repository. When I try to use gbp buildpackage --git-pbuilder though it errors out due to all of my dependencies not being found. It seems that dh-make-golang ignores the vendor folder when it copies everything from my project's git repository, and I use govendor so all of my dependencies are in there.
How can I resolve this dependency issue and build the project as a .deb package properly? For reference, the error I am getting is:
src/github.com/project/project/project.go:15:2: cannot find package "google.golang.org/grpc/grpclog" in any of:
/usr/lib/go-1.7/src/google.golang.org/grpc/grpclog (from $GOROOT)
/tmp/project/obj-x86_64-linux-gnu/src/google.golang.org/grpc/grpclog (from $GOPATH)
Issue was a bug in dh-make-golang regarding importing vendor dependencies. It was just fixed today.
https://github.com/Debian/dh-make-golang/issues/46
Take a look at goxc - it can do this for you!
You simply need to add a .goxc.json to the root of your directory, that looks like this
{
"AppName": "my_app",
"ArtifactsDest": "downloads",
"Tasks": [
"interpolate-source"
"deb",
],
"BuildConstraints": "linux,amd64 windows,amd64 darwin,amd64 linux,arm",
"ResourcesInclude": "INSTALL*,README*,LICENSE*,config/*,static/*,templates/*",
"PackageVersion": "0.9.3",
"TaskSettings": {
"deb": {
"metadata": {
"description": "my app",
"maintainer": "me",
"maintainer-email": "me#example.com"
},
"metadata-deb": {
"Homepage": "https://example.com"
},
"other-mapped-files": {
"/": "debian/",
"/usr/share/something/static": "static/",
"/usr/share/something/templates": "templates/"
}
}
},
"ConfigVersion": "0.9"
}
Then run goxc and it'll do all the work for you.
I'm using composer to manage a WordPress project and don't need some plugins in development. So basically the opposite of require-dev.
If there was a name for it I would guess it to be require-production or exclude-dev. So requirements in this object would only get installed if composer --production was ran. That's not a real flag, just trying to make the path to the solution clear.
"require-production": {
"example/caching-plugin": "1.0"
}
Is there a way to do this?
I can do this with a php function, but would really like to keep my dependency management in one location
As for workaround, you can define replace property to specify list of packages to ignore, e.g.
{
"require": {
"example/caching-plugin": "*"
},
"replace": {
"example/ignore-this": "*"
}
}
This tells Composer that you're replacing these dependencies, so they won't be downloaded.
Another way is to perform code patching by adding this section:
"extra": {
"patches": {
"vendor/package": {
"Bug #1234: Something is wrong": "patches/1234.diff"
}
}
}
For above feature to work, you need to install cweagans/composer-patches package first, e.g.
composer require "cweagans/composer-patches:~1.0"
Then you can provide different patch files on different branches for certain environments.
There is also scripts property where you can invoke some scripts or commands which can check your environment and depending on the hostname, can invoke certain commands to do some post-processing such as removing some files or folders.
I want to install a package into my local project.For that I'm creating a composer.json file in my project folder is given below, it gives the total vendor folder of that package into my custom folder in my project. Its working fine.....
{
"config": {
"vendor-dir": "/var/www/html/Test2/Testing/Down"
},
}
It gives the package into 'Down' folder.
But, now I want the sub folders or files in that packages to be installed in my custom folders like js/css folders in my project.
For example i want jquery.js file into my local folder path
/var/www/html/Test2/Testing/assests/js
From the package "frameworks/jquery".
For that, what changes are needed in my composer.json file?
Composer is used to bring in packages to support the PHP code of a project, here is how they describe it on the Composer website:
Composer is a tool for dependency management in PHP. It allows you to
declare the libraries your project depends on and it will manage
(install/update) them for you.
In other words, if you need to do logging in your PHP code and decide to use the publicly available monolog package, you use composer to bring that package into your project, then in your PHP code, you can call monolog functions.
Using config to rename the vendor directory is trying to use Composer in a way that doesn't fit the intent of the tool. The vendor directory is used to hold the packages brought in (such as the monolog code). The vendor-dir value is simply renaming that directory.
Since you have GitHub listed as a tag, you could possibly use cloning to get your files to your website directory.
I've modified my composer.json file, it looks like the below:
{
"config": {
"vendor-dir": "/var/www/html/Test2/Testing/Down"
},
"require": {
},
"scripts": {
"post-package-install": [
"php -r \"exec('cp -r /var/www/html/Test2/Testing/Down/frameworks/jquery/* /var/www/html/Test2/Testing/assets/js');\""
]
}
}
It will gives all selected files in a package to my local folder.
Briefly the files in the folder 'frameworks/jquery' are copied into my local 'assets/js' folder.
In my .jsx module I get this error
Unable to resolve path to module
How can I fix it? The imported module exist.
I use eslint-plugin-import, github issue here
It might be that eslint-import doesn't automatically include the .jsx extension. You can try this:
Add to your .eslintrc:
"settings": {
"import/extensions": [".js", ".jsx"]
}
If just that doesn't help, try to add eslint-import-resolver-webpack as a devDependency.
npm i -D eslint-import-resolver-webpack
And include it in the .eslintrc settings:
"settings": {
"import/resolver": "webpack",
"import/extensions": [".js", ".jsx"]
}
You may need to configure the "module roots" in webpack:
resolve: {
modules: ['app', 'node_modules']
}
You might need to replace modules by root in webpack 1.x.
If it still don't work (and it does in command line), it might be a sublime linter issue: https://www.npmjs.com/package/eslint-plugin-import#sublimelinter-eslint
I'm installed some packages from bower.
For tests i need full path to directory with one of the installed packages.
How can i get this path (something like $TRAVIS_BUILD_DIR on travis-ci)?
In Programmatic API i don't find nothing similar.
For this issue i decided to use GruntJS.
I needed to SpecRunner.html from jasmine that's to run tests.
Due to GruntJS (and plugin grunt-contrib-jasmine) i can set nessesary paths (sources, specs, helpers) one time - in Gruntfile:
jasmine: {
pivotal: {
src: 'src/**/*.js',
options: {
specs: 'spec/*Spec.js',
helpers: 'spec/*Helper.js'
}
}
}
For dynamically include libs, loaded from bower, i used GruntJS's plugin grunt-bower-install.
Also for getting path to package, you can use path from .bowerrc:
pkg: grunt.file.readJSON('.bowerrc'),
build: {
src: 'src/<%= pkg.directory %>.js'
}