I've got a bare repository from which we start new projects. Inside this repository is another repository that has to be updated seperately. Every project starts with these two repositories, but sometimes during the project they should not both be updated.
I'm trying to create an Npm script that clones the parent repository, after that it opens the folder and clones the child repository.
The script has a variable that represents the project and thus folder name.
Based on this answer, I came up with the following:
"new_project": "git clone x:/parent_repo $PROJECT & cd $PROJECT & git clone x:/child_repo"
I run the command like so: PROJECT=new_project_name npm run new_project
Have also tried PROJECT="new_project_name" npm run new_project
Unfortunately this creates a folder named $PROJECT
in stead of actualy reading the variable.
Also tried:
"new_project": "git clone x:/parent_repo $PROJECT & cd $PROJECT & git clone x:/child_repo"
npm run new_project --PROJECT new_project_name
or run with
npm run new_project -- --PROJECT=new_project
Same result.
Most of these sollutions seem to work on linux machines but not for Windows.
It appears the variables in the string are not being read as such. I tried
"git clone x:/parent_repo "+$PROJECT+" & cd "+$PROJECT+" & git clone x:/child_repo"
But that just gave me syntax errors.
How do I succesfully pass a variable from the command line that I can use in my npm script?
The command has to be a single line.
I'm using Git bash on windows as cli
npm version: 2.14.20