This guide walks you through setting up the development environment and other important information for contributing to Asgardeo JavaScript SDKs.
- Prerequisite Software
- Development Tools
- Setting up the Source Code
- Setting up the Development Environment
- Commit Message Guidelines
- Contributing
To build and write code, make sure you have the following set of tools on your local environment:
- Git - Open source distributed version control system. For install instructions, refer this.
- Node.js - JavaScript runtime. (
v18 or higher) - pnpm - Alternate npm client for faster package installs. (
v9 or higher)
| Extension | Description | VS Code Marketplace |
|---|---|---|
| NX Console | Editor plugin which wraps NX commands so you don't have to memorize. | Install |
| ESLint | Static code analysis tool for identifying problematic patterns found in JavaScript/Typescript code. | Install |
| Code Spell Checker | A basic spell checker that works well with code and documents. | Install |
| JSON Sort Order | Sorts JSON objects in alphabetical order. | Install |
- Fork the repository.
- Clone your fork to the local machine.
Replace <github username> with your own username.
git clone https://github.com/<github username>/javascript.git- Set the original repo as the upstream remote.
git remote add upstream https://github.com/asgardeo/javascript.git- Install dependencies.
pnpm install- Build the project.
pnpm buildWe use Conventional Commits as the commit message convention.
Please refer to the Conventional Commits documentation for more information.
Important
- Use the imperative, present tense: "change" not "changed" nor "changes".
- Don't capitalize the first letter.
- No dot (.) at the end.
Must be one of the following:
- chore: Housekeeping tasks that doesn't require to be highlighted in the changelog
- feat: A new feature
- ci: Changes to our CI configuration files and scripts (examples: GitHub Actions)
- fix: A bug fix
- build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- docs: Documentation only changes
- perf: A code change that improves performance
- refactor: A code change that neither fixes a bug nor adds a feature
- test: Adding missing tests or correcting existing tests
The scope should be the name of the npm package affected (as perceived by the person reading the changelog generated from commit messages).
The following is the list of supported scopes:
javascript- Changes to the@asgardeo/javascriptpackage.browser- Changes to the@asgardeo/browserpackage.node- Changes to the@asgardeo/nodepackage.express- Changes to the@asgardeo/expresspackage.i18n- Changes to the@asgardeo/i18npackage.react- Changes to the@asgardeo/reactpackage.react-router- Changes to the@asgardeo/react-routerpackage.nextjs- Changes to the@asgardeo/nextjspackage.vue- Changes to the@asgardeo/vuepackage.nuxt- Changes to the@asgardeo/nuxtpackage.
Note
If the change affects multiple packages, just use the type without a scope, e.g., fix: ....
Each commit message consists of a header, a body, and a footer.
<type>(<scope>): <short summary>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
# Update issue templates to include '@asgardeo/i18n' and improve version description
chore: update issue templates to include '@asgardeo/i18n' and improve version description
# Add a new feature to the react package.
feat(react): add `SignInWithPopup` method to facilitate popup-based authentication flows.
# Update GitHub Actions workflows to include linting and testing steps.
ci: enhance GitHub Actions workflows with linting and testing steps
If the commit reverts a previous commit, it should begin with revert:, followed by the header of the reverted commit.
The content of the commit message body should contain:
- Information about the SHA of the commit being reverted in the following format:
This reverts commit <SHA>. - A clear description of the reason for reverting the commit message.
The @asgardeo/i18n package provides internationalization support for Asgardeo JavaScript SDKs. To add support for a new language, follow these steps:
Navigate to packages/i18n/src/translations/ and create a new TypeScript file for your language.
Use the correct IETF BCP 47 language tag (which combines ISO 639-1 language codes and ISO 3166-1 country codes).
For example:
fr-FR.ts→ French (France)es-ES.ts→ Spanish (Spain)en-US.ts→ English (United States)
Use the English (en-US.ts) file as a template to ensure you have all the required translation keys:
cp packages/i18n/src/translations/en-US.ts packages/i18n/src/translations/<locale-code>.tsImportant
translations object. Only update the text values.
Open your new language file and:
- Translate all the text values in the
translationsobject while keeping the keys unchanged - Update the
metadataobject with the correct locale information
const translations: I18nTranslations = {
'elements.buttons.signIn': 'Se connecter',
'elements.buttons.signOut': 'Se déconnecter',
// ... translate all other keys
};
const metadata: I18nMetadata = {
localeCode: 'fr-FR',
countryCode: 'FR',
languageCode: 'fr',
displayName: 'Français (France)',
direction: 'ltr', // or 'rtl' for right-to-left languages
};At the end of your new language file, export the bundle:
const fr_FR: I18nBundle = {
metadata,
translations,
};
export default fr_FR;Add your new language to the translations export file at packages/i18n/src/translations/index.ts:
export {default as fr_FR} from './fr-FR';Build the package and test the new language in a sample application to ensure all translations are working correctly:
pnpm build --filter @asgardeo/i18nTo test your new language translation, you have two options:
Create a symlink to test your local changes without publishing:
# Navigate to the i18n package
cd packages/i18n
# Create a global symlink
npm link
# Navigate to your test application
cd /path/to/your/test-app
# Link the local i18n package
npm link @asgardeo/i18nFor more information about npm symlinks, see the npm link documentation.
Use one of the existing sample applications in the samples/ directory:
# Navigate to a sample app (e.g., teamspace-react)
cd samples/teamspace-react
# Install dependencies
pnpm install
# The sample will automatically use your local i18n package changesOnce you have your testing environment set up (using either option above), configure the AsgardeoProvider to use your new language:
- Import your new language bundle
import {fr_FR} from '@asgardeo/i18n';- Configure the AsgardeoProvider with the new language
<AsgardeoProvider
baseUrl={import.meta.env.VITE_ASGARDEO_BASE_URL}
clientId={import.meta.env.VITE_ASGARDEO_CLIENT_ID}
// ... other configuration
preferences={{
i18n: {
language: 'fr-FR',
bundles: {
'fr-FR': fr_FR,
},
},
}}
>
<App />
</AsgardeoProvider>For more details on the i18n preferences interface, see the I18nPreferences.
-
Verify the translations
-
Navigate through your application's authentication flows
-
Check that all UI text appears in your new language
-
Verify that buttons, labels, error messages, and other UI elements display the correct translations
-
Test different authentication scenarios (sign-in, sign-up, errors) to ensure comprehensive coverage
-
Test text direction (if applicable)
For right-to-left languages, ensure that the UI layout adjusts correctly based on the direction property in your metadata.
Update any relevant documentation to mention the newly supported language.
The documentation for Asgardeo JavaScript SDKs is maintained in the Asgardeo / WSO2 Identity Server Official Docs site.
To contribute to the documentation, please send a pull request to the Asgardeo Docs repository.