diff --git a/.commitlintrc.js b/.commitlintrc.js new file mode 100644 index 0000000..75d3a2b --- /dev/null +++ b/.commitlintrc.js @@ -0,0 +1,11 @@ + +const {COMMIT_TYPES: TYPES, COMMIT_SCOPES: SCOPES} = require('./rules.js'); + +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'type-enum': [2, 'always', Object.keys(TYPES) ], + 'scope-enum': async () => [2,'always', Object.keys(SCOPES)], + }, +}; + diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..67864a4 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..15d89c7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,7 @@ + +Please help us process issues more efficiently by filing an +issue using one of the following templates: + + + +Thank you! diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..f10d346 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,36 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: 'bug' +assignees: '' +--- +## Describe the bug +A clear and concise description of what the bug is. + +## To Reproduce +Steps to reproduce the behavior: + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + +## Expected behavior +A clear and concise description of what you expected to happen. + +## Screenshots +If applicable, add screenshots to help explain your problem. + +## Desktop (please complete the following information) + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +## Smartphone (please complete the following information) + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +## Additional context +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ba13e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..6a0118f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,16 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: 'feature' +assignees: '' +--- + +## Is your feature request related to a problem? Please describe +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +## Describe the solution you'd like +A clear and concise description of what you want to happen. + +## Describe alternatives you've considered +A clear and concise description of any alternative solutions or features you've considered. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..e13d0b1 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,26 @@ + +## Feature PR Checklist +Please check if your PR fulfills the following requirements: + +- [] The commit message follows our guidelines: +- [] Tests for the changes have been added +- [] Docs have been added / updated + +## PR Type +- [] Feature +- [] BugFix +- [] Other + +## Does this PR introduce a breaking change? +- [ ] Yes +- [ ] No + +## What is the current behavior? + + +## What is the new behavior? + + + +## Other information + \ No newline at end of file diff --git a/.github/actions/setup/README.md b/.github/actions/setup/README.md new file mode 100644 index 0000000..e4004ff --- /dev/null +++ b/.github/actions/setup/README.md @@ -0,0 +1,35 @@ +# Setup Project Composite Action + +This composite action sets up a project with Node.js, pnpm, and Docker Buildx. + +Version: 0.0.0 + +## Inputs + +- `dependencies`: Install dependencies (default: `false`) +- `docker-buildx`: Install Docker Buildx (default: `false`) + +## Example Usage + +```yaml +name: CI + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup project + uses: ebizbase/ebizbase/actions/setup + with: + dependencies: true + docker-buildx: true +``` diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml new file mode 100644 index 0000000..66de823 --- /dev/null +++ b/.github/actions/setup/action.yaml @@ -0,0 +1,37 @@ +name: Setup project +description: Setup project with node pnpm docker-buildx +inputs: + dependencies: + description: Install dependencies + required: false + buildx: + description: Install docker buildx + required: false +runs: + using: composite + steps: + - name: Setup Node.js + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4 + with: + node-version: lts/* + + - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 + if: ${{ inputs.dependencies == 'true' }} + with: + path: ~/.bun/install/cache + key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} + restore-keys: | + ${{ runner.os }}-bun- + + - name: Setup Bun + if: ${{ inputs.dependencies == 'true' }} + uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2 + + - name: Install npm dependencies + if: ${{ inputs.dependencies == 'true' }} + shell: bash + run: bun install --frozen-lockfile + + - name: Install docker buildx + if: ${{ inputs.buildx == 'true' }} + uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3 diff --git a/.github/pr-size.yaml b/.github/pr-size.yaml new file mode 100644 index 0000000..7847bfc --- /dev/null +++ b/.github/pr-size.yaml @@ -0,0 +1,39 @@ +# Configuration for PR Size Labeler + +# List of files to exclude from size calculation +# Files matching these patterns will not be considered when calculating PR size +exclude_files: + - pnpm-lock.yaml + +# Configuration for labeling based on the size of the Pull Request +# Each entry defines a size label, along with thresholds for diff and file count +label_configs: + # Configuration for 'extra small' PRs + - size: xs + diff: 25 # Threshold for the total lines of code changed (additions + deletions) + files: 1 # Threshold for the total number of files changed + labels: [size/xs] # Labels to be applied for this size + + # Configuration for 'small' PRs + - size: s + diff: 150 + files: 10 + labels: [size/s] + + # Configuration for 'medium' PRs + - size: m + diff: 600 + files: 25 + labels: [size/m, pairing-wanted] + + # Configuration for 'large' PRs + - size: l + diff: 2500 + files: 50 + labels: [size/l, pairing-wanted] + + # Configuration for 'extra large' PRs + - size: xl + diff: 5000 + files: 100 + labels: [size/xl, pairing-wanted] diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..21b5b25 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,52 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["config:recommended"], + "baseBranches": ["main"], + "rangeStrategy": "replace", + "pinDigests": true, + "prConcurrentLimit": 5, + "semanticCommits": "enabled", + "semanticCommitScope": "deps", + "semanticCommitType": "chore", + "dependencyDashboard": true, + "branchPrefix": "renovate/", + "dependencyDashboardAutoclose": true, + "commitBodyTable": true, + "schedule": ["before 1am"], + "automerge": false, + "lockFileMaintenance": { + "enabled": true + }, + "packageRules": [ + { + "groupName": "All patch dependencies", + "matchPackageNames": ["*"], + "matchUpdateTypes": ["patch"], + "automerge": true + }, + { + "groupName": "Linting packages", + "matchPackageNames": [ + "@types/eslint", + "babel-eslint", + "@babel/eslint-parser", + "@eslint/**", + "@eslint-community/**", + "@stylistic/eslint-plugin**", + "@types/eslint__**", + "@typescript-eslint/**", + "typescript-eslint", + "eslint**", + "@commitlint/**" + ] + }, + { + "groupName": "Testing libraries", + "matchPackageNames": ["/jest/", "/ts-jest/", "/@playwright/test/"] + }, + { + "groupName": "Nx packages", + "matchPackageNames": ["/^@nx//", "/nx/", "@nx/jest"] + } + ] +} diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml new file mode 100644 index 0000000..888c6fe --- /dev/null +++ b/.github/workflows/analysis.yaml @@ -0,0 +1,31 @@ +name: Analysis + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + merge_group: + schedule: + - cron: 0 0 * * * + +permissions: + contents: read + security-events: write + +jobs: + codeql: + name: CodeQL Runner + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - name: Initialize CodeQL + uses: github/codeql-action/init@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3 + with: + languages: javascript + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..87db479 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,92 @@ +name: Testing + +on: + pull_request_target: + branches: + - main + merge_group: + + +concurrency: + group: ${{ github.event.pull_request.head.repo.full_name }}-${{ github.event.pull_request.head.sha }} + cancel-in-progress: true + +permissions: + contents: read + actions: read + checks: write + pull-requests: write + +jobs: + + affected: + name: Get affected projects + runs-on: ubuntu-latest + outputs: + affected-projects: ${{ steps.affected.outputs.projects }} + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - name: Setup project + uses: ./.github/actions/setup + with: + dependencies: true + - name: Add and fetch main branch from original repository + run: | + repo="${{github.event.pull_request.base.repo.clone_url}}" + if [ -z "$repo" ]; then + repo="https://github.com/${{github.event.repository.full_name}}.git" + fi + git remote add upstream "$repo" + git fetch upstream main + - name: Get projects should run unit test and e2e test + id: affected + run: | + projects=$(npx nx show projects --affected --base=upstream/main --json | jq -r '.[]') + echo "Affected projects" + echo "$projects" + echo "projects=$(printf '%s\n' "${projects[@]}" | jq -R . | jq -s . | jq -c .)" >> $GITHUB_OUTPUT + + affected-check: + name: Affected projects check + runs-on: ubuntu-latest + needs: affected + if: ${{ needs.affected.outputs.affected-projects != '[""]' }} + strategy: + matrix: + project: ${{ fromJson(needs.affected.outputs.affected-projects) }} + steps: + - name: Checkout PR branch + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - name: Setup project + uses: ./.github/actions/setup + with: + dependencies: true + buildx: true + - name: Run nx check + run: npx nx run-many -p ${{ matrix.project }} -t lint test e2e --configuration ci + - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: CI Check (${{ matrix.project }}) + conclusion: ${{ job.status }} + + aggregate: + name: Aggregate results + runs-on: ubuntu-latest + needs: affected-check + if: always() + steps: + - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: Unit Test Check + conclusion: ${{needs.affected-check.result == 'skipped' && 'success' || needs.affected-check.result}} + + diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml new file mode 100644 index 0000000..f8a9b35 --- /dev/null +++ b/.github/workflows/daily.yaml @@ -0,0 +1,39 @@ +name: Daily Chores +on: + workflow_dispatch: + schedule: + - cron: '0 23 * * *' + +permissions: + contents: read + issues: write + +jobs: + + lock-stale-issues: + name: Lock Stale Issues + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - name: Lock closed issues older than 30 days without comments + env: + GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} + run: | + issues=$(gh issue list --state closed --json number,updatedAt --jq '.[] | select((now - (.updatedAt | fromdateiso8601)) > 2592000) | .number') + for issue in $issues; do + last_comment_date=$(gh issue view $issue --json comments --jq '.comments | max_by(.updatedAt) | .updatedAt') + if [ -z "$last_comment_date" ]; then + echo "No comments found for issue #${issue}" + continue + fi + last_comment_timestamp=$(date -d "$last_comment_date" +%s) + current_timestamp=$(date +%s) + difference=$(( (current_timestamp - last_comment_timestamp) / 86400 )) + if [ $difference -gt 30 ]; then + echo "Locking issue #${issue}" + gh issue lock $issue --comment "This issue has been closed for more than 30 days without any comments. If this issue is still occurring, please open a new issue with more recent context." + else + echo "Issue #${issue} has recent comments within the last 30 days." + fi + done diff --git a/.github/workflows/pr-size-labeler.yaml b/.github/workflows/pr-size-labeler.yaml new file mode 100644 index 0000000..69357b9 --- /dev/null +++ b/.github/workflows/pr-size-labeler.yaml @@ -0,0 +1,27 @@ +name: PR Size Labeler + +on: + pull_request_target: + branches: + - main + +permissions: + contents: read + pull-requests: write + +jobs: + + pr-zize-labeler: + name: PR Size Labeler + runs-on: ubuntu-latest + if: startsWith(github.head_ref, 'release-please-')==false && startsWith(github.head_ref, 'renovate')==false + steps: + - name: Checkout Repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - name: Label PR based on size + uses: cbrgm/pr-size-labeler-action@main + with: + github_token: ${{ secrets.GH_BOT_TOKEN }} + github_repository: ${{ github.repository }} + github_pr_number: ${{ github.event.number }} + config_file_path: .github/pr-size.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..7ac354d --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,79 @@ +name: Release + +on: + push: + branches: + - main + +permissions: + pull-requests: write + +jobs: + + release: + name: Release + runs-on: ubuntu-latest + outputs: + released: ${{ steps.release.outputs.releases_created }} + projects: ${{ steps.packages.outputs.projects }} + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - name: Release Please + id: release + uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4 + with: + token: ${{ secrets.GH_BOT_TOKEN }} + config-file: release-config.json + manifest-file: release-manifest.json + - name: Prepare list released packages + id: packages + if: steps.release.outputs.releases_created == 'true' + run: | + paths_released=$(echo '${{ steps.release.outputs.paths_released }}' | jq -r '. | .[]') + echo "Release paths: ${paths_released[@]}" + + projects=() + for projectPath in $paths_released; do + if [[ "$projectPath" != "." ]]; then + projectFile="$projectPath/project.json" + projectName=$(jq -r '.name' "$projectFile") + projects+=("$projectName") + fi + done + echo "Projects: ${applications[@]}" + echo "projects=$(printf '%s\n' "${projects[@]}" | jq -R . | jq -s . | jq -c .)" >> $GITHUB_OUTPUT + + publish: + name: Publish + runs-on: ubuntu-latest + needs: release + if: ${{ needs.release.outputs.released == 'true' && needs.release.outputs.projects != '[""]' }} + strategy: + matrix: + project: ${{fromJson(needs.release.outputs.projects)}} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - uses: ./.github/actions/setup + with: + dependencies: true + buildx: true + + - name: Login to Docker Hub container registry + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 + with: + registry: docker.io + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GitHub container registry + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GH_BOT_TOKEN }} + + - run: npx nx publish ${{ matrix.project }} + env: + NPM_REGISTRY_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }} + GH_REGISTRY_TOKEN: ${{ secrets.GH_BOT_TOKEN }} diff --git a/.github/workflows/welcome.yaml b/.github/workflows/welcome.yaml new file mode 100644 index 0000000..36dbb7b --- /dev/null +++ b/.github/workflows/welcome.yaml @@ -0,0 +1,23 @@ +name: Welcome + +on: + issues: + types: [opened] + pull_request_target: + types: [opened] + +permissions: + issues: write + pull-requests: write + +jobs: + + welcome-new-contributor: + runs-on: ubuntu-latest + steps: + - name: Greet the contributor + uses: garg3133/welcome-new-contributors@a38583ed8282e23d63d7bf919ca2d9fb95300ca6 # v1.2 + with: + token: ${{ secrets.GH_BOT_TOKEN }} + issue-message: Hello @contributor_name, thanks for opening your first issue. We welcome you to the community! + pr-message: Hello @contributor_name, thanks for opening your first Pull Request. Our team will review it soon. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..62f82ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,50 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# compiled output +dist +tmp +/out-tsc +/trunk-* +/output + +# dependencies +node_modules + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +# misc +/.sass-cache +/connect.lock +/coverage +.coverage +/libpeerconnection.log +npm-debug.log +yarn-error.log +testem.log +/typings + +# System Files +.DS_Store +Thumbs.db + +.nx/cache +.nx/workspace-data +.pnpm-store +.vscode + +.angular +.playwright diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 0000000..e81b051 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1 @@ +npx commitlint --edit "$1" diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..fde9cf3 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,15 @@ +start_time=$(date +%s) + +# Your existing commands +echo "Running pre-commit hook..." + +echo "Running check targets with affected projects..." +npx nx affected --base=origin/main -t lint +npx nx affected --base=origin/main -t test + +echo "Formating all change files..." +npx lint-staged --relative + +end_time=$(date +%s) +elapsed_time=$((end_time - start_time)) +echo "Pre-commit hook completed in ${elapsed_time}s" diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100644 index 0000000..689b906 --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,8 @@ +start_time=$(date +%s) +echo "Running pre-push hook..." + +npx nx run-many -t e2e + +end_time=$(date +%s) +elapsed_time=$((end_time - start_time)) +echo "Pre-push hook completed in ${elapsed_time}s" diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..b8878c4 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,10 @@ +# Add files here to ignore them from prettier formatting +/dist +/coverage +/.husky +/.nx/cache +/.nx/workspace-data +.* +**/protobuf/* + +.angular diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..6a167f8 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,12 @@ +{ + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "es5", + "printWidth": 100, + "bracketSpacing": true, + "arrowParens": "always", + "endOfLine": "lf", + "htmlWhitespaceSensitivity": "css", + "embeddedLanguageFormatting": "auto" +} \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..8fb5aa8 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,79 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at ebizbasevn@gmail.com. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of actions. + +**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). + +For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. + +[homepage]: https://www.contributor-covenant.org diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..2abd467 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,96 @@ +# Contribution Guidelines + +First off, thank you for considering contributing to our project! We appreciate your time and effort in helping us improve. + +The following is a set of guidelines for contributing to this project. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. + +## Table of Contents + +- [Code of Conduct](#code-of-conduct) +- [How Can I Contribute?](#how-can-i-contribute) + - [Reporting Bugs](#reporting-bugs) + - [Suggesting Enhancements](#suggesting-enhancements) + - [Submitting Pull Requests](#submitting-pull-requests) +- [Commit Message Guidelines](#commit-message-guidelines) + +## Code of Conduct + +This project and everyone participating in it is governed by the [Contributor Covenant Code of Conduct](https://github.com/ebizbase/dev-infras/blob/main/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [INSERT CONTACT EMAIL]. + +## How Can I Contribute? + +### Reporting Bugs + +If you find a bug in the project, please open an issue on GitHub. Be sure to include: + +- A clear and descriptive title. +- A detailed description of the problem. +- Steps to reproduce the issue. +- Any relevant logs or screenshots. + +### Suggesting Enhancements + +If you have an idea for an enhancement or new feature, please open an issue on GitHub. Be sure to include: + +- A clear and descriptive title. +- A detailed description of the enhancement or feature. +- Any relevant examples or use cases. + +### Submitting Pull Requests + +1. Fork the repository. +2. Create a new branch from `main` (e.g., `feature/my-new-feature`). +3. Make your changes. +4. Ensure your changes pass all tests and adhere to the project's coding standards. +5. Commit your changes using a conventional commit message (see below). +6. Push your branch to your forked repository. +7. Open a pull request against the `main` branch of the original repository. + +## Commit Message Guidelines + +We follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for our commit messages. This helps us maintain a clean and readable commit history. Please adhere to the following format: + +```text +(): +``` + +### Types + +- `feat`: A new feature. +- `fix`: A bug fix. +- `docs`: Documentation only changes. +- `style`: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc). +- `refactor`: A code change that neither fixes a bug nor adds a feature. +- `perf`: A code change that improves performance. +- `test`: Adding missing or correcting existing tests. +- `build`: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm). +- `ci`: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs). +- `chore`: Other changes that don't modify src or test files. +- `revert`: Reverts a previous commit. + +### Scopes + +The scope should be the name of the project or module affected (as perceived by the person reading the changelog generated from commit messages). + +See all of scope supported with command: + +```shell +node rules.js +``` + +### Subject + +The subject contains a succinct description of the change: + +- Use the imperative, present tense: "change" not "changed" nor "changes". +- Do not capitalize the first letter. +- Do not end the subject with a period. + +### Examples + +```text +feat(parser): add ability to parse arrays +fix(parser): handle null pointer exceptions +docs(readme): update contributing guidelines +style: fix linting issues refactor: remove redundant code +``` diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..816d9ef --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) eBizBase + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..1882547 --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ + +Ebizbase dev-infras logo + +# [Ebizbase Development Infrastructure](https://github.com/ebizbase/dev-infras) + + + +[![Code Quality][codefactor-shield]][codefactor-url] +[![Issues][issues-shield]][issues-url] +[![Contributors][contributors-shield]][contributors-url] +[![MIT License][license-shield]][license-url] + +Development infrastructure projects monorepo. This repo containt prebuilt devcontainer images, devcontainer features, nx plugins. + +This project is mainly used internally within ebizbase projects but we have decided to share the entire source code of the project for the community to use and contribute. + +## List of packages + +| Name | Type | Description | +| ------------------------------------------------------------------- | -------------------- | ----------------------------------------------------------------------------------------------- | +| [omz-plugin][omz-plugin-readme] | devcontainer feature | This feature will install and active plugins for oh my zsh | +| [install-npm-package-globally][install-npm-package-globally-readme] | devcontainer feature | This feature will be install npm packages globally | +| [powerlevel10k][powerlevel10k-readme] | devcontainer feature | This feature will install, activate and config powerlevel10k theme for oh my zsh | +| base-devcontainer | devcontainer image | Base on ubuntu image with git,zsh (with modern features) | +| node-devcontainer | devcontainer image | Base on base-devcontainer with node, npm, yarn,pnpm, bun | +| nx-devcontainer | devcontainer image | Base on node-devcontainer with nx tools | +| playwright-devcontainer | devcontainer image | Base on node-devcontainer with playwright install (both os dependecies and browser binary) | +| nx-playwright-devcontainer | devcontainer image | Base on nx-devcontainer with docker in docker and playwright install (both os dependecies and browser binary) | +| [nx-docker][nx-docker-readme] | nx plugin | The NX plugin to build, push and analyze image | + +

