heymark 1.1.3 → 1.2.0
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/package.json +1 -1
- package/scripts/sync.js +18 -0
package/package.json
CHANGED
package/scripts/sync.js
CHANGED
|
@@ -23,8 +23,11 @@ const SHORT_PREVIEW = "-p";
|
|
|
23
23
|
const SHORT_HELP = "-h";
|
|
24
24
|
const OPTION_BRANCH = "--branch";
|
|
25
25
|
const OPTION_DIR = "--dir";
|
|
26
|
+
const OPTION_SAMPLES = "--samples";
|
|
26
27
|
const SHORT_BRANCH = "-b";
|
|
27
28
|
const SHORT_DIR = "-d";
|
|
29
|
+
const SAMPLES_REPO_URL = "https://github.com/MosslandOpenDevs/heymark.git";
|
|
30
|
+
const SAMPLES_SOURCE_DIR = "samples";
|
|
28
31
|
|
|
29
32
|
function exitWithError(message, details = []) {
|
|
30
33
|
console.error(`[Error] ${message}`);
|
|
@@ -153,9 +156,24 @@ Examples:
|
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
function parseInitArgs(initArgs) {
|
|
159
|
+
if (initArgs.length === 1 && initArgs[0] === OPTION_SAMPLES) {
|
|
160
|
+
return {
|
|
161
|
+
rulesSource: SAMPLES_REPO_URL,
|
|
162
|
+
branch: DEFAULT_BRANCH,
|
|
163
|
+
rulesSourceDir: SAMPLES_SOURCE_DIR,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (initArgs.includes(OPTION_SAMPLES)) {
|
|
168
|
+
exitWithError("--samples cannot be combined with other init arguments.", [
|
|
169
|
+
"Use: heymark init --samples",
|
|
170
|
+
]);
|
|
171
|
+
}
|
|
172
|
+
|
|
156
173
|
const repoUrl = initArgs[0];
|
|
157
174
|
if (!repoUrl || repoUrl.startsWith("--")) {
|
|
158
175
|
exitWithError("init requires a GitHub repository URL.", [
|
|
176
|
+
"Sample preset: heymark init --samples",
|
|
159
177
|
"Example: heymark init https://github.com/org/my-rules.git",
|
|
160
178
|
"Example: heymark init git@github.com:org/my-rules.git",
|
|
161
179
|
"Optional: --branch <branch> --dir <subdir> (e.g. --dir rules)",
|