@@ -9,62 +9,58 @@ import publishApm from './lib/publish.js';
99let verified ;
1010let prepared ;
1111
12- const plugin = {
13- async verifyConditions ( pluginConfig , context ) {
14- const errors = await verifyApm ( pluginConfig , context ) ;
12+ export async function verifyConditions ( pluginConfig , context ) {
13+ const errors = await verifyApm ( pluginConfig , context ) ;
1514
16- try {
17- await getPkg ( pluginConfig , context ) ;
18- } catch ( error ) {
19- errors . push ( ...error . errors ) ;
20- }
15+ try {
16+ await getPkg ( pluginConfig , context ) ;
17+ } catch ( error ) {
18+ errors . push ( ...error . errors ) ;
19+ }
2120
22- if ( errors . length > 0 ) {
23- throw new AggregateError ( errors ) ;
24- }
21+ if ( errors . length > 0 ) {
22+ throw new AggregateError ( errors ) ;
23+ }
2524
26- verified = true ;
27- } ,
25+ verified = true ;
26+ } ;
2827
29- async prepare ( pluginConfig , context ) {
30- const errors = verified ? [ ] : await verifyApm ( pluginConfig , context ) ;
28+ export async function prepare ( pluginConfig , context ) {
29+ const errors = verified ? [ ] : await verifyApm ( pluginConfig , context ) ;
3130
32- try {
33- await getPkg ( pluginConfig , context ) ;
34- } catch ( error ) {
35- errors . push ( ...error . errors ) ;
36- }
31+ try {
32+ await getPkg ( pluginConfig , context ) ;
33+ } catch ( error ) {
34+ errors . push ( ...error . errors ) ;
35+ }
3736
38- if ( errors . length > 0 ) {
39- throw new AggregateError ( errors ) ;
40- }
37+ if ( errors . length > 0 ) {
38+ throw new AggregateError ( errors ) ;
39+ }
4140
42- await prepareApm ( pluginConfig , context ) ;
41+ await prepareApm ( pluginConfig , context ) ;
4342
44- prepared = true ;
45- } ,
43+ prepared = true ;
44+ } ;
4645
47- async publish ( pluginConfig , context ) {
48- let pkg ;
49- const errors = verified ? [ ] : await verifyApm ( pluginConfig , context ) ;
46+ export async function publish ( pluginConfig , context ) {
47+ let pkg ;
48+ const errors = verified ? [ ] : await verifyApm ( pluginConfig , context ) ;
5049
51- try {
52- pkg = await getPkg ( pluginConfig , context ) ;
53- } catch ( error ) {
54- errors . push ( ...error . errors ) ;
55- }
50+ try {
51+ pkg = await getPkg ( pluginConfig , context ) ;
52+ } catch ( error ) {
53+ errors . push ( ...error . errors ) ;
54+ }
5655
57- if ( errors . length > 0 ) {
58- throw new AggregateError ( errors ) ;
59- }
56+ if ( errors . length > 0 ) {
57+ throw new AggregateError ( errors ) ;
58+ }
6059
61- if ( ! prepared ) {
62- await prepareApm ( pluginConfig , context ) ;
63- prepared = true ;
64- }
60+ if ( ! prepared ) {
61+ await prepareApm ( pluginConfig , context ) ;
62+ prepared = true ;
63+ }
6564
66- return publishApm ( pluginConfig , pkg , context ) ;
67- } ,
65+ return publishApm ( pluginConfig , pkg , context ) ;
6866} ;
69-
70- export default plugin ;
0 commit comments