From d19aa5ec8b483754f16a63a5e768c6f3a3aa7560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rge=20N=C3=A6ss?= Date: Thu, 19 Oct 2023 17:31:35 +0200 Subject: [PATCH] chore(scripts): revert convert symlinkDependencies script to ts (#5008) --- ...Dependencies.ts => symlinkDependencies.js} | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) rename scripts/{symlinkDependencies.ts => symlinkDependencies.js} (81%) diff --git a/scripts/symlinkDependencies.ts b/scripts/symlinkDependencies.js similarity index 81% rename from scripts/symlinkDependencies.ts rename to scripts/symlinkDependencies.js index 431e670a2b9..5e2e73ee0a8 100755 --- a/scripts/symlinkDependencies.ts +++ b/scripts/symlinkDependencies.js @@ -1,12 +1,17 @@ #!/usr/bin/env node /* eslint-disable no-sync, no-console, strict */ +/** + * ************************************************************** + * This script needs to stay as a CommonJS/JavaScript file + * (it's executed in node by the `CLI unit tests`, and possibly other places) + * ************************************************************** + **/ 'use strict' -import fs from 'fs' - -import path from 'path' -import rimraf from 'rimraf' -import minimist from 'minimist' +const fs = require('fs') +const path = require('path') +const rimraf = require('rimraf') +const minimist = require('minimist') const argv = minimist(process.argv.slice(2), {boolean: ['all']}) @@ -15,9 +20,9 @@ if (!targetDir) { throw new Error('Target directory must be specified (`.` for current dir)') } -const notSanity = (dir: string) => dir !== '@sanity' -const prefix = (name: string) => `@sanity/${name}` -const normalize = (dir: string) => dir.replace(/@sanity\//g, `@sanity${path.sep}`) +const notSanity = (dir) => dir !== '@sanity' +const prefix = (name) => `@sanity/${name}` +const normalize = (dir) => dir.replace(/@sanity\//g, `@sanity${path.sep}`) const pkgPath = path.join(__dirname, '..', 'packages') const rootPackages = fs.readdirSync(pkgPath).filter(notSanity)