I would like to use https://github.com/MrRio/jsPDF in my ember project.
I wanted to import jsPDF as dependency, therefore I started this way:
bower install git#github.com:MrRio/jsPDF.git --save
Unfortunately, I cannot install files from plugins directory, because "plugins/*" directory is ignored in bower.json file.
I have tried overriding it this way, but without success.
"overrides": {
"jspdf": {
"ignore": [
"**/.*",
"libs",
"CNAME",
"jspdf.js",
"examples/jspdf.PLUGINTEMPLATE.js",
"todo.txt",
"wscript.py",
"build.sh",
"test",
"tools"
]
}
}
Could you please help me?
I just added a jsPDF plugins package to bower.
You can add all the plugins via
bower install jsPDF-plugins --save
Related
On my ruby project when I try to run gulp (gulp server, gulp watch) I have the following error :
Users/workspace/website2019/gulpfile.babel.js:1
import del from 'del';
^^^^^^
SyntaxError: Cannot use import statement outside a module
I don't get how can I fix it, if someone could help me please,
you use babel transpilation with gulp because of the file gulpfile.babel.js For this reason you need to install babel. according to the documentation you need #babel/register and #babel/preset-env for transpiling your import syntax.
So run the following command in your project folder
npm install --save-dev #babel/core #babel/register
Afterwards create the babel configuration file .babelrc in the root folder and add the following lines to it
{
"presets": [
[
"#babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
make sure you have this line in package.json
"type": "module"
bower.json can specify which files should be ignored:
ignore [array]: An array of paths not needed in production that you want Bower to ignore when installing your package.
Which paths are ignored by default?
From the source:
json.ignore = mout.array.combine(json.ignore || [], [
'**/.*',
'node_modules',
'bower_components',
config.directory,
'test',
'tests'
]);
Apparently all dotfiles are ignored, as are the bower_components, node_modules, test, and tests directories. I don't know what config.directory is.
Update: I just published a package, and the test directory was not ignored. Apparently I've misunderstood the source code. I'd love clarification from a Bower contributor.
Files which are listed in ignore property will not be installed by bower.
So, if you have a this kind of structure:
style.css
index.html
bower.json
script.js
and a bower.json file:
{
"ignore": [ "./script.js" ]
}
script.js will not be installed within this component.
I have a project that uses bower.
My bower.json:
{
"name": "myproject",
"version": "0.0.0",
"dependencies": {
...
"angular-sanitize": "1.2.1",
...
Then I run bower install.
Then I can see what's installed:
➜ myproject git:(develop) ✗ ls app/bower_components/angular-sanitize/
README.md angular-sanitize.min.js bower.json
angular-sanitize.js angular-sanitize.min.js.map
But then a coworker checkouts the project, he bower installs, on his machine, this dependency is installed in
app/bower_components/angular-sanitize/bower-angular-sanitize-v1.2.1/
instead of my original
app/bower_components/angular-sanitize/.
So why does bower sometimes adds bower-angular-sanitize-v1.2.1/ to the installation folder ?
Notes: We have the same bower.json and version of bower. If I delete my bower_dependencies and reinstall, I still have the old folder.
Edit:
What I understand (after playing a while with bower install a removing bower_components, clearing bower cache etc)...
My problem is linked to how bower resolves resolutions. It seems that versions are resolved once bower prompts you with a choice for choosing a few version (jquery, angular and bootstrap).
But still, a few things that I don't understand:
On my machine, even after removing bower cache, removing bower_dependencies or copying the bower.json in a new folder, bower never prompts me about resolutions after a "bower install" (so how are they stored?)
On my coworker machine, bower prompts for resolutions only on his native system (and not when "bower install"ing in a vagrant machine).
So, I have a few more obscure points:
How does bower store the dependencies resolutions ? Is there documentation about this anywhere ? The only place I have found something is on some github issues (and by playing around with it).
My bower.json:
{
"name": "myproject",
"version": "0.0.0",
"dependencies": {
"json3": "~3.2.4",
"bootstrap-sass": "~2.3.1",
"es5-shim": "~2.0.8",
"angular-cookies": "~1.2.1",
"angular-dragdrop": "<=1.0.4",
"angular-strap": "~0.7.1",
"angulartics": "~0.8.4",
"jquery": "~1.8.3",
"underscore": "~1.4.4",
"angular": "1.2.1",
"angular-route": "1.2.1",
"angular-resource": "1.2.1",
"angular-sanitize": "1.2.1",
"angular-ui-date": "~0.0.3",
"jquery.masonry": "v2.1.08",
"bootstrap": "~2.3.1",
"angular-bootstrap": "~0.10.0",
"highcharts": "~3.0.2",
"jqueryui-timepicker-addon": "~1.4",
"moment": "~2.0.0",
"bootstrap-notify": "0.1.0",
"mjaalnir-bootstrap-colorpicker": "~1.0.0"
},
"devDependencies": {
"angular-mocks": "~1.0.7",
"angular-scenario": "~1.0.7"
},
"resolutions": {
"jquery": "~1.8.3",
"angular": "1.2.1",
"bootstrap": "~2.3.1"
}
}
We have the same problem here - it seems when the resolutions are defined within bower.json on install with empty cache and an empty bower_components directory, the package gets installed into bower_components/package/package-version whereas if you select the resolutions interactively during install, then it gets installed into bower_components/package - so if you hit that problem, clean the cache (e.g. bower cache clean), delete installed components (e.g. rm -rf bower_components/) and remove the resolutions from bower.json and then bower install.
I had the same issue. I had to go trough every dependency and install it separately, check its version and then resolving it's resolution when asked. Once it worked and didn't put the folder with the package version number, then I saved the bower.json with the right version and with the resolution (again, when asked to). It worked for me, now all bower dependencies are versioned, no "*" or "latest", and some even without the "~" at the beginning of the version.
Hope this helps you and everyone facing this problem.
I want to install two versions of the same package on my components directory.
On command line I can do something like:
bower install <name>=<package>#<version>
For example:
bower install bootstrap-new=bootstrap#2.3.2
bower install bootstrap-old=bootstrap#2.0.2
Having this .bowerrc file...
{
"directory": "vendor/assets/components",
"json": "bower.json"
}
I can see 2 directories:
vendor/assets/components/bootstrap-new
vendor/assets/components/bootstrap-old
The question is: How can I do the same thing using the bower.json file?
Use the --save flag bower install --save bootstrap-new=bootstrap#2.3.2 and you should end up with this in your bower.json:
"dependencies": {
"bootstrap-new": "bootstrap#2.3.2"
}
when you use the zend skeleton to start your new project and composer to install packages it recommends this:
"doctrine/common": "Doctrine\\Common >=2.1 for annotation features",
"ext-intl": "ext/intl for i18n features",
"pecl-weakref": "Implementation of weak references for Zend\\Stdlib\\CallbackHandler",
"zendframework/zendpdf": "ZendPdf for creating PDF representations of barcodes",
"zendframework/zendservice-recaptcha": "ZendService\\ReCaptcha for rendering ReCaptchas in Zend\\Captcha and/or Zend\\Form"
I could install the zendpdf, zendservice-recaptcha and doctine/common package but not the PECL ones.
I think it's a little sad that zf2 suggest the packages, but leaves users alone with, how to properly configure the composer.json.
I heard composer could also get PECL packages, but couldn't find any documentation on it.
How do I install them?
To install the suggested packages, modify composer.json to include them.
"repositories": [
{
"type": "composer",
"url": "http://packages.zendframework.com/"
}
],
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.*",
"doctrine/common": "dev-master",
"zendframework/zendpdf": "2.*",
"zendframework/zendservice-recaptcha": "2.*"
}
Then run
php composer.phar update
Note: that composer installs doctrine/common by using
git clone http://github.com/doctrine/common
On Windows git needs to be in your PATH environment variable.
Regarding ext/intl, this extension is bundled with PHP as of PHP version 5.3.0. and can be found in the ext/ folder of your php installation.[1]
To enable, uncomment (remove the semi-colon before the directive) it in php.ini
extension=php_intl.dll
Regarding pecl-weakref, this is also a PHP extension however this is not bundled with php and needs to be installed. More information on how to do that can be found at http://php.net/manual/en/install.pecl.php
A DLL for this PECL extension is currently unavailable. See also the
building on Windows section. [4]
[1] http://php.net/manual/en/intl.requirements.php
[2] http://php.net/manual/en/weakref.installation.php
[3] http://php.net/manual/en/install.pecl.intro.php
[4] http://php.net/manual/en/install.pecl.windows.php