how to add link of my github repo to npm package? - github

I need to add an link of my github repository to my npm package. I did not find the solution yet on the npm documentation.

You have a field called repository in package.json. If not, you can make it yourself. Add the GitHub repository URL there:
"repository": {
"type": "git",
"url": "https://github.com/your-user/repo-url.git"
},
Make sure you specify git as type and that the URL is pointing to the actual repository, not an HTML page. So the URL has to end with .git. You can copy/paste the URL you find when you click the Clone or download button on GitHub.
There is also a field called homepage that you can use to point to the repository landing page.
The documentation is here, by the way.

Related

Adding README pointer in Github

So im trying to do something similiar to what vercel does with their README.
When I go into the raw code its just the path to the referenced readme
packages/next/README.md
So I attempted to do this with my own repo and was given back
packages/repo name here/README.md
at the front of my github page.
Anyone know how to do what vercel does?
That symbol means that the readme directory is actually a submodules: a pointer to another git repository. You can't click on the link in github because it point at a repository that is not hosted on github.
the another documentation you can see reference in here about blog sobmodules

How to publish a Ionic 5 website on GitHub pages?

I already had published some website on GitHub pages with no issue. My common workflow is to build a website, upload in the root (/) or docs (/docs) directory of my repository and set up GitHub Pages in the settings.
This is my first time using Ionic. I wrote a website and I build it by running ionic build --prod.
Than I uploaded my contents to the /docs directory of the repo.
When I visit the website https://<nickname>.github.io/<myrepo>/ it leaves me in a blank page. Inspecting with Google Chrome dev tools, I can see that scripts are referred to https://<nickname>.github.io/script.js instead of https://<nickname>.github.io/<myrepo>/script.js
How can I make it work? What I am doing wrong?
You can find the full source code of my project here. You can build it by yourself and try if there is something wrong. The site is functional when I execute it on my local web server for testing.
How to make any React website work with GitHub Pages
Prerequisites
npm installed
directory containing the React project
git repository set on this directory and linked to the remote on GitHub
Steps to follow
Run npm install gh-pages --save-dev
Edit the package.json file:
Add this line: "homepage": "http://githubname.github.io/repository". Use your nickname and repository name
Add these lines in the scripts section:
"scripts": {
//...
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
}
Push a commit
git add .
git commit -m "Create a React app and publish it to GitHub Pages"
git push origin master
Your website is available at http://githubname.github.io/repository
For more info see this page
Additional steps for Ionic 5
If you are using Ionic 5, some errors can still occur.
In this case, visit the website on http://githubname.github.io/repository and open the Chrome Inspector Tools (CTRL + SHIFT + I).
Look at the Console: some JS or TS script could be not loaded. You can see that the browser is looking at the scripts in a wrong path.
By manually editing the index.html you can point the script to the right URLs.
Upload the edited index.html in the gh-pages branch of your GitHub repo and you are good to go.

How to add a relative link to a file in a submodule in github markdown?

I'm using markdown for the README file in my repositories.
Relative links work well for files in the same repo.
But I want to link a file in a submodule (so that the same version as the submodule is displayed).
The usecase is the following: I have a submodule in external/fancy-lib. In the README.md of my repository I want to add "please refer to fancy-lib's [README](external/fancy-lib/README.md) for info about the required packages", but it generates a non-existent link.
Adding a link to fancy-lib's README from fancy-lib's repository would point to HEAD which is not always the same version included in my repository.
On the other hand, manually updating the link each time the submodule is updated to a new version (git pull) is a burden of maintenance.
Any workaround?
I do not think relative links are going to work. One can always use the full URL though, which is something like
![](https://raw.githubusercontent.com/<account>/<name of submodule repo>/README.md)
or
https://github.com/<account>/<repo>/blob/<hash>/README.md

Moving my public NPM package from Bitbucket to Github

I like Bitbucket better than Github, but sadly there's only very few options for continuous integration for Bitbucket.
The packages in question are written by me, and are currently hosted on Bitbucket:
https://www.npmjs.com/package/grunt-asset-compress
https://www.npmjs.com/package/node-file-parser
I want these to be moved to Github, without breaking anything. I am afraid changing the repository data is not enough.
"repository": {
"type": "git",
"url": "https://StephanBijzitter#bitbucket.org/skelware/grunt-asset-compress.git"
},
Image a user has version 1 installed, which is hosted on Bitbucket.
I then change the version to 2 and change the URL to the Github URL.
I proceed to push, to both Github and Bitbucket.
If the user updates, he will be updating to version 2, which by now includes the URL of Github.
I push some more fixes and release version 3 on Github, the user updates again and everything is fine.
However, what if the user did not update to version 2, before version 3 was released? NPM will probably try to download version 3 from Bitbucket as that is what the URL points to in version 1!
I do not want to keep the repositories in sync; I want to be able to make the Bitbucket repository private at one point to hide it from public view while the Github repository would then serve on its own.
What are the steps I need to take to be able to move to Github, without breaking the update system for the (albeit limited) users of my packages?
Just got a reply from NPM itself:
Hi, Stephan.
Thanks for the question. I'm hoping I can help...if I'm understanding
your inquiry correctly.
What ever you publish to npm is held within our own repository and
that is what's served to a user when they install your package. The
inclusion of the repository url, bitbucket or github, is more
informational as opposed to functional. Regardless of when you push
changes to github, the user that installs your package will get your
latest publish to npm. In other words, those two things may be in
different states and at different versions.
Please let me know if I'm off base. I'll be here to help. Ernie
In other words, for all I care I could remove the Bitbucket repository entire and nothing will break, as a copy is hosted on their servers which is served to everyone downloading it through NPM.
Thank you, Ernie!

How to composer update a github repo

I recently gain administration of a Github repo, on my developing server we use composer, im trying to do a composer update, in composer.json i have defined the repo as VCS type pointing to my github repo.
I commit and push some changes to the repo, but when i do composer update it says there is nothing to update. Other than the commit and the push, there is something else i need to do in order to allow composer to see there is an update in the code?
Consider your repo is https://github.com/auraphp/Aura.Web .
You do commit and push updating the repo for the changes.
Composer is a tool to manage the dependencies for a project. So say if you are using this package downloaded via composer, like
composer.json
{
"require": {
"aura/web": "2.0.*#beta"
}
}
and
$ php composer.phar update
You will get the latest version. In order for composer to understand it is updated, you need to first add the package in packagist.org . What you need to do is activate the service hook in https://github.com/<user/org>/<repo-name>/settings/hooks .
You can get more information from respective websites
Packagist
Composer
For a quick start read http://www.sitepoint.com/php-dependency-management-with-composer/ , there will be many if you search in google.
You only specify your repo URL and it will automatically scan your composer.json for package info. Keep in mind that repositories have a higher priority over Packagist when installing or updating.
The template used regularly in various projects is as follows:
"repositories": [
{
"type":"package",
"package": {
"name": "package-name",
"version":"master",
"type": "wordpress-plugin",
"source": {
"type": "git",
"url": "https://github.com/package-name.git",
"reference":"master"
}
}
}
],
"require": {
"package-name": "dev-master"
}