From e2035294f400f9d595b1ce2a40d7aa82f67f888c Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Fri, 3 Feb 2023 16:06:59 -0800 Subject: [PATCH] fix: Fix pnpm lockfile parsing for non-workspace repos. (#595) * Fix fields. * Take in commit. * Move tests. * Test pnpm. * Test npm. * Add tests. * Bump version. * Fix lockfile. --- .yarn/versions/410551b9.yml | 9 +++ crates/cli/tests/docker_test.rs | 16 ++--- crates/cli/tests/node_test.rs | 20 +++--- crates/cli/tests/run_node_test.rs | 67 ++++++++++++++++++- crates/node/lang/src/pnpm/dependency_path.rs | 2 +- crates/node/lang/src/pnpm/mod.rs | 23 +++++-- packages/cli/CHANGELOG.md | 6 ++ tests/fixtures/node-npm/project/moon.yml | 5 ++ .../node-npm/project/package-lock.json | 36 ++++++++++ tests/fixtures/node-npm/project/package.json | 7 ++ .../node-npm/{ => workspaces}/base/moon.yml | 0 .../{ => workspaces}/base/package.json | 0 .../not-in-workspace/package.json | 0 .../{ => workspaces}/other/package.json | 0 .../{ => workspaces}/package-lock.json | 0 .../node-npm/{ => workspaces}/package.json | 0 tests/fixtures/node-pnpm/{ => project}/.npmrc | 0 tests/fixtures/node-pnpm/project/moon.yml | 5 ++ tests/fixtures/node-pnpm/project/package.json | 7 ++ .../fixtures/node-pnpm/project/pnpm-lock.yaml | 15 +++++ tests/fixtures/node-pnpm/workspaces/.npmrc | 2 + .../node-pnpm/{ => workspaces}/base/moon.yml | 0 .../{ => workspaces}/base/package.json | 0 .../not-in-workspace/package.json | 0 .../{ => workspaces}/other/package.json | 0 .../node-pnpm/{ => workspaces}/package.json | 0 .../node-pnpm/{ => workspaces}/pnpm-lock.yaml | 0 .../{ => workspaces}/pnpm-workspace.yaml | 0 .../node-yarn/{ => project}/.yarnrc.yml | 0 tests/fixtures/node-yarn/project/moon.yml | 5 ++ tests/fixtures/node-yarn/project/package.json | 7 ++ tests/fixtures/node-yarn/project/yarn.lock | 23 +++++++ .../fixtures/node-yarn/workspaces/.yarnrc.yml | 1 + .../node-yarn/{ => workspaces}/base/moon.yml | 0 .../{ => workspaces}/base/package.json | 0 .../not-in-workspace/package.json | 0 .../not-in-workspace/yarn.lock | 0 .../{ => workspaces}/other/package.json | 0 .../node-yarn/{ => workspaces}/package.json | 0 .../node-yarn/{ => workspaces}/yarn.lock | 0 tests/fixtures/node-yarn1/project/moon.yml | 5 ++ .../fixtures/node-yarn1/project/package.json | 7 ++ tests/fixtures/node-yarn1/project/yarn.lock | 8 +++ .../node-yarn1/{ => workspaces}/base/moon.yml | 0 .../{ => workspaces}/base/package.json | 0 .../not-in-workspace/package.json | 0 .../not-in-workspace/yarn.lock | 0 .../{ => workspaces}/other/package.json | 0 .../node-yarn1/{ => workspaces}/package.json | 0 .../node-yarn1/{ => workspaces}/yarn.lock | 0 50 files changed, 250 insertions(+), 26 deletions(-) create mode 100644 .yarn/versions/410551b9.yml create mode 100644 tests/fixtures/node-npm/project/moon.yml create mode 100644 tests/fixtures/node-npm/project/package-lock.json create mode 100644 tests/fixtures/node-npm/project/package.json rename tests/fixtures/node-npm/{ => workspaces}/base/moon.yml (100%) rename tests/fixtures/node-npm/{ => workspaces}/base/package.json (100%) rename tests/fixtures/node-npm/{ => workspaces}/not-in-workspace/package.json (100%) rename tests/fixtures/node-npm/{ => workspaces}/other/package.json (100%) rename tests/fixtures/node-npm/{ => workspaces}/package-lock.json (100%) rename tests/fixtures/node-npm/{ => workspaces}/package.json (100%) rename tests/fixtures/node-pnpm/{ => project}/.npmrc (100%) create mode 100644 tests/fixtures/node-pnpm/project/moon.yml create mode 100644 tests/fixtures/node-pnpm/project/package.json create mode 100644 tests/fixtures/node-pnpm/project/pnpm-lock.yaml create mode 100644 tests/fixtures/node-pnpm/workspaces/.npmrc rename tests/fixtures/node-pnpm/{ => workspaces}/base/moon.yml (100%) rename tests/fixtures/node-pnpm/{ => workspaces}/base/package.json (100%) rename tests/fixtures/node-pnpm/{ => workspaces}/not-in-workspace/package.json (100%) rename tests/fixtures/node-pnpm/{ => workspaces}/other/package.json (100%) rename tests/fixtures/node-pnpm/{ => workspaces}/package.json (100%) rename tests/fixtures/node-pnpm/{ => workspaces}/pnpm-lock.yaml (100%) rename tests/fixtures/node-pnpm/{ => workspaces}/pnpm-workspace.yaml (100%) rename tests/fixtures/node-yarn/{ => project}/.yarnrc.yml (100%) create mode 100644 tests/fixtures/node-yarn/project/moon.yml create mode 100644 tests/fixtures/node-yarn/project/package.json create mode 100644 tests/fixtures/node-yarn/project/yarn.lock create mode 100644 tests/fixtures/node-yarn/workspaces/.yarnrc.yml rename tests/fixtures/node-yarn/{ => workspaces}/base/moon.yml (100%) rename tests/fixtures/node-yarn/{ => workspaces}/base/package.json (100%) rename tests/fixtures/node-yarn/{ => workspaces}/not-in-workspace/package.json (100%) rename tests/fixtures/node-yarn/{ => workspaces}/not-in-workspace/yarn.lock (100%) rename tests/fixtures/node-yarn/{ => workspaces}/other/package.json (100%) rename tests/fixtures/node-yarn/{ => workspaces}/package.json (100%) rename tests/fixtures/node-yarn/{ => workspaces}/yarn.lock (100%) create mode 100644 tests/fixtures/node-yarn1/project/moon.yml create mode 100644 tests/fixtures/node-yarn1/project/package.json create mode 100644 tests/fixtures/node-yarn1/project/yarn.lock rename tests/fixtures/node-yarn1/{ => workspaces}/base/moon.yml (100%) rename tests/fixtures/node-yarn1/{ => workspaces}/base/package.json (100%) rename tests/fixtures/node-yarn1/{ => workspaces}/not-in-workspace/package.json (100%) rename tests/fixtures/node-yarn1/{ => workspaces}/not-in-workspace/yarn.lock (100%) rename tests/fixtures/node-yarn1/{ => workspaces}/other/package.json (100%) rename tests/fixtures/node-yarn1/{ => workspaces}/package.json (100%) rename tests/fixtures/node-yarn1/{ => workspaces}/yarn.lock (100%) diff --git a/.yarn/versions/410551b9.yml b/.yarn/versions/410551b9.yml new file mode 100644 index 00000000000..1f2a5d9c201 --- /dev/null +++ b/.yarn/versions/410551b9.yml @@ -0,0 +1,9 @@ +releases: + "@moonrepo/cli": patch + "@moonrepo/core-linux-arm64-gnu": patch + "@moonrepo/core-linux-arm64-musl": patch + "@moonrepo/core-linux-x64-gnu": patch + "@moonrepo/core-linux-x64-musl": patch + "@moonrepo/core-macos-arm64": patch + "@moonrepo/core-macos-x64": patch + "@moonrepo/core-windows-x64-msvc": patch diff --git a/crates/cli/tests/docker_test.rs b/crates/cli/tests/docker_test.rs index d8932ff68f1..234493165e9 100644 --- a/crates/cli/tests/docker_test.rs +++ b/crates/cli/tests/docker_test.rs @@ -93,7 +93,7 @@ mod scaffold_workspace { get_node_depman_fixture_configs("npm"); let sandbox = create_sandbox_with_config( - "node-npm", + "node-npm/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -114,7 +114,7 @@ mod scaffold_workspace { get_node_depman_fixture_configs("pnpm"); let sandbox = create_sandbox_with_config( - "node-pnpm", + "node-pnpm/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -136,7 +136,7 @@ mod scaffold_workspace { get_node_depman_fixture_configs("yarn"); let sandbox = create_sandbox_with_config( - "node-yarn", + "node-yarn/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -158,7 +158,7 @@ mod scaffold_workspace { get_node_depman_fixture_configs("yarn1"); let sandbox = create_sandbox_with_config( - "node-yarn1", + "node-yarn1/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -295,7 +295,7 @@ mod prune_node { get_node_depman_fixture_configs("npm"); let sandbox = create_sandbox_with_config( - "node-npm", + "node-npm/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -327,7 +327,7 @@ mod prune_node { get_node_depman_fixture_configs("pnpm"); let sandbox = create_sandbox_with_config( - "node-pnpm", + "node-pnpm/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -357,7 +357,7 @@ mod prune_node { get_node_depman_fixture_configs("yarn"); let sandbox = create_sandbox_with_config( - "node-yarn", + "node-yarn/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -387,7 +387,7 @@ mod prune_node { get_node_depman_fixture_configs("yarn1"); let sandbox = create_sandbox_with_config( - "node-yarn1", + "node-yarn1/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), diff --git a/crates/cli/tests/node_test.rs b/crates/cli/tests/node_test.rs index b2dee06fc4e..0f86f063bc5 100644 --- a/crates/cli/tests/node_test.rs +++ b/crates/cli/tests/node_test.rs @@ -14,7 +14,7 @@ mod run_script { get_node_depman_fixture_configs("npm"); let sandbox = create_sandbox_with_config( - "node-npm", + "node-npm/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -36,7 +36,7 @@ mod run_script { get_node_depman_fixture_configs("npm"); let sandbox = create_sandbox_with_config( - "node-npm", + "node-npm/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -58,7 +58,7 @@ mod run_script { get_node_depman_fixture_configs("npm"); let sandbox = create_sandbox_with_config( - "node-npm", + "node-npm/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -78,15 +78,17 @@ mod run_script { get_node_depman_fixture_configs("npm"); let sandbox = create_sandbox_with_config( - "node-npm", + "node-npm/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), ); let assert = sandbox.run_moon(|cmd| { - cmd.args(["node", "run-script", "test"]) - .env("MOON_PROJECT_ROOT", get_fixtures_path("node-npm/base")); + cmd.args(["node", "run-script", "test"]).env( + "MOON_PROJECT_ROOT", + get_fixtures_path("node-npm/workspaces/base"), + ); }); assert.success().stdout(predicate::str::contains("> test")); @@ -99,7 +101,7 @@ mod run_script { get_node_depman_fixture_configs("pnpm"); let sandbox = create_sandbox_with_config( - "node-pnpm", + "node-pnpm/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -119,7 +121,7 @@ mod run_script { get_node_depman_fixture_configs("yarn"); let sandbox = create_sandbox_with_config( - "node-yarn", + "node-yarn/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -139,7 +141,7 @@ mod run_script { get_node_depman_fixture_configs("yarn1"); let sandbox = create_sandbox_with_config( - "node-yarn1", + "node-yarn1/workspaces", Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), diff --git a/crates/cli/tests/run_node_test.rs b/crates/cli/tests/run_node_test.rs index 22b83b7f34c..b152adceed5 100644 --- a/crates/cli/tests/run_node_test.rs +++ b/crates/cli/tests/run_node_test.rs @@ -1,9 +1,10 @@ -use moon_config::{NodeConfig, TypeScriptConfig}; +use moon_config::{NodeConfig, TypeScriptConfig, WorkspaceProjects}; use moon_test_utils::{ assert_snapshot, create_sandbox_with_config, get_node_depman_fixture_configs, get_node_fixture_configs, get_typescript_fixture_configs, predicates::prelude::*, Sandbox, }; use moon_utils::string_vec; +use rustc_hash::FxHashMap; use std::fs::read_to_string; fn node_sandbox() -> Sandbox { @@ -46,7 +47,25 @@ fn depman_sandbox(depman: &str) -> Sandbox { get_node_depman_fixture_configs(depman); let sandbox = create_sandbox_with_config( - format!("node-{}", depman), + format!("node-{}/workspaces", depman), + Some(&workspace_config), + Some(&toolchain_config), + Some(&tasks_config), + ); + + sandbox.enable_git(); + sandbox +} + +fn depman_non_workspaces_sandbox(depman: &str) -> Sandbox { + let (mut workspace_config, toolchain_config, tasks_config) = + get_node_depman_fixture_configs(depman); + + workspace_config.projects = + WorkspaceProjects::Sources(FxHashMap::from_iter([("root".to_owned(), ".".to_owned())])); + + let sandbox = create_sandbox_with_config( + format!("node-{}/project", depman), Some(&workspace_config), Some(&toolchain_config), Some(&tasks_config), @@ -704,6 +723,17 @@ mod npm { assert.success(); } + + #[test] + fn works_in_non_workspaces_project() { + let sandbox = depman_non_workspaces_sandbox("npm"); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("run").arg("root:version"); + }); + + assert!(predicate::str::contains("8.0.0").eval(&assert.output())); + } } mod pnpm { @@ -806,6 +836,17 @@ mod pnpm { // assert.success(); // } + + #[test] + fn works_in_non_workspaces_project() { + let sandbox = depman_non_workspaces_sandbox("pnpm"); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("run").arg("root:version"); + }); + + assert!(predicate::str::contains("7.5.0").eval(&assert.output())); + } } mod yarn1 { @@ -886,6 +927,17 @@ mod yarn1 { assert.success(); } + + #[test] + fn works_in_non_workspaces_project() { + let sandbox = depman_non_workspaces_sandbox("yarn1"); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("run").arg("root:version"); + }); + + assert!(predicate::str::contains("1.22.0").eval(&assert.output())); + } } mod yarn { @@ -966,6 +1018,17 @@ mod yarn { assert.success(); } + + #[test] + fn works_in_non_workspaces_project() { + let sandbox = depman_non_workspaces_sandbox("yarn"); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("run").arg("root:version"); + }); + + assert!(predicate::str::contains("3.3.0").eval(&assert.output())); + } } mod profile { diff --git a/crates/node/lang/src/pnpm/dependency_path.rs b/crates/node/lang/src/pnpm/dependency_path.rs index 7ff02e3d0f9..d24f51b5bb4 100644 --- a/crates/node/lang/src/pnpm/dependency_path.rs +++ b/crates/node/lang/src/pnpm/dependency_path.rs @@ -8,7 +8,7 @@ use thiserror::Error; #[derive(Error, Debug, PartialEq, Eq)] pub enum DependencyPathError { - #[error("{0} is an invalid relative dependency path")] + #[error("{0} is an invalid pnpm relative dependency path.")] IsNotAbsolute(String), } diff --git a/crates/node/lang/src/pnpm/mod.rs b/crates/node/lang/src/pnpm/mod.rs index aa78a3a18ee..e6972c42125 100644 --- a/crates/node/lang/src/pnpm/mod.rs +++ b/crates/node/lang/src/pnpm/mod.rs @@ -1,3 +1,5 @@ +// https://github.com/pnpm/pnpm/blob/main/lockfile/lockfile-types/src/index.ts + pub mod dependency_path; pub mod workspace; @@ -21,13 +23,17 @@ type DependencyMap = FxHashMap; pub struct PnpmLockPackage { pub cpu: Option>, pub dependencies: Option, + pub deprecated: Option, pub dev: Option, pub engines: Option>, pub has_bin: Option, + pub libc: Option>, pub optional: Option, pub optional_dependencies: Option, pub os: Option>, + pub patched: Option, pub peer_dependencies: Option, + pub prepare: Option, pub requires_build: Option, pub transitive_peer_dependencies: Option>, pub resolution: PnpmLockResolution, @@ -36,6 +42,7 @@ pub struct PnpmLockPackage { #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct PnpmLockResolution { + pub commit: Option, // git pub integrity: Option, pub tarball: Option, } @@ -44,7 +51,7 @@ pub struct PnpmLockResolution { #[serde(rename_all = "camelCase")] pub struct PnpmLock { pub lockfile_version: Value, - pub importers: FxHashMap, + pub importers: Option>, pub packages: FxHashMap, #[serde(skip)] @@ -69,6 +76,10 @@ pub fn load_lockfile_dependencies(path: PathBuf) -> Result=6.0.0".to_owned()) ])), resolution: - PnpmLockResolution { integrity: Some("sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==".to_owned()), tarball: None }, + PnpmLockResolution { commit: None, integrity: Some("sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==".to_owned()), tarball: None }, ..PnpmLockPackage::default() } ), ( @@ -170,7 +181,7 @@ packages: Value::String("^7.0.0-0".to_owned()) )])), resolution: - PnpmLockResolution { integrity: Some( "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==".to_owned()), tarball: None }, + PnpmLockResolution { commit: None,integrity: Some( "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==".to_owned()), tarball: None }, ..PnpmLockPackage::default() } ), ( @@ -181,7 +192,7 @@ packages: ("node".to_owned(), ">=8".to_owned()) ])), resolution: - PnpmLockResolution { integrity: Some( "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==".to_owned()), tarball: None }, + PnpmLockResolution { commit: None,integrity: Some( "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==".to_owned()), tarball: None }, ..PnpmLockPackage::default() } ), ( @@ -199,7 +210,7 @@ packages: )])), transitive_peer_dependencies: Some(string_vec!["@babel/core", "supports-color"]), resolution: - PnpmLockResolution { integrity: Some( "sha512-1ILtAj+z6bh1vTvaDlcT8501vmkzkVZMk2aiexJy+XWTZ+sb9B7IWedvWadIhOwwL97fiW4eMmN6SrbaHjn12A==".to_owned()), tarball: None }, + PnpmLockResolution { commit: None,integrity: Some( "sha512-1ILtAj+z6bh1vTvaDlcT8501vmkzkVZMk2aiexJy+XWTZ+sb9B7IWedvWadIhOwwL97fiW4eMmN6SrbaHjn12A==".to_owned()), tarball: None }, ..PnpmLockPackage::default() } )]), diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 4ffd9e0dd30..4e3125d217c 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +#### 🐞 Fixes + +- Fixed an issue where pnpm lockfile parsing would fail when not workspaces enabled. + ## 0.23.3 #### 🐞 Fixes diff --git a/tests/fixtures/node-npm/project/moon.yml b/tests/fixtures/node-npm/project/moon.yml new file mode 100644 index 00000000000..3ca1747de30 --- /dev/null +++ b/tests/fixtures/node-npm/project/moon.yml @@ -0,0 +1,5 @@ +language: javascript + +tasks: + version: + command: npm diff --git a/tests/fixtures/node-npm/project/package-lock.json b/tests/fixtures/node-npm/project/package-lock.json new file mode 100644 index 00000000000..3107545a694 --- /dev/null +++ b/tests/fixtures/node-npm/project/package-lock.json @@ -0,0 +1,36 @@ +{ + "name": "test-node-npm-project", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "test-node-npm-project", + "devDependencies": { + "prettier": "2.7.0" + } + }, + "node_modules/prettier": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.0.tgz", + "integrity": "sha512-nwoX4GMFgxoPC6diHvSwmK/4yU8FFH3V8XWtLQrbj4IBsK2pkYhG4kf/ljF/haaZ/aii+wNJqISrCDPgxGWDVQ==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + } + }, + "dependencies": { + "prettier": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.0.tgz", + "integrity": "sha512-nwoX4GMFgxoPC6diHvSwmK/4yU8FFH3V8XWtLQrbj4IBsK2pkYhG4kf/ljF/haaZ/aii+wNJqISrCDPgxGWDVQ==", + "dev": true + } + } +} diff --git a/tests/fixtures/node-npm/project/package.json b/tests/fixtures/node-npm/project/package.json new file mode 100644 index 00000000000..6fa41e1f4e9 --- /dev/null +++ b/tests/fixtures/node-npm/project/package.json @@ -0,0 +1,7 @@ +{ + "name": "test-node-npm-project", + "private": true, + "devDependencies": { + "prettier": "2.7.0" + } +} diff --git a/tests/fixtures/node-npm/base/moon.yml b/tests/fixtures/node-npm/workspaces/base/moon.yml similarity index 100% rename from tests/fixtures/node-npm/base/moon.yml rename to tests/fixtures/node-npm/workspaces/base/moon.yml diff --git a/tests/fixtures/node-npm/base/package.json b/tests/fixtures/node-npm/workspaces/base/package.json similarity index 100% rename from tests/fixtures/node-npm/base/package.json rename to tests/fixtures/node-npm/workspaces/base/package.json diff --git a/tests/fixtures/node-npm/not-in-workspace/package.json b/tests/fixtures/node-npm/workspaces/not-in-workspace/package.json similarity index 100% rename from tests/fixtures/node-npm/not-in-workspace/package.json rename to tests/fixtures/node-npm/workspaces/not-in-workspace/package.json diff --git a/tests/fixtures/node-npm/other/package.json b/tests/fixtures/node-npm/workspaces/other/package.json similarity index 100% rename from tests/fixtures/node-npm/other/package.json rename to tests/fixtures/node-npm/workspaces/other/package.json diff --git a/tests/fixtures/node-npm/package-lock.json b/tests/fixtures/node-npm/workspaces/package-lock.json similarity index 100% rename from tests/fixtures/node-npm/package-lock.json rename to tests/fixtures/node-npm/workspaces/package-lock.json diff --git a/tests/fixtures/node-npm/package.json b/tests/fixtures/node-npm/workspaces/package.json similarity index 100% rename from tests/fixtures/node-npm/package.json rename to tests/fixtures/node-npm/workspaces/package.json diff --git a/tests/fixtures/node-pnpm/.npmrc b/tests/fixtures/node-pnpm/project/.npmrc similarity index 100% rename from tests/fixtures/node-pnpm/.npmrc rename to tests/fixtures/node-pnpm/project/.npmrc diff --git a/tests/fixtures/node-pnpm/project/moon.yml b/tests/fixtures/node-pnpm/project/moon.yml new file mode 100644 index 00000000000..238e71ac4ba --- /dev/null +++ b/tests/fixtures/node-pnpm/project/moon.yml @@ -0,0 +1,5 @@ +language: javascript + +tasks: + version: + command: pnpm diff --git a/tests/fixtures/node-pnpm/project/package.json b/tests/fixtures/node-pnpm/project/package.json new file mode 100644 index 00000000000..3c2f4f3bf97 --- /dev/null +++ b/tests/fixtures/node-pnpm/project/package.json @@ -0,0 +1,7 @@ +{ + "name": "test-node-pnpm-project", + "private": true, + "devDependencies": { + "prettier": "2.7.0" + } +} diff --git a/tests/fixtures/node-pnpm/project/pnpm-lock.yaml b/tests/fixtures/node-pnpm/project/pnpm-lock.yaml new file mode 100644 index 00000000000..2d0d977da07 --- /dev/null +++ b/tests/fixtures/node-pnpm/project/pnpm-lock.yaml @@ -0,0 +1,15 @@ +lockfileVersion: 5.4 + +specifiers: + prettier: 2.7.0 + +devDependencies: + prettier: 2.7.0 + +packages: + + /prettier/2.7.0: + resolution: {integrity: sha512-nwoX4GMFgxoPC6diHvSwmK/4yU8FFH3V8XWtLQrbj4IBsK2pkYhG4kf/ljF/haaZ/aii+wNJqISrCDPgxGWDVQ==} + engines: {node: '>=10.13.0'} + hasBin: true + dev: true diff --git a/tests/fixtures/node-pnpm/workspaces/.npmrc b/tests/fixtures/node-pnpm/workspaces/.npmrc new file mode 100644 index 00000000000..4c2f52b3be7 --- /dev/null +++ b/tests/fixtures/node-pnpm/workspaces/.npmrc @@ -0,0 +1,2 @@ +auto-install-peers=true +strict-peer-dependencies=false diff --git a/tests/fixtures/node-pnpm/base/moon.yml b/tests/fixtures/node-pnpm/workspaces/base/moon.yml similarity index 100% rename from tests/fixtures/node-pnpm/base/moon.yml rename to tests/fixtures/node-pnpm/workspaces/base/moon.yml diff --git a/tests/fixtures/node-pnpm/base/package.json b/tests/fixtures/node-pnpm/workspaces/base/package.json similarity index 100% rename from tests/fixtures/node-pnpm/base/package.json rename to tests/fixtures/node-pnpm/workspaces/base/package.json diff --git a/tests/fixtures/node-pnpm/not-in-workspace/package.json b/tests/fixtures/node-pnpm/workspaces/not-in-workspace/package.json similarity index 100% rename from tests/fixtures/node-pnpm/not-in-workspace/package.json rename to tests/fixtures/node-pnpm/workspaces/not-in-workspace/package.json diff --git a/tests/fixtures/node-pnpm/other/package.json b/tests/fixtures/node-pnpm/workspaces/other/package.json similarity index 100% rename from tests/fixtures/node-pnpm/other/package.json rename to tests/fixtures/node-pnpm/workspaces/other/package.json diff --git a/tests/fixtures/node-pnpm/package.json b/tests/fixtures/node-pnpm/workspaces/package.json similarity index 100% rename from tests/fixtures/node-pnpm/package.json rename to tests/fixtures/node-pnpm/workspaces/package.json diff --git a/tests/fixtures/node-pnpm/pnpm-lock.yaml b/tests/fixtures/node-pnpm/workspaces/pnpm-lock.yaml similarity index 100% rename from tests/fixtures/node-pnpm/pnpm-lock.yaml rename to tests/fixtures/node-pnpm/workspaces/pnpm-lock.yaml diff --git a/tests/fixtures/node-pnpm/pnpm-workspace.yaml b/tests/fixtures/node-pnpm/workspaces/pnpm-workspace.yaml similarity index 100% rename from tests/fixtures/node-pnpm/pnpm-workspace.yaml rename to tests/fixtures/node-pnpm/workspaces/pnpm-workspace.yaml diff --git a/tests/fixtures/node-yarn/.yarnrc.yml b/tests/fixtures/node-yarn/project/.yarnrc.yml similarity index 100% rename from tests/fixtures/node-yarn/.yarnrc.yml rename to tests/fixtures/node-yarn/project/.yarnrc.yml diff --git a/tests/fixtures/node-yarn/project/moon.yml b/tests/fixtures/node-yarn/project/moon.yml new file mode 100644 index 00000000000..d2b90f44dae --- /dev/null +++ b/tests/fixtures/node-yarn/project/moon.yml @@ -0,0 +1,5 @@ +language: javascript + +tasks: + version: + command: yarn diff --git a/tests/fixtures/node-yarn/project/package.json b/tests/fixtures/node-yarn/project/package.json new file mode 100644 index 00000000000..9fc09c046aa --- /dev/null +++ b/tests/fixtures/node-yarn/project/package.json @@ -0,0 +1,7 @@ +{ + "name": "test-node-yarn-project", + "private": true, + "devDependencies": { + "prettier": "2.7.0" + } +} diff --git a/tests/fixtures/node-yarn/project/yarn.lock b/tests/fixtures/node-yarn/project/yarn.lock new file mode 100644 index 00000000000..9f3dbaec616 --- /dev/null +++ b/tests/fixtures/node-yarn/project/yarn.lock @@ -0,0 +1,23 @@ +# This file is generated by running "yarn install" inside your project. +# Manual changes might be lost - proceed with caution! + +__metadata: + version: 6 + cacheKey: 8 + +"prettier@npm:2.7.0": + version: 2.7.0 + resolution: "prettier@npm:2.7.0" + bin: + prettier: bin-prettier.js + checksum: 5b55bb1dced9d16635b83229df8e670d150890fdb343f19e8a66e610094a108e960c0f57352b3e5cdbc4eff4ef00a834406047ffcd9f20bd22a6497ba143c81f + languageName: node + linkType: hard + +"test-node-yarn-project@workspace:.": + version: 0.0.0-use.local + resolution: "test-node-yarn-project@workspace:." + dependencies: + prettier: 2.7.0 + languageName: unknown + linkType: soft diff --git a/tests/fixtures/node-yarn/workspaces/.yarnrc.yml b/tests/fixtures/node-yarn/workspaces/.yarnrc.yml new file mode 100644 index 00000000000..3186f3f0795 --- /dev/null +++ b/tests/fixtures/node-yarn/workspaces/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/tests/fixtures/node-yarn/base/moon.yml b/tests/fixtures/node-yarn/workspaces/base/moon.yml similarity index 100% rename from tests/fixtures/node-yarn/base/moon.yml rename to tests/fixtures/node-yarn/workspaces/base/moon.yml diff --git a/tests/fixtures/node-yarn/base/package.json b/tests/fixtures/node-yarn/workspaces/base/package.json similarity index 100% rename from tests/fixtures/node-yarn/base/package.json rename to tests/fixtures/node-yarn/workspaces/base/package.json diff --git a/tests/fixtures/node-yarn/not-in-workspace/package.json b/tests/fixtures/node-yarn/workspaces/not-in-workspace/package.json similarity index 100% rename from tests/fixtures/node-yarn/not-in-workspace/package.json rename to tests/fixtures/node-yarn/workspaces/not-in-workspace/package.json diff --git a/tests/fixtures/node-yarn/not-in-workspace/yarn.lock b/tests/fixtures/node-yarn/workspaces/not-in-workspace/yarn.lock similarity index 100% rename from tests/fixtures/node-yarn/not-in-workspace/yarn.lock rename to tests/fixtures/node-yarn/workspaces/not-in-workspace/yarn.lock diff --git a/tests/fixtures/node-yarn/other/package.json b/tests/fixtures/node-yarn/workspaces/other/package.json similarity index 100% rename from tests/fixtures/node-yarn/other/package.json rename to tests/fixtures/node-yarn/workspaces/other/package.json diff --git a/tests/fixtures/node-yarn/package.json b/tests/fixtures/node-yarn/workspaces/package.json similarity index 100% rename from tests/fixtures/node-yarn/package.json rename to tests/fixtures/node-yarn/workspaces/package.json diff --git a/tests/fixtures/node-yarn/yarn.lock b/tests/fixtures/node-yarn/workspaces/yarn.lock similarity index 100% rename from tests/fixtures/node-yarn/yarn.lock rename to tests/fixtures/node-yarn/workspaces/yarn.lock diff --git a/tests/fixtures/node-yarn1/project/moon.yml b/tests/fixtures/node-yarn1/project/moon.yml new file mode 100644 index 00000000000..d2b90f44dae --- /dev/null +++ b/tests/fixtures/node-yarn1/project/moon.yml @@ -0,0 +1,5 @@ +language: javascript + +tasks: + version: + command: yarn diff --git a/tests/fixtures/node-yarn1/project/package.json b/tests/fixtures/node-yarn1/project/package.json new file mode 100644 index 00000000000..3fbf5fc3d41 --- /dev/null +++ b/tests/fixtures/node-yarn1/project/package.json @@ -0,0 +1,7 @@ +{ + "name": "test-node-yarn1-project", + "private": true, + "devDependencies": { + "prettier": "2.7.0" + } +} diff --git a/tests/fixtures/node-yarn1/project/yarn.lock b/tests/fixtures/node-yarn1/project/yarn.lock new file mode 100644 index 00000000000..f87f2726d0a --- /dev/null +++ b/tests/fixtures/node-yarn1/project/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +prettier@2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.0.tgz#a4fdae07e5596c51c9857ea676cd41a0163879d6" + integrity sha512-nwoX4GMFgxoPC6diHvSwmK/4yU8FFH3V8XWtLQrbj4IBsK2pkYhG4kf/ljF/haaZ/aii+wNJqISrCDPgxGWDVQ== diff --git a/tests/fixtures/node-yarn1/base/moon.yml b/tests/fixtures/node-yarn1/workspaces/base/moon.yml similarity index 100% rename from tests/fixtures/node-yarn1/base/moon.yml rename to tests/fixtures/node-yarn1/workspaces/base/moon.yml diff --git a/tests/fixtures/node-yarn1/base/package.json b/tests/fixtures/node-yarn1/workspaces/base/package.json similarity index 100% rename from tests/fixtures/node-yarn1/base/package.json rename to tests/fixtures/node-yarn1/workspaces/base/package.json diff --git a/tests/fixtures/node-yarn1/not-in-workspace/package.json b/tests/fixtures/node-yarn1/workspaces/not-in-workspace/package.json similarity index 100% rename from tests/fixtures/node-yarn1/not-in-workspace/package.json rename to tests/fixtures/node-yarn1/workspaces/not-in-workspace/package.json diff --git a/tests/fixtures/node-yarn1/not-in-workspace/yarn.lock b/tests/fixtures/node-yarn1/workspaces/not-in-workspace/yarn.lock similarity index 100% rename from tests/fixtures/node-yarn1/not-in-workspace/yarn.lock rename to tests/fixtures/node-yarn1/workspaces/not-in-workspace/yarn.lock diff --git a/tests/fixtures/node-yarn1/other/package.json b/tests/fixtures/node-yarn1/workspaces/other/package.json similarity index 100% rename from tests/fixtures/node-yarn1/other/package.json rename to tests/fixtures/node-yarn1/workspaces/other/package.json diff --git a/tests/fixtures/node-yarn1/package.json b/tests/fixtures/node-yarn1/workspaces/package.json similarity index 100% rename from tests/fixtures/node-yarn1/package.json rename to tests/fixtures/node-yarn1/workspaces/package.json diff --git a/tests/fixtures/node-yarn1/yarn.lock b/tests/fixtures/node-yarn1/workspaces/yarn.lock similarity index 100% rename from tests/fixtures/node-yarn1/yarn.lock rename to tests/fixtures/node-yarn1/workspaces/yarn.lock