Skip to content

Commit

Permalink
feat(cli): remove patching of tsconfig.json and thus silver-fleece de…
Browse files Browse the repository at this point in the history
…pendency (#8114)
  • Loading branch information
judofyr authored Dec 20, 2024
1 parent 56baefa commit d2f2254
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 26 deletions.
1 change: 0 additions & 1 deletion packages/@sanity/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"pkg-dir": "^5.0.0",
"prettier": "^3.3.0",
"semver": "^7.3.5",
"silver-fleece": "1.1.0",
"validate-npm-package-name": "^3.0.0"
},
"devDependencies": {
Expand Down
18 changes: 1 addition & 17 deletions packages/@sanity/cli/src/actions/init-project/initProject.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {existsSync, readFileSync} from 'node:fs'
import {existsSync} from 'node:fs'
import fs from 'node:fs/promises'
import path from 'node:path'

Expand All @@ -11,7 +11,6 @@ import {deburr, noop} from 'lodash'
import pFilter from 'p-filter'
import resolveFrom from 'resolve-from'
import semver from 'semver'
import {evaluate, patch} from 'silver-fleece'

import {CLIInitStepCompleted} from '../../__telemetry__/init.telemetry'
import {type InitFlags} from '../../commands/init/initCommand'
Expand Down Expand Up @@ -434,21 +433,6 @@ export default async function initSanity(

await writeSourceFiles(sanityFolder(useTypeScript, templateToUse), undefined, hasSrcFolder)

// set tsconfig.json target to ES2017
const tsConfigPath = path.join(workDir, 'tsconfig.json')

if (useTypeScript && existsSync(tsConfigPath)) {
const tsConfigFile = readFileSync(tsConfigPath, 'utf8')
const config = evaluate(tsConfigFile)

if (config.compilerOptions.target?.toLowerCase() !== 'es2017') {
config.compilerOptions.target = 'ES2017'

const newConfig = patch(tsConfigFile, config)
await fs.writeFile(tsConfigPath, Buffer.from(newConfig))
}
}

const appendEnv = unattended ? true : await promptForAppendEnv(prompt, envFilename)

if (appendEnv) {
Expand Down
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d2f2254

Please sign in to comment.