(back to top)

+ +## Contributing + +Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. + +If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". +Don't forget to give the project a star! Thanks again! + +See [Contribution Guidelines][contribution-guidelines-url] for more information. + +### Contributors + + + ebizbase/dev-infras top contributors + + +

(back to top)

+ +## License + +Distributed under the MIT License. See [LICENSE][license-url] for more information. + +

(back to top)

+ +[codefactor-shield]: https://img.shields.io/codefactor/grade/github/ebizbase/dev-infras +[codefactor-url]: https://www.codefactor.io/repository/github/ebizbase/dev-infras +[contributors-shield]: https://img.shields.io/github/contributors/ebizbase/dev-infras.svg +[contributors-url]: https://github.com/ebizbase/dev-infras/graphs/contributors +[issues-shield]: https://img.shields.io/github/issues/ebizbase/dev-infras.svg +[issues-url]: https://github.com/ebizbase/dev-infras/issues +[license-shield]: https://img.shields.io/github/license/ebizbase/dev-infras.svg +[license-url]: https://github.com/ebizbase/dev-infras/blob/main/LICENSE.txt +[contribution-guidelines-url]: https://github.com/ebizbase/dev-infras/blob/main/CONTRIBUTING.md +[omz-plugin-readme]: https://github.com/ebizbase/dev-infras/blob/main/devcontainer-features/omz-plugin/README.md +[install-npm-package-globally-readme]: https://github.com/ebizbase/dev-infras/blob/main/devcontainer-features/install-npm-package-globally/README.md +[powerlevel10k-readme]: https://github.com/ebizbase/dev-infras/blob/main/devcontainer-features/powerlevel10k/README.md +[nx-docker-readme]: https://github.com/ebizbase/dev-infras/blob/main/nx-plugins/nx-docker/README.md diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..63bd93d Binary files /dev/null and b/bun.lockb differ diff --git a/docs/assets/logo.png b/docs/assets/logo.png new file mode 100644 index 0000000..599bc1c Binary files /dev/null and b/docs/assets/logo.png differ diff --git a/docs/assets/poster.png b/docs/assets/poster.png new file mode 100644 index 0000000..9a40914 Binary files /dev/null and b/docs/assets/poster.png differ diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..d016da3 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,70 @@ +const nx = require('@nx/eslint-plugin'); + +module.exports = [ + ...nx.configs['flat/base'], + ...nx.configs['flat/typescript'], + ...nx.configs['flat/javascript'], + { + ignores: ['**/dist', '**/node_modules'], + }, + { + files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], + rules: { + eqeqeq: 'error', + curly: 'error', + quotes: ['error', 'single'], + semi: ['error', 'always'], + indent: ['error', 2], + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], + '@nx/enforce-module-boundaries': [ + 'error', + { + enforceBuildableLibDependency: true, + allow: ['^.*/eslint(\\.base)?\\.config\\.[cm]?js$'], + depConstraints: [ + { + sourceTag: '*', + onlyDependOnLibsWithTags: ['*'], + }, + ], + }, + ], + }, + }, + + { + files: [ + '**/*.test.ts', + '**/*.test.tsx', + '**/*.test.js', + '**/*.test.jsx', + '**/*.spec.ts', + '**/*.spec.tsx', + '**/*.spec.js', + '**/*.spec.jsx', + ], + rules: { + '@typescript-eslint/no-require-imports': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-empty-function': 'off', + }, + }, + { + files: ['**/*.json'], + rules: { + '@nx/dependency-checks': [ + 'error', + { ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs}'] }, + ], + }, + languageOptions: { parser: require('jsonc-eslint-parser') }, + }, +]; diff --git a/jest.config.ts b/jest.config.ts new file mode 100644 index 0000000..6b3f2d6 --- /dev/null +++ b/jest.config.ts @@ -0,0 +1,5 @@ +import { getJestProjectsAsync } from '@nx/jest'; + +export default async () => ({ + projects: await getJestProjectsAsync(), +}); diff --git a/jest.preset.js b/jest.preset.js new file mode 100644 index 0000000..ccd49df --- /dev/null +++ b/jest.preset.js @@ -0,0 +1,22 @@ +const nxPreset = require('@nx/jest/preset').default; +const { pathsToModuleNameMapper } = require('ts-jest'); +const { compilerOptions } = require('./tsconfig.base.json'); +const { CODE_COVERAGE } = require('./rules'); +/** + * @type {import('@jest/types').Config.InitialOptions} + */ +module.exports = { + ...nxPreset, + verbose: true, + collectCoverage: process.env.CI, + collectCoverageFrom: ['src/**/*.ts', '!src/**/index.ts', '!src/**/*.d.ts'], + coverageReporters: process.env.CI ? ['json-summary'] : ['text', 'html'], + passWithNoTests: !process.env.CI, + coverageThreshold: { + global: CODE_COVERAGE, + }, + moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { + prefix: '', + useESM: true, + }), +}; diff --git a/nx.json b/nx.json new file mode 100644 index 0000000..d1c0bb7 --- /dev/null +++ b/nx.json @@ -0,0 +1,77 @@ +{ + "$schema": "./node_modules/nx/schemas/nx-schema.json", + "namedInputs": { + "default": ["{projectRoot}/**/*", "sharedGlobals"], + "production": [ + "default", + "!{projectRoot}/.eslintrc.json", + "!{projectRoot}/eslint.config.js", + "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", + "!{projectRoot}/tsconfig.spec.json", + "!{projectRoot}/jest.config.[jt]s", + "!{projectRoot}/src/test-setup.[jt]s", + "!{projectRoot}/test-setup.[jt]s" + ], + "sharedGlobals": [] + }, + "plugins": [ + { + "plugin": "@nx/jest/plugin", + "exclude": ["**/*-e2e"], + "options": { + "targetName": "test" + } + }, + { + "plugin": "@nx/jest/plugin", + "include": ["**/*-e2e"], + "options": { + "targetName": "e2e" + } + }, + { + "plugin": "@nx/eslint/plugin", + "options": { + "targetName": "lint" + } + } + ], + "targetDefaults": { + "@nx/js:tsc": { + "cache": true, + "dependsOn": ["^build"], + "inputs": ["production", "^production"] + }, + "@nx/eslint:lint": { + "cache": true, + "inputs": [ + "default", + "{workspaceRoot}/.eslintrc.json", + "{workspaceRoot}/.eslintignore", + "{workspaceRoot}/eslint.config.js" + ] + }, + "@nx/jest:jest": { + "cache": true, + "inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"], + "options": { + "passWithNoTests": true + } + }, + "@angular-devkit/build-angular:application": { + "cache": true, + "dependsOn": ["^build"], + "inputs": ["production", "^production"] + }, + "@nx/angular:ng-packagr-lite": { + "cache": true, + "dependsOn": ["^build"], + "inputs": ["production", "^production"] + }, + "@nx/js:swc": { + "cache": true, + "dependsOn": ["^build"], + "inputs": ["production", "^production"] + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..dd98c4b --- /dev/null +++ b/package.json @@ -0,0 +1,62 @@ +{ + "name": "@ebizbase/dev-infras", + "private": true, + "description": "The docker images and tools for devops", + "bugs": "https://github.com/ebizbase/dev-infras/issues", + "repository": { + "type": "git", + "url": "git+https://github.com/ebizbase/dev-infras.git" + }, + "license": "MIT", + "scripts": { + "prepare": "husky" + }, + "devDependencies": { + "@commitlint/cli": "^19.5.0", + "@commitlint/config-conventional": "^19.5.0", + "@devcontainers/cli": "^0.72.0", + "@ebizbase/nx-docker": "^1.4.3", + "@eslint/js": "^9.8.0", + "@jscutlery/semver": "^5.3.1", + "@nx/devkit": "20.1.1", + "@nx/eslint": "20.1.2", + "@nx/eslint-plugin": "20.1.2", + "@nx/jest": "20.1.2", + "@nx/js": "20.1.2", + "@nx/plugin": "20.1.1", + "@octokit/rest": "^21.0.2", + "@swc-node/register": "^1.10.9", + "@swc/cli": "~0.5.0", + "@swc/core": "^1.7.42", + "@swc/helpers": "~0.5.11", + "@swc/jest": "~0.2.36", + "@types/is-ci": "^3.0.4", + "@types/jest": "^29.5.12", + "@types/node": "22.9.0", + "@types/semver": "^7.5.8", + "@typescript-eslint/utils": "^8.0.0", + "eslint": "^9.8.0", + "eslint-config-prettier": "^9.0.0", + "husky": "^9.1.7", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", + "jest-environment-node": "^29.7.0", + "json5": "^2.2.3", + "jsonc-eslint-parser": "^2.1.0", + "lint-staged": "^15.2.10", + "nx": "^20.0.12", + "prettier": "^3.3.3", + "semver": "^7.6.3", + "ts-jest": "^29.1.0", + "ts-node": "10.9.1", + "tslib": "^2.3.0", + "typescript": "~5.6.0", + "typescript-eslint": "^8.0.0" + }, + "lint-staged": { + "*.{js,jsx,ts,tsx,css,less,scss,html,json,graphql,md,yaml,yml,vue}": [ + "npx prettier --write" + ] + }, + "dependencies": {} +} diff --git a/release-config.json b/release-config.json new file mode 100644 index 0000000..934c147 --- /dev/null +++ b/release-config.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/refs/heads/main/schemas/config.json", + "pull-request-header": ":robot: I have created a release pull request for you.", + "pull-request-footer": "This pull request was created by the release bot. Merge this request will trigger CD process.", + "separate-pull-requests": true, + "initial-version": "1.0.0", + "packages": { + ".": { + "release-type": "node" + } + } +} diff --git a/release-manifest.json b/release-manifest.json new file mode 100644 index 0000000..e18ee07 --- /dev/null +++ b/release-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.0" +} diff --git a/rules.js b/rules.js new file mode 100644 index 0000000..f22e2cd --- /dev/null +++ b/rules.js @@ -0,0 +1,36 @@ +const { getProjects } = require('nx/src/generators/utils/project-configuration.js'); +const { FsTree } = require('nx/src/generators/tree.js'); + +const projects = getProjects(new FsTree(__dirname, false)); +const projectScopes = Array.from(projects.keys()).reduce((acc, name) => { + acc[name] = `for changes of project ${name} within the directory ${projects.get(name).root}`; + return acc; +}, {}); + +module.exports = { + COMMIT_TYPES: { + feat: 'A new feature', + fix: 'A bug fix', + docs: 'Documentation only changes', + refactor: 'A code change that neither fixes a bug nor adds a feature', + perf: 'A code change that improves performance', + test: 'Adding missing tests or correcting existing tests', + build: 'Changes that affect the build system or external dependencies', + ci: 'Changes to our CI configuration files and scripts', + chore: 'Other changes that don’t modify src or test files', + revert: 'Reverts a previous commit', + }, + COMMIT_SCOPES: { + ...projectScopes, + '': 'empty/none scope useful for `test` and `refactor` changes that are done across all packages (e.g. `test: add missing unit tests`) and for docs changes that are not related to a specific package (e.g. `docs: fix typo in tutorial`)', + }, + CODE_COVERAGE: { + branches: 50, + functions: 50, + statements: 50, + }, +}; + +if (require.main === module) { + console.log(module.exports); +} diff --git a/tools/nx-internal/.swcrc b/tools/nx-internal/.swcrc new file mode 100644 index 0000000..5dc252d --- /dev/null +++ b/tools/nx-internal/.swcrc @@ -0,0 +1,22 @@ +{ + "jsc": { + "target": "es2022", + "parser": { + "syntax": "typescript", + "decorators": true, + "dynamicImport": true + }, + "transform": { + "decoratorMetadata": true, + "legacyDecorator": true + }, + "keepClassNames": true, + "externalHelpers": true, + "loose": true + }, + "module": { + "type": "commonjs" + }, + "sourceMaps": true, + "exclude": ["jest.config.ts",".*\\.spec.tsx?$",".*\\.test.tsx?$","./src/jest-setup.ts$","./**/jest-setup.ts$",".*.js$"] +} diff --git a/tools/nx-internal/README.md b/tools/nx-internal/README.md new file mode 100644 index 0000000..b6445cd --- /dev/null +++ b/tools/nx-internal/README.md @@ -0,0 +1,3 @@ +# nx + +The nx plugin using internal @ebizbase/dev-infras project diff --git a/tools/nx-internal/eslint.config.js b/tools/nx-internal/eslint.config.js new file mode 100644 index 0000000..d023101 --- /dev/null +++ b/tools/nx-internal/eslint.config.js @@ -0,0 +1,26 @@ +const baseConfig = require('../../eslint.config.js'); + +module.exports = [ + ...baseConfig, + { + files: ['**/*.json'], + rules: { + '@nx/dependency-checks': [ + 'error', + { + ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs}'], + }, + ], + }, + languageOptions: { + parser: require('jsonc-eslint-parser'), + }, + }, + { + files: ['**/package.json', '**/generators.json', '**/package.json', '**/generators.json'], + rules: { '@nx/nx-plugin-checks': 'error' }, + languageOptions: { + parser: require('jsonc-eslint-parser'), + }, + }, +]; diff --git a/tools/nx-internal/executors.json b/tools/nx-internal/executors.json new file mode 100644 index 0000000..3a64718 --- /dev/null +++ b/tools/nx-internal/executors.json @@ -0,0 +1,3 @@ +{ + "executors": {} +} diff --git a/tools/nx-internal/generators.json b/tools/nx-internal/generators.json new file mode 100644 index 0000000..65a4590 --- /dev/null +++ b/tools/nx-internal/generators.json @@ -0,0 +1,3 @@ +{ + "generators": {} +} diff --git a/tools/nx-internal/jest.config.ts b/tools/nx-internal/jest.config.ts new file mode 100644 index 0000000..162419d --- /dev/null +++ b/tools/nx-internal/jest.config.ts @@ -0,0 +1,22 @@ +import { readFileSync } from 'fs'; + +// Reading the SWC compilation config and remove the "exclude" +// for the test files to be compiled by SWC +const { exclude: _, ...swcJestConfig } = JSON.parse(readFileSync(`${__dirname}/.swcrc`, 'utf-8')); + +// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves. +// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude" +if (swcJestConfig.swcrc === undefined) { + swcJestConfig.swcrc = false; +} + +export default { + displayName: 'nx-internal', + preset: '../../jest.preset.js', + testEnvironment: 'node', + transform: { + '^.+\\.[tj]s$': ['@swc/jest', swcJestConfig], + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../.coverage/tools/nx-internal', +}; diff --git a/tools/nx-internal/package.json b/tools/nx-internal/package.json new file mode 100644 index 0000000..5a70acb --- /dev/null +++ b/tools/nx-internal/package.json @@ -0,0 +1,14 @@ +{ + "name": "@ebizbase/nx-internal", + "private": true, + "description": "Nx plugin for internal use @ebizbase/dev-infras project", + "type": "commonjs", + "main": "./src/index.js", + "typings": "./src/index.d.ts", + "dependencies": { + "@swc/helpers": "~0.5.11" + }, + "devDependencies": {}, + "executors": "./executors.json", + "generators": "./generators.json" +} diff --git a/tools/nx-internal/project.json b/tools/nx-internal/project.json new file mode 100644 index 0000000..b8f826c --- /dev/null +++ b/tools/nx-internal/project.json @@ -0,0 +1,34 @@ +{ + "name": "nx-internal", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "tools/nx-internal/src", + "projectType": "library", + "tags": [], + "targets": { + "build": { + "executor": "@nx/js:swc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/tools/nx-internal", + "main": "tools/nx-internal/index.ts", + "tsConfig": "tools/nx-internal/tsconfig.lib.json", + "assets": ["tools/nx-internal/*.md"] + } + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/.coverage/{projectRoot}"], + "options": { + "jestConfig": "tools/nx-internal/jest.config.ts" + }, + "configurations": { + "ci": { + "ci": true, + "codeCoverage": true + }, + "development": {} + }, + "defaultConfiguration": "development" + } + } +} diff --git a/tools/nx-internal/src/index.ts b/tools/nx-internal/src/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/tools/nx-internal/tsconfig.json b/tools/nx-internal/tsconfig.json new file mode 100644 index 0000000..19b9eec --- /dev/null +++ b/tools/nx-internal/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs" + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/tools/nx-internal/tsconfig.lib.json b/tools/nx-internal/tsconfig.lib.json new file mode 100644 index 0000000..76db587 --- /dev/null +++ b/tools/nx-internal/tsconfig.lib.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": ["node"] + }, + "include": [ + "src/**/*.ts", + "src/generators/library/files/angular/jest.config.ts.template", + "src/generators/library/files/angular/src/test-setup.ts.template", + "src/generators/library/files/angular/src/lib/nglib/__name__.component.ts.template" + ], + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/tools/nx-internal/tsconfig.spec.json b/tools/nx-internal/tsconfig.spec.json new file mode 100644 index 0000000..f6d8ffc --- /dev/null +++ b/tools/nx-internal/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 0000000..006f9e1 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,42 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "strict": true, + "noImplicitAny": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitThis": true, + "allowJs": false, + "rootDir": ".", + "sourceMap": true, + "declaration": true, + "esModuleInterop": true, + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "forceConsistentCasingInFileNames": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "importHelpers": true, + "target": "ES2022", + "module": "esnext", + "lib": [ + "es2020", + "dom" + ], + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "baseUrl": ".", + "paths": { + "@ebizbase/nx-internal": [ + "tools/nx-internal/src/index.ts" + ] + } + }, + "exclude": [ + "node_modules", + "tmp" + ] +}