Skip to content

Commit

Permalink
feat: add footer library
Browse files Browse the repository at this point in the history
  • Loading branch information
ilMatto99 committed Jan 14, 2025
1 parent 42844a3 commit 1076d9a
Show file tree
Hide file tree
Showing 14 changed files with 202 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/footer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# footer

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test footer` to execute the unit tests via [Vitest](https://vitest.dev/).
12 changes: 12 additions & 0 deletions packages/footer/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const nx = require('@nx/eslint-plugin');
const baseConfig = require('../../eslint.config.js');

module.exports = [
...baseConfig,
...nx.configs['flat/react'],
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
];
17 changes: 17 additions & 0 deletions packages/footer/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default {
displayName: 'footer',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]sx?$': [
'@swc/jest',
{
jsc: {
parser: { syntax: 'typescript', tsx: true },
transform: { react: { runtime: 'automatic' } },
},
},
],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/packages/footer',
};
12 changes: 12 additions & 0 deletions packages/footer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@marino-ui/footer",
"version": "0.0.1",
"main": "./index.js",
"types": "./index.d.ts",
"exports": {
".": {
"import": "./index.mjs",
"require": "./index.js"
}
}
}
9 changes: 9 additions & 0 deletions packages/footer/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "footer",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/footer/src",
"projectType": "library",
"tags": [],
"// targets": "to see all targets run: nx show project footer --web",
"targets": {}
}
1 change: 1 addition & 0 deletions packages/footer/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/footer';
7 changes: 7 additions & 0 deletions packages/footer/src/lib/footer.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/
10 changes: 10 additions & 0 deletions packages/footer/src/lib/footer.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { render } from '@testing-library/react';

import Footer from './footer';

describe('Footer', () => {
it('should render successfully', () => {
const { baseElement } = render(<Footer />);
expect(baseElement).toBeTruthy();
});
});
11 changes: 11 additions & 0 deletions packages/footer/src/lib/footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import styles from './footer.module.css';

export function Footer() {
return (
<div className={styles['container']}>
<h1>Welcome to Footer!</h1>
</div>
);
}

export default Footer;
21 changes: 21 additions & 0 deletions packages/footer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"jsx": "react-jsx",
"allowJs": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"types": ["vite/client"]
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"extends": "../../tsconfig.base.json"
}
23 changes: 23 additions & 0 deletions packages/footer/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": [
"node",
"@nx/react/typings/cssmodule.d.ts",
"@nx/react/typings/image.d.ts",
"vite/client"
]
},
"exclude": [
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx",
"**/*.spec.js",
"**/*.test.js",
"**/*.spec.jsx",
"**/*.test.jsx"
],
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
}
20 changes: 20 additions & 0 deletions packages/footer/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
]
}
51 changes: 51 additions & 0 deletions packages/footer/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/// <reference types='vitest' />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import dts from 'vite-plugin-dts';
import * as path from 'path';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';

export default defineConfig({
root: __dirname,
cacheDir: '../../node_modules/.vite/packages/footer',

plugins: [
react(),
nxViteTsPaths(),
nxCopyAssetsPlugin(['*.md']),
dts({
entryRoot: 'src',
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
}),
],

// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },

// Configuration for building your library.
// See: https://vitejs.dev/guide/build.html#library-mode
build: {
outDir: '../../dist/packages/footer',
emptyOutDir: true,
reportCompressedSize: true,
commonjsOptions: {
transformMixedEsModules: true,
},
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: 'src/index.ts',
name: 'footer',
fileName: 'index',
// Change this to the formats you want to support.
// Don't forget to update your package.json as well.
formats: ['es', 'cjs'],
},
rollupOptions: {
// External packages that should not be bundled into your library.
external: ['react', 'react-dom', 'react/jsx-runtime'],
},
},
});
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"baseUrl": ".",
"paths": {
"@marino-ui/button": ["packages/button/src/index.ts"],
"@marino-ui/footer": ["packages/footer/src/index.ts"],
"@marino-ui/grid": ["packages/grid/src/index.ts"],
"@marino-ui/header": ["packages/header/src/index.ts"]
}
Expand Down

0 comments on commit 1076d9a

Please sign in to comment.