When trying to set the version of all work-spaces I have found that only the root workspace change is committed. Steps to reproduce using Angular CLI:
ng new test-workspace --create-application false
cd test-workspace
ng generate application test-app
git add --all
git commit -m "Application"
ng generate library test-lib
git add --all
git commit -m "Library"
Change root-level package.json to include:
"workspaces": [
"projects/test-lib"
]
git add --all
git commit -m "Workspaces"
npm version --workspaces --include-workspace-root true --workspaces-update false 0.0.2
After the final step test-lib/package.json has been changed to the new version but has not been commited.
Related
We have a storybook / react component library, we have a master branch which is being published like so: make publish kind=patch
The Makefile command which works as expected:
.PHONY: publish
publish:
npm version $(kind)
tsc && cp ./package.json ./dist
(cd dist; npm publish) && rm -fr ./dist
git push && git push --tags
This takes the patch, applies a version then compiles to ./dist, and publishes, then deletes ./dist, pushes the git commit and git tags... great...
But we have a new development branch that needs to be published as well, how do you tag or label the development version without interfering with the master branch?
I have an npm source code that needs to be built and push to npmjs repository. In details it looks like:
Build pipeline:
1) Get sources from Bitbucket repository
2) Get from package.json version number (ex. 0.0.3), increase it by 0.0.1 (0.0.4) and add this value to build variables $(version)
3) Make NPM install and build.
4) Take package-0.0.4.tgz and package.json to the artifacts folder and publish it.
Release pipeline:
1) Download artifacts
2) Extract package-0.0.4.tgz to npm-publish folder
3) Copy package.json to npm-publish folder
4) Publish npm folder to npmjs repository.
My question - is it possible to commit to Bitbucket repository updated package.json file with new version after publishing to npmjs repository?
It is possible to commit to Bitbucket repository. You only need to add a script task to execute the git commands.
For below example. I add a powershell task to run below commands in the pipeline to commit changes and push to the Bitbucket repo.
- powershell: |
git config --global user.email "you#example.com"
git config --global user.name "user.name"
#echo "some-text" > filename.txt
git add .
git commit -m "update package version"
git push https://username:password#bitbucket.org/name/repo.git HEAD:master -q
#if your password or username contain # replace it with %40
displayName: 'push to bitbucket'
I am very new to node and npm and I am wondering if it is possible to work on a application, but also work on a local git repository for some node modules.
Let's say I am starting a new project that uses chalk and I would like to develop both on my project and on chalk.
mkdir my-project && cd my-project
npm install
npm install --save chalk/chalk
With the above command I will the source of chalk into node_modules but I cannot contribute to it.
Is there a way to directly get the Git repository?
Asumming '~/projects' is your projects folder, first clone chalk:
cd ~/projects
git clone https://github.com/chalk/chalk.git
Then create your project:
mkdir my-project && cd my-project
npm init
And set your project to use your local chalk. Look for package.json file inside my-project and include chalk in dependencies:
"dependencies": {
"chalk": "file:../chalk"
....
....
Then install chalk in your project:
cd ~/my-project
npm install chalk
Or simply 'npm install' to install all your dependencies. Every time you need to include in your project changes you made on chalk type again 'npm install chalk'. It copies ~/chalk on ~/my-project/node_modules and uses it.
You can continue working on your project and on chalk.
I have a library which requires 2 dependencies to exist in the "vendor" directory. This library has these 2 dependencies installed as git submodules on Github, so to install my library from a Git clone you would do:
git clone --recursive https://github.com/MYLIBRARY.git
And to install it as another Git submodule, you would do:
git submodule add https://github.com/MYLIBRARY.git && git submodule update --init --recursive
The issue comes when trying to install it with Bower, as the Git submodules do not get downloaded with the bower package (the dependency folders exist, but are empty). The 2 dependencies exist separately on bower, but as they are required to be in the "vendor" directory of the main library, I cannot include them as bower dependencies. I also can't assume that any project installing my library will be a Git repo, so I can't do something like:
bower install MYLIBRARY && git submodule update --init --recursive
Which would work if the parent project you installed my library in was a Git repo, but would error if not.
I'm worried I may have to have an instruction similar to:
bower install MYLIBRARY && cd bower_componets/MYLIBRARY && git clone https://github.com/DEPENDENCY1.git vendor/DEPENDENCY1 && git clone https://github.com/DEPENDENCY2.git vendor/DEPENDENCY2
This can be tidied slightly by adding an npm run script in package.json:
"scripts": {
"bower_vendor": "git clone https://github.com/DEPENDENCY1.git vendor/DEPENDENCY1 && git clone https://github.com/DEPENDENCY2.git vendor/DEPENDENCY2"
}
Then the installation instruction would become:
bower install MYLIBRARY && cd bower_componets/MYLIBRARY && npm run bower_vendor
Which is a little neater, but again wouldn't work if the user has customised their bower_components directory (which is simple enough to change in the above command, but is still another concern).
I'm hoping I've just missed something somewhere which will solve my issue. I read that bower performs a git clone of the repo, so if there was a way to get it to perform git clone --recursive that would be amazing.
Thanks
I have some applications built on phalcon version 2, but since the release of the version 3, new installations of phalcon default to version 3.
You need to install phalcon from source, but instead of build from the master branch switch the branch to the 2.0.x branch.
git clone --depth 1 https://github.com/phalcon/cphalcon.git
cd cphalcon
git remote set-branches origin '2.0.x'
git fetch --depth 1 origin 2.0.x
git checkout 2.0.x
cd build
./install
I created this gist to make this easier - https://gist.github.com/goke-epapa/c325da217296ec4880850972be955bf0
UPDATE
I've been told that the above snippet installs version 2.0.10, so the snippet below is specifically for version 2.0.13
git clone --depth 1 https://github.com/phalcon/cphalcon.git
cd cphalcon
git remote set-branches origin 'phalcon-v2.0.13'
git fetch --depth 1 origin phalcon-v2.0.13
git checkout phalcon-v2.0.13
cd build
./install
Update
Both code snippets were missing the cd cphalcon command so I modified the snippets.