Skip to content

Commit

Permalink
feat(store): ✨ add store package
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideSegullo committed Oct 30, 2023
1 parent b2b9809 commit feea226
Show file tree
Hide file tree
Showing 13 changed files with 203 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"examples-nextjs",
"core",
"wallets",
"react"
"react",
"store"
]
}
30 changes: 30 additions & 0 deletions packages/store/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": [
"error",
{
"ignoredFiles": ["{projectRoot}/vite.config.{js,ts,mjs,mts}"]
}
]
}
}
]
}
11 changes: 11 additions & 0 deletions packages/store/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# store

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

## Building

Run `nx build store` to build the library.

## Running unit tests

Run `nx test store` to execute the unit tests via [Jest](https://jestjs.io).
8 changes: 8 additions & 0 deletions packages/store/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@quirks/store",
"version": "0.0.0",
"dependencies": {},
"main": "./index.js",
"module": "./index.mjs",
"typings": "./index.d.ts"
}
34 changes: 34 additions & 0 deletions packages/store/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "store",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/store/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/vite:build",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/store"
}
},
"test": {
"executor": "@nx/vite:test",
"outputs": ["{options.reportsDirectory}"],
"options": {
"passWithNoTests": true,
"reportsDirectory": "../../coverage/packages/store"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/store/**/*.ts",
"packages/store/package.json"
]
}
}
},
"tags": []
}
1 change: 1 addition & 0 deletions packages/store/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/store';
7 changes: 7 additions & 0 deletions packages/store/src/lib/store.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { store } from './store';

describe('store', () => {
it('should work', () => {
expect(store()).toEqual('store');
});
});
3 changes: 3 additions & 0 deletions packages/store/src/lib/store.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function store(): string {
return 'store';
}
22 changes: 22 additions & 0 deletions packages/store/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
10 changes: 10 additions & 0 deletions packages/store/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node", "vite/client"]
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
25 changes: 25 additions & 0 deletions packages/store/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": [
"vitest/globals",
"vitest/importMeta",
"vite/client",
"node",
"vitest"
]
},
"include": [
"vite.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"
]
}
49 changes: 49 additions & 0 deletions packages/store/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/// <reference types='vitest' />
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import * as path from 'path';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';

export default defineConfig({
cacheDir: '../../node_modules/.vite/store',

plugins: [
nxViteTsPaths(),
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: {
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: 'src/index.ts',
name: 'store',
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: [],
},
},

test: {
globals: true,
cache: {
dir: '../../node_modules/.vitest',
},
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
},
});
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@nabla-studio/chain-registry": ["packages/chain-registry/src/index.ts"],
"@quirks/core": ["packages/core/src/index.ts"],
"@quirks/react": ["packages/react/src/index.ts"],
"@quirks/store": ["packages/store/src/index.ts"],
"@quirks/wallets": ["packages/wallets/src/index.ts"]
}
},
Expand Down

0 comments on commit feea226

Please sign in to comment.