Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
Shared TypeScript library for backend and frontend applications of the Panther project.

## Important Rule
Read and follow all `.github/instructions/*` files for code and practises clarity.
- Read and follow all `.github/instructions/*` files for code and practises clarity.
- Predefined prompts can be found in `.github/prompts/`


## Repository Summary
- This repo is a shared TypeScript library used by backend and frontend apps.
Expand Down
69 changes: 69 additions & 0 deletions .github/instructions/package-json.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
applyTo: "package.json"
---

# How to structure `package.json`
- As this is a NPM package, use no `dependencies`. Only `peerDependencies` and `devDependencies` are allowed.
- Keep dependencies in `peerDependencies` and `devDependencies` properly separated. Only packages required at runtime should be in `peerDependencies`.
- Ensure that ESLint and its plugins are listed under `devDependencies` since they are only needed during development.

## NPM Structure Rules
- Type must be set to `module`
- Use `exports` field to define entry points for the package
- Use `files` field to specify which files should be included when the package is published

## Overall Structure of the `package.json` file
- Should contain at least these fields in this order from top to bottom:
1. name
2. version
3. description
4. type

- After this header shold be be `files` definition pointing to `dist` folder

- After `files` should be `exports` part defining entry points:

- browser part with name `./browser` contains:
- import entry point: `./dist/index.browser.js`
- default entry point: `./dist/index.browser.js`
- types entry point: `./dist/index.browser.d.ts`

- nodejs part with name `./node` contains:
- require entry point: `./dist/index.node.cjs`
- default entry point: `./dist/index.node.js`
- types entry point: `./dist/index.node.d.ts`

- "./package.json": "./package.json"

- After this header should be:
1. scripts part
2. peerDependencies part
3. devDependencies part

- Than can be other parts (like repository, keywords, author, license, etc.)

## PeerDependencies part
Structure of dependencies should be:
1. Anything starts with `@gisatcz/` (internal packages)
2. Database related (like `mongoose`, `neo4j`, `ioredis`, etc.)
3. Security related parts (like `bcrypt`, `jsonwebtoken`, `openid-client` etc.)
4. Other production dependencies

## DevDependencies part
Structure of DEV dependencies should be:
1. All packages starting with `@types/` (TypeScript type definitions)
2. Anything related to testing (like `vitest`, `jest`, etc.)
3. Anything related to linting (like `eslint`, `typescript-eslint`, etc.)
4. Eerything related to building/bundling (like `rollup`, `esbuild`, etc.)
5. All related with typescript and building (like `typescript`, `tsc-alias`, `tsx`, etc.)
6. Other development dependencies

## Scripts part
Scripts part should be structured as:
1. dev related scripts (like `dev`, `dev:watch`, etc.)
2. build related scripts (like `build`, `build:prod`, etc.)
3. lint related scripts (like `lint`, `lint:fix`, etc.)
4. test related scripts (like `test`, `test:watch`, etc.)
5. `yalc` related scripts (like `yalc:publish`, `yalc:publish:push`, etc.)
6. before push script (combination of lint, build and test. Example is `before:push`)
7. other scripts
15 changes: 15 additions & 0 deletions .github/prompts/beforepush.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
agent: agent
tools: ['vscode', 'execute', 'read', 'edit', 'search', 'web', 'agent', 'todo']
description: 'Run all steps needed for clean push to the repository like linting, building, testing, etc.'
---
Before we push code to the repository, we need to ensure that everything is in order.

Process:
1. In terminal run `npm run before:push` to check if linting, building, and testing pass successfully.
2. If any of the steps fail, fix the issues:
- For linting issues, refer to ESLint output and fix code style or errors.
- For build issues, check TypeScript errors and fix them.
- For test failures, review test output, identify failing tests, and fix the underlying issues.
3. After fixing issues, repeat step 1 until all steps pass successfully.
4. Once all checks pass, proceed to commit and push the code to the repository.
20 changes: 20 additions & 0 deletions .github/prompts/npmrefresh.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
agent: agent
tools: ['vscode', 'execute', 'read', 'edit', 'search', 'web', 'agent', 'todo']
description: 'Refresh all NPM packages to newest major version'
---
We need to make clean reinstall of all NPM packages. We expect need to solve futher compatibility issues.

Process:
1. delete `node_modules` folder
2. delete `package-lock.json` file
3. read `package.json` and prepare two CLIs:
- one for installing all dependencies in `peerDependencies` with `npm install <packages_in_peerDependencies> --save`
- second for installing all devDependencies in `devDependencies` with `npm install <packages_in_devDependencies> --save-dev`
5. save both CLIs into `docs/npm-refresh-commands.md` file with header "NPM Refresh Commands" and short description of the process
6. execute both CLIs
7. check if `package.json` needs to be restructured according to `.github/instructions/package-json.instructions.md` file, if yes, restructure it
8. run `npm run before:push` to check if everything is fine
9. if there are any issues, fix them (like compatibility issues, missing types, etc.)
10. repeat from step 8 until everything is fine
11. finally create a summary of all changes made in this process, including major version updates and any issues encountered and how they were resolved.
6 changes: 6 additions & 0 deletions .github/prompts/package-json.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
agent: agent
tools: ['vscode', 'execute', 'read', 'edit', 'search', 'web', 'agent', 'todo']
description: 'Run all steps needed for clean push to the repository like linting, building, testing, etc.'
---
Order and clean the `package.json` file according to `.github/instructions/package-json.instructions.md` file.
4 changes: 3 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
Shared TypeScript library for backend and frontend applications of the Panther project.

## Important Rule
Read and follow all `.github/instructions/*` files for code and practises clarity.
- Read and follow all `.github/instructions/*` files for code and practises clarity.
- Predefined prompts can be found in `.github/prompts/`


## Repository Summary
- This repo is a shared TypeScript library used by backend and frontend apps.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dev": "npm run build:clean && rollup --config --watch",
"pack:check": "npm pack --dry-run",
"lint": "eslint",
"test": "vitest --config vitest.config.ts",
"test": "vitest run --config vitest.config.ts",
"build:clean": "rm -rf dist .rollup.cache tsconfig.tsbuildinfo",
"build": "npm run build:clean && rollup --config",
"before:push": "npm run lint && npm run build && npm run test"
Expand Down