semantic-release-yaml 1.0.2 → 1.1.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/README.md CHANGED
@@ -19,21 +19,75 @@ The plugin can be configured in the [**semantic-release** configuration file](ht
19
19
  ```json
20
20
  {
21
21
  "plugins": [
22
+ "@semantic-release/commit-analyzer",
23
+ "@semantic-release/npm",
22
24
  [
23
25
  "semantic-release-yaml",
24
26
  {
27
+ // A list of files to edit.
25
28
  "commands": [
26
29
  {
30
+ // The current working directory is the root of the project.
27
31
  "cwd": "./",
32
+ // Currently only supports "prepare" phase.
28
33
  "phase": "prepare",
34
+ // The file to edit
29
35
  "file": "./Chart.yaml",
36
+ // The field in the file to edit.
30
37
  "selector": "version",
38
+ // The value to set the field to.
31
39
  "value": "${nextRelease.version}"
32
40
  }
33
41
  ]
34
42
  }
35
43
  ],
36
- "@semantic-release/git"
44
+ [
45
+ "@semantic-release/git",
46
+ {
47
+ // Make sure Chart.yaml is pushed to the remote repository
48
+ "assets": ["package.json", "Chart.yaml"]
49
+ }
50
+ ]
37
51
  ]
38
52
  }
39
53
  ```
54
+
55
+ ## Lodash `template`
56
+
57
+ - Lodash `template`: https://lodash.com/docs/4.17.15#template
58
+
59
+ Each variable (`cwd`, `phase`, `file`, `selector`, `value`) in a command is evaluated via lodash's `template` function.
60
+
61
+ ```json
62
+ {
63
+ ...
64
+ "value": "${nextRelease.version}"
65
+ }
66
+ ```
67
+
68
+ ## Lodash `set`
69
+
70
+ - Lodash `set`: https://lodash.com/docs/4.17.15#set
71
+
72
+ Next to this; selector is used by lodash's `set` function to set the value of the field.
73
+
74
+ This means you can write the following command:
75
+
76
+ ```json
77
+ {
78
+ ...
79
+ "selector": "meta.version",
80
+ "value": "${nextRelease.version}"
81
+ }
82
+ ```
83
+
84
+ which could result in the following:
85
+
86
+ ```yaml
87
+ version:
88
+ value: "1.0.0"
89
+ ```
90
+
91
+ ## Yaml comments
92
+
93
+ Yaml comments will be preserved.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var e=require("path"),t=require("lodash/template"),r=require("js-yaml"),n=require("fs"),i=require("lodash/set"),o=require("lodash"),a=require("aggregate-error"),l=require("@semantic-release/error"),s=require("lodash/isString"),d=require("util");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/c(e),f=/*#__PURE__*/c(t),p=/*#__PURE__*/c(r),m=/*#__PURE__*/c(n),g=/*#__PURE__*/c(i),h=/*#__PURE__*/c(a),w=/*#__PURE__*/c(l),y=/*#__PURE__*/c(s);const q=["cwd","env","stdout","stderr","logger"],[v]="https://github.com/meesvandongen/semantic-release-yaml#readme".split("#"),b=e=>y.default(e)?e:d.inspect(e,{breakLength:Infinity,depth:2,maxArrayLength:5}),$=e=>`${v}/blob/master/${e}`,E={cmd:e=>({message:`Invalid \`cmd\` option for phase \`${e.phase}\`.`,details:`The [\`cmd\` option](${$("README.md#options")}) is required and must be a non empty \`String\`.\n\nYour configuration for the \`cmd\` option is \`${b(e.template)}\`.`}),cwd:e=>({message:"Invalid `cwd` option.",details:`The [\`cwd\` option](${$("README.md#options")}) if defined, must be a non empty \`String\`.\n\nYour configuration for the \`cwd\` option is \`${b(e.cwd)}\`.`})};function S(e,t){const{message:r,details:n}=E[e](t);return new w.default(r,e,n)}const j=e=>o.isString(e)&&e.trim().length>0,A={cmd:j,cwd:(M=j,e=>o.isNil(e)||M(e))};var M;exports.prepare=function(e,t){const r=e.commands.filter(e=>"prepare"===e.phase);if(r.length>0)return function(e){const t=e.flatMap(e=>Object.keys(A).reduce((t,r)=>(0,A[r])(e[r])?t:t.concat(S(r,e)),[]));if(t.length>0)throw new h.default(t)}(r),r.forEach(e=>{((e,t)=>{let{cwd:r=process.cwd(),logger:n}=t,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}(t,q);const o=f.default(e.template)(i);n.log("Call script %s",o);const a=e.cwd?u.default.resolve(r,e.cwd):r,l=u.default.resolve(a,e.file),s=p.default.load(m.default.readFileSync(l,"utf8"));if("object"!=typeof s||null===s)throw new Error(`The file ${l} is not a valid YAML file.`);g.default(s,e.selector,o),m.default.writeFileSync(l,p.default.dump(s))})(e,t)}),"Prepared"};
1
+ var e=require("path"),t=require("lodash/template"),r=require("fs"),a=require("lodash/set"),l=require("yaml-diff-patch"),i=require("js-yaml"),o=require("lodash"),n=require("aggregate-error"),u=require("@semantic-release/error"),f=require("lodash/isString"),d=require("util");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=/*#__PURE__*/s(e),h=/*#__PURE__*/s(t),p=/*#__PURE__*/s(r),g=/*#__PURE__*/s(a),v=/*#__PURE__*/s(i),y=/*#__PURE__*/s(n),m=/*#__PURE__*/s(u),q=/*#__PURE__*/s(f);const w=["cwd","env","logger"],[k]="https://github.com/meesvandongen/semantic-release-yaml#readme".split("#"),b=e=>o.isString(e)&&e.trim().length>0,j=[{key:"cwd",validator:($=b,e=>o.isNil(e)||$(e))},{key:"file",validator:b},{key:"phase",validator:b},{key:"selector",validator:b},{key:"value",validator:b}];var $;exports.prepare=function(e,t){const r=e.commands.filter(e=>"prepare"===h.default(e.phase)(t));if(r.length>0)return function(e){const t=e.flatMap(e=>j.reduce((t,{key:r,validator:a})=>a(e[r])?t:t.concat(function(e,t){const r=[`for usage, see ${k}/blob/master/README.md#options`,"",`Your configuration for the \`${e}\` option is \`${a=t[e],q.default(a)?a:d.inspect(a,{breakLength:Infinity,depth:2,maxArrayLength:5})}\`.`].join("\n");var a;return new m.default(`Invalid \`${e}\` option.`,e,r)}(r,e)),[]));if(t.length>0)throw new y.default(t)}(r),r.forEach(e=>{((e,t)=>{let{cwd:r=process.cwd(),logger:a}=t,i=function(e,t){if(null==e)return{};var r,a,l={},i=Object.keys(e);for(a=0;a<i.length;a++)t.indexOf(r=i[a])>=0||(l[r]=e[r]);return l}(t,w);const o=h.default(e.cwd)(i),n=h.default(e.file)(i),u=h.default(e.selector)(i),f=h.default(e.value)(i);a.log("Writing to file %s",f);const d=o?c.default.resolve(r,o):r,s=c.default.resolve(d,n),y=p.default.readFileSync(s,"utf8"),m=v.default.load(y),q=v.default.load(y);if("object"!=typeof q||null===q)throw new Error(`The file ${s} is not a valid YAML file.`);g.default(q,u,f);const k=l.yamlDiffPatch(y,m,q);p.default.writeFileSync(s,k)})(e,t)}),"Prepared"};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/get-error.ts","../src/verify-commands.ts","../src/index.ts","../src/yaml.ts"],"sourcesContent":["import SemanticReleaseError from \"@semantic-release/error\";\nimport isString from \"lodash/isString\";\nimport { inspect } from \"util\";\nimport { Command } from \"./definitions/configuration.interface\";\nimport pkg from \"../package.json\";\n\nconst [homepage] = pkg.homepage.split(\"#\");\nconst stringify = (object) =>\n isString(object)\n ? object\n : inspect(object, { breakLength: Infinity, depth: 2, maxArrayLength: 5 });\nconst linkify = (file) => `${homepage}/blob/master/${file}`;\n\nconst errors = {\n cmd: (command: Command) => ({\n message: `Invalid \\`cmd\\` option for phase \\`${command.phase}\\`.`,\n details: `The [\\`cmd\\` option](${linkify(\n `README.md#options`\n )}) is required and must be a non empty \\`String\\`.\n\nYour configuration for the \\`cmd\\` option is \\`${stringify(\n command.template\n )}\\`.`,\n }),\n cwd: (command: Command) => ({\n message: \"Invalid `cwd` option.\",\n details: `The [\\`cwd\\` option](${linkify(\n \"README.md#options\"\n )}) if defined, must be a non empty \\`String\\`.\n\nYour configuration for the \\`cwd\\` option is \\`${stringify(command.cwd)}\\`.`,\n }),\n};\n\nexport function getError(\n commandKey: string,\n command: Command\n): SemanticReleaseError {\n const { message, details } = errors[commandKey](command);\n return new SemanticReleaseError(message, commandKey, details);\n}\n","import { Command } from \"./definitions/configuration.interface\";\nimport { isNil } from \"lodash\";\nimport { isString } from \"lodash\";\nimport AggregateError from \"aggregate-error\";\nimport { getError } from \"./get-error\";\n\nconst isNonEmptyString = (value: unknown) =>\n isString(value) && value.trim().length > 0;\n\nconst isOptional =\n (validator: (value: unknown) => boolean) => (value: unknown) =>\n isNil(value) || validator(value);\n\nconst VALIDATORS = {\n cmd: isNonEmptyString,\n cwd: isOptional(isNonEmptyString),\n};\n\nexport function verifyCommands(commands: Array<Command>) {\n const errors = commands.flatMap((command) =>\n Object.keys(VALIDATORS).reduce((errors, key) => {\n const validator = VALIDATORS[key];\n const value = command[key];\n\n if (!validator(value)) {\n return errors.concat(getError(key, command));\n }\n return errors;\n }, [])\n );\n\n if (errors.length > 0) {\n throw new AggregateError(errors);\n }\n}\n","import { yaml } from \"./yaml\";\nimport { verifyCommands } from \"./verify-commands\";\nimport { Configuration } from \"./definitions/configuration.interface\";\nimport { SemanticContext } from \"./definitions/semantic-context.interface\";\n\nexport function prepare(pluginConfig: Configuration, context: SemanticContext) {\n const commands = pluginConfig.commands.filter(command => command.phase === \"prepare\");\n\n if (commands.length > 0) {\n verifyCommands(commands);\n\n commands.forEach(command => {\n yaml(command, context);\n });\n return \"Prepared\";\n }\n}\n","import path from \"path\";\nimport template from \"lodash/template\";\nimport jsYaml from \"js-yaml\";\nimport fs from \"fs\";\nimport { Command } from \"./definitions/configuration.interface\";\nimport { SemanticContext } from \"./definitions/semantic-context.interface\";\nimport set from \"lodash/set\";\n\nexport const yaml = (\n command: Command,\n {\n cwd = process.cwd(),\n env,\n stdout,\n stderr,\n logger,\n ...context\n }: SemanticContext\n) => {\n const newValue = template(command.template)(context);\n\n logger.log(\"Call script %s\", newValue);\n\n const workingDirectory = command.cwd ? path.resolve(cwd, command.cwd) : cwd;\n const pathToFile = path.resolve(workingDirectory, command.file);\n\n const yamlFile = jsYaml.load(fs.readFileSync(pathToFile, \"utf8\"));\n\n if (typeof yamlFile !== \"object\" || yamlFile === null) {\n throw new Error(`The file ${pathToFile} is not a valid YAML file.`);\n }\n set(yamlFile, command.selector, newValue);\n\n fs.writeFileSync(pathToFile, jsYaml.dump(yamlFile));\n};\n"],"names":["homepage","split","stringify","object","isString","inspect","breakLength","Infinity","depth","maxArrayLength","linkify","file","errors","cmd","command","message","phase","details","template","cwd","getError","commandKey","SemanticReleaseError","isNonEmptyString","value","trim","length","VALIDATORS","validator","isNil","pluginConfig","context","commands","filter","flatMap","Object","keys","reduce","key","concat","AggregateError","verifyCommands","forEach","process","logger","newValue","log","workingDirectory","path","resolve","pathToFile","yamlFile","jsYaml","load","fs","readFileSync","Error","set","selector","writeFileSync","dump","yaml"],"mappings":"mhBAMOA,mEAAyBC,MAAM,KAChCC,EAAaC,GACjBC,UAASD,GACLA,EACAE,UAAQF,EAAQ,CAAEG,YAAaC,SAAUC,MAAO,EAAGC,eAAgB,IACnEC,EAAWC,MAAYX,iBAAwBW,IAE/CC,EAAS,CACbC,IAAMC,KACJC,8CAA+CD,EAAQE,WACvDC,gCAAiCP,6HAIYR,EAC3CY,EAAQI,iBAGZC,IAAML,KACJC,QAAS,wBACTE,gCAAiCP,EAC/B,uHAG2CR,EAAUY,EAAQK,sBAInDC,EACdC,EACAP,GAEA,MAAMC,QAAEA,EAAFE,QAAWA,GAAYL,EAAOS,GAAYP,GAChD,WAAWQ,UAAqBP,EAASM,EAAYJ,GCjCvD,MAAMM,EAAoBC,GACxBpB,WAASoB,IAAUA,EAAMC,OAAOC,OAAS,EAMrCC,EAAa,CACjBd,IAAKU,EACLJ,KALCS,EAKeL,EAL6BC,GAC3CK,QAAML,IAAUI,EAAUJ,KAD3BI,IAAAA,2BCLqBE,EAA6BC,GACnD,MAAMC,EAAWF,EAAaE,SAASC,OAAOnB,GAA6B,YAAlBA,EAAQE,OAEjE,GAAIgB,EAASN,OAAS,EAMpB,gBDI2BM,GAC7B,MAAMpB,EAASoB,EAASE,QAASpB,GAC/BqB,OAAOC,KAAKT,GAAYU,OAAO,CAACzB,EAAQ0B,KAIjCV,EAHaD,EAAWW,IACfxB,EAAQwB,IAKf1B,EAFEA,EAAO2B,OAAOnB,EAASkB,EAAKxB,IAGpC,KAGL,GAAIF,EAAOc,OAAS,EAClB,UAAUc,UAAe5B,GCvBzB6B,CAAeT,GAEfA,EAASU,QAAQ5B,ICHD,EAClBA,WACAK,IACEA,EAAMwB,QAAQxB,MADhByB,OAKEA,KACGb,0IAGL,MAAMc,EAAW3B,UAASJ,EAAQI,SAAjBA,CAA2Ba,GAE5Ca,EAAOE,IAAI,iBAAkBD,GAE7B,MAAME,EAAmBjC,EAAQK,IAAM6B,UAAKC,QAAQ9B,EAAKL,EAAQK,KAAOA,EAClE+B,EAAaF,UAAKC,QAAQF,EAAkBjC,EAAQH,MAEpDwC,EAAWC,UAAOC,KAAKC,UAAGC,aAAaL,EAAY,SAEzD,GAAwB,iBAAbC,GAAsC,OAAbA,EAClC,UAAUK,kBAAkBN,+BAE9BO,UAAIN,EAAUrC,EAAQ4C,SAAUb,GAEhCS,UAAGK,cAAcT,EAAYE,UAAOQ,KAAKT,KDrBrCU,CAAK/C,EAASiB,KAET"}
1
+ {"version":3,"file":"index.js","sources":["../src/get-error.ts","../src/verify-commands.ts","../src/index.ts","../src/yaml.ts"],"sourcesContent":["import SemanticReleaseError from \"@semantic-release/error\";\nimport isString from \"lodash/isString\";\nimport { inspect } from \"util\";\nimport { Command } from \"./definitions/configuration.interface\";\nimport pkg from \"../package.json\";\n\nconst [homepage] = pkg.homepage.split(\"#\");\n\nfunction stringify(object: unknown) {\n if (isString(object)) {\n return object;\n }\n return inspect(object, {\n breakLength: Infinity,\n depth: 2,\n maxArrayLength: 5,\n });\n}\n\nfunction linkify(file: string) {\n return `${homepage}/blob/master/${file}`;\n}\n\nexport function getError(key: keyof Command, command: Command): Error {\n const message = [\n `for usage, see ${linkify(\"README.md#options\")}`,\n \"\",\n `Your configuration for the \\`${key}\\` option is \\`${stringify(\n command[key]\n )}\\`.`,\n ].join(\"\\n\");\n return new SemanticReleaseError(`Invalid \\`${key}\\` option.`, key, message);\n}\n","import { Command } from \"./definitions/configuration.interface\";\nimport { isNil } from \"lodash\";\nimport { isString } from \"lodash\";\nimport AggregateError from \"aggregate-error\";\nimport { getError } from \"./get-error\";\n\nconst isNonEmptyString = (value: unknown) =>\n isString(value) && value.trim().length > 0;\n\nconst isOptional =\n (validator: (value: unknown) => boolean) => (value: unknown) =>\n isNil(value) || validator(value);\n\ninterface Validator {\n key: keyof Command;\n validator: (value: unknown) => boolean;\n}\nconst validators: Array<Validator> = [\n { key: \"cwd\", validator: isOptional(isNonEmptyString) },\n { key: \"file\", validator: isNonEmptyString },\n { key: \"phase\", validator: isNonEmptyString },\n { key: \"selector\", validator: isNonEmptyString },\n { key: \"value\", validator: isNonEmptyString },\n];\n\nexport function verifyCommands(commands: Array<Command>) {\n const errors = commands.flatMap((command) =>\n validators.reduce((errors, { key, validator }) => {\n const value = command[key];\n\n if (!validator(value)) {\n return errors.concat(getError(key, command));\n }\n return errors;\n }, [] as Array<Error>)\n );\n\n if (errors.length > 0) {\n throw new AggregateError(errors);\n }\n}\n","import { yaml } from \"./yaml\";\nimport { verifyCommands } from \"./verify-commands\";\nimport { Configuration } from \"./definitions/configuration.interface\";\nimport { SemanticContext } from \"./definitions/semantic-context.interface\";\nimport template from \"lodash/template\";\n\nexport function prepare(pluginConfig: Configuration, context: SemanticContext) {\n const commands = pluginConfig.commands.filter((command) => {\n const phase = template(command.phase)(context);\n return phase === \"prepare\";\n });\n\n if (commands.length > 0) {\n verifyCommands(commands);\n\n commands.forEach((command) => {\n yaml(command, context);\n });\n return \"Prepared\";\n }\n}\n","import path from \"path\";\nimport template from \"lodash/template\";\nimport fs from \"fs\";\nimport { Command } from \"./definitions/configuration.interface\";\nimport { SemanticContext } from \"./definitions/semantic-context.interface\";\nimport set from \"lodash/set\";\nimport { yamlDiffPatch } from \"yaml-diff-patch\";\nimport jsYaml from \"js-yaml\";\n\nexport const yaml = (\n command: Command,\n { cwd = process.cwd(), env, logger, ...context }: SemanticContext\n) => {\n const interpretedCwd = template(command.cwd)(context);\n const interpretedFile = template(command.file)(context);\n const interpretedSelector = template(command.selector)(context);\n const interpretedValue = template(command.value)(context);\n\n logger.log(\"Writing to file %s\", interpretedValue);\n\n const workingDirectory = interpretedCwd\n ? path.resolve(cwd, interpretedCwd)\n : cwd;\n const pathToFile = path.resolve(workingDirectory, interpretedFile);\n\n const yamlFileRaw = fs.readFileSync(pathToFile, \"utf8\");\n const originalYamlFile = jsYaml.load(yamlFileRaw);\n const changedYamlFile = jsYaml.load(yamlFileRaw);\n\n if (typeof changedYamlFile !== \"object\" || changedYamlFile === null) {\n throw new Error(`The file ${pathToFile} is not a valid YAML file.`);\n }\n\n set(changedYamlFile, interpretedSelector, interpretedValue);\n const yamlResult = yamlDiffPatch(\n yamlFileRaw,\n originalYamlFile,\n changedYamlFile\n );\n\n fs.writeFileSync(pathToFile, yamlResult);\n};\n"],"names":["homepage","split","isNonEmptyString","value","isString","trim","length","validators","key","validator","isNil","pluginConfig","context","commands","filter","command","template","phase","errors","flatMap","reduce","concat","message","object","inspect","breakLength","Infinity","depth","maxArrayLength","join","SemanticReleaseError","getError","AggregateError","verifyCommands","forEach","cwd","process","logger","interpretedCwd","interpretedFile","file","interpretedSelector","selector","interpretedValue","log","workingDirectory","path","resolve","pathToFile","yamlFileRaw","fs","readFileSync","originalYamlFile","jsYaml","load","changedYamlFile","Error","set","yamlResult","yamlDiffPatch","writeFileSync","yaml"],"mappings":"8hBAMOA,mEAAyBC,MAAM,KCAhCC,EAAoBC,GACxBC,WAASD,IAAUA,EAAME,OAAOC,OAAS,EAUrCC,EAA+B,CACnC,CAAEC,IAAK,MAAOC,WARbA,EAQmCP,EARSC,GAC3CO,QAAMP,IAAUM,EAAUN,KAQ5B,CAAEK,IAAK,OAAQC,UAAWP,GAC1B,CAAEM,IAAK,QAASC,UAAWP,GAC3B,CAAEM,IAAK,WAAYC,UAAWP,GAC9B,CAAEM,IAAK,QAASC,UAAWP,IAZ1BO,IAAAA,2BCJqBE,EAA6BC,GACnD,MAAMC,EAAWF,EAAaE,SAASC,OAAQC,GAE5B,YADHC,UAASD,EAAQE,MAAjBD,CAAwBJ,IAIxC,GAAIC,EAASP,OAAS,EAMpB,gBDO2BO,GAC7B,MAAMK,EAASL,EAASM,QAASJ,GAC/BR,EAAWa,OAAO,CAACF,GAAUV,IAAAA,EAAKC,UAAAA,KAG3BA,EAFSM,EAAQP,IAKfU,EAFEA,EAAOG,gBDRGb,EAAoBO,GAC3C,MAAMO,EAAU,mBAJNtB,kCAMR,mCACgCQ,mBAnBjBe,EAoBbR,EAAQP,GAnBRJ,UAASmB,GACJA,EAEFC,UAAQD,EAAQ,CACrBE,YAAaC,SACbC,MAAO,EACPC,eAAgB,UAehBC,KAAK,MAtBT,IAAmBN,EAuBjB,WAAWO,uBAAkCtB,cAAiBA,EAAKc,GCAxCS,CAASvB,EAAKO,IAGpC,KAGL,GAAIG,EAAOZ,OAAS,EAClB,UAAU0B,UAAed,GCzBzBe,CAAepB,GAEfA,EAASqB,QAASnB,ICNF,EAClBA,WACAoB,IAAEA,EAAMC,QAAQD,MAAhBE,OAA4BA,KAAWzB,0IAEvC,MAAM0B,EAAiBtB,UAASD,EAAQoB,IAAjBnB,CAAsBJ,GACvC2B,EAAkBvB,UAASD,EAAQyB,KAAjBxB,CAAuBJ,GACzC6B,EAAsBzB,UAASD,EAAQ2B,SAAjB1B,CAA2BJ,GACjD+B,EAAmB3B,UAASD,EAAQZ,MAAjBa,CAAwBJ,GAEjDyB,EAAOO,IAAI,qBAAsBD,GAEjC,MAAME,EAAmBP,EACrBQ,UAAKC,QAAQZ,EAAKG,GAClBH,EACEa,EAAaF,UAAKC,QAAQF,EAAkBN,GAE5CU,EAAcC,UAAGC,aAAaH,EAAY,QAC1CI,EAAmBC,UAAOC,KAAKL,GAC/BM,EAAkBF,UAAOC,KAAKL,GAEpC,GAA+B,iBAApBM,GAAoD,OAApBA,EACzC,UAAUC,kBAAkBR,+BAG9BS,UAAIF,EAAiBd,EAAqBE,GAC1C,MAAMe,EAAaC,gBACjBV,EACAG,EACAG,GAGFL,UAAGU,cAAcZ,EAAYU,IDxBzBG,CAAK9C,EAASH,KAET"}
@@ -1,3 +1,2 @@
1
- import SemanticReleaseError from "@semantic-release/error";
2
1
  import { Command } from "./definitions/configuration.interface";
