Convert to ESM
This commit is contained in:
@@ -12,7 +12,7 @@ import * as path from 'path';
|
||||
const format = (source: string, regex: RegExp | string, replaceValue: string): string =>
|
||||
source.replace(regex, replaceValue);
|
||||
|
||||
let generatedGraphQLFilePath = path.resolve(__dirname, '../../src/lib/graphql/generated/graphql.ts');
|
||||
let generatedGraphQLFilePath = path.resolve(import.meta.dirname, '../../src/lib/graphql/generated/graphql.ts');
|
||||
let generatedGraphQLFile = fs.readFileSync(generatedGraphQLFilePath, 'utf8');
|
||||
|
||||
// add logic to format the codegen generated graphql file
|
||||
@@ -33,7 +33,7 @@ fs.writeFileSync(generatedGraphQLFilePath, fixSubscriptionHookNameSuffix);
|
||||
/* */
|
||||
/* ****************************************** */
|
||||
|
||||
generatedGraphQLFilePath = path.resolve(__dirname, '../../src/lib/graphql/generated/apollo-helpers.ts');
|
||||
generatedGraphQLFilePath = path.resolve(import.meta.dirname, '../../src/lib/graphql/generated/apollo-helpers.ts');
|
||||
generatedGraphQLFile = fs.readFileSync(generatedGraphQLFilePath, 'utf8');
|
||||
|
||||
const addImports = format(
|
||||
|
||||
@@ -284,7 +284,7 @@ const getContributorsForRange = async (url: string, authToken: string): Promise<
|
||||
const getLanguageLinesFromChangelog = (): Promise<string[]> => {
|
||||
const fileReadPromise = new ControlledPromise<string[]>();
|
||||
|
||||
const changelogFile = path.resolve(__dirname, '../../CHANGELOG.md');
|
||||
const changelogFile = path.resolve(import.meta.dirname, '../../CHANGELOG.md');
|
||||
const fileStream = fs.createReadStream(changelogFile);
|
||||
const fileLineReader = readline.createInterface({
|
||||
input: fileStream,
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
const outputFilePath = path.join(__dirname, '../../src/lib/dayjs/Locales.ts');
|
||||
const resourcesDirPath = path.join(__dirname, '../../node_modules/dayjs/locale');
|
||||
const outputFilePath = path.join(import.meta.dirname, '../../src/lib/dayjs/Locales.ts');
|
||||
const resourcesDirPath = path.join(import.meta.dirname, '../../node_modules/dayjs/locale');
|
||||
|
||||
const dayjsLocaleFileNames = fs.readdirSync(resourcesDirPath);
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
const outputFilePath = path.join(__dirname, '../../src/lib/dayjs/LocaleImporter.ts');
|
||||
const resourcesDirPath = path.join(__dirname, '../../node_modules/dayjs/locale');
|
||||
const outputFilePath = path.join(import.meta.dirname, '../../src/lib/dayjs/LocaleImporter.ts');
|
||||
const resourcesDirPath = path.join(import.meta.dirname, '../../node_modules/dayjs/locale');
|
||||
|
||||
const dayjsLocaleFileNames = fs.readdirSync(resourcesDirPath);
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
const outputFilePath = path.join(__dirname, '../../src/i18n/index.ts');
|
||||
const resourcesDirPath = path.join(__dirname, '../../public/locales');
|
||||
const outputFilePath = path.join(import.meta.dirname, '../../src/i18n/index.ts');
|
||||
const resourcesDirPath = path.join(import.meta.dirname, '../../public/locales');
|
||||
|
||||
const resourceFileNames = fs.readdirSync(resourcesDirPath);
|
||||
|
||||
|
||||
@@ -6,11 +6,5 @@
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"ts-node": {
|
||||
// these options are overrides used only by ts-node
|
||||
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
|
||||
"compilerOptions": {
|
||||
"module": "commonjs"
|
||||
}
|
||||
}
|
||||
"ts-node": {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user