Avoid import.meta.dirname to be backwards compatible to Node.js 18+ (#1058)
This commit is contained in:
parent
53753f0455
commit
e717c51aa1
|
@ -20,9 +20,11 @@
|
||||||
|
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import { existsSync } from 'fs';
|
import { existsSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { dirname, join } from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
const root = join(import.meta.dirname, '..');
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const root = join(__dirname, '..');
|
||||||
|
|
||||||
// npm install if node_modules was removed (e.g. via npm run clean or scripts/clean.js)
|
// npm install if node_modules was removed (e.g. via npm run clean or scripts/clean.js)
|
||||||
if (!existsSync(join(root, 'node_modules'))) {
|
if (!existsSync(join(root, 'node_modules'))) {
|
||||||
|
|
|
@ -19,9 +19,11 @@
|
||||||
|
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import { rmSync } from 'fs';
|
import { rmSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { dirname, join } from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
const root = join(import.meta.dirname, '..');
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const root = join(__dirname, '..');
|
||||||
|
|
||||||
// remove npm install/build artifacts
|
// remove npm install/build artifacts
|
||||||
rmSync(join(root, 'node_modules'), { recursive: true, force: true });
|
rmSync(join(root, 'node_modules'), { recursive: true, force: true });
|
||||||
|
|
|
@ -18,10 +18,12 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { copyFileSync, existsSync, mkdirSync } from 'fs';
|
import { copyFileSync, existsSync, mkdirSync } from 'fs';
|
||||||
import { join, basename } from 'path';
|
import { dirname, join, basename } from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
import { glob } from 'glob';
|
import { glob } from 'glob';
|
||||||
|
|
||||||
const root = join(import.meta.dirname, '..');
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const root = join(__dirname, '..');
|
||||||
const bundleDir = join(root, 'bundle');
|
const bundleDir = join(root, 'bundle');
|
||||||
|
|
||||||
// Create the bundle directory if it doesn't exist
|
// Create the bundle directory if it doesn't exist
|
||||||
|
|
|
@ -19,9 +19,11 @@
|
||||||
|
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { dirname, join } from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
const root = join(import.meta.dirname, '..');
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const root = join(__dirname, '..');
|
||||||
const generatedDir = join(root, 'packages/cli/src/generated');
|
const generatedDir = join(root, 'packages/cli/src/generated');
|
||||||
const gitCommitFile = join(generatedDir, 'git-commit.ts');
|
const gitCommitFile = join(generatedDir, 'git-commit.ts');
|
||||||
let gitCommitInfo = 'N/A';
|
let gitCommitInfo = 'N/A';
|
||||||
|
|
|
@ -18,10 +18,12 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { spawn, execSync } from 'child_process';
|
import { spawn, execSync } from 'child_process';
|
||||||
import { join } from 'path';
|
import { dirname, join } from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
|
|
||||||
const root = join(import.meta.dirname, '..');
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const root = join(__dirname, '..');
|
||||||
const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf-8'));
|
const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf-8'));
|
||||||
|
|
||||||
// check build status, write warnings to file for app to display if needed
|
// check build status, write warnings to file for app to display if needed
|
||||||
|
|
Loading…
Reference in New Issue