Skip to content

Commit

Permalink
feat(react-native): ✨ add react-native package setup
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideSegullo committed Jan 17, 2024
1 parent 4cab60c commit 7aafe5e
Show file tree
Hide file tree
Showing 14 changed files with 247 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 @@ -17,6 +17,7 @@
"vue",
"examples-vue3",
"nuxt",
"wallet-registry"
"wallet-registry",
"react-native"
]
}
30 changes: 30 additions & 0 deletions packages/react-native/.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}"]
}
]
}
}
]
}
1 change: 1 addition & 0 deletions packages/react-native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
11 changes: 11 additions & 0 deletions packages/react-native/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# react-native

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

## Building

Run `nx build react-native` to build the library.

## Running unit tests

Run `nx test react-native` to execute the unit tests via [Jest](https://jestjs.io).
22 changes: 22 additions & 0 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@quirks/react-native",
"repository": "nabla-studio/quirks",
"keywords": [
"blockchain",
"cosmos",
"cosmos-sdk",
"registry",
"osmosis",
"juno",
"desmos",
"evmos",
"react-native"
],
"version": "0.0.0",
"sideEffects": false,
"type": "module",
"dependencies": {},
"main": "./index.js",
"module": "./index.js",
"typings": "./index.d.ts"
}
59 changes: 59 additions & 0 deletions packages/react-native/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "react-native",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/react-native/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/vite:build",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/react-native"
}
},
"test": {
"executor": "@nx/vite:test",
"outputs": ["{options.reportsDirectory}"],
"options": {
"passWithNoTests": true,
"reportsDirectory": "../../coverage/packages/react-native"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/react-native/**/*.ts",
"packages/react-native/package.json"
]
}
},
"version": {
"executor": "@jscutlery/semver:version",
"options": {
"preset": "conventional",
"tagPrefix": "{projectName}@",
"trackDeps": true,
"push": true,
"noVerify": true,
"postTargets": ["react-native:github", "react-native:npm"]
},
"dependsOn": ["^build"]
},
"github": {
"executor": "@jscutlery/semver:github",
"options": {
"tag": "{tag}",
"notes": "{notes}"
}
},
"npm": {
"executor": "ngx-deploy-npm:deploy",
"options": {
"access": "public"
}
}
},
"tags": []
}
1 change: 1 addition & 0 deletions packages/react-native/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/react-native';
7 changes: 7 additions & 0 deletions packages/react-native/src/lib/react-native.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { reactNative } from './react-native';

describe('reactNative', () => {
it('should work', () => {
expect(reactNative()).toEqual('react-native');
});
});
3 changes: 3 additions & 0 deletions packages/react-native/src/lib/react-native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function reactNative(): string {
return 'react-native';
}
22 changes: 22 additions & 0 deletions packages/react-native/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/react-native/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/react-native/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"
]
}
53 changes: 53 additions & 0 deletions packages/react-native/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/// <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/react-native',

plugins: [
nxViteTsPaths(),
dts({
entryRoot: 'src',
tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),
skipDiagnostics: true,
}),
],

// 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: 'react-native',
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: {
output: {
preserveModules: true,
},
// External packages that should not be bundled into your library.
external: [],
},
},

test: {
globals: true,
cache: {
dir: '../../node_modules/.vitest',
},
environment: 'node',
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 @@ -22,6 +22,7 @@
"@quirks/core": ["packages/core/src/index.ts"],
"@quirks/nuxt": ["packages/nuxt/src/index.ts"],
"@quirks/react": ["packages/react/src/index.ts"],
"@quirks/react-native": ["packages/react-native/src/index.ts"],
"@quirks/store": ["packages/store/src/index.ts"],
"@quirks/vue": ["packages/vue/src/index.ts"],
"@quirks/wallets": ["packages/wallets/src/index.ts"]
Expand Down

0 comments on commit 7aafe5e

Please sign in to comment.