Skip to content

nukiro/foundations

Repository files navigation

Foundations

Setup instructions

Initialise gcloud

gcloud auth login
gcloud config set project bastion-cloud-dev

Configure npm to use Artifact Registry

gcloud artifacts print-settings npm \
    --project=bastion-cloud-dev \
    --repository=foundations \
    --location=europe-southwest1 \
    --scope=@bastion-cloud

Running 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-auth

Using the package

Install the package in your project:

Add 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=true

additionally, also include if you want to exclude the package from minimum release age check:

minimum-release-age-exclude[]=@bastion-cloud/foundations

Then run:

pnpm install

Import and use the package in your code:

import { 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";

Development

  1. Clone the repository and navigate to the package directory:
git clone <repository-url>
cd foundations
  1. Link the package locally for development in the project where you want to use it.:
pnpm link <path-to-foundations-package>
  1. Develop your changes in the foundations package and build the package (no publish required) to see the changes in the linked project:
pnpm build
pnpm build --watch

and changes will be reflected in the linked project.

Publish a new version

  1. Authenticate:
gcloud auth login
npx google-artifactregistry-auth
  1. Before publishing, make sure to build the package:
pnpm build
  1. Update the version in package.json (e.g., from 0.1.0 to 0.2.0).
  2. 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
  1. After publishing, you can verify the new version is available in the Artifact Registry console.
  2. Update the README.md file with the new version number if necessary.
  3. 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
  1. Optionally, create a new release in your version control system (e.g., GitHub) to tag the new version and provide release notes.
  2. Notify your team about the new version and any important changes or updates included in the release.

What if you need to publish a development version?

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages