summaryrefslogtreecommitdiff
path: root/app-misc/anki/files/24.04.1/remove-yarn.patch
blob: 9343f426de5860cc794873b75d82ebc967efc42e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
The ebuild ships a ready-to-use node_modules tarball which does not require
sys-apps/yarn to be installed. Pre-built node_modules allows us to run JS tests
but we lose the ability to hack node packages' source files in YARN_CACHE_FOLDER.

From: Lucio Sauer <watermanpaint@posteo.net>
--- a/build/ninja_gen/src/node.rs
+++ b/build/ninja_gen/src/node.rs
@@ -76,12 +76,11 @@ pub struct YarnInstall<'a> {
 
 impl BuildAction for YarnInstall<'_> {
     fn command(&self) -> &str {
-        "$runner yarn $yarn $out"
+        "$runner yarn $out"
     }
 
     fn files(&mut self, build: &mut impl build::FilesHandle) {
         build.add_inputs("", &self.package_json_and_lock);
-        build.add_inputs("yarn", inputs![":yarn:bin"]);
         build.add_outputs("out", vec!["node_modules/.marker"]);
         for (key, value) in &self.exports {
             let outputs: Vec<_> = value.iter().map(|o| format!("node_modules/{o}")).collect();
@@ -139,9 +138,7 @@ pub fn setup_node(
             );
             build.add_dependency("yarn:bin", inputs![path]);
         }
-        Err(_) => {
-            build.add_action("yarn", YarnSetup {})?;
-        }
+        Err(_) => ()
     };
 
     for binary in binary_exports {
--- a/build/runner/src/yarn.rs
+++ b/build/runner/src/yarn.rs
@@ -1,36 +1,18 @@
 // Copyright: Ankitects Pty Ltd and contributors
 // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
 
-use std::env;
 use std::path::Path;
-use std::process::Command;
 
 use clap::Args;
 
-use crate::run::run_command;
-
 #[derive(Args)]
 pub struct YarnArgs {
-    yarn_bin: String,
     stamp: String,
 }
 
 pub fn setup_yarn(args: YarnArgs) {
     link_node_modules();
 
-    if env::var("OFFLINE_BUILD").is_ok() {
-        println!("OFFLINE_BUILD is set");
-        println!("Running yarn with '--offline' and '--ignore-scripts'.");
-        run_command(
-            Command::new(&args.yarn_bin)
-                .arg("install")
-                .arg("--offline")
-                .arg("--ignore-scripts"),
-        );
-    } else {
-        run_command(Command::new(&args.yarn_bin).arg("install"));
-    }
-
     std::fs::write(args.stamp, b"").unwrap();
 }