-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3d9fa2e
Showing
30 changed files
with
7,881 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.eslintrc.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
extends: ['mantine'], | ||
rules: { | ||
'import/extensions': 'off', | ||
'import/no-relative-packages': 'off', | ||
}, | ||
parserOptions: { | ||
project: './tsconfig.eslint.json', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
node_modules/ | ||
*.tsbuildinfo | ||
.npm | ||
.eslintcache | ||
.node_repl_history | ||
.yarn-integrity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
node_modules/ | ||
*.tsbuildinfo | ||
.npm | ||
.eslintcache | ||
.node_repl_history | ||
.yarn-integrity | ||
src | ||
scripts | ||
yarn.lock | ||
.config | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('eslint-config-mantine/.prettierrc'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Vitaly Rtishchev | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# coh3-data-types-library | ||
|
||
This library includes all Mantine React components that are reused in multiple cohstats projects. | ||
|
||
Please only include stateless components which are used for Rendering UI elements! | ||
|
||
## Get started | ||
|
||
- Install dependencies: `yarn` | ||
|
||
## Publishing | ||
|
||
- Commit changes | ||
- During commit new dist files will be build | ||
- Commit the dist files too | ||
- To use the new components in other projects, create a tag on the newest commit | ||
- Add the package to the dependencies list in the project in the package.json file | ||
``` | ||
"dependencies": { | ||
"coh-stats-components": "github:cohstats/coh-stats-components#<ENTER TAG HERE>" | ||
} | ||
``` | ||
e.g. | ||
``` | ||
"dependencies": { | ||
"coh-stats-components": "github:cohstats/coh-stats-components#0.0.1" | ||
} | ||
``` | ||
- Install the package with ``yarn`` | ||
|
||
## Testing scripts | ||
|
||
- `npm run typecheck` – checks validity of types | ||
- `npm run lint` – lints package code | ||
- `npm run jest` – package unit tests | ||
- `npm run prettier:test` – checks package code formatting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'], | ||
testEnvironment: 'jsdom', | ||
testMatch: ['**/__tests__/**/*.ts?(x)', '**/?(*.)+(spec|test).ts?(x)'], | ||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'], | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require('@testing-library/jest-dom/extend-expect'); | ||
|
||
class ResizeObserver { | ||
observe() {} | ||
unobserve() {} | ||
disconnect() {} | ||
} | ||
|
||
window.ResizeObserver = ResizeObserver; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
{ | ||
"name": "@cohstats/coh-stats-components", | ||
"version": "0.0.10", | ||
"description": "Coh stats react components", | ||
"types": "./dist/cjs/declarations/index.d.ts", | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/esm/index.js", | ||
"exports": { | ||
".": { | ||
"require": "./dist/cjs/index.js", | ||
"default": "./dist/esm/index.js" | ||
} | ||
}, | ||
"scripts": { | ||
"nojekyll": "esno scripts/nojekyll", | ||
"typecheck": "tsc --noEmit", | ||
"lint": "eslint src --cache", | ||
"jest": "jest", | ||
"prettier:test": "prettier --check \"**/*.{ts,tsx}\"", | ||
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"", | ||
"test": "npm run typecheck && npm run lint && npm run prettier:test && npm run jest && npm run build", | ||
"build": "rollup --config .config/rollup.config.js", | ||
"release:patch": "npm test && npm run build && esno scripts/release patch", | ||
"release:minor": "npm test && npm run build && esno scripts/release minor", | ||
"release:major": "npm test && npm run build && esno scripts/release major", | ||
"deploy": "npm publish" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/cohstats/coh-stats-components.git" | ||
}, | ||
"keywords": [ | ||
"mantine", | ||
"extension" | ||
], | ||
"author": "Johannes Merkt", | ||
"license": "MIT", | ||
"homepage": "https://github.com/cohstats/coh-stats-components#readme", | ||
"peerDependencies": { | ||
"@emotion/react": ">=11.10.0", | ||
"@mantine/core": ">=5.0.0", | ||
"@mantine/hooks": ">=5.0.0" | ||
}, | ||
"dependencies": { | ||
"@tabler/icons": "^1.117.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.18.9", | ||
"@emotion/react": "11.10.6", | ||
"@mantine/core": "5.10.4", | ||
"@mantine/ds": "5.10.4", | ||
"@mantine/hooks": "5.10.4", | ||
"@mantine/prism": "5.10.4", | ||
"@rollup/plugin-alias": "^3.1.2", | ||
"@rollup/plugin-commonjs": "^19.0.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^13.0.0", | ||
"@rollup/plugin-replace": "^2.4.2", | ||
"@rollup/plugin-typescript": "^10.0.1", | ||
"@testing-library/dom": "^8.16.0", | ||
"@testing-library/jest-dom": "^5.16.4", | ||
"@testing-library/react": "^13.3.0", | ||
"@testing-library/user-event": "^14.3.0", | ||
"@types/fs-extra": "^9.0.13", | ||
"@types/jest": "^28.1.6", | ||
"@types/node": "^18.0.6", | ||
"@types/react": "^18.0.15", | ||
"@types/signale": "^1.4.4", | ||
"@types/yargs": "^17.0.10", | ||
"@typescript-eslint/eslint-plugin": "^5.30.0", | ||
"@typescript-eslint/parser": "^5.30.0", | ||
"babel-loader": "^8.2.5", | ||
"cross-env": "^7.0.3", | ||
"esbuild": "^0.14.49", | ||
"eslint": "^8.18.0", | ||
"eslint-config-airbnb": "19.0.4", | ||
"eslint-config-airbnb-typescript": "^17.0.0", | ||
"eslint-config-mantine": "2.0.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jest": "^26.6.0", | ||
"eslint-plugin-jsx-a11y": "^6.6.0", | ||
"eslint-plugin-react": "^7.30.1", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-testing-library": "^5.5.1", | ||
"esno": "^0.16.3", | ||
"execa": "^6.1.0", | ||
"fs-extra": "^10.1.0", | ||
"gh-pages": "^4.0.0", | ||
"jest": "^28.1.3", | ||
"jest-environment-jsdom": "^28.1.3", | ||
"new-github-release-url": "^2.0.0", | ||
"open": "^8.4.0", | ||
"pre-commit": "^1.2.2", | ||
"prettier": "^2.7.1", | ||
"react": "^18.2.0", | ||
"react-docgen-typescript": "^2.2.2", | ||
"react-dom": "^18.2.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.77.0", | ||
"rollup-plugin-esbuild": "^4.2.3", | ||
"rollup-plugin-node-externals": "^2.2.0", | ||
"signale": "^1.4.0", | ||
"simple-git": "^3.10.0", | ||
"ts-jest": "^28.0.7", | ||
"typescript": "^4.7.4", | ||
"yargs": "^17.5.1" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://npm.pkg.github.com/@cohstats" | ||
}, | ||
"pre-commit": [ | ||
"build" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import chalk from 'chalk'; | ||
import signale from 'signale'; | ||
|
||
const VERSION_INCREMENT: string[] = ['patch', 'minor', 'major']; | ||
const VERSION_STAGE: string[] = ['alpha', 'beta', 'rc']; | ||
|
||
// eslint-disable-next-line consistent-return | ||
export function getNextVersion(version: string, options: { type: string; stage?: string }): string { | ||
if (!VERSION_INCREMENT.includes(options.type)) { | ||
signale.error( | ||
`Incorrect version type: ${chalk.cyan( | ||
options.type | ||
)}, it should be one of these values: ${VERSION_INCREMENT.join(', ')}` | ||
); | ||
|
||
process.exit(1); | ||
} | ||
|
||
if (options.stage && !VERSION_STAGE.includes(options.stage)) { | ||
signale.error( | ||
`Incorrect version stage: ${chalk.cyan( | ||
options.stage | ||
)}, it should be one of these values: ${VERSION_STAGE.join(', ')}` | ||
); | ||
|
||
process.exit(1); | ||
} | ||
|
||
const updateVersion = (raw: string): string => { | ||
const splitted = raw.split('.'); | ||
|
||
if (options.type === 'patch') { | ||
splitted[2] = (parseInt(splitted[2], 10) + 1).toString(); | ||
} | ||
|
||
if (options.type === 'minor') { | ||
splitted[1] = (parseInt(splitted[1], 10) + 1).toString(); | ||
splitted[2] = '0'; | ||
} | ||
|
||
if (options.type === 'major') { | ||
splitted[0] = (parseInt(splitted[0], 10) + 1).toString(); | ||
splitted[1] = '0'; | ||
splitted[2] = '0'; | ||
} | ||
|
||
return splitted.join('.'); | ||
}; | ||
|
||
const updateStage = (raw: string): string => { | ||
const [name, no] = (raw || '').split('.'); | ||
|
||
if (!raw || name !== options.stage) return `${options.stage}.0`; | ||
|
||
return `${name}.${parseInt(no, 10) + 1}`; | ||
}; | ||
|
||
try { | ||
const [rawVersion, rawStage] = version.split('-'); | ||
|
||
// entering prerelease | ||
if (!rawStage && options.stage) { | ||
return `${updateVersion(rawVersion)}-${updateStage(rawStage)}`; | ||
} | ||
|
||
// exiting prerelase | ||
if (rawStage && !options.stage) { | ||
return rawVersion; | ||
} | ||
|
||
// release | ||
if (!rawStage && !options.stage) { | ||
return updateVersion(rawVersion); | ||
} | ||
|
||
// prerelease | ||
return `${rawVersion}-${updateStage(rawStage)}`; | ||
} catch (e) { | ||
signale.error('Failed to parse version'); | ||
process.exit(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
fs.writeFileSync(path.join(__dirname, '../docs/out/.nojekyll'), ''); |
Oops, something went wrong.