Skip to content

Commit

Permalink
refactor: Convert to conceptually private context
Browse files Browse the repository at this point in the history
BREAKING CHANGE
Modules in  folder are no longer considerd public and are subject to changes
in any release phase
  • Loading branch information
medikoo committed Nov 27, 2023
1 parent 4baa7a9 commit 2c08940
Show file tree
Hide file tree
Showing 53 changed files with 44 additions and 44 deletions.
6 changes: 3 additions & 3 deletions install-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const toPlainObject = require("es5-ext/object/normalize-options")
, { resolve } = require("path")
, ensurePackageName = require("./lib/ensure-package-name")
, NpmCrossLinkError = require("./lib/npm-cross-link-error")
, ensureConfiguration = require("./lib/private/ensure-user-configuration")
, createProgressData = require("./lib/private/create-progress-data")
, installDependencies = require("./lib/private/install-dependencies")
, ensureConfiguration = require("./lib/ensure-user-configuration")
, createProgressData = require("./lib/create-progress-data")
, installDependencies = require("./lib/install-dependencies")
, getPackageJson = require("./lib/get-package-json");

module.exports = (path, dependencyNames, userConfiguration, inputOptions = {}) => {
Expand Down
8 changes: 4 additions & 4 deletions install-packages-globally.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
const ensureObject = require("es5-ext/object/valid-object")
, toPlainObject = require("es5-ext/object/normalize-options")
, ensurePackageName = require("./lib/ensure-package-name")
, ensureConfiguration = require("./lib/private/ensure-user-configuration")
, createProgressData = require("./lib/private/create-progress-data")
, installPackageGlobally = require("./lib/private/install-package-globally")
, installMaintainedPackage = require("./lib/private/install-maintained-package");
, ensureConfiguration = require("./lib/ensure-user-configuration")
, createProgressData = require("./lib/create-progress-data")
, installPackageGlobally = require("./lib/install-package-globally")
, installMaintainedPackage = require("./lib/install-maintained-package");

module.exports = (packageNames, userConfiguration, inputOptions = {}) => {
packageNames = Array.from(ensureObject(packageNames), ensurePackageName);
Expand Down
6 changes: 3 additions & 3 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const toPlainObject = require("es5-ext/object/normalize-options")
, ensureString = require("es5-ext/object/validate-stringifiable-value")
, { resolve, basename } = require("path")
, NpmCrossLinkError = require("./lib/npm-cross-link-error")
, ensureConfiguration = require("./lib/private/ensure-user-configuration")
, createProgressData = require("./lib/private/create-progress-data")
, install = require("./lib/private/install")
, ensureConfiguration = require("./lib/ensure-user-configuration")
, createProgressData = require("./lib/create-progress-data")
, install = require("./lib/install")
, getPackageJson = require("./lib/get-package-json");

module.exports = (path, userConfiguration, inputOptions = {}) => {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const log = require("log").get("npm-cross-link")
, format = require("cli-sprintf-format")
, cliFooter = require("cli-progress-footer")()
, NpmCrossLinkError = require("../npm-cross-link-error")
, resolveUserConfiguration = require("../private/resolve-user-configuration")
, resolveUserConfiguration = require("../resolve-user-configuration")
, install = require("../../install")
, installPackagesGlobally = require("../../install-packages-globally")
, installDependencies = require("../../install-dependencies")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const ensureArray = require("es5-ext/array/valid-array")
, { resolve } = require("path")
, { homedir } = require("os")
, log = require("log").get("npm-cross-link:configuration").debug
, NpmCrossLinkError = require("../npm-cross-link-error");
, NpmCrossLinkError = require("./npm-cross-link-error");

module.exports = userConfiguration => {
log.debug("user input: %O", userConfiguration);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const optionalChaining = require("es5-ext/optional-chaining")
, log = require("log").get("npm-cross-link")
, isDirectory = require("fs2/is-directory")
, rm = require("fs2/rm")
, NpmCrossLinkError = require("../../npm-cross-link-error")
, getPackageJson = require("../../get-package-json")
, getNpmModulesPath = require("../../get-npm-modules-path")
, NpmCrossLinkError = require("../npm-cross-link-error")
, getPackageJson = require("../get-package-json")
, getNpmModulesPath = require("../get-npm-modules-path")
, cleanupNpmInstall = require("../cleanup-npm-install")
, setupRepository = require("../setup-repository")
, resolveExternalContext = require("../resolve-external-context")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const { resolve } = require("path")
, isSymlink = require("fs2/is-symlink")
, rm = require("fs2/rm")
, cleanupNpmInstall = require("../cleanup-npm-install")
, getNpmModulesPath = require("../../get-npm-modules-path")
, runProgram = require("../../run-program");
, getNpmModulesPath = require("../get-npm-modules-path")
, runProgram = require("../run-program");

module.exports = async packageContext => {
const { path, name, installationJobs, isNameMismatch } = packageContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const { resolve } = require("path")
, log = require("log").get("npm-cross-link")
, wait = require("timers-ext/promise/sleep")
, rm = require("fs2/rm")
, NpmCrossLinkError = require("../npm-cross-link-error")
, getNpmModulesPath = require("../get-npm-modules-path")
, runProgram = require("../run-program")
, NpmCrossLinkError = require("./npm-cross-link-error")
, getNpmModulesPath = require("./get-npm-modules-path")
, runProgram = require("./run-program")
, nonOverridableExternals = require("./non-overridable-externals")
, resolveExternalContext = require("./resolve-external-context");

Expand Down
2 changes: 1 addition & 1 deletion lib/private/install.js → lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { basename } = require("path")
, wait = require("timers-ext/promise/sleep")
, cleanupNpmInstall = require("./cleanup-npm-install")
, getPackageJson = require("../get-package-json")
, getPackageJson = require("./get-package-json")
, removeNonDirectDependencies = require("./remove-non-direct-dependencies")
, installMaintainedPackage = require("./install-maintained-package")
, updatePackageJsonDependencies = require("./update-package-json-dependencies")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const optionalChaining = require("es5-ext/optional-chaining")
, log = require("log").get("npm-cross-link")
, isDirectory = require("fs2/is-directory")
, semver = require("semver")
, getPackageJson = require("../get-package-json")
, getPackageJson = require("./get-package-json")
, getMetadata = require("./get-metadata");

const getVersions = ({ externalContext: { metadata } }) => Object.keys(metadata.versions);
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { resolve } = require("path")
, { homedir } = require("os")
, isModuleNotFoundError = require("ncjsm/is-module-not-found-error")
, NpmCrossLinkError = require("../npm-cross-link-error");
, NpmCrossLinkError = require("./npm-cross-link-error");

const configurationPath = resolve(homedir(), ".npm-cross-link");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";

const log = require("log").get("npm-cross-link")
, getPackageJson = require("../../get-package-json")
, getPackageJson = require("../get-package-json")
, processDependency = require("./process-dependency")
, setupRequiredDependencies = require("./setup-required-dependencies");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { resolve } = require("path")
, log = require("log").get("npm-cross-link")
, semver = require("semver")
, getNpmModulesPath = require("../../get-npm-modules-path")
, getNpmModulesPath = require("../get-npm-modules-path")
, setupExternal = require("./setup-external")
, setupLocal = require("./setup-local")
, resolveLogLevel = require("./resolve-log-level");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const optionalChaining = require("es5-ext/optional-chaining")
, isDirectory = require("fs2/is-directory")
, rm = require("fs2/rm")
, log = require("log").get("npm-cross-link")
, getPackageJson = require("../../../get-package-json")
, getPackageJson = require("../../get-package-json")
, muteErrorIfOptional = require("../mute-error-if-optional")
, prepareDependency = require("./prepare")
, resolveBinariesDict = require("./resolve-binaries-dict")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const memoizee = require("memoizee")
, { resolve } = require("path")
, rm = require("fs2/rm")
, log = require("log").get("npm-cross-link")
, runProgram = require("../../../../run-program");
, runProgram = require("../../../run-program");

const repoDataRe = /^git\+(?<url>[^#]+)(?:#(?<target>.*))?$/u
, refRe = /^refs\/(?:heads|tags)\/(?<target>.+)$/u;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const memoizee = require("memoizee")
, tmpdir = require("os").tmpdir()
, log = require("log").get("npm-cross-link")
, cachePath = require("../../../cache").path
, getPackageJson = require("../../../../get-package-json")
, getPackageJson = require("../../../get-package-json")
, updatePackageJson = require("../../../update-package-json")
, resolveBinariesDict = require("../resolve-binaries-dict");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { resolve } = require("path")
, rename = require("fs2/rename")
, rm = require("fs2/rm")
, log = require("log").get("npm-cross-link")
, runProgram = require("../../../../run-program");
, runProgram = require("../../../run-program");

module.exports = {
isApplicable: () => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const optionalChaining = require("es5-ext/optional-chaining")
, writeFile = require("fs2/write-file")
, tar = require("tar")
, log = require("log").get("npm-cross-link")
, runProgram = require("../../../../run-program")
, runProgram = require("../../../run-program")
, resolveNpmAuthToken = require("../../resolve-npm-auth-token")
, nodeFetch = require("node-fetch");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";

const memoizee = require("memoizee")
, getPackageJson = require("../../../get-package-json");
, getPackageJson = require("../../get-package-json");

module.exports = memoizee(
path => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const log = require("log").get("npm-cross-link")
, isSymlink = require("fs2/is-symlink")
, rm = require("fs2/rm")
, NpmCrossLinkError = require("../../../npm-cross-link-error")
, runProgram = require("../../../run-program")
, NpmCrossLinkError = require("../../npm-cross-link-error")
, runProgram = require("../../run-program")
, installExternal = require("../install-external")
, muteErrorIfOptional = require("../mute-error-if-optional")
, resolveIsToBeLinked = require("./resolve-is-to-be-linked");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const rm = require("fs2/rm")
, log = require("log").get("npm-cross-link")
, runProgram = require("../../../run-program");
, runProgram = require("../../run-program");

module.exports = async dependencyContext => {
const { dependentContext, name, path } = dependencyContext;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const optionalChaining = require("es5-ext/optional-chaining")
, log = require("log").get("npm-cross-link")
, getPackageJson = require("../../../get-package-json")
, getPackageJson = require("../../get-package-json")
, resolveMaintainedPackagePath = require("../../resolve-maintained-package-path");

module.exports = (dependencyContext, userConfiguration, { locals }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const memoizee = require("memoizee")
, log = require("log").get("npm-cross-link")
, isDirectory = require("fs2/is-directory")
, rm = require("fs2/rm")
, runProgram = require("../run-program");
, runProgram = require("./run-program");

const resolveCurrentBranch = async path =>
String(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@
"overrides": [
{
"files": [
"lib/private/install-dependencies/index.js",
"lib/private/install-maintained-package/finalize.js",
"lib/private/setup-dependencies/index.js",
"lib/private/setup-dependencies/setup-required-dependencies.js",
"lib/private/update-all.js"
"lib/install-dependencies/index.js",
"lib/install-maintained-package/finalize.js",
"lib/setup-dependencies/index.js",
"lib/setup-dependencies/setup-required-dependencies.js",
"lib/update-all.js"
],
"rules": {
"no-await-in-loop": "off"
Expand Down
6 changes: 3 additions & 3 deletions update-all.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use strict";

const toPlainObject = require("es5-ext/object/normalize-options")
, ensureConfiguration = require("./lib/private/ensure-user-configuration")
, createProgressData = require("./lib/private/create-progress-data")
, updateAll = require("./lib/private/update-all");
, ensureConfiguration = require("./lib/ensure-user-configuration")
, createProgressData = require("./lib/create-progress-data")
, updateAll = require("./lib/update-all");

module.exports = (configuration, options = {}) => {
const progressData = createProgressData();
Expand Down

0 comments on commit 2c08940

Please sign in to comment.