@pega/dx-component-builder-sdk 0.1.32 → 0.1.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/dx-component-builder-sdk",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -18,6 +18,20 @@ import {
18
18
  import { PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH, COMPONENT_SCHEMA, CATEGORY_CUSTOM } from '../../constants.js';
19
19
 
20
20
 
21
+ export const cleanUp = async () => {
22
+ fs.rm('dist', { recursive: true }, err => {
23
+ if (err) {
24
+ throw err;
25
+ }
26
+ });
27
+
28
+ fs.rm('lib', { recursive: true }, err => {
29
+ if (err) {
30
+ throw err;
31
+ }
32
+ });
33
+ }
34
+
21
35
  export const getBuildCategory = async (options) => {
22
36
  const categoryType = getOptionsCategory(options);
23
37
 
@@ -6,7 +6,7 @@ import validate from '../validator/index.js';
6
6
 
7
7
  import bundleComponent from '../bundle/index.js';
8
8
  import lintComponent from '../linter/index.js';
9
- import { getBuildComponentQuestions, getBuildCategory } from './helper.js';
9
+ import { getBuildComponentQuestions, getBuildCategory, cleanUp } from './helper.js';
10
10
  import { getComponentDirectoryPath, showVersion, getOptionsCategory } from '../../util.js';
11
11
 
12
12
  import { CATEGORY_CUSTOM } from '../../constants.js';
@@ -105,5 +105,8 @@ export default async options => {
105
105
  });
106
106
  }
107
107
 
108
+
109
+ cleanUp();
110
+
108
111
  return true;
109
112
  };
@@ -12,6 +12,19 @@ import {
12
12
  } from '../../util.js';
13
13
  import { COMPONENT_SCHEMA, CATEGORY_CUSTOM } from '../../constants.js';
14
14
 
15
+ export const cleanUp = async () => {
16
+ fs.rm('dist', { recursive: true }, err => {
17
+ if (err) {
18
+ throw err;
19
+ }
20
+ });
21
+
22
+ fs.rm('lib', { recursive: true }, err => {
23
+ if (err) {
24
+ throw err;
25
+ }
26
+ });
27
+ }
15
28
 
16
29
  export const getBuildCategory = async (options) => {
17
30
  const categoryType = getOptionsCategory(options);
@@ -6,7 +6,7 @@ import validate from '../validator/index.js';
6
6
 
7
7
  import bundleComponent from '../bundle/index.js';
8
8
  import lintComponent from '../linter/index.js';
9
- import { getBuildComponentQuestions, getBuildCategory } from './helper.js';
9
+ import { getBuildComponentQuestions, getBuildCategory, cleanUp } from './helper.js';
10
10
  import { getComponentDirectoryPath, showVersion, getOptionsCategory, getComponentsObj } from '../../util.js';
11
11
 
12
12
  import { CATEGORY_CUSTOM } from '../../constants.js';
@@ -117,5 +117,7 @@ export default async options => {
117
117
  }
118
118
  }
119
119
 
120
+ cleanUp();
121
+
120
122
  return true;
121
123
  };
@@ -143,6 +143,11 @@ export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) =>
143
143
  throw err;
144
144
  }
145
145
  });
146
+ fs.rmdir('lib', { recursive: true }, err => {
147
+ if (err) {
148
+ throw err;
149
+ }
150
+ });
146
151
  }
147
152
  else {
148
153
  if (fs.existsSync(configExtJson)) {
@@ -152,6 +157,11 @@ export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) =>
152
157
  throw err;
153
158
  }
154
159
  });
160
+ fs.rmdir('lib', { recursive: true }, err => {
161
+ if (err) {
162
+ throw err;
163
+ }
164
+ });
155
165
  }
156
166
  else {
157
167
  const tempConfig = { "componentKey" : ""};
@@ -161,12 +161,18 @@ export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) =>
161
161
  return { zipContent, configContent };
162
162
  };
163
163
 
164
- export const removeDist = async () => {
164
+ export const cleanUp = async () => {
165
165
  fs.rm('dist', { recursive: true }, err => {
166
166
  if (err) {
167
167
  throw err;
168
168
  }
169
169
  });
170
+
171
+ fs.rm('lib', { recursive: true }, err => {
172
+ if (err) {
173
+ throw err;
174
+ }
175
+ });
170
176
  }
171
177
 
172
178
  export const publishComponentToServer = async data => {
@@ -16,7 +16,7 @@ import { getPublishComponentQuestions,
16
16
  getBuildCategory,
17
17
  mapConfigJsonToCompanion,
18
18
  removeCompanionConfigJson,
19
- removeDist
19
+ cleanUp
20
20
  } from './helper.js';
21
21
 
22
22
 
@@ -195,8 +195,8 @@ export default async options => {
195
195
  }
196
196
 
197
197
 
198
- // once done, remove leftover dist directory
199
- removeDist();
198
+ // once done, remove leftover directories
199
+ cleanUp();
200
200
 
201
201
 
202
202
  return true;