Skip to content

Commit b1caf52

Browse files
aduthjsnajdrhbhalodia
authored
Theme: Update precomputed color ramps script for Node.js v20.10 compatibility (#72971)
Co-authored-by: aduth <aduth@git.wordpress.org> Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: hbhalodia <hbhalodia@git.wordpress.org>
1 parent a4ba451 commit b1caf52

File tree

1 file changed

+5
-2
lines changed
  • packages/theme/bin/generate-default-ramps

1 file changed

+5
-2
lines changed

packages/theme/bin/generate-default-ramps/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* External dependencies
33
*/
44
import { writeFile } from 'node:fs/promises';
5-
import { join } from 'node:path';
5+
import { dirname, join } from 'node:path';
6+
import { fileURLToPath } from 'node:url';
67

78
/**
89
* Internal dependencies
@@ -13,6 +14,8 @@ import {
1314
buildAccentRamp,
1415
} from '../../src/color-ramps/index.ts';
1516

17+
const __dirname = dirname( fileURLToPath( import.meta.url ) );
18+
1619
const bgRamp = buildBgRamp( DEFAULT_SEED_COLORS.bg );
1720
const accentRamps = Object.fromEntries(
1821
[ ...Object.entries( DEFAULT_SEED_COLORS ) ]
@@ -26,7 +29,7 @@ const accentRamps = Object.fromEntries(
2629
const ramps = { bg: bgRamp, ...accentRamps };
2730

2831
const outputPath = join(
29-
import.meta.dirname,
32+
__dirname,
3033
'../../src/color-ramps/lib/default-ramps.ts'
3134
);
3235

0 commit comments

Comments
 (0)