diff --git a/.changeset/wide-mugs-drive.md b/.changeset/wide-mugs-drive.md new file mode 100644 index 000000000..01e8903e2 --- /dev/null +++ b/.changeset/wide-mugs-drive.md @@ -0,0 +1,7 @@ +--- +'@asgardeo/javascript': patch +'@asgardeo/react': patch +'@asgardeo/i18n': patch +--- + +Introduce a new `@asgardeo/i18n` package diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 5603f21b3..3948ce6d9 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -18,7 +18,7 @@ body: - type: dropdown id: area attributes: - label: Please select the package issue is related to + label: Please select the area the issue is related to options: - '@asgardeo/browser' - '@asgardeo/express' @@ -29,7 +29,9 @@ body: - '@asgardeo/react' - '@asgardeo/react-router' - '@asgardeo/vue' + - '@asgardeo/i18n' - 'samples' + - 'other' default: 1 multiple: true validations: @@ -38,7 +40,7 @@ body: id: version attributes: label: Version - description: Enter package version or commit hash. + description: Enter package version or commit hash. (Use `N/A` if not applicable) validations: required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/improvement.yml b/.github/ISSUE_TEMPLATE/improvement.yml index 2c8fa101f..301b56d4f 100644 --- a/.github/ISSUE_TEMPLATE/improvement.yml +++ b/.github/ISSUE_TEMPLATE/improvement.yml @@ -30,7 +30,9 @@ body: - '@asgardeo/react' - '@asgardeo/react-router' - '@asgardeo/vue' + - '@asgardeo/i18n' - 'samples' + - 'other' default: 1 multiple: true validations: @@ -39,7 +41,7 @@ body: id: version attributes: label: Version - description: Enter package version or commit hash. + description: Enter package version or commit hash. (Use `N/A` if not applicable) validations: required: true - type: checkboxes diff --git a/.github/ISSUE_TEMPLATE/new_feature.yml b/.github/ISSUE_TEMPLATE/new_feature.yml index bdef20147..4b74bc261 100644 --- a/.github/ISSUE_TEMPLATE/new_feature.yml +++ b/.github/ISSUE_TEMPLATE/new_feature.yml @@ -37,7 +37,9 @@ body: - '@asgardeo/react' - '@asgardeo/react-router' - '@asgardeo/vue' + - '@asgardeo/i18n' - 'samples' + - 'other' default: 1 multiple: true validations: @@ -46,7 +48,7 @@ body: id: version attributes: label: Version - description: Enter package version or commit hash. + description: Enter package version or commit hash. (Use `N/A` if not applicable) validations: required: true - type: checkboxes diff --git a/.github/issue_template.md b/.github/issue_template.md deleted file mode 100644 index 757e13efe..000000000 --- a/.github/issue_template.md +++ /dev/null @@ -1,18 +0,0 @@ -**Description:** - - -**Suggested Labels:** - - -**Suggested Assignees:** - - -**Affected Product Version:** - -**OS, DB, other environment details and versions:** - -**Steps to reproduce:** - - -**Related Issues:** - \ No newline at end of file diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7d7404b73..8c083c589 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,20 +2,17 @@ ### Related Issues -- +- N/A ### Related PRs -- +- N/A ### Checklist -- [ ] e2e cypress tests locally verified. +- [ ] Followed the [CONTRIBUTING](https://github.com/asgardeo/javascript/blob/main/CONTRIBUTING.md) guidelines. - [ ] Manual test round performed and verified. -- [ ] UX/UI review done on the final implementation. - [ ] Documentation provided. (Add links if there are any) - [ ] Unit tests provided. (Add links if there are any) -- [ ] Integration tests provided. (Add links if there are any) ### Security checks - [ ] Followed secure coding standards in http://wso2.com/technical-reports/wso2-secure-engineering-guidelines? -- [ ] Ran FindSecurityBugs plugin and verified report? -- [ ] Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? \ No newline at end of file +- [ ] Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? diff --git a/.gitignore b/.gitignore index 9b89913dd..6e06d3ee7 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,7 @@ Thumbs.db .env* .cursor/rules/nx-rules.mdc .github/instructions/nx.instructions.md + +# Experimental Samples +# NOTE to Developers: Please use this samples folder for experimental code only and do not commit. +samples/__experimental__/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e3845960..39999223b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,69 +1,49 @@ -# Contributing to Asgardeo Web UI SDKs +# Contributing to Asgardeo JavaScript SDKs -This guide walks you through setting up the development environment and other important information for contributing to Asgardeo Web UI SDKs. +This guide walks you through setting up the development environment and other important information for contributing to Asgardeo JavaScript SDKs. ## Table of Contents + - [Prerequisite Software](#prerequisite-software) - [Development Tools](#development-tools) - - [NX Console](#nx-console) - - [React Developer Tools](#react-developer-tools) - - [ESLint Plugin](#eslint-plugin) - - [Code Spell Checker](#code-spell-checker) - - [JSON Sort Order](#json-sort-order) - [Setting up the Source Code](#setting-up-the-source-code) - [Setting up the Development Environment](#setting-up-the-development-environment) -- [Contributing to the Documentation](#contributing-to-the-documentation) - [Commit Message Guidelines](#commit-message-guidelines) - - [Commit Message Header](#commit-header) - - [Type](#type) - - [Scope](#scope) - - [Summary](#summary) - - [Commit Message Body](#commit-body) - - [Commit Message Footer](#commit-footer) + - [Types](#types) + - [Scope](#scope) + - [Example Commit Message](#example-commit-message) - [Revert commits](#revert-commits) +- [Contributing](#contributing) + - [Contributing to the Internalization (i18n) Package](#contributing-to-the-internalization-i18n-package) + - [Adding a New Language](#adding-a-new-language) + - [Create a new language file](#create-a-new-language-file) + - [Copy the structure from the existing language file](#copy-the-structure-from-the-existing-language-file) + - [Update the translations and metadata](#update-the-translations-and-metadata) + - [Export the new language bundle](#export-the-new-language-bundle) + - [Add the export to the translations index](#add-the-export-to-the-translations-index) + - [Test your translation](#test-your-translation) + - [Option 1: Using `npm` symlinks](#option-1-using-npm-symlinks) + - [Option 2: Integrate into an existing sample](#option-2-integrate-into-an-existing-sample) + - [Testing with AsgardeoProvider](#testing-with-asgardeoprovider) + - [Update documentation](#update-documentation) + - [Contributing to the Documentation](#contributing-to-the-documentation) ## Prerequisite Software To build and write code, make sure you have the following set of tools on your local environment: -* [Git](https://git-scm.com/downloads) - Open source distributed version control system. For install instructions, refer [this](https://www.atlassian.com/git/tutorials/install-git). -* [Node.js](https://nodejs.org/en/download/) - JavaScript runtime. (`v18 or higher`) -* [pnpm](https://pnpm.io/) - Alternate npm client for faster package installs. (`v9 or higher`) +- [Git](https://git-scm.com/downloads) - Open source distributed version control system. For install instructions, refer [this](https://www.atlassian.com/git/tutorials/install-git). +- [Node.js](https://nodejs.org/en/download/) - JavaScript runtime. (`v18 or higher`) +- [pnpm](https://pnpm.io/) - Alternate npm client for faster package installs. (`v9 or higher`) ## Development Tools -### NX Console - -Editor plugin which wraps NX commands so you don't have to memorize. - -- [Install for VS Code](https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console) -- [Install for VS Web Storm](https://plugins.jetbrains.com/plugin/15000-nx-webstorm) - -### React Developer Tools - -Browser extension to debug React code. - -- [Download for Chrome](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en) -- [Download for Firefox](https://addons.mozilla.org/en-US/firefox/addon/react-devtools/) - -### ESLint Plugin - -Static code analysis tool for identifying problematic patterns found in JavaScript/Typescript code. - -- [Install for VS Code](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) -- [Install for VS Web Storm](https://www.jetbrains.com/help/webstorm/eslint.html) - -### Code Spell Checker - -A basic spell checker that works well with code and documents. - -- [Install for VS Code](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) - -### JSON Sort Order - -Sorts JSON objects in alphabetical order. - -- [Install for VS Code](https://marketplace.visualstudio.com/items?itemName=msyesyan.json-sorter) +| Extension | Description | VS Code Marketplace | +|-----------|-------------|---------------------| +| NX Console | Editor plugin which wraps NX commands so you don't have to memorize. | [Install](https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console) | +| ESLint | Static code analysis tool for identifying problematic patterns found in JavaScript/Typescript code. | [Install](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) | +| Code Spell Checker | A basic spell checker that works well with code and documents. | [Install](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) | +| JSON Sort Order | Sorts JSON objects in alphabetical order. | [Install](https://marketplace.visualstudio.com/items?itemName=msyesyan.json-sorter) | ## Setting up the Source Code @@ -96,155 +76,254 @@ pnpm install pnpm build ``` -## Contributing to the Documentation +## Commit Message Guidelines -We use [Vitepress](https://vitepress.dev/) to generate the documentation site. The documentation site is located in the `docs` directory. -To contribute to the documentation, you can follow the steps below to start the Vitepress server locally. +We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) as the commit message convention. -1. Navigate to the `docs` directory. +Please refer to the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) documentation for more information. -```bash -cd docs -``` +> [!IMPORTANT] +> +> 1. Use the imperative, present tense: "change" not "changed" nor "changes". +> 2. Don't capitalize the first letter. +> 3. No dot (.) at the end. -2. Start the Vitepress server. +### Types -```bash -pnpm docs:dev -``` +Must be one of the following: -## Commit Message Guidelines +- **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 + +### Scope + +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: -*This specification is inspired by and supersedes the [AngularJS commit message format][commit-message-format].* +- `javascript` - Changes to the `@asgardeo/javascript` package. +- `browser` - Changes to the `@asgardeo/browser` package. +- `node` - Changes to the `@asgardeo/node` package. +- `express` - Changes to the `@asgardeo/express` package. +- `i18n` - Changes to the `@asgardeo/i18n` package. +- `react` - Changes to the `@asgardeo/react` package. +- `react-router` - Changes to the `@asgardeo/react-router` package. +- `nextjs` - Changes to the `@asgardeo/nextjs` package. +- `vue` - Changes to the `@asgardeo/vue` package. +- `nuxt` - Changes to the `@asgardeo/nuxt` package. -We have very precise rules over how our Git commit messages must be formatted. -This format leads to **easier to read commit history**. +> [!NOTE] +> If the change affects multiple packages, just use the type without a scope, e.g., `fix: ...`. + +### Example Commit Message Each commit message consists of a **header**, a **body**, and a **footer**. ``` -
+():