Permanently add bower proxy - bower

How do I permanently add bower proxy to my system so I do not have to edit the .bowerrc file for every project and add
{
"proxy":"http://<proxy>:<port>",
"https-proxy":"https://<proxy>:<port>",
}
I have added the proxys to my OS with:
export HTTP_PROXY=http://<proxy_url>:<port>
export HTTPS_PROXY=http://<proxy_url>:<port>
But it seams bower does not get it. Thank you in advance for your response

Put the .bowerrc file in your home folder (it will work on Windows as well).
From http://bower.io/docs/config/:
Placement & Order
The config is obtained by merging multiple configurations by this
order of importance:
CLI arguments via --config
Environment variables
Local .bowerrc located in the current working directory
All .bowerrc files upwards the directory tree
.bowerrc file located in user’s home folder (~)
.bowerrc file located in the global folder (/)
Example of CLI arguments:
--config.endpoint-parser=
--config.storage.cache=
Example of valid environment variables:
bower_endpoint_parser is evaluated as endpoint-parser
bower_storage__cache is evaluated as storage.cache

Related

How to integrate Hybris Custom and Config folder to local installation?

I installed Hybris 1905 out of the box locally on my machine and I would like to include the custom code which our project stores on bitbucket.
To track the progress of the commits, I installed earlier Sourcetree and have integrated the repository. The repo is stored locally in directory
C:\git\projectname
How can I now get the folders custom and config into my local installation to be able to run always the latest code in my local machine? Thanks!
You can create a symlink or directory junction.
Assuming your custom config is stored in C:\git\projectname\config and your custom code is stored in C:\git\projectname\bin\custom
In hybrisHomeDirectory, open command prompt then type :
mklink /J config C:\git\projectname\config
this will create a directory junction that link your config to hybris installation folder.
In hybrisHomeDirectory/bin, open command prompt then type :
mklink /J custom C:\git\projectname\bin\custom
This will create a directory junction that link your custom code.
If you want to create a symlink instead of directory junction (requires admin), then open cmd as administrator and type mklink /D instead of mlink /J
Config folder
In order to refer a config folder(other than the default one) you can edit your hybris\bin\platform\setantenv.bat. For example please have a look at my setantenv.bat that I used in the past:
#echo off
set ANT_OPTS=-Xmx2g -Dfile.encoding=UTF-8 -Djdk.util.jar.enableMultiRelease=force
set ANT_HOME=%~dp0apache-ant
set PATH=%ANT_HOME%\bin;%PATH%
rem deleting CLASSPATH as a workaround for PLA-8702
set CLASSPATH=
Rem Custom zone start
set HYBRIS_RUNTIME_PROPERTIES=%~dp0local_custom.properties
chcp 65001
set HYBRIS_CONFIG_DIR=%~dp0..\..\..\gitrepo\config
echo -------CustomChanges--------
echo CustomChanges: configFolder: %HYBRIS_CONFIG_DIR%
echo CustomChanges: runTimeProperties: %HYBRIS_RUNTIME_PROPERTIES%
echo -------CustomChanges--------
Rem Custom zone end
echo ant home: %ANT_HOME%
echo ant opts: %ANT_OPTS%
ant -version
Between Rem Custom zone start and Rem Custom zone end there is the Custom section that, among other things, sets the path to the config folder.
In my case, hybris folder and gitrepo folder are right next to eachother(in the same parent folder) and that is why the following path(also mentioned above) works:
set HYBRIS_CONFIG_DIR=%~dp0..\..\..\gitrepo\config
Keeping these two folders next to each other makes it easier to use relatives paths in order to easily use resources from git Repo into Hybris.
Custom folder
In order for Hybris to take into consideration the custom extensions, their folder needs to be specified in the localextensions.xml as exemplified below:
<path autoload="true" dir="${HYBRIS_BIN_DIR}/../../gitRepo/extensions"/>
Again, above relative path works for me because hybris and gitrepo folders are next to each other.

Include non-electron folder as part of the NSIS installation

