Skip to content

Commit 9bf21dc

Browse files
feat: adding type=module to package.json (#974)
* 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]>
1 parent 3844f68 commit 9bf21dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3181
-2454
lines changed
File renamed without changes.

cli.mjs renamed to cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import path from 'node:path';
55
import { hideBin } from 'yargs/helpers';
66
import yargs from 'yargs/yargs';
77

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

1010
const argvNoBin = hideBin(process.argv);
1111
const argv = yargs(argvNoBin)

documents/esbuild.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
const fg = require('fast-glob');
2-
const esbuild = require('esbuild');
1+
import fg from 'fast-glob';
2+
import esbuild from 'esbuild'
33

44
const DIST = 'dist/resources';
5-
65
const OPTIONS = {
76
format: 'esm',
87
bundle: true,

documents/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@refinitiv-ui/docs",
33
"version": "7.5.3",
44
"private": true,
5+
"type": "module",
56
"description": "Element Framework Documentation",
67
"engines": {
78
"node": ">=16.11.0",
@@ -11,7 +12,7 @@
1112
"start:dev": "concurrently \"pandora src dist --watch\" \"serve dist -s\"",
1213
"start": "serve dist -s",
1314
"copy:resources": "cp src/_redirects dist/_redirects && cp src/_routes.json dist/_routes.json && cp -r resources dist/resources",
14-
"prebuild": "rm -rf build && nx run @refinitiv-ui/elements:api-analyzer && node ./scripts/element.injector.mjs",
15+
"prebuild": "rm -rf build && nx run @refinitiv-ui/elements:api-analyzer && node ./scripts/element.injector.js",
1516
"build": "pandora build dist --clean --logo=./resources/images/ef-logo.svg",
1617
"postbuild": "npm run copy:resources && npm run bundle",
1718
"bundle": "node esbuild.js"

documents/scripts/element.injector.mjs renamed to documents/scripts/element.injector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'node:path';
22
import fs from 'node:fs';
33
import fg from 'fast-glob';
44
import chalk from 'chalk';
5-
import { Source, Build } from './paths.mjs';
5+
import { Source, Build } from './paths.js';
66

77
const PACKAGE_ROOT = '../node_modules/@refinitiv-ui/elements/lib';
88
const ELEMENT_API_FILENAME = 'custom-elements.md';

documents/scripts/paths.mjs renamed to documents/scripts/paths.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import path from 'node:path';
2-
import { fileDirName } from '../../scripts/helpers/esm.mjs';
2+
import { fileDirName } from '../../scripts/helpers/index.js';
33

44
const { dirName } = fileDirName(import.meta);
55
const root = path.resolve(dirName, '../');

0 commit comments

Comments
 (0)