Skip to content

Commit

Permalink
feat: adding type=module to package.json (#974)
Browse files Browse the repository at this point in the history
* feat: add `type=module` to `package.json`

* refactor: replace `glob-promise` with `glob`

* feat: converting theme-compiler to ESM

* feat: converting scripts to ESM

* chore: reverts web-component-analyzer

* fix: use commonjs module for web-component-analyzer

* chore: update dependencies

* test: fix interactive chart mock test data (#985)

* fix: use type module for create-efx

* chore: update chalk to latest version

* refactor: simplify create efx tsconfig

* chore: update ts module target

* chore: update package-lock

* fix: replace __dirname with esm compatible syntax

* fix: replace `demo-block` start command with `vite`

* chore: remove `.mjs` from format command

Co-authored-by: wattachai <[email protected]>

* fix: adding await to `isValidAPI()` function that returns a Promise

Co-authored-by: wattachai <[email protected]>

* fix: adding await to `isValidAPI()` function that returns a Promise

Co-authored-by: wattachai <[email protected]>

* refactor: replace `for` loop with `for of`

* refactor: replace IIFE with simple try catch and utilise `getJson()` util

* refactor: simplify `getElementFiles()`

* fix: theme's `package.json` should be relative to current working directory

* refactor: remove `log()` out of try...catch block

* refactor: simplify URL creation

---------

Co-authored-by: wattachai <[email protected]>
  • Loading branch information
wsuwt and wattachai-lseg authored Oct 25, 2023
1 parent 3844f68 commit 9bf21dc
Show file tree
Hide file tree
Showing 57 changed files with 3,181 additions and 2,454 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion cli.mjs → cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'node:path';
import { hideBin } from 'yargs/helpers';
import yargs from 'yargs/yargs';

import { PACKAGES_ROOT, errorHandler, getJSON } from './scripts/helpers/esm.mjs';
import { PACKAGES_ROOT, errorHandler, getJSON } from './scripts/helpers/index.js';

const argvNoBin = hideBin(process.argv);
const argv = yargs(argvNoBin)
Expand Down
5 changes: 2 additions & 3 deletions documents/esbuild.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const fg = require('fast-glob');
const esbuild = require('esbuild');
import fg from 'fast-glob';
import esbuild from 'esbuild'

const DIST = 'dist/resources';

const OPTIONS = {
format: 'esm',
bundle: true,
Expand Down
3 changes: 2 additions & 1 deletion documents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@refinitiv-ui/docs",
"version": "7.5.3",
"private": true,
"type": "module",
"description": "Element Framework Documentation",
"engines": {
"node": ">=16.11.0",
Expand All @@ -11,7 +12,7 @@
"start:dev": "concurrently \"pandora src dist --watch\" \"serve dist -s\"",
"start": "serve dist -s",
"copy:resources": "cp src/_redirects dist/_redirects && cp src/_routes.json dist/_routes.json && cp -r resources dist/resources",
"prebuild": "rm -rf build && nx run @refinitiv-ui/elements:api-analyzer && node ./scripts/element.injector.mjs",
"prebuild": "rm -rf build && nx run @refinitiv-ui/elements:api-analyzer && node ./scripts/element.injector.js",
"build": "pandora build dist --clean --logo=./resources/images/ef-logo.svg",
"postbuild": "npm run copy:resources && npm run bundle",
"bundle": "node esbuild.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'node:path';
import fs from 'node:fs';
import fg from 'fast-glob';
import chalk from 'chalk';
import { Source, Build } from './paths.mjs';
import { Source, Build } from './paths.js';

const PACKAGE_ROOT = '../node_modules/@refinitiv-ui/elements/lib';
const ELEMENT_API_FILENAME = 'custom-elements.md';
Expand Down
2 changes: 1 addition & 1 deletion documents/scripts/paths.mjs → documents/scripts/paths.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'node:path';
import { fileDirName } from '../../scripts/helpers/esm.mjs';
import { fileDirName } from '../../scripts/helpers/index.js';

const { dirName } = fileDirName(import.meta);
const root = path.resolve(dirName, '../');
Expand Down
Loading

0 comments on commit 9bf21dc

Please sign in to comment.