submodule-version 1.1.0 → 1.1.1
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/index.js +20 -14
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -53,12 +53,23 @@ const getName = url => {
|
|
|
53
53
|
return parts[parts.length - 1];
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
const checkout = (url, version) => {
|
|
57
|
+
const module = isGitUrl(url) ? `${config.dir}/${getName(url)}` : url;
|
|
58
|
+
logger('checkout', module);
|
|
59
|
+
try {
|
|
60
|
+
execSync(`git -C ${module} checkout ${version} -q`);
|
|
61
|
+
} catch {
|
|
62
|
+
abort('Checkout failded');
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
56
66
|
const install = (url, version, location) => {
|
|
57
67
|
const name = getName(url);
|
|
58
68
|
const targetLocation = path.join(location, name);
|
|
59
|
-
const gitCmd = `git submodule add
|
|
69
|
+
const gitCmd = `git submodule add ${url} ${targetLocation}`;
|
|
60
70
|
try {
|
|
61
71
|
execSync(gitCmd);
|
|
72
|
+
checkout(url, version);
|
|
62
73
|
} catch {
|
|
63
74
|
abort(url, 'Is not a git repo');
|
|
64
75
|
}
|
|
@@ -101,20 +112,15 @@ const computeErrors = () => {
|
|
|
101
112
|
|
|
102
113
|
const validate = (sv, name) => {
|
|
103
114
|
buildGraph(sv, name, config.dir);
|
|
104
|
-
|
|
115
|
+
|
|
105
116
|
const errors = computeErrors();
|
|
106
|
-
if (
|
|
107
|
-
abort(errors);
|
|
108
|
-
};
|
|
117
|
+
if (errors) abort(errors);
|
|
109
118
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
} catch {
|
|
116
|
-
abort('Checkout failded');
|
|
117
|
-
};
|
|
119
|
+
Object.entries(graph).forEach(([url, versions]) => {
|
|
120
|
+
checkout(url, versions[0]);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
logger('Everything is up to date.');
|
|
118
124
|
};
|
|
119
125
|
|
|
120
126
|
const validationCommand = () => {
|
|
@@ -135,7 +141,7 @@ const installCommand = arg => {
|
|
|
135
141
|
const installedDep = projectJSON.sv?.[gitaddress];
|
|
136
142
|
|
|
137
143
|
if (installedDep && installedDep !== version) {
|
|
138
|
-
|
|
144
|
+
checkout(gitaddress, version);
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
const sv = {
|