mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Stacked on https://github.com/vercel/next.js/pull/84877, https://github.com/vercel/next.js/pull/84880 This PR adds a codemod for removing the `unstable_` prefix for stabilized APIs. It is considered to scale by adding more APIs to the `UNSTABLE_TO_STABLE_MAPPING` map in the future to this codemod. Closes NEXT-4739
16 lines
588 B
JavaScript
16 lines
588 B
JavaScript
/* global jest */
|
|
jest.autoMockOff()
|
|
const defineTest = require('jscodeshift/dist/testUtils').defineTest
|
|
const { readdirSync } = require('fs')
|
|
const { join } = require('path')
|
|
|
|
const fixtureDir = 'remove-unstable-prefix'
|
|
const fixtureDirPath = join(__dirname, '..', '__testfixtures__', fixtureDir)
|
|
const fixtures = readdirSync(fixtureDirPath)
|
|
.filter(file => file.endsWith('.input.tsx'))
|
|
.map(file => file.replace('.input.tsx', ''))
|
|
|
|
for (const fixture of fixtures) {
|
|
const prefix = `${fixtureDir}/${fixture}`;
|
|
defineTest(__dirname, fixtureDir, null, prefix, { parser: 'tsx' });
|
|
} |