3
- export declare function getError(commandKey: string, command: Command): SemanticReleaseError;
2
+ export declare function getError(key: keyof Command, command: Command): Error;
@@ -1,3 +1,3 @@
1
1
  import { Configuration } from "./definitions/configuration.interface";
2
2
  import { SemanticContext } from "./definitions/semantic-context.interface";
3
- export declare function prepare(pluginConfig: Configuration, context: SemanticContext): string;
3
+ export declare function prepare(pluginConfig: Configuration, context: SemanticContext): "Prepared" | undefined;
@@ -1,3 +1,3 @@
1
1
  import { Command } from "./definitions/configuration.interface";
2
2
  import { SemanticContext } from "./definitions/semantic-context.interface";
3
- export declare const yaml: (command: Command, { cwd, env, stdout, stderr, logger, ...context }: SemanticContext) => void;
3
+ export declare const yaml: (command: Command, { cwd, env, logger, ...context }: SemanticContext) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "semantic-release-yaml",
3
3
  "description": "semantic-release plugin to edit yaml files",
4
- "version": "1.0.2",
4
+ "version": "1.1.0",
5
5
  "author": "Mees van Dongen",
6
6
  "bugs": {
7
7
  "url": "https://github.com/meesvandongen/semantic-release-yaml/issues"
@@ -11,15 +11,21 @@
11
11
  "aggregate-error": "^3.0.0",
12
12
  "debug": "^4.0.0",
13
13
  "js-yaml": "^4.1.0",
14
- "lodash": "^4.17.4"
14
+ "lodash": "^4.17.4",
15
+ "yaml-diff-patch": "^1.1.0"
15
16
  },
