Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/opencrvs toolkit #7964

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
48 changes: 45 additions & 3 deletions .github/workflows/publish-toolkit-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,51 @@ on:
push:
branches:
- develop

jobs:
publish:
runs-on: 'ubuntu-latest'
runs-on: ubuntu-latest
steps:
- name: Placeholder for publish
run: echo "Placeholder for publish"
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org/'

- name: Check if version exists on npm
id: check-version
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
if npm view @opencrvs/toolkit@$PACKAGE_VERSION > /dev/null 2>&1; then
echo "Version $PACKAGE_VERSION already exists on npm."
echo "version-exists=true" >> $GITHUB_OUTPUT
else
echo "Version $PACKAGE_VERSION does not exist on npm."
echo "version-exists=false" >> $GITHUB_OUTPUT
fi
working-directory: packages/toolkit

- name: Install dependencies
if: steps.check-version.outputs.version-exists == 'false'
run: yarn install
working-directory: packages/toolkit

- name: Build
if: steps.check-version.outputs.version-exists == 'false'
run: yarn build
working-directory: packages/toolkit

- name: Authenticate to npm
if: steps.check-version.outputs.version-exists == 'false'
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
working-directory: packages/toolkit

- name: Publish to npm
if: steps.check-version.outputs.version-exists == 'false'
run: npm publish --access public
working-directory: packages/toolkit
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion license-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"packages/dashboards/*.jar",
"packages/dashboards/plugins/*.jar",
"packages/dashboards/data/metabase/*.db",
"packages/client/dev-dist"
"packages/client/dev-dist",
"packages/toolkit/.npmignore"
],
"license": "license-header.txt",
"licenseFormats": {
Expand Down
21 changes: 21 additions & 0 deletions packages/toolkit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/lib

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
1 change: 1 addition & 0 deletions packages/toolkit/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!lib
3 changes: 3 additions & 0 deletions packages/toolkit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# OpenCRVS toolkit

OpenCRVS toolkit for building country configurations.
15 changes: 15 additions & 0 deletions packages/toolkit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@opencrvs/toolkit",
"version": "0.0.2",
"description": "OpenCRVS toolkit for building country configurations",
"license": "MPL-2.0",
"main": "./lib/index.js",
"exports": "./lib/index.js",
"types": "./lib/index.d.ts",
"scripts": {
"build": "rimraf lib && tsc"
},
"devDependencies": {
"typescript": "^5.6.3"
}
}
13 changes: 13 additions & 0 deletions packages/toolkit/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* OpenCRVS is also distributed under the terms of the Civil Registration
* & Healthcare Disclaimer located at http://opencrvs.org/license.
*
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
*/
export type Noop = () => void

export const noop: Noop = () => {}
17 changes: 17 additions & 0 deletions packages/toolkit/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"lib": ["esnext"],
"target": "es2016",
"module": "CommonJS",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"declaration": true,
"declarationMap": true,
"rootDir": "src",
"outDir": "lib"
},
"include": ["src/**/*.ts"],
"exclude": ["**/node_modules/**"]
}
Loading