Skip to content

Commit

Permalink
[DDW-596] Configuration steps
Browse files Browse the repository at this point in the history
  • Loading branch information
mchappell committed Jan 4, 2022
1 parent d096de3 commit 5b66cae
Show file tree
Hide file tree
Showing 16 changed files with 1,620 additions and 1,921 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-flow"
"@babel/preset-typescript"
],
"plugins": [
["@babel/plugin-transform-runtime"],
Expand Down
27 changes: 21 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"parser": "@babel/eslint-parser",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"legacyDecorators": true
}
},
"extends": [
"airbnb",
"plugin:flowtype/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"prettier",
"plugin:jest/recommended"
Expand All @@ -21,8 +21,8 @@
"rules": {
"class-methods-use-this": 0,
"consistent-return": "warn",
"flowtype/generic-spacing": 0,
"flowtype/space-after-type-colon": 0,
"@typescript-eslint/generic-spacing": 0,
"@typescript-eslint/space-after-type-colon": 0,
"jsx-a11y/alt-text": 0,
"lines-between-class-members": 0,
"global-require": 0,
Expand Down Expand Up @@ -71,13 +71,24 @@
"react/require-default-props": 0,
"react/sort-comp": 0,
"react/state-in-constructor": 0,
"react/jsx-first-prop-new-line": [1, "multiline-multiprop"],
"@typescript-eslint/ban-ts-comment": 1,
"@typescript-eslint/no-empty-function": 1,
"@typescript-eslint/ban-types": 1,
"import/no-unresolved": 1,
"@typescript-eslint/no-var-requires": 1,
"camelcase": 1,
"no-empty": 1,
"@typescript-eslint/no-explicit-any": 1,
"no-shadow": 1,
"react/no-did-update-set-state": 1,
"react/static-property-placement": 0,
"react/jsx-one-expression-per-line": 0,
"react/jsx-curly-newline": 0,
"react/jsx-indent": 0
},
"plugins": [
"flowtype",
"@typescript-eslint",
"import",
"promise",
"react",
Expand All @@ -92,6 +103,10 @@
"Process": true // TODO: remove after fix
},
"settings": {
"import/resolver": "webpack"
"import/resolver": {
"node": {
"extensions": [".js", ".jsx",".ts", ".tsx"]
}
}
}
}
30 changes: 0 additions & 30 deletions .flowconfig

This file was deleted.

2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

# But not these file types
!*.js
!*.ts
!*.tsx
!*.scss
!*.json

Expand Down
37 changes: 37 additions & 0 deletions declaration.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
declare module '*.svg' {
const content: any;
export default content;
}

declare module '*.scss' {
const content: any;
export default content;
}

type Daedalus = {
actions: ActionsMap,
api: Api,
environment: Object,
reset: Function,
stores: StoresMap,
translations: Object,
utils: {
crypto: {
generateMnemonic: Function
}
},
};

//declare type EnumMap<K: string, V, O: Object = *> = O & { [K]: V & <O, K> };

declare global {
namespace NodeJS {
interface ProcessEnv {
WALLET_COUNT: number;
}
}
var daedalus: Daedalus;
}

export {};

1 change: 0 additions & 1 deletion flow/declarations/EnumMap.js

This file was deleted.

2 changes: 0 additions & 2 deletions flow/mappers/CSSModule.js.flow

This file was deleted.

1 change: 0 additions & 1 deletion flow/mappers/GeneralStub.js.flow

This file was deleted.

2 changes: 0 additions & 2 deletions flow/mappers/WebpackAsset.js.flow

This file was deleted.

