@vocab/cli 2.1.8-remove-env-ci-20251223225254 → 2.1.9
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/dist/index.cjs +11 -24
- package/dist/index.cjs.map +1 -1
- package/package.json +5 -4
package/dist/index.cjs
CHANGED
|
@@ -25,32 +25,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
let
|
|
29
|
-
let
|
|
28
|
+
let _vocab_phrase = require("@vocab/phrase");
|
|
29
|
+
let _vocab_core = require("@vocab/core");
|
|
30
30
|
let yargs = require("yargs");
|
|
31
31
|
yargs = __toESM(yargs);
|
|
32
|
-
let
|
|
32
|
+
let env_ci = require("env-ci");
|
|
33
|
+
env_ci = __toESM(env_ci);
|
|
33
34
|
|
|
34
|
-
//#region src/getGitBranch.ts
|
|
35
|
-
function getGitBranch() {
|
|
36
|
-
try {
|
|
37
|
-
const headRef = (0, node_child_process.execSync)("git rev-parse --abbrev-ref HEAD", { encoding: "utf8" }).trim();
|
|
38
|
-
if (headRef === "HEAD") {
|
|
39
|
-
const branch = (0, node_child_process.execSync)("git show -s --pretty=%d HEAD", { encoding: "utf8" }).trim().replace(/^\(|\)$/g, "").split(", ").find((b) => b.startsWith("origin/"));
|
|
40
|
-
return branch ? branch.match(/^origin\/(?<branch>.+)/)?.[1] : void 0;
|
|
41
|
-
}
|
|
42
|
-
return headRef;
|
|
43
|
-
} catch {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
35
|
//#region src/index.ts
|
|
36
|
+
const { branch } = (0, env_ci.default)();
|
|
50
37
|
const branchDefinition = {
|
|
51
38
|
type: "string",
|
|
52
39
|
describe: "The Phrase branch to target",
|
|
53
|
-
default:
|
|
40
|
+
default: branch || "local-development"
|
|
54
41
|
};
|
|
55
42
|
const ignorePathDefinition = {
|
|
56
43
|
type: "string",
|
|
@@ -63,7 +50,7 @@ let config = null;
|
|
|
63
50
|
type: "string",
|
|
64
51
|
describe: "Path to config file"
|
|
65
52
|
}).middleware(async ({ config: configPath }) => {
|
|
66
|
-
config = await (0,
|
|
53
|
+
config = await (0, _vocab_core.resolveConfig)(configPath);
|
|
67
54
|
console.log("Loaded config from", configPath || process.cwd());
|
|
68
55
|
}).command({
|
|
69
56
|
command: "push",
|
|
@@ -77,7 +64,7 @@ let config = null;
|
|
|
77
64
|
ignore: ignorePathDefinition
|
|
78
65
|
}),
|
|
79
66
|
handler: async (options) => {
|
|
80
|
-
await (0,
|
|
67
|
+
await (0, _vocab_phrase.push)(options, config);
|
|
81
68
|
}
|
|
82
69
|
}).command({
|
|
83
70
|
command: "pull",
|
|
@@ -90,7 +77,7 @@ let config = null;
|
|
|
90
77
|
}
|
|
91
78
|
}),
|
|
92
79
|
handler: async (options) => {
|
|
93
|
-
await (0,
|
|
80
|
+
await (0, _vocab_phrase.pull)(options, config);
|
|
94
81
|
}
|
|
95
82
|
}).command({
|
|
96
83
|
command: "compile",
|
|
@@ -99,12 +86,12 @@ let config = null;
|
|
|
99
86
|
default: false
|
|
100
87
|
} }),
|
|
101
88
|
handler: async ({ watch }) => {
|
|
102
|
-
await (0,
|
|
89
|
+
await (0, _vocab_core.compile)({ watch }, config);
|
|
103
90
|
}
|
|
104
91
|
}).command({
|
|
105
92
|
command: "validate",
|
|
106
93
|
handler: async () => {
|
|
107
|
-
if (!await (0,
|
|
94
|
+
if (!await (0, _vocab_core.validate)(config)) throw new Error("Project invalid");
|
|
108
95
|
}
|
|
109
96
|
}).help().wrap(72).parse();
|
|
110
97
|
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["config: UserConfig | null","yargs"],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["config: UserConfig | null","yargs"],"sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { pull, push } from '@vocab/phrase';\nimport { type UserConfig, resolveConfig, compile, validate } from '@vocab/core';\nimport yargsCli from 'yargs';\n\nimport envCi from 'env-ci';\n\nconst { branch } = envCi();\n\nconst branchDefinition = {\n type: 'string',\n describe: 'The Phrase branch to target',\n default: branch || 'local-development',\n} as const;\n\nconst ignorePathDefinition = {\n type: 'string',\n array: true,\n describe: 'Array of glob paths to ignore when searching for keys to push',\n default: [] as string[],\n} as const;\n\nlet config: UserConfig | null = null;\n\nyargsCli(process.argv.slice(2))\n .scriptName('vocab')\n .option('config', {\n type: 'string',\n describe: 'Path to config file',\n })\n .middleware(async ({ config: configPath }) => {\n config = await resolveConfig(configPath);\n console.log('Loaded config from', configPath || process.cwd());\n })\n .command({\n command: 'push',\n builder: (yargs) =>\n yargs.options({\n branch: branchDefinition,\n 'delete-unused-keys': {\n type: 'boolean',\n describe: 'Whether or not to delete unused keys after pushing',\n default: false,\n },\n ignore: ignorePathDefinition,\n }),\n handler: async (options) => {\n await push(options, config!);\n },\n })\n .command({\n command: 'pull',\n builder: (yargs) =>\n yargs.options({\n branch: branchDefinition,\n 'error-on-no-global-key-translation': {\n type: 'boolean',\n describe:\n 'Throw an error when there is no translation for a global key',\n default: false,\n },\n }),\n handler: async (options) => {\n await pull(options, config!);\n },\n })\n .command({\n command: 'compile',\n builder: (yargs) =>\n yargs.options({\n watch: { type: 'boolean', default: false },\n }),\n handler: async ({ watch }) => {\n await compile({ watch }, config!);\n },\n })\n .command({\n command: 'validate',\n handler: async () => {\n const valid = await validate(config!);\n\n if (!valid) {\n throw new Error('Project invalid');\n }\n },\n })\n .help()\n .wrap(72)\n .parse();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,EAAE,gCAAkB;AAE1B,MAAM,mBAAmB;CACvB,MAAM;CACN,UAAU;CACV,SAAS,UAAU;CACpB;AAED,MAAM,uBAAuB;CAC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": "git",
|
|
6
6
|
"url": "https://github.com/seek-oss/vocab.git",
|
|
@@ -22,12 +22,13 @@
|
|
|
22
22
|
"author": "SEEK",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"env-ci": "^7.3.0",
|
|
25
26
|
"yargs": "^17.7.2",
|
|
26
|
-
"@vocab/core": "^1.7.
|
|
27
|
-
"@vocab/phrase": "^2.1.
|
|
27
|
+
"@vocab/core": "^1.7.5",
|
|
28
|
+
"@vocab/phrase": "^2.1.9"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@types/
|
|
31
|
+
"@types/env-ci": "^3.1.0",
|
|
31
32
|
"@types/yargs": "^17.0.32"
|
|
32
33
|
}
|
|
33
34
|
}
|