Chart.js/types/tests/autogen.js
Dan Onoshko ce375a6876
feat: add ESM support (#10525)
* feat: add ESM support

* build: rename UMD bundle

* chore: edit supbackages description

* style: disable es/no-import-meta linter rule

* test: dynamic import in cjs module

* docs: edit integrations page

* docs: review fixes

* chore: remove useless regex in webpack config

* ci: test size-limit only for ESM bundle
2022-08-04 18:43:26 -04:00

26 lines
673 B
JavaScript

import * as fs from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url';
import * as helpers from '../../dist/helpers.js';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
let fd;
try {
const fn = path.resolve(__dirname, 'autogen_helpers.ts');
fd = fs.openSync(fn, 'w+');
fs.writeSync(fd, 'import * as helpers from \'../helpers\';\n\n');
fs.writeSync(fd, 'const testKeys = [];\n');
for (const key of Object.keys(helpers)) {
if (key[0] !== '_' && typeof helpers[key] === 'function') {
fs.writeSync(fd, `testKeys.push(helpers.${key});\n`);
}
}
} finally {
if (fd !== undefined) {
fs.closeSync(fd);
}
}