diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e798a1a..a3b71f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,8 +42,8 @@ jobs: - name: Run unit tests and generate report run: npm run test:ci - - name: SonarCloud Scan - uses: SonarSource/sonarqube-scan-action@v4 + - name: SonarQube Cloud Scan + uses: SonarSource/sonarqube-scan-action@v5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 51233c2..7e829a1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,6 @@ name: publish -# Run when a new Github publish is released +# Run when a new GitHub release is published on: release: types: [released] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ab667b..ec0040f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,8 @@ name: create a release -# TODO: remove trigger -on: - push: - branches: - - main +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: jobs: publish: @@ -12,10 +10,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "20" @@ -23,4 +21,4 @@ jobs: env: PAT_TOKEN: ${{ secrets.RELEASE_PAT_TOKEN }} GIT_EMAIL: ${{ vars.RELEASE_GIT_EMAIL }} - run: ../scripts/release.sh + run: ./scripts/release.sh diff --git a/.vscode/settings.json b/.vscode/settings.json index 0b6f694..3490156 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -69,5 +69,20 @@ "search.exclude": { "**/node_modules": true, "**/lib": true - } + }, + "github.copilot.chat.codeGeneration.instructions": [ + { + "file": "./prettier.config.js", + "text": "This is a configuration file for Prettier, a code formatter. It specifies the formatting rules to be applied to the code." + }, + { + "file": "./LLM_INSTRUCTIONS.md", + "text": "This file contains instructions that coding agents (e.g., Copilot) should follow when generating code." + } + ], + "github.copilot.chat.commitMessageGeneration.instructions": [ + { + "text": "start the commit message with a list of the file paths in the staged changes separated by commas and ending with a colon. each file in the list should include only the parent folder and not the full path to the file, the linux path separator, the file name and the file's extension." + } + ] } diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..3db940b --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,37 @@ +# CLAUDE.md + +@./LLM_INSTRUCTIONS.md + +## Remote Repository Configuration + +- Organization: https://github.com/MFB-Technologies-Inc +- Project: react-async-renderer +- Repository: react-async-renderer +- Default target branch for PRs: main + +## Claude Commit Messages + +- start the commit message with a list of the file paths in the staged changes separated by commas and ending with a colon +- each file in the list should include only the parent folder and not the full path to the file, the linux path separator, the file name and the file's extension. + +## Pull Requests + +- Use the Github CLI tool if you are asked to do tasks related to PRs +- When creating a PR: + + 1. **Title Format**: Use conventional commit format (e.g., `feat: add new feature`, `fix: resolve bug`) + 2. **Reviewers**: Set to `MFB-Technologies-Inc/web-app-devs` team + 3. **Assignment**: Assign to the PR creator + 4. **Body Structure**: Include a "Summary" section with bullet points of changes + 5. **GitHub CLI Command Example**: + + ```bash + gh pr create --title "fix: describe the change" --body "$(cat <<'EOF' + ## Summary + + - Change 1 description + - Change 2 description + - Change 3 description + EOF + )" --reviewer "MFB-Technologies-Inc/web-app-devs" --assignee "@me" + ``` diff --git a/Dockerfile b/Dockerfile index 8b1f567..0fc06ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,12 @@ FROM debian:bookworm ARG USERNAME=vscode -RUN apt-get update -RUN apt-get -y install git fzf ripgrep curl python3 ssh sudo locales gnupg lsb-release libnss3-tools gstreamer1.0-gl gstreamer1.0-plugins-ugly +# Add GitHub CLI repo and update, then install all packages in one RUN +RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \ + | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ + && chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" > /etc/apt/sources.list.d/github-cli.list \ + && apt-get update \ + && apt-get -y install git fzf ripgrep curl python3 ssh sudo locales gnupg lsb-release libnss3-tools gstreamer1.0-gl gstreamer1.0-plugins-ugly gh # set the locale RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ locale-gen diff --git a/LLM_INSTRUCTIONS.md b/LLM_INSTRUCTIONS.md new file mode 100644 index 0000000..871085a --- /dev/null +++ b/LLM_INSTRUCTIONS.md @@ -0,0 +1,99 @@ +# Code Generation Instructions + +## User Interactions + +- If the user asks for a plan, proposal, explanation, or guidance, respond ONLY with a proposed plan; do NOT start implementing +- When answering questions, don't write code unless explicitly asked + +## Remote Repository Configuration + +- Organization: https://github.com/MFB-Technologies-Inc +- Project: react-async-renderer +- Repository: react-async-renderer +- Default target branch for PRs: main +- If the user is not logged in remind them to login using `gh auth login` + +## Pull Requests + +1. **Title Format**: Use conventional commit format (e.g., `feat: add new feature`, `fix: resolve bug`) +2. **Reviewers**: Set to `MFB-Technologies-Inc/web-app-devs` team +3. **Assignment**: Assign to the PR creator +4. **Body Structure**: Include a "Summary" section with bullet points of changes +5. **GitHub CLI Command Example**: + + ```bash + gh pr create --title "fix: describe the change" --body "$(cat <<'EOF' + ## Summary + + - Change 1 description + - Change 2 description + - Change 3 description + EOF + )" --reviewer "MFB-Technologies-Inc/web-app-devs" --assignee "@me" + ``` + +## Repository Overview + +### Project Structure + +- `src/` - Main library source code +- `example-app/` - Demo application showing library usage +- `scripts/` - Build and release automation scripts +- `.github/workflows/` - CI/CD pipelines +- Test files are in `__tests__/` directories + +### Coding Standards + +- Define constants/variables; no "magic" string or numbers +- Avoid excessive nesting +- Be declarative +- Prefer array methods over imperative loops +- Run `npm run lint` regularly to check for lint errors + +### Typescript + +- Use strict, strong typing +- Explicitly type function returns unless unusually complex +- Do not use classes; use function builder patterns +- Use types, not interfaces +- Use explicit type imports +- Avoid enums, use constants and string literal types +- Run `npm run typecheck` to check typing whenever you finish editing a typescript file + +### React + +- When creating React components: + - Create them using the function keyword + - Type their props explicitly + - Type the return type explicitly using React.JSX.Element and, if appropriate, null + - Put display text in a `text: Record` object outside of component scope + - Do not destructure props; this makes it clear when values come from props + - Do not use React.FC + - Do not use ReactNode + - Example: + + ```typescript + const text = { + enabled: "Enabled" + } + + export function MyComponent(props:{ isEnabled: boolean }):React.JSX.Element { + return ( +
+ {props.isEnabled &&

{text.enabled}

} +
+ ) + } + ``` + +### CSS + +- Use SASS (.scss) +- Use variables to define colors +- Use rgba() not hexcodes for colors + +### Testing + +- Use `npm run test:once` to run tests, if it exists. +- If it does not exist, suggest creating it to the developer. +- Do not run `npm run test`; it runs in watch mode and will block you. diff --git a/README.md b/README.md index b5fa149..560d706 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ These other utility functions can be used to simplify the logic around `createAs - `getCascadedAsyncState`: Reduces a chain of asynchronous request objects down one asynchronous request object. - `getOptimisticAsyncLoadState`: Converts its arguments into an optimistic asynchronous request object such that if the arguments indicate a pending asynchronous request and a fulfilled asynchronous request, then the result is a fulfilled asynchronous request object. -Checkout the [example application](./example/README.md). +Checkout the [example application](./example-app/README.md). ## License diff --git a/changes/feature-improve-actions-and-ai_2025-5-13-18-53-42.json b/changes/feature-improve-actions-and-ai_2025-5-13-18-53-42.json new file mode 100644 index 0000000..4198762 --- /dev/null +++ b/changes/feature-improve-actions-and-ai_2025-5-13-18-53-42.json @@ -0,0 +1,9 @@ +{ + "changes": [ + { + "packageName": "@mfbtech/react-async-renderer", + "comment": "Fixed release script path in release action and updated action and package dependencies", + "type": "PATCH" + } + ] +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 70d64e7..2b0132a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3782,10 +3782,11 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } @@ -4448,10 +4449,11 @@ } }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -9793,10 +9795,11 @@ } }, "node_modules/rimraf/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } diff --git a/package.json b/package.json index 7f9f212..44922d9 100644 --- a/package.json +++ b/package.json @@ -42,9 +42,11 @@ "lint": "eslint './src/**/*.{ts,tsx}'", "test:ci": "jest --reporters=jest-standard-reporter --coverage", "test": "jest --watch", + "test:once": "jest", "fix-formatting": "prettier --write --config ./prettier.config.js ./src/", "check-formatting": "prettier --check --config ./prettier.config.js ./src/", - "package": "node ./scripts/package.js" + "package": "node ./scripts/package.js", + "typecheck": "tsc --noEmit --project ./tsconfig.prod.json" }, "devDependencies": { "@testing-library/react": "12.1.5",