Skip to content

Commit

Permalink
Dev (#47)
Browse files Browse the repository at this point in the history
* fix QR code in dark mode by adding white border

* add shim & remove pkg patches

* update buffer imports

* move disclaimer in its own container

* only apply white border in darkmode

* add localization helper & update @Styles imports

* update after review

* add openLinkInBrowser helper && update jest setup

* Update index.ts

* update fn name from openLinkInBrowser  to openUrl

* Update node.js.yml

* update npm script

* update type of mint states to handle custom mint name

* show custom mint names on all components using mint_url. closes #2

* update after review

* update after review

* update formatInt

* update jsDocs for formatInt()

* use getLanguageCode() in localeDateString. closes #19

* show compact notation using 'en' locale

* update var name from createSpendableToken to isSendingToken

* add memo input to send token page #1

* show memo in success pages & prompts #1

* fix styling of text-input fields

* update address book contact modal

* change new mint popup into a bottom slide modal

* Show msg not enough funds if selected mint bal is 0

* update header text from payment page

* replace a popup with a txt msg

* update payment process from empty mints, remove popups

* add a toaster component

* update toaster, use it in mint settings page

* use toaster in dashboard

* update sql stuff

* add base layout for mint proofs page #3

* add mint proofs page #3

* add a few jsDocs for proofs-list components

* setup Reactotron

* update after review

* setup bugsnag & add ErrorBoundary

* add basic test

* fix

* test the Txt component

* fix imports

* small fix

* fix selected mint state, fix bugsnack missing api key

* use the Txt component whenever possible

* remove TODO

* Update the cashu token QR

closes #26

* claimToken

* Update index.ts

* update getMintsUrls

* add isTrustedMint overload

* Feature request! "eCash" -> "Ecash"  The 90s are long gone!!! 😁

* add jscpd & add @ConstS path alias

* fix tests

* Update package.json

* add AsyncStore tests

* update QR scan page

* update qr marker border width

* add utils hasTrustedMint tests

* update jest config for tsx components

* add test, handle getLanguageCode, update theme context

* update jest config

* add success page basic test

* test successpage. navigation hook error

* add success page test

* lint

* remove unused import

* add eslint jest plugin

* fix tests

* update lint & update Success component navigation test

* indicate latest keyset ids in proof lists #33

* add scrollview to proof list page

* add keysetHint #33

* add mint icon next to mintUrl in proof list

* fix linter hook warnings

* add comment

* update spelling of ecash to Ecash

* add getMintCurrentKeySetId & getMintKeySetIds fns

* update bugsnag error boundary

* update errorDetails component

* example bugsnag notify

* remove useless code

* add .example.env

* update example env, remove error test

* remove error test

* Add options to the history entry of an ecash tx #20 (#45)

* show and check if token is spent in history entry details #20

* add IsSpentContainer component #20

* add qr to history entry details, update dashboard claim token #20

* update version to 0.0.2-alpha

* lint

* import package.json version

* fix pkg import

* add release.yml

* update eas ci workflow (#46)

---------

Co-authored-by: BilligsterUser <billigsteruser@protonmail.com>
Co-authored-by: BilligsterUser <49797107+BilligsterUser@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 11, 2023
1 parent 8892389 commit 7543017
Show file tree
Hide file tree
Showing 115 changed files with 3,957 additions and 1,395 deletions.
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ build
.vscode
coverage
patches
test
babel.config.js
jest.config.js
jest.config.js
report
86 changes: 56 additions & 30 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
{
"env": {
"es6": true,
"node": true,
"es2021": true,
// "react-native/react-native": true,
"jest/globals": true
},
"settings": {
"react": {
"pragma": "React",
"version": "detect"
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
} /* ,
"import/resolver": {
/* "typescript": {
"paths": "./tsconfig.json",
"alwaysTryTypes": true
},
// "typescript": {}, // this loads <rootdir>/tsconfig.json to ESLint
"node": {
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
} */
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
Expand All @@ -7,16 +38,29 @@
"plugin:promise/recommended",
"plugin:json/recommended",
// "plugin:import/recommended",
"plugin:import/typescript"
"plugin:import/typescript",
"plugin:jest/recommended",
// "eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:react/jsx-runtime"
// "plugin:import/errors",
// "plugin:import/warnings"
],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.d.ts"]
}
],
"globals": {
"__dirname": true,
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
// "sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"globalReturn": true,
Expand All @@ -25,6 +69,9 @@
"project": "tsconfig.json"
},
"plugins": [
"react",
"react-hooks",
"jest",
"es5",
"html",
"@typescript-eslint",
Expand All @@ -41,6 +88,8 @@
"jsdoc"
],
"rules": {
"react/no-unescaped-entities": "warn",
"no-dupe-class-members": 0,
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"import/first": "warn",
Expand All @@ -49,25 +98,16 @@
"promise/always-return": ["warn", { "ignoreLastCallback": true }],
// to enforce using type for object type definitions, can be type or interface
"@typescript-eslint/consistent-type-definitions": ["warn", "interface"],
"@typescript-eslint/array-type": [
"warn",
{
"default": "array"
}
],
"@typescript-eslint/array-type": ["warn", { "default": "array" }],
"@typescript-eslint/require-await": "warn",
"@typescript-eslint/await-thenable": "warn",
"@typescript-eslint/consistent-type-exports": "warn",
"@typescript-eslint/restrict-template-expressions": [
"warn",
{
"allowNumber": true,
"allowBoolean": true,
"allowNullish": true
}
{ "allowNumber": true, "allowBoolean": true, "allowNullish": true }
],
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
// "@typescript-eslint/explicit-module-boundary-types": 0,
/* "@typescript-eslint/naming-convention": [
"warn",
{
Expand Down Expand Up @@ -156,7 +196,7 @@
"@getify/proper-arrows/return": ["warn", {
"object": true
}] */
"@getify/proper-arrows/where": 0,
// "@getify/proper-arrows/where": 0,
"@typescript-eslint/no-unused-vars": [
"warn",
{
Expand Down Expand Up @@ -185,21 +225,7 @@
"no-else-return": "warn",
"prefer-const": "warn",
"no-console": 1,
"no-unused-vars": [
"warn",
{
// "varsIgnorePattern": "^_",
// "caughtErrorsIgnorePattern": "^ignore"
"argsIgnorePattern": "^_"
}
],
"indent": [
"warn",
"tab",
{
"SwitchCase": 1
}
],
"indent": ["warn", "tab", { "SwitchCase": 1 }],
"linebreak-style": ["warn", "windows"],
"quotes": ["warn", "single"],
"semi": ["warn", "never"]
Expand Down
7 changes: 7 additions & 0 deletions .example.env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BUGSNAG_APIKEY=
BUGSNAG_API_KEY=

NODE_ENV=development
NODE_ENV_SHORT=dev
APP_VARIANT=dev
DEBUG=dev
21 changes: 21 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
changelog:
exclude:
labels:
- ignore-for-release
- bot
categories:
- title: Pull requests
labels:
- release
- title: Breaking Changes 🛠
labels:
- breaking-change
- title: New Features 🎉
labels:
- enhancement
- title: Tests
labels:
- "test"
- title: Documentation
labels:
- "documentation"
2 changes: 2 additions & 0 deletions .github/workflows/eas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:

jobs:
build:
env:
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
push:
branches: [main, dev]
pull_request:
types: [opened, reopened]
# types: [opened, reopened]
# types: [opened, synchronize, edited, ready_for_review]

jobs:
build:
Expand All @@ -29,6 +30,7 @@ jobs:
- run: npm run lint
- run: npm run build --if-present
- run: npm run test:coverage
# - run: npm run testtsx:coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ web-build/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*
.env*
.env
report/
6 changes: 5 additions & 1 deletion app.config.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@

const configPath = `${__dirname}/config/app.config.ts`;

require('ts-node/register');
module.exports = require('./config/app.config.ts');

module.exports = require(configPath);
7 changes: 6 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@

const configPath = `${__dirname}/config/babel.config.ts`;

require('ts-node/register');
module.exports = require('./config/babel.config.ts');

module.exports = require(configPath);

68 changes: 54 additions & 14 deletions config/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,55 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { config as dotenvConfig } from 'dotenv'
import { ExpoConfig } from 'expo/config'

import { version } from './../package.json'

const IS_DEV = process.env.APP_VARIANT === 'dev'
const IS_PREVIEW = process.env.APP_VARIANT === 'preview'
const IS_PROD = process.env.APP_VARIANT === 'prod'


type AppVariant = 'preview' | 'prod' | 'dev' | undefined

function nodeEnvShort(): 'test' | AppVariant {
if (!process?.env?.NODE_ENV) {
process.env.NODE_ENV = 'development'
return
}
if (process.env.NODE_ENV === 'production') { return 'prod' }
if (process.env.NODE_ENV === 'development') { return 'dev' }
if (process.env.NODE_ENV === 'test') { return 'test' }
if (process.env.NODE_ENV === 'preview') { return 'preview' }
}
function appVariant(): AppVariant {
if (!process?.env?.APP_VARIANT) {
process.env.APP_VARIANT = 'dev'
return
}
if (process.env.APP_VARIANT === 'prod') { return 'prod' }
if (process.env.APP_VARIANT === 'dev') { return 'dev' }
if (process.env.APP_VARIANT === 'preview') { return 'preview' }
}


const _appVariant = appVariant() || process.env.APP_VARIANT || 'dev'

const _nodeEnvShort = nodeEnvShort()

try {
dotenvConfig({ path: `.env${_nodeEnvShort === 'prod' ? '' : `.${nodeEnvShort()}`}` })
} catch (e) { console.log('dotenv error:', e) } // eslint-disable-line no-console


// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
const IS_DEV = _appVariant === 'dev'
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
const IS_PREVIEW = _appVariant === 'preview'
const IS_PROD = _appVariant === 'prod'



const config: ExpoConfig = {
name: `eNuts${!IS_PROD ? ` (${process.env.APP_VARIANT})` : ''}`,
name: `eNuts${!IS_PROD ? ` (${_appVariant})` : ''}`,
slug: 'enuts',
version: `${version}${!IS_PROD ? `-${process.env.APP_VARIANT}` : ''}`,
owner: 'enuts_wallet',
version: `${version}${!IS_PROD ? `-${_appVariant}` : ''}`,
scheme: 'cashu',
orientation: 'portrait',
icon: './assets/icon.png',
Expand All @@ -25,6 +61,8 @@ const config: ExpoConfig = {
},
assetBundlePatterns: ['**/*'],
plugins: [
'@bugsnag/plugin-expo-eas-sourcemaps',
'expo-localization',
[
'expo-barcode-scanner',
{
Expand All @@ -49,18 +87,20 @@ const config: ExpoConfig = {
foregroundImage: './assets/adaptive-icon.png',
backgroundColor: '#5DB075'
},
package: `com.agron.enuts${!IS_PROD ? `.${process.env.APP_VARIANT}` : ''}`
package: `com.agron.enuts${!IS_PROD ? `.${_appVariant}` : ''}`
},
web: {
favicon: './assets/favicon.png'
},
extra: {
eas: {
projectId: 'edb75ccd-71ac-4934-9147-baf1c7f2b068'
}, DEBUG: process.env.DEBUG,
APP_VARIANT: process.env.APP_VARIANT,
},
owner: 'enuts_wallet'
eas: { projectId: 'edb75ccd-71ac-4934-9147-baf1c7f2b068' },
DEBUG: process.env.DEBUG,
APP_VARIANT: _appVariant,
bugsnag: { 'apiKey': process.env.BUGSNAG_API_KEY, },
NODE_ENV: process.env.NODE_ENV,
NODE_ENV_SHORT: _nodeEnvShort,
}
}


export default config
1 change: 1 addition & 0 deletions config/babel.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const fn: ConfigFunction = (api: ConfigAPI): TransformOptions => {
'@util': './src/util',
'@modal': './src/components/modal',
'@store': './src/storage/store',
'@consts': './src/consts',
},
'extensions': [
'.js',
Expand Down
17 changes: 17 additions & 0 deletions config/cpd.config.ts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"output":"./report/ts/",
"pattern": "**/*.ts",
"format": "typescript",
"silent": true,
"ignoreCase": true,
"max-lines": 10000,
"minTokens": 75,
"max-size": "30mb",
"threshold": 10,
"min-lines": 5,
"mode": "weak",
"gitignore": true,
"reporters": ["html", "console"],
"ignore": ["**/__snapshots__/**", "node_modules", "report", ".git"],
"absolute": true
}
17 changes: 17 additions & 0 deletions config/cpd.config.tsx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"output": "./report/tsx/",
"pattern": "**/*.tsx",
"format": "tsx",
"silent":true,
"ignoreCase": true,
"max-lines": 10000,
"minTokens": 75,
"max-size": "30mb",
"threshold": 10,
"min-lines": 5,
"mode": "weak",
"gitignore": true,
"reporters": ["html", "console"],
"ignore": ["**/__snapshots__/**", "node_modules", "report", ".git"],
"absolute": true
}
Loading

0 comments on commit 7543017

Please sign in to comment.