Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite migration #444

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion functions/testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
// - change the CI workflow so it copies only the .js files


export function onRequest(context) {
export function onRequest() {
/*
const env = require('../public/env')(context);
console.dir(context);
const apiEndpoint = env.NETWORK_EVM_RPC;
return new Response(`Hello, ${context.env.NETWORK} world!!!!!!!!\n\nNetwork RPC is: ${apiEndpoint}`);
*/
return new Response('Hello, world!');
}
2 changes: 1 addition & 1 deletion src/index.template.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
</head>
<body>
<!-- DO NOT touch the following DIV -->
<div id="q-app"></div>
<!-- quasar:entry-point -->
</body>
</html>
29 changes: 19 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"@eosrio/hyperion-stream-client": "^0.4.0-beta.5",
"@ethereumjs/tx": "^3.5.0",
"@metamask/detect-provider": "^2.0.0",
"@quasar/extras": "^1.0.0",
"@quasar/extras": "^1.16.4",
"@telosnetwork/telosevm-js": "^0.2.6",
"autoprefixer": "^10.4.2",
"axios": "^0.21.2",
"axios-time": "^1.0.0",
"babel-loader": "^8.1.0",
Expand All @@ -31,42 +32,50 @@
"ethereumjs-util": "^7.1.4",
"ethers": "^5.5.1",
"fs": "^0.0.1-security",
"global": "^4.4.0",
"highlight.js": "10",
"highlightjs-solidity": "^2.0.3",
"keccak": "^3.0.3",
"moment": "^2.29.4",
"quasar": "2",
"quasar": "^2.6.0",
"ual-anchor": "^1.0.0",
"ual-ledger": "^0.3.0",
"ual-wombat": "^0.3.3",
"universal-authenticator-library": "^0.3.0",
"vue": "3",
"vite-plugin-esmodule": "^1.5.0",
"vue": "^3.0.0",
"vue-i18n": "^9.0.0",
"vue-json-viewer": "3",
"vue-router": "4",
"vue-router": "^4.0.0",
"vue3-click-away": "^1.2.4",
"vuex": "4",
"web3": "^4.0.1"
"web3": "^4.0.1",
"webpack": "^5.88.2"
},
"devDependencies": {
"@babel/core": "7.19.3",
"@babel/eslint-parser": "^7.13.14",
"@babel/preset-env": "7.19.3",
"@quasar/app-webpack": "3.6.2",
"@originjs/vite-plugin-commonjs": "^1.0.3",
"@quasar/app-vite": "^1.3.0",
"@quasar/babel-preset-app": "^2.0.2",
"@types/jest": "29.1.1",
"@types/lodash": "^4.14.182",
"@typescript-eslint/eslint-plugin": "^5.48.2",
"@types/node": "^12.20.21",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^5.48.2",
"@vue/test-utils": "2.1.0",
"@vue/vue3-jest": "29",
"babel-jest": "29.1.2",
"eslint": "^8.32.0",
"eslint-plugin-jest": "27.1.0",
"eslint-plugin-vue": "^9.0.0",
"eslint-webpack-plugin": "^2.4.0",
"jest": "29.1.2",
"jest-environment-jsdom": "29.1.2",
"jest-serializer-vue": "^2.0.2",
"node-polyfill-webpack-plugin": "^2.0.1"
"typescript": "^5.1.6",
"vite-plugin-commonjs": "^0.8.2",
"vite-plugin-node-polyfills": "^0.9.0"
},
"browserslist": [
"last 10 Chrome versions",
Expand All @@ -80,7 +89,7 @@
"last 5 Opera versions"
],
"engines": {
"node": ">= 10.18.1",
"node": "^18 || ^16 || ^14.19",
"npm": ">= 6.13.4",
"yarn": ">= 1.21.1"
}
Expand Down
77 changes: 55 additions & 22 deletions quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
/* eslint-env node */

require('dotenv').config();
const { nodePolyfills } = require('vite-plugin-node-polyfills');
//const { viteCommonjs } = require('@originjs/vite-plugin-commonjs');
//import esmodule from "vite-plugin-esmodule";
//const esmodule = require('vite-plugin-esmodule');
// const commonjs = require('vite-plugin-commonjs');
const env = require('./public/env')(process);
const ESLintPlugin = require('eslint-webpack-plugin');
const nodePolyfillWebpackPlugin = require('node-polyfill-webpack-plugin');


