No description
- TypeScript 86.2%
- JavaScript 13.8%
|
All checks were successful
Build and Publish / publish (push) Successful in 13s
Reviewed-on: #3 |
||
|---|---|---|
| .forgejo/workflows | ||
| scripts | ||
| src | ||
| tests | ||
| .gitignore | ||
| .npmrc | ||
| CHANGELOG.md | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
Introduction
This template scaffolds a ...
Table of Contents
Quick Start
# placeholder:
# <TEMPLATE_PACKAGE_NAME: @temir.ra/create-oci-compose
# <TEMPLATE_NAME: @temir.ra/oci-compose
# print the latest version
npm info "@temir.ra/create-oci-compose" version
# create/update a package from the template in the current directory
npm create --no-install --no-git "@temir.ra/oci-compose@latest" .
# set metadata in package.json
npm update
Documentation
The following sections explain the configurations and conventions baked into the generated package. Useful when adapting it to fit specific needs.
<DOCUMENTATION>
DevOps
npm install
npm update
npm run clean
npm run build
npm run tests
npx tsx dist/cli.bundle.js -- example/
git fetch upstream
git fetch origin
git fetch . upstream/main:origin/main
git fetch . origin/main:main
git push origin main
git merge --ff-only main
git push
Change Management
- Create a new branch for the change.
- Make the changes and commit.
- Bump the version in
package.json. - Add an entry for the new version in
CHANGELOG.md. - Pull-request the branch.
- Ensure package artifacts are current.
- Publish.
Registry
.npmrc:
@temir.ra:registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=${NPMJSORG_REGISTRY_AUTH_TOKEN}
or bunfig.toml:
[install.scopes]
"temir.ra" = { url = "https://registry.npmjs.org/", token = "$NPMJSORG_REGISTRY_AUTH_TOKEN" }
# registry.npmjs.org/
export NPMJSORG_REGISTRY_AUTH_TOKEN=<AUTH_TOKEN>
# or
$env:NPMJSORG_REGISTRY_AUTH_TOKEN = "<AUTH_TOKEN>"
npm publish
CI/CD Workflows
Build and Publish
⚠️ .npmrc configuring the package registry and its authentication token is required for the workflow to work.
| Parameter | Type | Description |
|---|---|---|
RUNNER_LABEL |
Variable | The label of the runner to use for the workflow. |
ACCESS_TOKEN |
Secret | The authentication token for the package registry. |
.github/workflows/build-publish.yml:
name: Build and Publish
on:
push:
branches:
- main
jobs:
publish:
runs-on: ${{ vars.RUNNER_LABEL }}
steps:
- uses: actions/checkout@v4
- name: Install
env:
NPMJSORG_REGISTRY_AUTH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: npm ci
- name: Build
run: npm run build
- name: Test
run: npm run tests
- name: Publish
env:
NPMJSORG_REGISTRY_AUTH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
PKG_NAME=$(node -p "require('./package.json').name")
PKG_VERSION=$(node -p "require('./package.json').version")
NPM_TAG="latest"
if echo "$PKG_VERSION" | grep -q -- '-'; then
NPM_TAG="next"
fi
if npm view "$PKG_NAME@$PKG_VERSION" version >/dev/null 2>&1; then
echo "$PKG_NAME@$PKG_VERSION already published, skipping."
else
npm publish --tag "$NPM_TAG"
fi