diff --git a/.eslintrc.js b/.eslintrc.js index 290a0dc..a846a10 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -30,6 +30,8 @@ module.exports = { '@typescript-eslint/no-use-before-define': ['error'], 'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks 'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies - 'react/react-in-jsx-scope': 'off', // suppress errors for missing 'import React' in files + 'react/react-in-jsx-scope': 'off', // suppress errors for missing 'import React' in files, + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': 'error', }, }; diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..cab39a8 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +**/* @kishannareshpal @ianvexler @jsteeland @rich-williamson \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cb5feef --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: CI +on: [push] + +jobs: + build: + name: "Build (and lint) the package" + runs-on: ubuntu-latest + timeout-minutes: 2 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Install NPM dependencies + run: npm ci + + - name: Build (and lint) the package + run: npm run build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..fb2f509 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,35 @@ +name: Publish +on: + release: + types: + created + +jobs: + publish: + name: "Publish NPM package to GitHub Packages" + runs-on: ubuntu-latest + timeout-minutes: 2 + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20.x + registry-url: 'https://npm.pkg.github.com' + scope: '@the-curve-consulting' + + - name: Install NPM dependencies + run: npm ci + + - name: Build (and lint) the package + run: npm run build + + - name: Publish the package + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml deleted file mode 100644 index 87018df..0000000 --- a/.github/workflows/release-please.yml +++ /dev/null @@ -1,13 +0,0 @@ -on: - push: - branches: - - main -name: release-please -jobs: - release-please: - runs-on: ubuntu-latest - steps: - - uses: google-github-actions/release-please-action@v3 - with: - release-type: node - package-name: texmo-react-components diff --git a/.gitignore b/.gitignore index 73eb718..8c30a06 100644 --- a/.gitignore +++ b/.gitignore @@ -129,6 +129,7 @@ public/ # Ignore all local history of files .history -dist/ - # End of https://www.gitignore.io/api/node,macos,visualstudiocode + +# Ignore distribution files. They can always be generated manually via `npm run buiild`. +dist diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..33a9488 --- /dev/null +++ b/.npmignore @@ -0,0 +1 @@ +example diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..e15cf1e --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +@the-curve-consulting:registry=https://npm.pkg.github.com diff --git a/.nvmrc b/.nvmrc index fb457f3..7ea6a59 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v16.19.0 +v20.11.0 diff --git a/commitlint.config.js b/commitlint.config.js deleted file mode 100644 index 422b194..0000000 --- a/commitlint.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = { extends: ['@commitlint/config-conventional'] }; diff --git a/custom.d.ts b/custom.d.ts new file mode 100644 index 0000000..cdb2b1a --- /dev/null +++ b/custom.d.ts @@ -0,0 +1,4 @@ +declare module '*.svg' { + const content: string; + export default content; +} diff --git a/example/.eslintrc.cjs b/example/.eslintrc.cjs new file mode 100644 index 0000000..d6c9537 --- /dev/null +++ b/example/.eslintrc.cjs @@ -0,0 +1,18 @@ +module.exports = { + root: true, + env: { browser: true, es2020: true }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + ], + ignorePatterns: ['dist', '.eslintrc.cjs'], + parser: '@typescript-eslint/parser', + plugins: ['react-refresh'], + rules: { + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, +} diff --git a/example/.gitignore b/example/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/example/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/example/README.md b/example/README.md new file mode 100644 index 0000000..0d6babe --- /dev/null +++ b/example/README.md @@ -0,0 +1,30 @@ +# React + TypeScript + Vite + +This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. + +Currently, two official plugins are available: + +- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh +- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh + +## Expanding the ESLint configuration + +If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: + +- Configure the top-level `parserOptions` property like this: + +```js +export default { + // other rules... + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + project: ['./tsconfig.json', './tsconfig.node.json'], + tsconfigRootDir: __dirname, + }, +} +``` + +- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` +- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` +- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list diff --git a/example/components/Header.tsx b/example/components/Header.tsx new file mode 100644 index 0000000..0748563 --- /dev/null +++ b/example/components/Header.tsx @@ -0,0 +1,22 @@ +import { Header } from '@the-curve-consulting/texmo-react-components'; +import MainNav from '../components/MainNav'; + +const HeaderComponent = () => { + return ( +
+ + + + + Test + + + + + + +
+ ) +} + +export default HeaderComponent; \ No newline at end of file diff --git a/example/components/MainNav.tsx b/example/components/MainNav.tsx new file mode 100644 index 0000000..0b3dd4b --- /dev/null +++ b/example/components/MainNav.tsx @@ -0,0 +1,38 @@ +import { Nav } from '@the-curve-consulting/texmo-react-components'; + +export interface NavItemProps { + route: string; + label: string; + icon: string; +} + +// TODO: Sort navlink context + +const Navbar = () => { + return ( + + ) +} + +export default Navbar; diff --git a/example/index.html b/example/index.html new file mode 100644 index 0000000..97257d4 --- /dev/null +++ b/example/index.html @@ -0,0 +1,14 @@ + + + + + + + + Vite + React + TS + + +
+ + + diff --git a/example/layouts/Layout.tsx b/example/layouts/Layout.tsx new file mode 100644 index 0000000..75e8a76 --- /dev/null +++ b/example/layouts/Layout.tsx @@ -0,0 +1,33 @@ +import { Outlet } from "react-router-dom"; +import Container from "react-bootstrap/Container"; +import MainNav from '../components/MainNav'; +import HeaderComponent from '../components/Header'; +import { SideNavbar, Footer, Layout } from "@the-curve-consulting/texmo-react-components"; + +const LayoutComponent = () => { + return ( + + + + + + + + + + + +
+ + + +
+ +