Skip to content
Merged
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
build/
dist/
out/
node_modules/
.snapshots/
*.min.js
4 changes: 2 additions & 2 deletions .github/workflows/sdk-dapp-sc-explorer-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.package.outputs.is-prerelease == 'true'}}
run: echo ${{ steps.package.outputs.is-prerelease}} && cd dist && npm publish --tag next
run: echo ${{ steps.package.outputs.is-prerelease}} && npm publish --tag next

- name: Publish to npmjs
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.package.outputs.is-prerelease == 'false' }}
run: cd dist && npm publish
run: npm publish
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ node_modules
yalc.lock
build
dist
out
.yalc
.idea
.idea/workspace.xml
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [[0.0.6-beta.2]](https://github.com/multiversx/mx-sdk-dapp-sc-explorer/pull/38)] - 2025-12-05
## [[0.0.7-beta.1]](https://github.com/multiversx/mx-sdk-dapp-sc-explorer/pull/40)] - 2025-12-05

- [Updated the build/publish system](https://github.com/multiversx/mx-sdk-dapp-sc-explorer/pull/39)

## [[0.0.6-beta.2]](https://github.com/multiversx/mx-sdk-dapp-sc-explorer/pull/38)] - 2025-12-04

- [Migrate to pnpm, update imports](https://github.com/multiversx/mx-sdk-dapp-sc-explorer/pull/36)

Expand Down
16 changes: 0 additions & 16 deletions esbuild-watch.js

This file was deleted.

86 changes: 81 additions & 5 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,83 @@
const executeBuildCommand = require('./executeBuildCommand');
const svgrPlugin = require('esbuild-plugin-svgr');
const esbuild = require('esbuild');
const glob = require('glob');
const plugin = require('node-stdlib-browser/helpers/esbuild/plugin');
const stdLibBrowser = require('node-stdlib-browser');
const { nodeExternalsPlugin } = require('esbuild-node-externals');
const { sassPlugin, postcssModules } = require('esbuild-sass-plugin');

const cjsBuild = executeBuildCommand('cjs');
const esmBuild = executeBuildCommand('esm');
const basedir = 'src';

cjsBuild();
esmBuild();
const files = glob
.sync('{./src/**/*.tsx,./src/**/*.ts,./src/**/*.scss}')
.filter((file) => !file.includes('.test.') && !file.includes('/__mocks__/'));

const commonConfig = {
entryPoints: files,
platform: 'node',
define: {
global: 'global',
process: 'process',
Buffer: 'Buffer'
},
plugins: [
svgrPlugin(),
plugin(stdLibBrowser),
nodeExternalsPlugin(),
sassPlugin({
loadPaths: [`./${basedir}`, 'node_modules'],
basedir,
transform: postcssModules({
basedir,
scopeBehaviour: 'local',
localsConvention: 'dashes',
generateScopedName: 'mx-sdk-sc-[local]'
}),
silenceDeprecations: [
'legacy-js-api',
'import',
'global-builtin',
'abs-percent',
'color-functions'
]
})
]
};

async function build() {
try {
// ESM build
await esbuild.build({
...commonConfig,
splitting: true,
format: 'esm',
outdir: 'out',
bundle: true,
minify: true,
sourcemap: true,
chunkNames: '__chunks__/[name]-[hash]',
target: ['es2021'],
outExtension: { '.js': '.mjs' },
tsconfig: './tsconfig.esm.json'
});
console.log('[sdk-dapp-sc-explorer][Build] ✅ ESM build completed');

// CJS build
await esbuild.build({
...commonConfig,
format: 'cjs',
outdir: 'out',
minify: true,
sourcemap: true,
target: ['es2021'],
outExtension: { '.js': '.cjs' },
tsconfig: './tsconfig.cjs.json'
});
console.log('[sdk-dapp-sc-explorer][Build] ✅ CJS build completed');
} catch (err) {
console.error(err);
process.exit(1);
}
}

build();
120 changes: 120 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import importPlugin from 'eslint-plugin-import';
import prettierPlugin from 'eslint-plugin-prettier';

/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: [
'build/**',
'dist/**',
'node_modules/**',
'.snapshots/**',
'**/*.min.js'
]
},
{
files: ['**/*.{js,mjs,cjs,ts,tsx}', '**/*.{test,spec}.{js,ts,tsx}'],
languageOptions: {
globals: {
...Object.fromEntries(
Object.entries({
...globals.browser,
...globals.node
}).map(([key, value]) => [key.trim(), value])
)
},
parser: tseslint.parser,
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
ecmaFeatures: {
jsx: true
},
project: './tsconfig.json'
}
},
plugins: {
import: importPlugin,
prettier: prettierPlugin,
'@typescript-eslint': tseslint.plugin
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx']
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
moduleDirectory: ['node_modules', 'src/']
},
typescript: {
alwaysTryTypes: true
}
}
},
rules: {
...pluginJs.configs.recommended.rules,
...tseslint.configs.recommended.rules,
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal'],
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before'
}
],
'newlines-between': 'ignore',
alphabetize: {
order: 'asc',
caseInsensitive: true
}
}
],
'prettier/prettier': ['error', { endOfLine: 'lf' }],
'@typescript-eslint/indent': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false, classes: false }
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
],
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'linebreak-style': ['error', 'unix'],
quotes: [
'error',
'single',
{ avoidEscape: true, allowTemplateLiterals: true }
],
semi: ['error', 'always'],
'no-unused-vars': ['off'],
'no-prototype-builtins': 'off',
'no-async-promise-executor': 'off',
'object-curly-newline': 'off',
'arrow-body-style': 'off',
'implicit-arrow-linebreak': 'off',
'func-names': 'off',
curly: ['error', 'all'],
'operator-linebreak': 'off',
'function-paren-newline': 'off',
'no-shadow': 'warn',
'@typescript-eslint/no-shadow': 'warn',
'prefer-const': 'error'
}
}
];
92 changes: 0 additions & 92 deletions executeBuildCommand.js

This file was deleted.

Loading