From 6380f6680a4f2000d74959896f377422ce00ab46 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Thu, 8 Feb 2024 19:22:00 +0100 Subject: [PATCH] change package name and distribute as module --- LICENSE | 1 + README.md | 69 +++++++++---------- cli.js | 24 +++---- index.js | 172 ++++++++++++++++++++++------------------------ package-lock.json | 49 ++++--------- package.json | 28 ++++---- 6 files changed, 154 insertions(+), 189 deletions(-) diff --git a/LICENSE b/LICENSE index 58a7c5f..0f26308 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ MIT License Copyright (c) 2019 Michel Weststrate +Copyright (c) 2024 Stefan Schubert Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 2ade0ad..ac420dc 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,12 @@ -# relative-deps - -[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/michelweststrate) -Buy Me A Coffee +# link-deps _Installs dependencies from a local checkout, and keeps them in sync, without the limitations of `link`_ ---- - # Summary -Relative deps introduces an additional dependency section in `package.json`, called `relativeDependencies`. +Based on a fork of [relative-deps](https://github.com/mweststrate/relative-deps) by Michel Weststrate. + +`link-deps` introduces an additional dependency section in `package.json`, called `linkDependencies`. This section contains paths to the local sources of any dependency, that will be built and installed over the publicly available versions, when needed. Example `package.json`: @@ -20,14 +17,14 @@ Example `package.json`: "dependencies": { "my-cool-library": "0.1.0" }, - "relativeDependencies": { + "linkDependencies": { "my-cool-library": "../../packages/my-cool-library" }, "scripts": { - "prepare": "relative-deps" + "prepare": "link-deps" }, "devDependencies": { - "relative-deps": "^1.0.0" + "link-deps": "^1.0.0" } } ``` @@ -53,9 +50,9 @@ There are a few existing solutions, but they have their own limitations: - `yarn link` / `npm link`. These work only if there are no peer / shared dependencies involved. If there are shared dependencies, the linked library will resolve those in their _own_ `node_modules`, instead of the `node_modules` of the hosting project, where it would normally be looked up. This results in peer dependencies ending up "twice" in the dependency tree, which often causes confusing behavior. - `yarn workspaces`. Those solve the above issue by putting all dependencies in one large root level `node_modules`. However, this setup is in practice quite obtrusive to the whole development setup. -### How is relative deps different? +### How is `link-deps` different? -Relative deps doesn't fight the problem but tries to emulate a "normal" install. It builds the "linked" library on `prepare` (that is, after installing all deps), packs it, and unpacks it in the `node_modules` of the hosting project. Since there is no linking, or shared `node_modules` involved, the folder structure ends up to be exactly the same as if the thing was installed directly from `yarn` / `npm`. Which avoids a plethora of problems. +`link-deps` doesn't fight the problem but tries to emulate a "normal" install. It builds the "linked" library on `prepare` (that is, after installing all deps), packs it, and unpacks it in the `node_modules` of the hosting project. Since there is no linking, or shared `node_modules` involved, the folder structure ends up to be exactly the same as if the thing was installed directly from `yarn` / `npm`. Which avoids a plethora of problems. Since building a linked package every time `yarn install` is run is expensive, this tool will take a hash of the directory contents of the library first, and only build and install if something changed. @@ -64,26 +61,26 @@ Since building a linked package every time `yarn install` is run is expensive, t ## Installation ```bash -npx relative-deps init +npx link-deps init ``` Options: - `--script` -Alias `-S`. Default: `prepare`. Script name which is using for running `relative-deps`. +Alias `-S`. Default: `prepare`. Script name which is using for running `link-deps`. -Running this script will install `relative-deps`, add script and initialize empty `relativeDependencies` section. +Running this script will install `link-deps`, add script and initialize empty `linkDependencies` section. ```json { "name": "my-project", "devDependencies": { - "relative-deps": "^1.0.0" + "link-deps": "^1.0.0" }, - "relativeDependencies": {}, + "linkDependencies": {}, "scripts": { - "prepare": "relative-deps" + "prepare": "link-deps" } } ``` @@ -94,22 +91,22 @@ Optionally, you can add this step also for more scripts, for example before star { "name": "my-project", "scripts": { - "prepare": "relative-deps", - "prestart": "relative-deps", - "prebuild": "relative-deps", - "pretest": "relative-deps" + "prepare": "link-deps", + "prestart": "link-deps", + "prebuild": "link-deps", + "pretest": "link-deps" } } ``` -In general, this doesn't add to much overhead, since usually relative-deps is able to determine rather quickly (~0.5 sec) that there are no changes. +In general, this doesn't add to much overhead, since usually `link-deps` is able to determine rather quickly (~0.5 sec) that there are no changes. ## Adding a relative dependency -Running following script will initialize `relative-deps` if not initialized yet, find the package at the provided path, install it as normal dependency and pack relative-dependency. +Running following script will initialize `link-deps` if not initialized yet, find the package at the provided path, install it as normal dependency and pack relative dependency. ```bash -npx relative-deps add ../../packages/my-cool-library +npx link-deps add ../../packages/my-cool-library ``` Options: @@ -124,32 +121,30 @@ Alias `-D`. Installs relative dependency in `devDependencies` section. "dependencies": { "my-cool-library": "0.1.0" }, - "relativeDependencies": { + "linkDependencies": { "my-cool-library": "../../packages/my-cool-library" }, "scripts": { - "prepare": "relative-deps" + "prepare": "link-deps" }, "devDependencies": { - "relative-deps": "^1.0.0" + "link-deps": "^1.0.0" } } ``` -Example of a [repository migration to relative-deps](https://github.com/mobxjs/mst-gql/pull/40/commits/4d2c0858f8c44a562c0244466b56f79b0ed7591b) - -## Run `npx relative-deps` when devving! +## Run `npx link-deps` when devving! -The relative deps will automatically be checked for changes, based on the hooks you've set up during [installation](#installation). +The relative dependency will automatically be checked for changes, based on the hooks you've set up during [installation](#installation). -However, you can always trigger a manual check-and-build-if-needed by running `npx relative-deps` (or just `yarn`). If you are working on a project that supports +However, you can always trigger a manual check-and-build-if-needed by running `npx link-deps` (or just `yarn`). If you are working on a project that supports hot reloading, this will makes sure the changes in the relative dependency will automatically show up in your project! ## Watch mode -You can run `relative-deps watch` and it'll run `relative-deps` command when one of the relative dependecies changed, debounced with 500ms. +You can run `link-deps watch` and it'll run `link-deps` command when one of the relative dependencies changed, debounced with 500ms. This can go along with config of your project to watch over the relevant packages and it will automate the process completely, -allowing you to change a library code and to enjoy the befefit of hot-reload. +allowing you to change a library code and to enjoy the benefit of hot-reload. # How @@ -157,9 +152,9 @@ Roughly, it works like this (obviously this can get out of date quickly): ``` - pre: yarn.lock exists or die -- read relativeDeps from nearest package.json +- read linkDependencies from nearest package.json - doesn't exist? warn & exit -- for each relativeDep: +- for each relative dependency: - check if target path exists - if not, do we have the module from normal install? - yes: warn diff --git a/cli.js b/cli.js index 3b1518b..974525c 100755 --- a/cli.js +++ b/cli.js @@ -1,28 +1,28 @@ #!/usr/bin/env node -const yargs = require("yargs"); -const relativeDeps = require("./index"); +import yargs from "yargs/yargs"; +import { initLinkDeps, installLinkDeps, watchLinkDeps, addLinkDeps } from "./index.js"; -yargs +yargs(process.argv.slice(2)) .usage("Usage: $0 [options]") .command({ command: "*", - describe: "Install relative deps", - handler: relativeDeps.installRelativeDeps + describe: "Install linked deps", + handler: installLinkDeps }) .command({ command: "watch", - describe: "Watch relative deps and install on change", - handler: relativeDeps.watchRelativeDeps + describe: "Watch linked deps and install on change", + handler: watchLinkDeps }) .command({ command: "init", - describe: "Initialize relative-deps", - handler: relativeDeps.initRelativeDeps + describe: "Initialize link-deps", + handler: initLinkDeps }) .command({ command: "add [paths...]", - describe: "Add path as relative dependencies", - handler: relativeDeps.addRelativeDeps + describe: "Add path as linked dependencies", + handler: addLinkDeps }) .option("D", { alias: ["dev", "save-dev"], @@ -32,7 +32,7 @@ yargs }) .option("S", { alias: ["script"], - description: "Script for relative-deps", + description: "Script for link-deps", default: "prepare", type: "string" }).argv; diff --git a/index.js b/index.js index 0f4f7a9..cde565c 100755 --- a/index.js +++ b/index.js @@ -1,49 +1,48 @@ -const path = require("path") -const child_process = require("child_process") -const fs = require("fs") -const readPkgUp = require("read-pkg-up") -const rimraf = require("rimraf") -const globby = require("globby") -const checksum = require("checksum") -const merge = require("lodash/merge") -const debounce = require("lodash/debounce") -const { spawn } = require("yarn-or-npm") -const tar = require("tar") - -async function installRelativeDeps() { - const projectPkgJson = readPkgUp.sync() - - const relativeDependencies = projectPkgJson.package.relativeDependencies - - if (!relativeDependencies) { - console.warn("[relative-deps][WARN] No 'relativeDependencies' specified in package.json") +import path from "node:path"; +import fs from "node:fs"; +import crypto from "node:crypto"; +import { readPackageUpSync } from "read-pkg-up"; +import { rimrafSync } from "rimraf"; +import { globby } from "globby"; +import merge from "lodash-es/merge.js"; +import debounce from "lodash-es/debounce.js"; +import yarnOrNpm from "yarn-or-npm"; +import tar from "tar"; + +export async function installLinkDeps() { + const projectPkgJson = readPackageUpSync() + + const dependencies = projectPkgJson?.packageJson.linkDependencies + + if (!dependencies) { + console.warn("[link-deps][WARN] No 'linkDependencies' specified in package.json") process.exit(0) } - const targetDir = path.dirname(projectPkgJson.path) + const targetDir = path.dirname(projectPkgJson?.path) - const depNames = Object.keys(relativeDependencies) + const depNames = Object.keys(dependencies) for (const name of depNames) { - const libDir = path.resolve(targetDir, relativeDependencies[name]) - console.log(`[relative-deps] Checking '${name}' in '${libDir}'`) + const libDir = path.resolve(targetDir, dependencies[name]) + console.log(`[link-deps] Checking '${name}' in '${libDir}'`) const regularDep = - (projectPkgJson.package.dependencies && projectPkgJson.package.dependencies[name]) || - (projectPkgJson.package.devDependencies && projectPkgJson.package.devDependencies[name]) + (projectPkgJson?.packageJson.dependencies && projectPkgJson?.packageJson.dependencies[name]) || + (projectPkgJson?.packageJson.devDependencies && projectPkgJson?.packageJson.devDependencies[name]) if (!regularDep) { - console.warn(`[relative-deps][WARN] The relative dependency '${name}' should also be added as normal- or dev-dependency`) + console.warn(`[link-deps][WARN] The relative dependency '${name}' should also be added as normal- or dev-dependency`) } // Check if target dir exists if (!fs.existsSync(libDir)) { // Nope, but is the dependency mentioned as normal dependency in the package.json? Use that one if (regularDep) { - console.warn(`[relative-deps][WARN] Could not find target directory '${libDir}', using normally installed version ('${regularDep}') instead`) + console.warn(`[link-deps][WARN] Could not find target directory '${libDir}', using normally installed version ('${regularDep}') instead`) return } else { console.error( - `[relative-deps][ERROR] Failed to resolve dependency ${name}: failed to find target directory '${libDir}', and the library is not present as normal depenency either` + `[link-deps][ERROR] Failed to resolve dependency ${name}: failed to find target directory '${libDir}', and the library is not present as normal depenency either` ) process.exit(1) } @@ -58,39 +57,38 @@ async function installRelativeDeps() { buildLibrary(name, libDir) packAndInstallLibrary(name, libDir, targetDir) fs.writeFileSync(hashStore.file, hashStore.hash) - console.log(`[relative-deps] Re-installing ${name}... DONE`) + console.log(`[link-deps] Re-installing ${name}... DONE`) } } } -async function watchRelativeDeps() { - const projectPkgJson = readPkgUp.sync() +export async function watchLinkDeps() { + const projectPkgJson = readPackageUpSync() - const relativeDependencies = projectPkgJson.package.relativeDependencies + const dependencies = projectPkgJson?.packageJson.linkDependencies - if (!relativeDependencies) { - console.warn("[relative-deps][WARN] No 'relativeDependencies' specified in package.json") + if (!dependencies) { + console.warn("[link-deps][WARN] No 'linkDependencies' specified in package.json") process.exit(0) } - Object.values(relativeDependencies).forEach(path => { - fs.watch(path, { recursive: true }, debounce(installRelativeDeps, 500)) + Object.values(dependencies).forEach(path => { + fs.watch(path, { recursive: true }, debounce(installLinkDeps, 500)) }); } async function libraryHasChanged(name, libDir, targetDir, hashStore) { - const hashFile = path.join(targetDir, "node_modules", name, ".relative-deps-hash") + const hashFile = path.join(targetDir, "node_modules", name, ".link-deps-hash") const referenceContents = fs.existsSync(hashFile) ? fs.readFileSync(hashFile, "utf8") : "" - // compute the hahses + // compute the hashes const libFiles = await findFiles(libDir, targetDir) - const hashes = [] - for (file of libFiles) hashes.push(await getFileHash(path.join(libDir, file))) - const contents = libFiles.map((file, index) => hashes[index] + " " + file).join("\n") + const hashes = await Promise.all(libFiles.map(file => getFileHash(path.join(libDir, file)))); + const contents = libFiles.map((file, index) => hashes[index] + " " + file).join("\n") hashStore.file = hashFile hashStore.hash = contents if (contents === referenceContents) { // computed hashes still the same? - console.log("[relative-deps] No changes") + console.log("[link-deps] No changes") return false } // Print which files did change @@ -99,7 +97,7 @@ async function libraryHasChanged(name, libDir, targetDir, hashStore) { const refLines = referenceContents.split("\n") for (let i = 0; i < contentsLines.length; i++) if (contentsLines[i] !== refLines[i]) { - console.log("[relative-deps] Changed file: " + libFiles[i]) //, contentsLines[i], refLines[i]) + console.log("[link-deps] Changed file: " + libFiles[i]) //, contentsLines[i], refLines[i]) break } } @@ -124,19 +122,19 @@ async function findFiles(libDir, targetDir) { function buildLibrary(name, dir) { // Run install if never done before if (!fs.existsSync(path.join(dir, "node_modules"))) { - console.log(`[relative-deps] Running 'install' in ${dir}`) - spawn.sync(["install"], { cwd: dir, stdio: [0, 1, 2] }) + console.log(`[link-deps] Running 'install' in ${dir}`) + yarnOrNpm.spawn.sync(["install"], { cwd: dir, stdio: [0, 1, 2] }) } // Run build script if present const libraryPkgJson = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8")) if (!libraryPkgJson.name === name) { - console.error(`[relative-deps][ERROR] Mismatch in package name: found '${libraryPkgJson.name}', expected '${name}'`) + console.error(`[link-deps][ERROR] Mismatch in package name: found '${libraryPkgJson.name}', expected '${name}'`) process.exit(1) } if (libraryPkgJson.scripts && libraryPkgJson.scripts.build) { - console.log(`[relative-deps] Building ${name} in ${dir}`) - spawn.sync(["run", "build"], { cwd: dir, stdio: [0, 1, 2] }) + console.log(`[link-deps] Building ${name} in ${dir}`) + yarnOrNpm.spawn.sync(["run", "build"], { cwd: dir, stdio: [0, 1, 2] }) } } @@ -144,12 +142,12 @@ function packAndInstallLibrary(name, dir, targetDir) { const libDestDir = path.join(targetDir, "node_modules", name) let fullPackageName try { - console.log("[relative-deps] Copying to local node_modules") - spawn.sync(["pack"], { cwd: dir, stdio: [0, 1, 2] }) + console.log("[link-deps] Copying to local node_modules") + yarnOrNpm.spawn.sync(["pack"], { cwd: dir, stdio: [0, 1, 2] }) if (fs.existsSync(libDestDir)) { // TODO: should we really remove it? Just overwritting could be fine - rimraf.sync(libDestDir) + rimrafSync(libDestDir) } fs.mkdirSync(libDestDir, { recursive: true }) @@ -160,7 +158,7 @@ function packAndInstallLibrary(name, dir, targetDir) { const packagedName = fs.readdirSync(dir).find(file => regex.test(file)) fullPackageName = path.join(dir, packagedName) - console.log(`[relative-deps] Extracting "${fullPackageName}" to ${libDestDir}`) + console.log(`[link-deps] Extracting "${fullPackageName}" to ${libDestDir}`) const [cwd, file] = [libDestDir, fullPackageName].map(absolutePath => path.relative(process.cwd(), absolutePath) @@ -181,12 +179,11 @@ function packAndInstallLibrary(name, dir, targetDir) { } async function getFileHash(file) { - return await new Promise((resolve, reject) => { - checksum.file(file, (error, hash) => { - if (error) reject(error) - else resolve(hash) - }) - }) + const fileContent = fs.readFileSync(file, { encoding: 'utf-8' }); + return crypto + .createHash('sha1') + .update(fileContent, 'utf8') + .digest('hex'); } function addScriptToPackage(script) { @@ -195,60 +192,60 @@ function addScriptToPackage(script) { pkg.scripts = {} } - const msg = `[relative-deps] Adding relative-deps to ${script} script in package.json` + const msg = `[link-deps] Adding link-deps to ${script} script in package.json` if (!pkg.scripts[script]) { console.log(msg) - pkg.scripts[script] = "relative-deps" + pkg.scripts[script] = "link-deps" - } else if (!pkg.scripts[script].includes("relative-deps")) { + } else if (!pkg.scripts[script].includes("link-deps")) { console.log(msg) - pkg.scripts[script] = `${pkg.scripts[script]} && relative-deps` + pkg.scripts[script] = `${pkg.scripts[script]} && link-deps` } setPackageData(pkg) } -function installRelativeDepsPackage() { +export function installLinkDepsPackage() { let pkg = getPackageJson() if (!( - (pkg.devDependencies && pkg.devDependencies["relative-deps"]) || - (pkg.dependencies && pkg.dependencies["relative-deps"]) + (pkg.devDependencies && pkg.devDependencies["link-deps"]) || + (pkg.dependencies && pkg.dependencies["link-deps"]) )) { - console.log('[relative-deps] Installing relative-deps package') - spawn.sync(["add", "-D", "relative-deps"]) + console.log('[link-deps] Installing link-deps package') + yarnOrNpm.spawn.sync(["add", "-D", "link-deps"]) } } -function setupEmptyRelativeDeps() { +function setupEmptyLinkDeps() { let pkg = getPackageJson() - if (!pkg.relativeDependencies) { - console.log(`[relative-deps] Setting up relativeDependencies section in package.json`) - pkg.relativeDependencies = {} + if (!pkg.linkDependencies) { + console.log(`[link-deps] Setting up linkDependencies section in package.json`) + pkg.linkDependencies = {} setPackageData(pkg) } } -function initRelativeDeps({ script }) { - installRelativeDepsPackage() - setupEmptyRelativeDeps() +export function initLinkDeps({ script }) { + installLinkDepsPackage() + setupEmptyLinkDeps() addScriptToPackage(script) } -async function addRelativeDeps({ paths, dev, script }) { - initRelativeDeps({ script }) +export async function addLinkDeps({ paths, dev, script }) { + initLinkDeps({ script }) if (!paths || paths.length === 0) { - console.log(`[relative-deps][WARN] no paths provided running ${script}`) - spawn.sync([script]) + console.log(`[link-deps][WARN] no paths provided running ${script}`) + yarnOrNpm.spawn.sync([script]) return } const libraries = paths.map(relPath => { const libPackagePath = path.resolve(process.cwd(), relPath, "package.json") if (!fs.existsSync(libPackagePath)) { console.error( - `[relative-deps][ERROR] Failed to resolve dependency ${relPath}` + `[link-deps][ERROR] Failed to resolve dependency ${relPath}` ) process.exit(1) } @@ -270,21 +267,21 @@ async function addRelativeDeps({ paths, dev, script }) { libraries.forEach(library => { if (!pkg[depsKey][library.name]) { try { - spawn.sync(["add", ...[dev ? ["-D"] : []], library.name], { stdio: "ignore" }) + yarnOrNpm.spawn.sync(["add", ...[dev ? ["-D"] : []], library.name], { stdio: "ignore" }) } catch (_e) { - console.log(`[relative-deps][WARN] Unable to fetch ${library.name} from registry. Installing as a relative dependency only.`) + console.log(`[link-deps][WARN] Unable to fetch ${library.name} from registry. Installing as a relative dependency only.`) } } }) - if (!pkg.relativeDependencies) pkg.relativeDependencies = {} + if (!pkg.linkDependencies) pkg.linkDependencies = {} libraries.forEach(dependency => { - pkg.relativeDependencies[dependency.name] = dependency.relPath + pkg.linkDependencies[dependency.name] = dependency.relPath }) setPackageData(pkg) - await installRelativeDeps() + await installLinkDeps() } function setPackageData(pkgData) { @@ -297,9 +294,4 @@ function setPackageData(pkgData) { function getPackageJson() { return JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), "utf-8")) -} - -module.exports.watchRelativeDeps = watchRelativeDeps -module.exports.installRelativeDeps = installRelativeDeps -module.exports.initRelativeDeps = initRelativeDeps -module.exports.addRelativeDeps = addRelativeDeps +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 33f4175..40ecc25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,16 @@ { - "name": "relative-deps", - "version": "1.0.5", + "name": "@stefan-schubert-sbb/link-deps", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "relative-deps", - "version": "1.0.5", + "name": "@stefan-schubert-sbb/link-deps", + "version": "1.0.0", "license": "MIT", "dependencies": { - "checksum": "^1.0.0", "globby": "^14.0.0", - "lodash": "^4.17.21", + "lodash-es": "^4.17.21", "read-pkg-up": "^11.0.0", "rimraf": "^5.0.5", "tar": "^6.2.0", @@ -19,7 +18,10 @@ "yarn-or-npm": "^3.0.1" }, "bin": { - "relative-deps": "cli.js" + "link-deps": "cli.js" + }, + "engines": { + "node": ">=18" } }, "node_modules/@babel/code-frame": { @@ -187,17 +189,6 @@ "node": ">=4" } }, - "node_modules/checksum": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/checksum/-/checksum-1.0.0.tgz", - "integrity": "sha512-68bHejnM/sBQhjXcXd2mFusICnqAwikZ9RVMURIacWh7moNjgOdHKimS6yk30Np/PwfR00dceY4b1GwWanu5cg==", - "dependencies": { - "optimist": "~0.3.5" - }, - "bin": { - "checksum": "bin/checksum-cli.js" - } - }, "node_modules/chownr": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", @@ -648,10 +639,10 @@ "node": ">=8" } }, - "node_modules/lodash": { + "node_modules/lodash-es": { "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" }, "node_modules/lru-cache": { "version": "10.2.0", @@ -756,14 +747,6 @@ "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/optimist": { - "version": "0.3.7", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz", - "integrity": "sha512-TCx0dXQzVtSCg2OgY/bO9hjM9cV4XYx09TVK+s3+FhkjT6LovsLe+pPMzpWf+6yXK/hUizs2gUoTw3jHM0VaTQ==", - "dependencies": { - "wordwrap": "~0.0.2" - } - }, "node_modules/p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -1260,14 +1243,6 @@ "node": ">= 8" } }, - "node_modules/wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", diff --git a/package.json b/package.json index 7b34910..5e660b4 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,20 @@ { - "name": "relative-deps", - "version": "1.0.5", + "name": "@stefan-schubert-sbb/link-deps", + "version": "1.0.0", "description": "Installs local dependencies for optimal developer experience", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, "bin": { - "relative-deps": "./cli.js" + "link-deps": "./cli.js" + }, + "type": "module", + "exports": { + "default": "./index.js" + }, + "engines": { + "node": ">=18" }, "repository": { "type": "git", - "url": "git+https://github.com/mweststrate/relative-deps.git" + "url": "git+https://github.com/stefan-schubert-sbb/link-deps.git" }, "keywords": [ "yarn", @@ -20,16 +23,15 @@ "relative", "dependencies" ], - "author": "Michel Weststrate", + "author": "Michel Weststrate, Stefan Schubert", "license": "MIT", "bugs": { - "url": "https://github.com/mweststrate/relative-deps/issues" + "url": "https://github.com/stefan-schubert-sbb/link-deps/issues" }, - "homepage": "https://github.com/mweststrate/relative-deps#readme", + "homepage": "https://github.com/stefan-schubert-sbb/link-deps#readme", "dependencies": { - "checksum": "^1.0.0", "globby": "^14.0.0", - "lodash": "^4.17.21", + "lodash-es": "^4.17.21", "read-pkg-up": "^11.0.0", "rimraf": "^5.0.5", "tar": "^6.2.0",