76 changes: 42 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
"build:renderer": "yarn webpack -c source/renderer/webpack.config.js --progress",
"build:cleanup": "rimraf ./dist",
"build:electron": "electron-rebuild -w usb --useCache -s --debug",
"check:all": "yarn prettier:check && yarn lint && yarn flow:test && yarn stylelint && yarn lockfile:check && yarn manage:translations",
"check:all": "yarn prettier:check && yarn lint && yarn compile && yarn stylelint && yarn lockfile:check && yarn manage:translations",
"start": "yarn electron ./",
"start:dev": "nodemon --watch 'dist/main' --exec 'NODE_ENV=development yarn start'",
"test": "NODE_ENV=test yarn build && yarn test:unit && yarn test:e2e:fail-fast",
"test:jest": "jest",
"test:generate:report": "node tests/reporter.js",
"test:unit": "yarn cucumber:run --require 'tests/**/unit/**/*.js' --tags '@unit and not @skip and not @wip'",
"test:unit:rerun": "yarn cucumber:rerun --require 'tests/**/unit/**/*.js' --tags '@unit and not @skip and not @wip'",
"test:generate:report": "ts-node tests/reporter.ts",
"test:unit": "yarn cucumber:run --require 'tests/**/unit/**/*.ts' --tags '@unit and not @skip and not @wip'",
"test:unit:rerun": "yarn cucumber:rerun --require 'tests/**/unit/**/*.ts' --tags '@unit and not @skip and not @wip'",
"test:unit:watch": "nodemon --watch source --watch tests --exec \"yarn test:unit --tags '@unit and @watch'\"",
"test:unit:unbound": "yarn cucumber:run --require 'tests/**/unit/**/*.js' --tags '@unbound and not @skip and not @wip'",
"test:e2e": "yarn cucumber:run --require 'tests/setup-e2e.js' --require 'tests/**/e2e/**/*.js' --tags '@e2e and not @skip and not @wip'",
"test:e2e:fail-fast": "yarn cucumber:fail-fast --require 'tests/setup-e2e.js' --require 'tests/**/e2e/**/*.js' --tags '@e2e and not @skip and not @wip'",
"test:e2e:rerun": "yarn cucumber:rerun --require 'tests/setup-e2e.js' --require 'tests/**/e2e/**/*.js' --tags '@e2e and not @skip and not @wip'",
"test:e2e:rerun:fail-fast": "yarn cucumber:rerun --require 'tests/setup-e2e.js' --require 'tests/**/e2e/**/*.js' --tags '@e2e and not @skip and not @wip'",
"test:unit:unbound": "yarn cucumber:run --require 'tests/**/unit/**/*.ts' --tags '@unbound and not @skip and not @wip'",
"test:e2e": "yarn cucumber:run --require 'tests/setup-e2e.ts' --require 'tests/**/e2e/**/*.ts' --tags '@e2e and not @skip and not @wip'",
"test:e2e:fail-fast": "yarn cucumber:fail-fast --require 'tests/setup-e2e.ts' --require 'tests/**/e2e/**/*.ts' --tags '@e2e and not @skip and not @wip'",
"test:e2e:rerun": "yarn cucumber:rerun --require 'tests/setup-e2e.ts' --require 'tests/**/e2e/**/*.ts' --tags '@e2e and not @skip and not @wip'",
"test:e2e:rerun:fail-fast": "yarn cucumber:rerun --require 'tests/setup-e2e.ts' --require 'tests/**/e2e/**/*.ts' --tags '@e2e and not @skip and not @wip'",
"test:e2e:watch": "gulp test:e2e:watch",
"test:e2e:watch:once": "KEEP_APP_AFTER_TESTS=true yarn test:e2e --tags '@e2e and @watch'",
"cucumber": "cross-env NODE_ENV=test cucumber-js --require 'tests/setup-common.js' --require-module @babel/register -f json:tests-report/report-data.json -f summary:tests-report/summary.log -f node_modules/cucumber-pretty:tests-report/results.log --format-options '{\"snippetInterface\": \"async-await\"}' -f node_modules/cucumber-pretty --format-options '{\"snippetInterface\": \"async-await\"}' -f rerun:tests/@rerun.txt",
"cucumber": "cross-env NODE_ENV=test cucumber-js --require 'tests/setup-common.ts' --require-module @babel/register -f json:tests-report/report-data.json -f summary:tests-report/summary.log -f node_modules/cucumber-pretty:tests-report/results.log --format-options '{\"snippetInterface\": \"async-await\"}' -f node_modules/cucumber-pretty --format-options '{\"snippetInterface\": \"async-await\"}' -f rerun:tests/@rerun.txt",
"cucumber:run": "yarn cucumber tests",
"cucumber:fail-fast": "yarn cucumber tests --fail-fast",
"cucumber:rerun": "yarn cucumber tests-report/@rerun.txt",
Expand All @@ -38,19 +38,19 @@
"package": "cross-env NODE_ENV=production yarn build && cross-env NODE_ENV=production babel-node scripts/package.js",
"package:all": "yarn package --all",
"cleanup": "mop -v",
"lint": "eslint --format=node_modules/eslint-formatter-pretty source storybook utils *.js",
"flow:test": "flow; test $? -eq 0 -o $? -eq 2",
"lint": "eslint --format=node_modules/eslint-formatter-pretty source storybook utils --ext .ts,.tsx",
"compile": "tsc --noEmit",
"prettier": "./node_modules/.bin/prettier \"**/*.*\"",
"prettier:check": "yarn prettier --check",
"prettier:format": "yarn prettier --write --loglevel warn",
"stylelint": "./node_modules/.bin/stylelint \"**/*.scss\"",
"stylelint:fix": "yarn stylelint --fix",
"manage:translations": "gulp purge:translations && gulp clear:cache && gulp build && node ./translations/translation-runner.js",
"manage:translations": "gulp purge:translations && gulp clear:cache && gulp build && ts-node ./translations/translation-runner.ts",
"storybook": "start-storybook -p 6006 -c storybook --ci /",
"storybook:build": "build-storybook -c storybook -o dist/storybook",
"themes:check:createTheme": "gulp build:themes && node -r esm ./dist/scripts/check.js",
"themes:update": "gulp build:themes && node -r esm ./dist/scripts/update.js && yarn prettier --loglevel warn --write source/renderer/app/themes/daedalus/*.js",
"themes:copy": "babel-node source/renderer/app/themes/utils/copyTheme.js && yarn prettier --loglevel warn --write source/renderer/app/themes/daedalus/*.js",
"themes:check:createTheme": "gulp build:themes && ts-node -r esm ./dist/scripts/check.js",
"themes:update": "gulp build:themes && ts-node -r esm ./dist/scripts/update.js && yarn prettier --loglevel warn --write source/renderer/app/themes/daedalus/*.ts",
"themes:copy": "babel-node source/renderer/app/themes/utils/copyTheme.ts && yarn prettier --loglevel warn --write source/renderer/app/themes/daedalus/*.ts",
"clear:cache": "gulp clear:cache",
"nix:alonzo_purple": "NETWORK=alonzo_purple nix-shell --argstr nodeImplementation cardano --argstr cluster alonzo_purple",
"nix:mainnet": "NETWORK=mainnet nix-shell --argstr nodeImplementation cardano --argstr cluster mainnet",
Expand All @@ -59,15 +59,15 @@
"nix:shelley_qa": "NETWORK=shelley_qa nix-shell --argstr nodeImplementation cardano --argstr cluster shelley_qa",
"nix:staging": "NETWORK=staging nix-shell --argstr nodeImplementation cardano --argstr cluster staging",
"nix:testnet": "NETWORK=testnet nix-shell --argstr nodeImplementation cardano --argstr cluster testnet",
"byron:wallet:importer": "node utils/api-importer/byron-wallet-importer.js",
"shelley:wallet:importer": "node utils/api-importer/shelley-wallet-importer.js",
"mary:wallet:importer": "node utils/api-importer/mary-wallet-importer.js",
"itn:byron:wallet:importer": "node utils/api-importer/itn-byron-wallet-importer.js",
"itn:shelley:wallet:importer": "node utils/api-importer/itn-shelley-wallet-importer.js",
"yoroi:wallet:importer": "node utils/api-importer/yoroi-wallet-importer.js",
"create-news-verification-hashes": "node utils/create-news-verification-hashes/index.js",
"lockfile:check": "node utils/lockfile-checker/index.js --check",
"lockfile:fix": "node utils/lockfile-checker/index.js --fix"
"byron:wallet:importer": "ts-node utils/api-importer/byron-wallet-importer.ts",
"shelley:wallet:importer": "ts-node utils/api-importer/shelley-wallet-importer.ts",
"mary:wallet:importer": "ts-node utils/api-importer/mary-wallet-importer.ts",
"itn:byron:wallet:importer": "ts-node utils/api-importer/itn-byron-wallet-importer.ts",
"itn:shelley:wallet:importer": "ts-node utils/api-importer/itn-shelley-wallet-importer.ts",
"yoroi:wallet:importer": "ts-node utils/api-importer/yoroi-wallet-importer.ts",
"create-news-verification-hashes": "ts-node utils/create-news-verification-hashes/index.ts",
"lockfile:check": "ts-node utils/lockfile-checker/index.ts --check",
"lockfile:fix": "ts-node utils/lockfile-checker/index.ts --fix"
},
"bin": {
"electron": "./node_modules/.bin/electron"
Expand All @@ -82,23 +82,31 @@
"@babel/plugin-proposal-object-rest-spread": "7.16.0",
"@babel/plugin-transform-modules-commonjs": "7.16.0",
"@babel/plugin-transform-runtime": "7.16.4",
"@babel/plugin-transform-typescript": "7.16.7",
"@babel/preset-env": "7.16.4",
"@babel/preset-flow": "7.16.0",
"@babel/preset-react": "7.16.0",
"@babel/preset-typescript": "7.16.7",
"@babel/register": "7.0.0",
"@dump247/storybook-state": "1.6.1",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.3",
"@storybook/addon-actions": "6.4.9",
"@storybook/addon-essentials": "^6.4.9",
"@storybook/addon-essentials": "6.4.9",
"@storybook/addon-knobs": "6.4.0",
"@storybook/addon-links": "6.4.9",
"@storybook/addons": "6.4.9",
"@storybook/builder-webpack5": "^6.4.9",
"@storybook/builder-webpack5": "6.4.9",
"@storybook/core": "6.4.9",
"@storybook/manager-webpack5": "^6.4.9",
"@storybook/manager-webpack5": "6.4.9",
"@storybook/react": "6.4.9",
"@testing-library/jest-dom": "5.15.1",
"@testing-library/react": "12.1.2",
"@types/aes-js": "3.1.1",
"@types/node": "17.0.7",
"@types/qrcode.react": "1.0.2",
"@types/react": "17.0.38",
"@types/react-svg-inline": "2.1.3",
"@typescript-eslint/eslint-plugin": "5.9.0",
"@typescript-eslint/parser": "5.9.0",
"asar": "2.1.0",
"autodll-webpack-plugin": "0.4.2",
"axios": "0.24.0",
Expand Down Expand Up @@ -127,7 +135,6 @@
"eslint-config-prettier": "6.12.0",
"eslint-formatter-pretty": "4.0.0",
"eslint-import-resolver-webpack": "0.13.1",
"eslint-plugin-flowtype": "5.9.2",
"eslint-plugin-import": "2.24.2",
"eslint-plugin-jest": "25.3.0",
"eslint-plugin-jsx-a11y": "6.4.1",
Expand All @@ -136,8 +143,6 @@
"eslint-plugin-react-hooks": "4.2.0",
"esm": "3.2.25",
"faker": "5.1.0",
"flow-bin": "0.166.1",
"gulp-flow-remove-types": "1.0.0",
"gulp-shell": "0.8.0",
"hash.js": "1.1.7",
"html-loader": "2.1.2",
Expand Down Expand Up @@ -178,6 +183,10 @@
"svg-inline-loader": "0.8.2",
"thread-loader": "2.1.3",
"transform-loader": "0.2.4",
"ts-loader": "8.2.0",
"ts-migrate": "0.1.27",
"ts-node": "10.4.0",
"typescript": "4.5.4",
"utf-8-validate": "5.0.2",
"webdriverio": "5.18.7",
"webpack": "5.65.0",
Expand All @@ -204,7 +213,7 @@
"cardano-js": "0.4.8",
"cardano-launcher": "0.20211105.1",
"cbor": "5.0.2",
"check-disk-space": "^3.1.0",
"check-disk-space": "3.1.0",
"chroma-js": "2.1.0",
"classnames": "2.2.6",
"csv-stringify": "5.5.1",
Expand Down Expand Up @@ -281,7 +290,6 @@
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged",
"pre-push": "yarn check:all"
}
},
Expand Down
12 changes: 6 additions & 6 deletions source/main/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const windowOptions: WindowOptionsType = {
nodeIntegration: isTest,
webviewTag: false,
enableRemoteModule: isTest,
preload: path.join(__dirname, './preload.js'),
preload: path.join(__dirname, './preload.ts'),
additionalArguments: isBlankScreenFixActive ? ['--safe-mode'] : [],
},
useContentSize: true,
Expand Down Expand Up @@ -136,11 +136,11 @@ export const buildLabel = getBuildLabel(

// Logging config
export const ALLOWED_LOGS = [
'Daedalus.json',
'System-info.json',
'Daedalus-versions.json',
'State-snapshot.json',
'Wallet-migration-report.json',
'Daedalus.tson',
'System-info.tson',
'Daedalus-versions.tson',
'State-snapshot.tson',
'Wallet-migration-report.tson',
'cardano-wallet.log',
'node.log',
];
Expand Down
16 changes: 12 additions & 4 deletions source/main/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const isDevelopment = process.env.NODE_ENV === 'development';

module.exports = {
entry: {
index: './source/main/index.js',
preload: './source/main/preload.js',
index: './source/main/index.ts',
preload: './source/main/preload.ts',
},
output: {
path: path.join(process.cwd(), 'dist/main'),
Expand All @@ -43,10 +43,13 @@ module.exports = {
optimization: {
minimize: false,
},
module: {
resolve: {
extensions: ['.tsx', '.ts', '.js', '.json'],
},
module: {
rules: [
{
test: /\.jsx?$/,
test: /\.tsx?$/,
include: /source/,
exclude: /source\/renderer/,
use: [
Expand All @@ -55,6 +58,11 @@ module.exports = {
options: {
cacheCompression: false,
cacheDirectory: true,
presets: [
'@babel/preset-env',
'@babel/preset-react',
'@babel/preset-typescript',
],
},
},
],
Expand Down
Loading

0 comments on commit 5b66cae

Please sign in to comment.