module.exports = function(/* ctx */) {
return {
Expand Down Expand Up @@ -53,33 +57,63 @@ module.exports = function(/* ctx */) {
build: {
vueRouterMode: 'history', // available values: 'hash', 'history'
env,
chainWebpack (chain) {
chain.plugin('eslint-webpack-plugin')
.use(ESLintPlugin, [{ extensions: ['js', 'vue'] }]);
chain.plugin('node-polyfill').use(nodePolyfillWebpackPlugin);
},
extendViteConf(viteConf) {
if (!viteConf.build.commonjsOptions) {
viteConf.build.commonjsOptions = {};
}

viteConf.optimizeDeps = {
disabled: false,
};

// transpile: false,
viteConf.build.commonjsOptions.include = [];
viteConf.build.commonjsOptions.transformMixedEsModules = true;
},
vitePlugins: [
//viteCommonjs(),
//esmodule([]),
// commonjs(),
nodePolyfills({
// To exclude specific polyfills, add them to this list.
exclude: [
'fs', // Excludes the polyfill for `fs` and `node:fs`.
],
// Whether to polyfill specific globals.
globals: {
Buffer: true, // can also be 'build', 'dev', or false
global: true,
process: true,
},
// Whether to polyfill `node:` protocol imports.
protocolImports: true,
}),
],
// vueRouterBase,
// vueDevtools,
// vueOptionsAPI: false,

// Add dependencies for transpiling with Babel (Array of string/regex)
// (from node_modules, which are by default not transpiled).
// Applies only if "transpile" is set to true.
// transpileDependencies: [],
// rebuildCache: true, // rebuilds Vite/linter/etc cache on startup

// rtl: false, // https://quasar.dev/options/rtl-support
// preloadChunks: true,
// showProgress: false,
// gzip: true,
// publicPath: '/',
// analyze: true,

// Options below are automatically set depending on the env, set them if you want to override
// extractCSS: false,
// env: {},
// rawDefine: {}
// ignorePublicFolder: true,
// minify: false,
// polyfillModulePreload: true,
// distDir

// extendViteConf (viteConf) {},
// viteVuePluginOptions: {},

// vitePlugins: [
// [ 'package-name', { ..options.. } ]
// ]
},

// Full list of options: https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-devServer
devServer: {
https: false,
port: 8080,
open: false, // opens browser window automatically
},

Expand Down Expand Up @@ -116,8 +150,7 @@ module.exports = function(/* ctx */) {

// https://quasar.dev/quasar-cli/developing-pwa/configuring-pwa
pwa: {
workboxPluginMode: 'GenerateSW', // 'GenerateSW' or 'InjectManifest'
workboxOptions: {}, // only for GenerateSW
workboxMode: 'generateSW', // or 'injectManifest'
manifest: {
name: 'Teloscan',
short_name: 'Teloscan',
Expand Down
2 changes: 1 addition & 1 deletion src/components/AddressField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { mapActions } from 'vuex';
import { ethers } from 'ethers';

import CopyButton from 'components/CopyButton';
import CopyButton from 'components/CopyButton.vue';

export default {
name: 'AddressField',
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContractTab/ContractInterface.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="javascript">
import FunctionInterface from 'components/ContractTab/FunctionInterface';
import FunctionInterface from 'components/ContractTab/FunctionInterface.vue';

import { sortAbiFunctionsByName } from 'src/lib/utils';

Expand Down
4 changes: 2 additions & 2 deletions src/components/ContractTab/ContractTab.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import ContractSource from 'components/ContractTab/ContractSource';
import ContractInterface from 'components/ContractTab/ContractInterface';
import ContractSource from 'components/ContractTab/ContractSource.vue';
import ContractInterface from 'components/ContractTab/ContractInterface.vue';
import CopyButton from 'components/CopyButton.vue';

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContractTab/FunctionInterface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
parameterTypeIsUnsignedIntArray,
} from 'components/ContractTab/function-interface-utils';

import TransactionField from 'components/TransactionField';
import TransactionField from 'components/TransactionField.vue';


export default {
Expand Down
22 changes: 11 additions & 11 deletions src/components/ContractTab/function-interface-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import { BigNumber, ethers } from 'ethers';
import { defineAsyncComponent } from 'vue';

const asyncInputComponents = {
AddressInput: defineAsyncComponent(() => import('components/inputs/AddressInput')),
AddressArrayInput: defineAsyncComponent(() => import('components/inputs/AddressArrayInput')),
BooleanArrayInput: defineAsyncComponent(() => import('components/inputs/BooleanArrayInput')),
BooleanInput: defineAsyncComponent(() => import('components/inputs/BooleanInput')),
BytesArrayInput: defineAsyncComponent(() => import('components/inputs/BytesArrayInput')),
SignedIntInput: defineAsyncComponent(() => import('components/inputs/SignedIntInput')),
StringArrayInput: defineAsyncComponent(() => import('components/inputs/StringArrayInput')),
StringInput: defineAsyncComponent(() => import('components/inputs/StringInput')),
UnsignedIntArrayInput: defineAsyncComponent(() => import('components/inputs/UnsignedIntArrayInput')),
UnsignedIntInput: defineAsyncComponent(() => import('components/inputs/UnsignedIntInput')),
SignedIntArrayInput: defineAsyncComponent(() => import('components/inputs/SignedIntArrayInput')),
AddressInput: defineAsyncComponent(() => import('components/inputs/AddressInput.vue')),
AddressArrayInput: defineAsyncComponent(() => import('components/inputs/AddressArrayInput.vue')),
BooleanArrayInput: defineAsyncComponent(() => import('components/inputs/BooleanArrayInput.vue')),
BooleanInput: defineAsyncComponent(() => import('components/inputs/BooleanInput.vue')),
BytesArrayInput: defineAsyncComponent(() => import('components/inputs/BytesArrayInput.vue')),
SignedIntInput: defineAsyncComponent(() => import('components/inputs/SignedIntInput.vue')),
StringArrayInput: defineAsyncComponent(() => import('components/inputs/StringArrayInput.vue')),
StringInput: defineAsyncComponent(() => import('components/inputs/StringInput.vue')),
UnsignedIntArrayInput: defineAsyncComponent(() => import('components/inputs/UnsignedIntArrayInput.vue')),
UnsignedIntInput: defineAsyncComponent(() => import('components/inputs/UnsignedIntInput.vue')),
SignedIntArrayInput: defineAsyncComponent(() => import('components/inputs/SignedIntArrayInput.vue')),
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/DateField.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import { getFormattedUtcOffset } from 'src/lib/utils';

const moment = require('moment');
import moment from 'moment';

export default {
name: 'DateField',
Expand Down
10 changes: 5 additions & 5 deletions src/components/InternalTransactionTable.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script>
import BlockField from 'components/BlockField';
import DateField from 'components/DateField';
import TransactionField from 'components/TransactionField';
import MethodField from 'components/MethodField';
import BlockField from 'components/BlockField.vue';
import DateField from 'components/DateField.vue';
import TransactionField from 'components/TransactionField.vue';
import MethodField from 'components/MethodField.vue';
import { formatWei } from 'src/lib/utils';
import { TRANSFER_SIGNATURES } from 'src/lib/abi/signature/transfer_signatures';
import InternalTxns from 'components/Transaction/InternalTxns';
import InternalTxns from 'components/Transaction/InternalTxns.vue';

export default {
name: 'InternalTransactionTable',
Expand Down
2 changes: 1 addition & 1 deletion src/components/TokenList.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import AddressField from 'components/AddressField';
import AddressField from 'components/AddressField.vue';
import { promptAddToMetamask } from 'src/lib/token-utils';
import { formatWei } from 'src/lib/utils';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Transaction/ERCTransferList.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import AddressField from 'components/AddressField';
import AddressField from 'components/AddressField.vue';
import { formatWei } from 'src/lib/utils';
import { BigNumber } from 'ethers';

Expand Down
72 changes: 36 additions & 36 deletions src/components/Transaction/FragmentList.vue
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
<script>
import FragmentListElement from 'components/Transaction/FragmentListElement';
export default {
name: 'FragmentList',
components: {
FragmentListElement,
},
props: {
fragments: {
type: Array,
required: true,
},
parsedFragments: {
type: Array,
required: true,
},
},
};
</script>
<template>
<div :key="parsedFragments.length == fragments.length" class="q-pa-md">
<div class="row">
<div class="col-12">
<FragmentListElement
v-for="(fragment, i) in fragments"
:key="'ltr' + (parsedFragments[i]) ? '1' : '0' + i"
:rawFragment="fragment"
:fragment="parsedFragments[i]"
/>
</div>
<div v-if="fragments.length !== parsedFragments.length" class="col-12 u-flex--center">
<q-spinner size="md" />
</div>
</div>
</div>
</template>
<script>
import FragmentListElement from 'components/Transaction/FragmentListElement.vue';
export default {
name: 'FragmentList',
components: {
FragmentListElement,
},
props: {
fragments: {
type: Array,
required: true,
},
parsedFragments: {
type: Array,
required: true,
},
},
};
</script>
<template>
<div :key="parsedFragments.length == fragments.length" class="q-pa-md">
<div class="row">
<div class="col-12">
<FragmentListElement
v-for="(fragment, i) in fragments"
:key="'ltr' + (parsedFragments[i]) ? '1' : '0' + i"
:rawFragment="fragment"
:fragment="parsedFragments[i]"
/>
</div>
<div v-if="fragments.length !== parsedFragments.length" class="col-12 u-flex--center">
<q-spinner size="md" />
</div>
</div>
</div>
</template>
2 changes: 1 addition & 1 deletion src/components/Transaction/FragmentListElement.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import JsonViewer from 'vue-json-viewer';
import AddressField from 'components/AddressField';
import AddressField from 'components/AddressField.vue';
import { formatWei } from 'src/lib/utils';
import { BigNumber } from 'ethers';

Expand Down
Loading