I've been trying to add additional functionality to the electron installer, where I copy some files that are packaged inside the installer, but I receive a non-descriptive error when I try to compile my electron project to create the installer i.e. I get:
* writing effective config
* packaging
* building
x [object Object]
Here is what my script looks like:
!macro customInstall
Rename "$APPDATA\myfolder\img" "$APPDATA\myfolder\img-old"
SetOutPath "$APPDATA\myfolder"
File /nonfatal /a /r "additional_files\*"
CreateShortcut "$SMSTARTUP\mylink.lnk" "$INSTDIR\mylink.exe"
!macroend
Basically everything works except the file copy part. When I remove that part the project builds and compiles into an installer with no problems.
I've also tried to use CopyFiles instead of SetOutPath and File and it works as expected when I place the additional_files folder into the same folder as the installation (dist folder), but I want the folder to be packaged inside the installer. However, I cannot get the additional_files to be packaged with the installation.
I believe it's a location issue, that is, that the NSIS script cannot locate the additional_files/ folder. I've tried modifying the package.json file by adding to the files section the additional_files/ folder and placing it in the root of the project.
I've even tried placing it in the build folder where my installer.nsh script resides, but with no luck.
File looks for files relative to the directory where the .nsi is by default. /NOCD can be used to prevent that but I'm not sure if electron uses that switch.
!cd can be used inside a script to change the directory but I'm not sure if that is going to help you much in this case unless you are willing to use a absolute path and in that case you could just use the absolute path with the File instruction instead.
If you only know where your .nsh file is I suppose you could try File /r "${__FILEDIR__}\additional_files\*"
if you are using electron-builder you have two options inside the settings
extraResources this will copy files into the $INST_DIR/resources folder in your app (this is where the app.asar file is too), and you can access via process.resourcesPath, ex:
extraResources: [
{ from: './dist/ThirdPartyNotices.txt', to: 'ThirdPartyNotices.txt' },
]
extraFiles this would do the same but place the files into the $INST_DIR root folder of your installation ex:
extraFiles: [
{ from: './distrib/mytool.exe', to: 'mytool.exe' },
],
to get the root folder you can use something like remote.app.getAppPath().replace('resources\\app.asar', '').replace('resources/app.asar', '');
all info on: https://www.electron.build/configuration/configuration#overridable-per-platform-options

laradock refer to workspace directory path

I have successfully installed Prince via the docker-compose.yml and I see the path + executable I need inside my workspace container but calling it out a number of ways in my Laravel .env will not find that path. In order to use prince I need to tell it where the PRINCE_EXECUTABLE_PATH is via the .env. What is the correct way to hit a directory in the workspace container from the Laravel app? I have tried to set a variable in the Laradock env and refer to it from laradock_workspace_1 and also just put the actual path in the env -- nothing seems to find it. What is the correct way?

yeoman creates project in Desktop even though I CD into directory

I am having a issue creating a yeoman project. I cd in the directory type yo and it says:
Here is it suppose to asked me project name etc and it wants to throw everything on my desktop not the file I cd into. It defaults to mvn and I want gradle. I even npm uninstall -g generator-jhipster
and reinstalled it and got the same issue.
If you have a .yo-rc.json file in a parent directory, Yeoman will load that configuration and generate from that file instead of prompting. This allows developers to run a yo command from any folder in the project and have it apply to the correct files.
To solve this, remove the .yo-rc.json from the parent directory, in your case /Users/drew/Desktop.
For example, if you are in the directory /Users/drew/Desktop/new-project but /Users/drew/Desktop has a .yo-rc.json inside, Yeoman will change to the parent directory (Desktop), load the configuration, and generate the files from that folder instead of the child folder.
Based on your log it's looks like you are running yo in a folder where a .yo-rc.json is already existing. Careful under windows the .yo-rc.json can be that is of type hidden and you can't see it in explorer. Because of an existing .yo-rc.json you are not asked anymore for info e.g. project name, build tool etc. My recommendation will be to create a new folder run inside yo command

How is Bower working without .bowerrc file

I appreciate this is not a real problem, just curious...
I'm using bower version 1.7.2 and all my projects so far have a .bowerrc file in the main project folder.
On my current project (through an oversight with .gitignore) I lost the .bowerrc file. However bower still works just fine and everything gets created where I want it.
I've read the docs on the Bower site and there is nothing to suggest that it will work without the .bowerrc file, and plenty on stackoverflow suggests that I need the .bowerrc file - ALSO - there isn't a .bowerrc file in the file tree between the project folder and root (although there are plenty around in folders that have different paths)
My question then is: does bower work ok without a .bowerrc file (e.g. defaulting to directory:bower_components) ? or is there a way to see which .bowerrc file my bower is using?
Many thanks for any reply, although completely understandable if you read this and move on, like I said, my problem is that it works, and I don't think it should...
As the docs specify, the .bowerrc file can be either in the project dir, the user home (i.e ~/.bowerrc - depends on your OS) or the root dir.
If you didn't put it anywhere Bower uses defaults as specified here.
And to answer your question - the default directory for bower packages is bower_components
Yes , I tested in my project with out .bowerrc I am able to install packages with bower.If we don't specify the .bowerrc file bower_components directory is creating in the root directly which is default. If we want "bower_components" to be in specific location that should be specified in the .bowerrc file.
For example if we want bower_components folder in "app" folder
bowerrc file should specify directory location : "directory": "app/bower_components",
But while downloading packages from git ,if you computer has any proxy settings that need to be configured in .bowerrc file. If we don't specify the proxy settings in .bowerrc we wont be able to download packages form git.

Resources