@jayree/sfdx-plugin-manifest 3.0.1 → 3.0.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [3.0.2](https://github.com/jayree/sfdx-plugin-manifest/compare/v3.0.1...v3.0.2) (2023-03-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * use new changelog ([48c4f91](https://github.com/jayree/sfdx-plugin-manifest/commit/48c4f91e096fc11407ca08180c9241caedde4afb))
7
+
1
8
  ## [3.0.1](https://github.com/jayree/sfdx-plugin-manifest/compare/v3.0.0...v3.0.1) (2023-03-10)
2
9
 
3
10
 
package/README.md CHANGED
@@ -48,7 +48,7 @@ EXAMPLES
48
48
  $ sfdx jayree:manifest:cleanup --manifest=package.xml --file=packageignore.xml
49
49
  ```
50
50
 
51
- _See code: [src/commands/jayree/manifest/cleanup.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v3.0.1/src/commands/jayree/manifest/cleanup.ts)_
51
+ _See code: [src/commands/jayree/manifest/cleanup.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v3.0.2/src/commands/jayree/manifest/cleanup.ts)_
52
52
 
53
53
  ### `sfdx jayree:manifest:generate`
54
54
 
@@ -84,7 +84,7 @@ EXAMPLES
84
84
  <Package xmlns='http://soap.sforce.com/2006/04/metadata'>...</Package>
85
85
  ```
86
86
 
87
- _See code: [src/commands/jayree/manifest/generate.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v3.0.1/src/commands/jayree/manifest/generate.ts)_
87
+ _See code: [src/commands/jayree/manifest/generate.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v3.0.2/src/commands/jayree/manifest/generate.ts)_
88
88
 
89
89
  ### `sfdx jayree:manifest:git:diff`
90
90
 
@@ -166,7 +166,7 @@ FLAG DESCRIPTIONS
166
166
  The location can be an absolute path or relative to the current working directory.
167
167
  ```
168
168
 
169
- _See code: [src/commands/jayree/manifest/git/diff.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v3.0.1/src/commands/jayree/manifest/git/diff.ts)_
169
+ _See code: [src/commands/jayree/manifest/git/diff.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v3.0.2/src/commands/jayree/manifest/git/diff.ts)_
170
170
 
171
171
  ### `sfdx jayree:manifest:legacy:git:diff`
172
172
 
@@ -244,5 +244,5 @@ FLAG DESCRIPTIONS
244
244
  The location can be an absolute path or relative to the current working directory.
245
245
  ```
246
246
 
247
- _See code: [src/commands/jayree/manifest/legacy/git/diff.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v3.0.1/src/commands/jayree/manifest/legacy/git/diff.ts)_
247
+ _See code: [src/commands/jayree/manifest/legacy/git/diff.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v3.0.2/src/commands/jayree/manifest/legacy/git/diff.ts)_
248
248
  <!-- commandsstop -->
@@ -1,2 +1,2 @@
1
1
  import { Hook } from '@oclif/core';
2
- export declare const changelog: Hook<'changelog'>;
2
+ export declare const changelog: Hook<'update'>;
@@ -7,91 +7,20 @@
7
7
  /* istanbul ignore file */
8
8
  import { join, dirname } from 'node:path';
9
9
  import { fileURLToPath } from 'node:url';
10
- import fs from 'fs-extra';
10
+ import printChangeLog from '@jayree/changelog';
11
11
  import Debug from 'debug';
12
- import TerminalRenderer from 'marked-terminal';
13
- import { marked } from 'marked';
14
- import semver from 'semver';
15
12
  // eslint-disable-next-line no-underscore-dangle
16
13
  const __filename = fileURLToPath(import.meta.url);
17
14
  // eslint-disable-next-line no-underscore-dangle
18
15
  const __dirname = dirname(__filename);
19
- // original from https://github.com/salesforcecli/plugin-info/blob/main/src/shared/parseReleaseNotes.ts
20
- const parseReleaseNotes = (notes, version, currentVersion) => {
21
- let found = false;
22
- let versions = [];
23
- const parsed = marked.lexer(notes);
24
- let tokens = [];
25
- const findVersion = (desiredVersion, localVersion) => {
26
- versions = [];
27
- tokens = parsed.filter((token) => {
28
- // TODO: Could make header depth (2) a setting in oclif.info.releasenotes
29
- if (token.type === 'heading' && token.depth <= 2) {
30
- const coercedVersion = semver.coerce(token.text)?.version;
31
- if (coercedVersion) {
32
- // We will use this to find the closest patch if passed version is not found
33
- versions.push(coercedVersion);
34
- if (coercedVersion <= desiredVersion && coercedVersion > localVersion) {
35
- found = true;
36
- return token;
37
- }
38
- }
39
- found = false;
40
- }
41
- else if (found === true) {
42
- return token;
43
- }
44
- });
45
- };
46
- findVersion(version, currentVersion);
47
- if (!versions.includes(version)) {
48
- const semverRange = `${semver.major(version)}.${semver.minor(version)}.x`;
49
- const closestVersion = semver.maxSatisfying(versions, semverRange);
50
- const warning = marked.lexer(`# ATTENTION: Version ${version} was not found. Showing notes for closest patch version ${closestVersion}.`)[0];
51
- tokens.unshift(warning);
52
- }
53
- return tokens;
54
- };
55
16
  // eslint-disable-next-line @typescript-eslint/require-await
56
17
  export const changelog = async function () {
57
- const debug = Debug(`${this.config.bin}:jayree-sfdx-plugin-manifest:hooks:changelog`);
58
- process.once('exit', () => {
59
- try {
60
- const pluginRootPath = join(__dirname, '..', '..');
61
- const { name, version } = fs.readJsonSync(join(pluginRootPath, 'package.json'));
62
- const changelogFile = fs.readFileSync(join(pluginRootPath, 'CHANGELOG.md'), 'utf8');
63
- const cacheDir = join(this.config.cacheDir, name);
64
- const versionFile = join(cacheDir, 'version');
65
- fs.ensureFileSync(versionFile);
66
- let latestVersion;
67
- try {
68
- latestVersion = fs.readJSONSync(versionFile);
69
- }
70
- catch (error) {
71
- latestVersion = { version: '0.0.0' };
72
- }
73
- debug({ latestVersion: latestVersion.version, version });
74
- if (latestVersion.version !== version) {
75
- const tokens = parseReleaseNotes(changelogFile, version, latestVersion.version);
76
- if (!tokens.length) {
77
- debug(`${name} - didn't find version '${version}'.`);
78
- }
79
- else {
80
- marked.setOptions({
81
- renderer: new TerminalRenderer({ emoji: false }),
82
- });
83
- tokens.unshift(marked.lexer(`# Changelog for '${name}':`)[0]);
84
- this.log(marked.parser(tokens));
85
- fs.writeJsonSync(versionFile, { version });
86
- }
87
- }
88
- else {
89
- debug(`${name} - no update`);
90
- }
91
- }
92
- catch (error) {
93
- debug(error);
94
- }
18
+ const debug = Debug([this.config.bin, '@jayree/sfdx-plugin-manifest', 'hooks', 'update'].join(':'));
19
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
20
+ process.once('beforeExit', async () => {
21
+ const changes = await printChangeLog(this.config.cacheDir, join(__dirname, '..', '..'), debug);
22
+ if (changes)
23
+ this.log(changes);
95
24
  });
96
25
  };
97
26
  //# sourceMappingURL=changelog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/hooks/changelog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,0BAA0B;AAC1B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,gBAAgB,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,gDAAgD;AAChD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,gDAAgD;AAChD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,uGAAuG;AACvG,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,OAAe,EAAE,cAAsB,EAAkB,EAAE;IACnG,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,QAAQ,GAAa,EAAE,CAAC;IAE5B,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEnC,IAAI,MAAM,GAAmB,EAA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AA8B,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEpG,kEAAkE;IAClE,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;QAC/F,IAAI,OAAO;YAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.0.1",
2
+ "version": "3.0.2",
3
3
  "commands": {
4
4
  "jayree:manifest:cleanup": {
5
5
  "id": "jayree:manifest:cleanup",
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@jayree/sfdx-plugin-manifest",
3
3
  "description": "A Salesforce CLI plugin containing commands for creating manifest files from Salesforce orgs or git commits of sfdx projects.",
4
- "version": "3.0.1",
4
+ "version": "3.0.2",
5
5
  "author": "jayree",
6
6
  "type": "module",
7
7
  "bugs": "https://github.com/jayree/sfdx-plugin-manifest/issues",
8
8
  "dependencies": {
9
+ "@jayree/changelog": "^1.1.0",
9
10
  "@oclif/core": "^2.6.2",
10
11
  "@salesforce/kit": "^1.9.2",
11
12
  "@salesforce/sf-plugins-core": "^2.2.4",
@@ -18,9 +19,6 @@
18
19
  "graceful-fs": "^4.2.10",
19
20
  "isomorphic-git": "^1.21.0",
20
21
  "listr2": "^5.0.7",
21
- "marked": "^4.2.12",
22
- "marked-terminal": "^5.1.1",
23
- "semver": "^7.3.8",
24
22
  "tslib": "^2.5.0"
25
23
  },
26
24
  "devDependencies": {
@@ -33,9 +31,6 @@
33
31
  "@types/debug": "^4.1.7",
34
32
  "@types/fs-extra": "^11.0.1",
35
33
  "@types/inquirer": "^9.0.3",
36
- "@types/marked": "^4.0.8",
37
- "@types/marked-terminal": "^3.1.3",
38
- "@types/semver": "^7.3.13",
39
34
  "@typescript-eslint/eslint-plugin": "^5.54.1",
40
35
  "@typescript-eslint/parser": "^5.54.1",
41
36
  "c8": "^7.13.0",