@repokit/core 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/installation/install.sh
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
set -e
|
|
2
2
|
|
|
3
3
|
SCRIPT_ORIGIN=$(pwd)
|
|
4
|
-
|
|
4
|
+
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
|
|
5
|
+
NODE_MODULES_PARENT="$(pwd)/../"
|
|
6
|
+
REPO_ROOT=${GIT_ROOT:-$NODE_MODULES_PARENT}
|
|
5
7
|
|
|
6
8
|
cd $REPO_ROOT
|
|
7
9
|
|
|
@@ -35,7 +37,7 @@ fi
|
|
|
35
37
|
|
|
36
38
|
echo "Installing Repokit CLI"
|
|
37
39
|
|
|
38
|
-
cd
|
|
40
|
+
cd $SCRIPT_ORIGIN
|
|
39
41
|
|
|
40
42
|
echo "Compiling from $SCRIPT_ORIGIN"
|
|
41
43
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
use normalize_path::NormalizePath;
|
|
2
2
|
use std::path::{Path, PathBuf};
|
|
3
3
|
|
|
4
|
+
use crate::{executor::executor::Executor, logger::logger::Logger};
|
|
5
|
+
|
|
4
6
|
pub struct InternalFileSystem {
|
|
5
7
|
root: String,
|
|
6
8
|
}
|
|
@@ -25,6 +27,23 @@ impl InternalFileSystem {
|
|
|
25
27
|
self.path_buf_to_str(self.templates_directory().join(file_name))
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
pub fn find_root() -> String {
|
|
31
|
+
let root = Executor::exec("echo $(git rev-parse --show-toplevel 2>/dev/null)", |cmd| {
|
|
32
|
+
cmd
|
|
33
|
+
});
|
|
34
|
+
if root.is_empty() {
|
|
35
|
+
Logger::exit_with_info(
|
|
36
|
+
format!(
|
|
37
|
+
"To start using {}, please initialize your git repository by running {}",
|
|
38
|
+
Logger::blue("Repokit"),
|
|
39
|
+
Logger::green_bright("git init")
|
|
40
|
+
)
|
|
41
|
+
.as_str(),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
root
|
|
45
|
+
}
|
|
46
|
+
|
|
28
47
|
fn commands_directory(&self) -> PathBuf {
|
|
29
48
|
self.absolute(format!("{}/commands", self.package_directory()).as_str())
|
|
30
49
|
}
|
package/internals/main.rs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
use crate::{
|
|
2
|
-
|
|
3
|
-
repokit::repokit::RepoKit,
|
|
2
|
+
internal_commands::typescript_command::TypescriptCommand,
|
|
3
|
+
internal_filesystem::internal_filesystem::InternalFileSystem, repokit::repokit::RepoKit,
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
mod configuration;
|
|
@@ -14,7 +14,7 @@ mod repokit;
|
|
|
14
14
|
mod validations;
|
|
15
15
|
|
|
16
16
|
fn main() {
|
|
17
|
-
let root =
|
|
17
|
+
let root = InternalFileSystem::find_root();
|
|
18
18
|
let config = TypescriptCommand::new(&root).parse_configuration();
|
|
19
19
|
let kit = RepoKit::new(root, config);
|
|
20
20
|
kit.invoke();
|