@vocab/cli 2.1.8-remove-env-ci-20251223225254 → 2.1.8
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 +4 -17
- package/dist/index.cjs.map +1 -1
- package/package.json +5 -4
package/dist/index.cjs
CHANGED
|
@@ -29,28 +29,15 @@ let __vocab_phrase = require("@vocab/phrase");
|
|
|
29
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",
|
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,mBA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
-
"version": "2.1.8
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "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.4",
|
|
28
|
+
"@vocab/phrase": "^2.1.8"
|
|
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
|
}
|