From e9f2d5a2680dbfd86c4529e4415690ac5dc7cbff Mon Sep 17 00:00:00 2001 From: Le Vivilet <72156503+levivilet@users.noreply.github.com> Date: Sat, 28 Dec 2024 18:46:18 +0100 Subject: [PATCH] feature: remove unused scripts (#98) --- scripts/build.js | 75 --------------------------- scripts/computeNodeModulesCacheKey.js | 1 - 2 files changed, 76 deletions(-) delete mode 100644 scripts/build.js delete mode 100644 scripts/computeNodeModulesCacheKey.js diff --git a/scripts/build.js b/scripts/build.js deleted file mode 100644 index 45f4699..0000000 --- a/scripts/build.js +++ /dev/null @@ -1,75 +0,0 @@ -import { cp, mkdir, readFile, rm, writeFile } from 'node:fs/promises' -import path, { dirname, join } from 'node:path' -import { fileURLToPath } from 'node:url' -import { execa } from 'execa' - -const __dirname = dirname(fileURLToPath(import.meta.url)) -const root = path.join(__dirname, '..') -const dist = join(root, 'dist') - -const readJson = async (path) => { - const content = await readFile(path, 'utf8') - return JSON.parse(content) -} - -const writeJson = async (path, json) => { - await writeFile(path, JSON.stringify(json, null, 2) + '\n') -} - -const getGitTagFromGit = async () => { - const { stdout, stderr, exitCode } = await execa('git', ['describe', '--exact-match', '--tags'], { - reject: false, - }) - if (exitCode) { - if (exitCode === 128 && stderr.startsWith('fatal: no tag exactly matches')) { - return '0.0.0-dev' - } - return '0.0.0-dev' - } - if (stdout.startsWith('v')) { - return stdout.slice(1) - } - return stdout -} - -const getVersion = async () => { - const { env } = process - const { RG_VERSION, GIT_TAG } = env - if (RG_VERSION) { - if (RG_VERSION.startsWith('v')) { - return RG_VERSION.slice(1) - } - return RG_VERSION - } - if (GIT_TAG) { - if (GIT_TAG.startsWith('v')) { - return GIT_TAG.slice(1) - } - return GIT_TAG - } - return getGitTagFromGit() -} - -await rm(dist, { recursive: true, force: true }) -await mkdir(dist, { recursive: true }) - -await execa(`npx`, ['rollup', '-c']) - -const version = await getVersion() - -const packageJson = await readJson(join(root, 'package.json')) - -delete packageJson.scripts -delete packageJson.devDependencies -delete packageJson.prettier -delete packageJson.jest -delete packageJson.xo -delete packageJson.nodemonConfig -delete packageJson.directories -packageJson.version = version -packageJson.main = 'dist/extensionHostWorkerMain.js' - -await writeJson(join(dist, 'package.json'), packageJson) - -await cp(join(root, 'README.md'), join(dist, 'README.md')) -await cp(join(root, 'LICENSE'), join(dist, 'LICENSE')) diff --git a/scripts/computeNodeModulesCacheKey.js b/scripts/computeNodeModulesCacheKey.js deleted file mode 100644 index 5ddb0d5..0000000 --- a/scripts/computeNodeModulesCacheKey.js +++ /dev/null @@ -1 +0,0 @@ -import '../packages/build/src/computeNodeModulesCacheKey.js'