16
17
  "devDependencies": {
17
18
  "@semantic-release/git": "^10.0.1",
19
+ "@swc/core": "^1.2.125",
20
+ "@swc/jest": "^0.2.15",
21
+ "@types/jest": "^27.4.0",
18
22
  "@types/js-yaml": "^4.0.5",
19
23
  "@types/lodash": "^4.14.178",
20
24
  "@types/semantic-release": "^17.2.3",
25
+ "jest": "^27.4.5",
21
26
  "microbundle": "^0.14.2",
22
- "semantic-release": "18.0.1"
27
+ "semantic-release": "18.0.1",
28
+ "type-fest": "^2.8.0"
23
29
  },
24
30
  "files": [
25
31
  "dist/**/*"
@@ -50,6 +56,8 @@
50
56
  "scripts": {
51
57
  "semantic-release": "semantic-release",
52
58
  "build": "microbundle --target=node --format cjs --compress",
53
- "build:watch": "microbundle watch --target=node --format cjs --compress"
59
+ "build:watch": "microbundle watch --target=node --format cjs --compress",
60
+ "test": "jest",
61
+ "test:watch": "jest --watch"
54
62
  }
55
63
  }
@@ -1,3 +0,0 @@
1
- import SemanticReleaseError from "@semantic-release/error";
2
- import { Command } from "./definitions/configuration.interface";
3
- export declare function getError(commandKey: string, command: Command): SemanticReleaseError;
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { Configuration } from "./definitions/configuration.interface";
2
- import { SemanticContext } from "./definitions/semantic-context.interface";
3
- export declare function prepare(pluginConfig: Configuration, context: SemanticContext): string;
@@ -1,2 +0,0 @@
1
- import { Command } from "./definitions/configuration.interface";
2
- export declare function verifyCommands(commands: Array<Command>): void;
package/dist/yaml.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { Command } from "./definitions/configuration.interface";
2
- import { SemanticContext } from "./definitions/semantic-context.interface";
3
- export declare const yaml: (command: Command, { cwd, env, stdout, stderr, logger, ...context }: SemanticContext) => void;