Shared code for all AG Grid websites (AG Grid and AG Charts).
This code is hosted in the ag-website-shared repository and included in other repositories using git-subrepo. Once it is included, the people using the container repository do not need to know about git-subrepo
, unless they need to push/pull updates from this repository.
- To modify or update this repository from the container repository, install git-subrepo on your local machine. You do not need
git-subrepo
if you just need to push/pull directly to this repositorygit clone https://github.com/ingydotnet/git-subrepo /path/to/git-subrepo
- Add
source /path/to/git-subrepo/.rc
to your terminal rc file eg,~/.zshrc
(see docs for other terminal environments) - Update
bash
if required:brew install bash
- Restart your terminal
To install this shared repository into another container repository, run the following commands (NOTE: This only needs to be done once, on the container repository).
-
In the container respository figure out the destination folder for this shared repository to go into (
[dest-folder]
), then rungit subrepo clone git@github.com:ag-grid/ag-website-shared.git [dest-folder] -b latest --method rebase # Grid/Charts git subrepo clone git@github.com:ag-grid/ag-website-shared.git external/ag-website-shared -b latest --method rebase
-
In the website folder of the container repository, add the
@ag-website-shared/*
import alias to point to thesrc
folder of this repository eg, if this repository is included in thesrc/ag-website-shared
folder:// tsconfig.json { "compilerOptions": { "baseUrl": ".", "paths": { "@ag-website-shared/*": ["../../external/ag-website-shared/src/*"], } } }
This allows all imports prefixed with
@ag-website-shared
to refer to files in this repository, whether it is imported in the container repository or this repository.
In the container repository:
git subrepo pull [dest-folder]
git subrepo pull
command:
yarn run subrepo pull [--verbose]
There are 2 ways to update this shared repository:
-
Check out the ag-website-shared repository and git push/pull as normal
-
Backport changes from the container repository back to this shared repository:
-
Make commits to the container respository as normal.
It doesn't matter if there are changes not related to the shared repository in the same commit, as they will be filtered out. However, it is good practice to make shared repository changes in separate commits.
-
Push changes from the container repository back to the shared repository:
git subrepo push [dest-folder]
⚠️ In grid/charts, there is a script that wraps thegit subrepo push
command:yarn run subrepo pull [--verbose]
If there are changes already on the shared repository, you will get the following error:
git-subrepo: There are new changes upstream, you need to pull first.
In which case, you should do a
git subrepo pull ...
first
-