Initialise gcloud
gcloud auth login
gcloud config set project bastion-cloud-devConfigure npm to use Artifact Registry
gcloud artifacts print-settings npm \
--project=bastion-cloud-dev \
--repository=foundations \
--location=europe-southwest1 \
--scope=@bastion-cloudRunning commands
Before running an npm or yarn command, you will need to refresh the access token in your .npmrc file. This can be done by running:
npx google-artifactregistry-authAdd package dependency to your package.json:
{
"dependencies": {
"@bastion-cloud/foundations": "^0.1.0"
}
}Update .npmrc to include the registry:
@bastion-cloud:registry=https://europe-southwest1-npm.pkg.dev/bastion-cloud-dev/foundations/
//europe-southwest1-npm.pkg.dev/bastion-cloud-dev/foundations/:always-auth=trueadditionally, also include if you want to exclude the package from minimum release age check:
minimum-release-age-exclude[]=@bastion-cloud/foundationsThen run:
pnpm installimport { BaseService, version } from "@bastion-cloud/foundations";
const myService = new BaseService();
console.log("🚀 Version installed:", version);
console.log("🛠️ Service:", myService.identify());Choose module what you want to use:
// Base core architecture (go to the root of the package)
import { BaseService } from "@bastion-cloud/foundations";
// Hono framework (go to the hono folder)
import {
HonoController,
authMiddleware,
} from "@bastion-cloud/foundations/hono";
// Shared utilities (go to the utils folder)
import { logger } from "@bastion-cloud/foundations/config";- Clone the repository and navigate to the package directory:
git clone <repository-url>
cd foundations- Link the package locally for development in the project where you want to use it.:
pnpm link <path-to-foundations-package>- Develop your changes in the
foundationspackage and build the package (no publish required) to see the changes in the linked project:
pnpm build
pnpm build --watchand changes will be reflected in the linked project.
- Authenticate:
gcloud auth login
npx google-artifactregistry-auth- Before publishing, make sure to build the package:
pnpm build- Update the version in
package.json(e.g., from0.1.0to0.2.0). - Run the following command to publish the package to Artifact Registry:
pnpm publish
pnpm publish --registry=https://europe-southwest1-maven.pkg.dev/bastion-cloud-dev/foundations/also for some cases:
pnpm publish --no-git-checks- After publishing, you can verify the new version is available in the Artifact Registry console.
- Update the README.md file with the new version number if necessary.
- Commit the changes to your version control system (e.g., Git) and push to the repository.
git commit -m "Update version to 0.2.0"
git push origin main
- Optionally, create a new release in your version control system (e.g., GitHub) to tag the new version and provide release notes.
- Notify your team about the new version and any important changes or updates included in the release.
Add sufix -dev to the version in package.json (e.g., from 0.1.0 to 0.1.0-dev) and follow the same publish steps as above. This allows you to publish a development version without affecting the stable release versions.
0.1.0-dev.1
0.1.0-dev.2
0.1.0-beta.1