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.text': 'Se connecter',
'elements.buttons.signout.text': '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.
This project uses 🦋 Changesets for version management and release automation. As an external contributor, you'll primarily interact with the changeset system when your changes need to be included in a release.
Whenever you make changes that should be included in a release (new features, bug fixes, breaking changes), you must create a changeset. This helps maintainers understand what changed and how to version your contribution appropriately.
When do you need a changeset?
- ✅ Adding new features
- ✅ Fixing bugs
- ✅ Making breaking changes
- ✅ Performance improvements
When you don't need a changeset?
- ❌ Documentation-only changes
- ❌ Internal refactoring that doesn't affect the public API
- ❌ Test-only changes
- Run the changeset command in your terminal from the root of the project:
pnpm changeset-
Select the packages that your changes affect:
- Use the arrow keys to navigate through the list
- Press space to select/deselect packages
- Press Enter to confirm your selection
Important
- Choose the type of change for each selected package:
- Patch (0.0.X) - Bug fixes and non-breaking changes
- Minor (0.X.0) - New features that don't break existing functionality
- Major (X.0.0) - Breaking changes that require users to update their code
-
Write a clear summary of your changes:
- Use present tense (e.g., "Add new authentication method")
- Be descriptive and user-focused
- Mention any breaking changes clearly
- Focus on what users will experience, not implementation details
-
Commit the changeset file along with your changes:
git add .changeset/
git commit -m "chore: add changeset 🦋"Example changeset summary:
Note
This is an example changeset summary. Changes are made for:
@asgardeo/javascript@asgardeo/react@asgardeo/i18nEven though there are other packages depending on these, only include the packages you directly modified.
---
'@asgardeo/javascript': patch
'@asgardeo/react': patch
'@asgardeo/i18n': patch
---
Update the react package to add a new `SignInWithPopup` method for popup-based authentication flows.
- This method allows users to sign in without redirecting, improving user experience.
- Ensure to handle popup blockers and errors gracefully.
**Usage:**
```javascript
import { SignInWithPopup } from '@asgardeo/react';
function App() {
const handleSignIn = () => {
SignInWithPopup()
.then((user) => {
console.log('User signed in:', user);
})
.catch((error) => {
console.error('Error signing in:', error);
});
};
return (
<div>
<h1>Welcome to My App</h1>
<button onClick={handleSignIn}>Sign In with Popup</button>
</div>
);
}
```
**Upgrade Notes:**
- Ensure your application can handle popup blockers.Tip
The changeset file will be automatically named and placed in the .changeset/ directory. Don't edit these files manually after creation.
Important
Include your changeset in the same PR as your code changes. PRs without changesets (when required) may be rejected during review.
This section contains information relevant to project maintainers who handle the actual release process.
The release process is fully automated and triggered by maintainers:
- Prerequisites for releases:
- Maintainer permissions on the repository
- NPM publish permissions for the
@asgardeoorganization - All PRs with changesets have been merged
- Code review and testing completed
- Automatic release workflow:
- When changesets are merged to
main, a GitHub Action creates/updates a "Release" PR (ex:[Release] [GitHub Action] Update package versions). - The Release PR includes version bumps and generated changelogs
- Maintainers review and merge the Release PR
- Merging triggers automatic NPM publishing and GitHub releases
The project includes automated release infrastructure:
GitHub Actions workflow (.github/workflows/release.yml):
- Triggers on pushes to
mainbranch - Creates release PRs using Changesets
- Publishes packages to NPM when release PR is merged
- Authenticates using
NPM_TOKENandASGARDEO_GITHUB_BOT_TOKENsecrets
Available scripts for maintainers:
pnpm version:packages- Updates versions and installs dependenciespnpm publish:packages- Publishes all packages to NPMpnpm aggregate-changelogs- Aggregates individual package changelogs
Important
Manual releases are strongly discouraged. Always use the automated workflow to ensure consistency and prevent human errors.
Note
For pre-releases or special cases, use the workflow_dispatch trigger in the GitHub Actions workflow and coordinate with other maintainers.
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.