@salesforce/plugin-marketplace 0.3.1 → 1.0.1
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 +1 -1
- package/lib/commands/plugins/discover.d.ts +1 -1
- package/lib/commands/plugins/discover.js +16 -17
- package/lib/commands/plugins/discover.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/shared/discoverQuery.d.ts +6 -1
- package/lib/shared/discoverQuery.js +14 -15
- package/lib/shared/discoverQuery.js.map +1 -1
- package/lib/shared/plugins.js +1 -4
- package/lib/shared/plugins.js.map +1 -1
- package/oclif.lock +7768 -0
- package/oclif.manifest.json +28 -12
- package/package.json +28 -49
package/README.md
CHANGED
|
@@ -84,6 +84,6 @@ EXAMPLES
|
|
|
84
84
|
$ sf plugins discover
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
_See code: [src/commands/plugins/discover.ts](https://github.com/salesforcecli/plugin-template-sf/blob/0.3.
|
|
87
|
+
_See code: [src/commands/plugins/discover.ts](https://github.com/salesforcecli/plugin-template-sf/blob/0.3.3/src/commands/plugins/discover.ts)_
|
|
88
88
|
|
|
89
89
|
<!-- commandsstop -->
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import { DiscoverResult } from '../../shared/discoverQuery';
|
|
2
|
+
import { DiscoverResult } from '../../shared/discoverQuery.js';
|
|
3
3
|
export type DiscoverResults = DiscoverResult[];
|
|
4
4
|
export default class PluginsDiscover extends SfCommand<DiscoverResults> {
|
|
5
5
|
static readonly summary: string;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
2
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
5
3
|
* All rights reserved.
|
|
6
4
|
* Licensed under the BSD 3-Clause license.
|
|
7
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
import { EOL } from 'node:os';
|
|
8
|
+
import { dirname } from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { SfCommand, StandardColors } from '@salesforce/sf-plugins-core';
|
|
11
|
+
import { Messages } from '@salesforce/core';
|
|
12
|
+
import shared from '../../shared/discoverQuery.js';
|
|
13
|
+
import { packages } from '../../shared/plugins.js';
|
|
14
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
15
|
+
const messages = Messages.loadMessages('@salesforce/plugin-marketplace', 'plugins.discover');
|
|
16
|
+
export default class PluginsDiscover extends SfCommand {
|
|
17
|
+
static summary = messages.getMessage('summary');
|
|
18
|
+
static examples = messages.getMessages('examples');
|
|
17
19
|
async run() {
|
|
18
20
|
await this.parse(PluginsDiscover);
|
|
19
|
-
const results =
|
|
21
|
+
const results = shared.transform(await shared.query(packages)).map(limitJson);
|
|
20
22
|
this.table(results.map(formatRow).map(colorizeRow), {
|
|
21
23
|
name: { header: 'Package' },
|
|
22
24
|
description: { header: 'Description' },
|
|
@@ -29,9 +31,6 @@ class PluginsDiscover extends sf_plugins_core_1.SfCommand {
|
|
|
29
31
|
return results;
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
|
-
PluginsDiscover.summary = messages.getMessage('summary');
|
|
33
|
-
PluginsDiscover.examples = messages.getMessages('examples');
|
|
34
|
-
exports.default = PluginsDiscover;
|
|
35
34
|
/* there's a LOT more properties outside out types coming back from the APIs that we don't want people to build dependencies on */
|
|
36
35
|
const limitJson = ({ name, description, homepage, downloads, published }) => ({
|
|
37
36
|
name,
|
|
@@ -42,10 +41,10 @@ const limitJson = ({ name, description, homepage, downloads, published }) => ({
|
|
|
42
41
|
});
|
|
43
42
|
const formatRow = (dr) => ({
|
|
44
43
|
...dr,
|
|
45
|
-
name: dr.name.split('/').join(`/${
|
|
46
|
-
description:
|
|
44
|
+
name: dr.name.split('/').join(`/${EOL} `),
|
|
45
|
+
description: shared.descriptionTransform(dr.description),
|
|
47
46
|
});
|
|
48
47
|
const colorizeRow = (row, index) => index % 2 === 0
|
|
49
48
|
? row
|
|
50
|
-
: Object.fromEntries(Object.entries(row).map(([key, value]) => [key,
|
|
49
|
+
: Object.fromEntries(Object.entries(row).map(([key, value]) => [key, StandardColors.info(value)]));
|
|
51
50
|
//# sourceMappingURL=discover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../../../src/commands/plugins/discover.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../../../src/commands/plugins/discover.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,MAA0B,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,QAAQ,CAAC,uBAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1E,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,gCAAgC,EAAE,kBAAkB,CAAC,CAAC;AAI7F,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAA0B;IAC9D,M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C,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAAE,CAAC,WAAW,CAAC;CACzD,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,CAAC,GAAmB,EAAE,KAAa,EAAkB,EAAE,CACzE,KAAK,GAAG,CAAC,KAAK,CAAC;IACb,CAAC,CAAC,GAAG;IACL,CAAC,CAAE,MAAM,CAAC,WAAW,CACjB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAC1D,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
declare const _default: {};
|
|
2
|
-
export
|
|
2
|
+
export default _default;
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2021, salesforce.com, inc.
|
|
4
3
|
* All rights reserved.
|
|
5
4
|
* Licensed under the BSD 3-Clause license.
|
|
6
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
6
|
*/
|
|
8
|
-
|
|
7
|
+
export default {};
|
|
9
8
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAe,EAAE,CAAC"}
|
|
@@ -22,4 +22,9 @@ export declare const query: (packages: string[]) => Promise<Array<[NpmInfo, Star
|
|
|
22
22
|
export declare const transform: (queryResult: QueryResult[]) => DiscoverResult[];
|
|
23
23
|
/** word wrap inside the description. Also removes line empty lines and markdown dividers */
|
|
24
24
|
export declare const descriptionTransform: (description: string) => string;
|
|
25
|
-
|
|
25
|
+
declare const _default: {
|
|
26
|
+
query: (packages: string[]) => Promise<[NpmInfo, StarInfo, SearchInfo][]>;
|
|
27
|
+
transform: (queryResult: QueryResult[]) => DiscoverResult[];
|
|
28
|
+
descriptionTransform: (description: string) => string;
|
|
29
|
+
};
|
|
30
|
+
export default _default;
|
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.descriptionTransform = exports.transform = exports.query = void 0;
|
|
4
1
|
/*
|
|
5
2
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
6
3
|
* All rights reserved.
|
|
7
4
|
* Licensed under the BSD 3-Clause license.
|
|
8
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
6
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const agent = { https: new
|
|
13
|
-
const query = async (packages) => Promise.all(packages.map((pkg) => Promise.all([
|
|
14
|
-
(
|
|
15
|
-
(
|
|
7
|
+
import got from 'got';
|
|
8
|
+
import { ProxyAgent } from 'proxy-agent';
|
|
9
|
+
const agent = { https: new ProxyAgent() };
|
|
10
|
+
export const query = async (packages) => Promise.all(packages.map((pkg) => Promise.all([
|
|
11
|
+
got(`https://registry.npmjs.org/${pkg}/latest`, { agent }).json(),
|
|
12
|
+
got(`https://api.npmjs.org/downloads/point/last-week/${pkg}`, { agent }).json(),
|
|
16
13
|
// use yarn to spread the load around some
|
|
17
|
-
(
|
|
14
|
+
got(`https://registry.yarnpkg.com/-/v1/search?text=${pkg}`, { agent }).json(),
|
|
18
15
|
])));
|
|
19
|
-
|
|
20
|
-
const transform = (queryResult) => queryResult
|
|
16
|
+
export const transform = (queryResult) => queryResult
|
|
21
17
|
.map((y) => ({ ...y[0], ...y[1], published: dateFromSearchObjects(y[0].name, y[2]) }))
|
|
22
18
|
.sort((a, b) => (b.downloads > a.downloads ? 1 : -1))
|
|
23
19
|
.map((y) => ({
|
|
24
20
|
...y,
|
|
25
21
|
homepage: y.homepage.replace('https://github.com/https://github.com', 'https://github.com'),
|
|
26
22
|
}));
|
|
27
|
-
exports.transform = transform;
|
|
28
23
|
const dateFromSearchObjects = (pkgName, searchInfo) => searchInfo.objects.find((o) => o.package.name === pkgName)?.package.date.split('T')[0] ?? '';
|
|
29
24
|
/** word wrap inside the description. Also removes line empty lines and markdown dividers */
|
|
30
|
-
const descriptionTransform = (description) => (description
|
|
25
|
+
export const descriptionTransform = (description) => (description
|
|
31
26
|
// links and image links
|
|
32
27
|
.replace(/\[.*\]\(.*\)/g, '')
|
|
33
28
|
// line dividers
|
|
@@ -39,5 +34,9 @@ const descriptionTransform = (description) => (description
|
|
|
39
34
|
.join('\n') ?? '')
|
|
40
35
|
// remove empty lines
|
|
41
36
|
.replace(/\n{2,}/gm, '\n');
|
|
42
|
-
|
|
37
|
+
export default {
|
|
38
|
+
query,
|
|
39
|
+
transform,
|
|
40
|
+
descriptionTransform,
|
|
41
|
+
};
|
|
43
42
|
//# sourceMappingURL=discoverQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discoverQuery.js","sourceRoot":"","sources":["../../src/shared/discoverQuery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discoverQuery.js","sourceRoot":"","sources":["../../src/shared/discoverQuery.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA2BzC,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,UAAU,EAAE,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EAAE,QAAkB,EAAmD,EAA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,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAE/F,6FAA6F;AAC7F,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,WAAmB,EAAU,EAAE,CAClE,CACE,WAAW;IACT,wBAAwB;KACvB,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;IAC7B,gBAAgB;KACf,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;KACrB,IAAI,EAAE;IACP,8BAA8B;KAC7B,KAAK,CAAC,oBAAoB,CAAC;IAC5B,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;KAC3B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CACpB;IACC,qBAAqB;KACpB,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AAE/B,eAAe;IACb,KAAK;IACL,SAAS;IACT,oBAAoB;CACrB,CAAC"}
|
package/lib/shared/plugins.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.packages = void 0;
|
|
4
1
|
/*
|
|
5
2
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
6
3
|
* All rights reserved.
|
|
7
4
|
* Licensed under the BSD 3-Clause license.
|
|
8
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
6
|
*/
|
|
10
|
-
|
|
7
|
+
export const packages = [
|
|
11
8
|
'mo-dx-plugin',
|
|
12
9
|
'sfdx-hardis',
|
|
13
10
|
'heat-sfdx-cli',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/shared/plugins.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/shared/plugins.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,cAAc;IACd,aAAa;IACb,eAAe;IACf,oBAAoB;IACpB,4CAA4C;IAC5C,2BAA2B;IAC3B,mBAAmB;IACnB,mBAAmB;IACnB,gBAAgB;IAChB,OAAO;IACP,kBAAkB;IAClB,0BAA0B;IAC1B,yBAAyB;IACzB,iBAAiB;IACjB,wBAAwB;IACxB,8BAA8B;IAC9B,yBAAyB;IACzB,8BAA8B;IAC9B,4BAA4B;IAC5B,6BAA6B;IAC7B,6BAA6B;IAC7B,iCAAiC;CAClC,CAAC"}
|