oc 0.49.3 → 0.49.7

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.
Files changed (193) hide show
  1. package/.github/workflows/node.js.yml +1 -1
  2. package/CHANGELOG.md +25 -0
  3. package/dist/cli/commands.d.ts +8 -0
  4. package/dist/cli/commands.js +8 -0
  5. package/dist/cli/domain/clean.d.ts +2 -2
  6. package/dist/cli/domain/get-components-by-dir.d.ts +1 -1
  7. package/dist/cli/domain/get-components-by-dir.js +10 -1
  8. package/dist/cli/domain/get-mocked-plugins.js +1 -1
  9. package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.d.ts +1 -1
  10. package/dist/cli/domain/handle-dependencies/get-compiler.d.ts +3 -2
  11. package/dist/cli/domain/handle-dependencies/index.d.ts +2 -2
  12. package/dist/cli/domain/handle-dependencies/install-compiler.d.ts +2 -1
  13. package/dist/cli/domain/handle-dependencies/install-compiler.js +1 -1
  14. package/dist/cli/domain/handle-dependencies/install-missing-dependencies.d.ts +1 -1
  15. package/dist/cli/domain/handle-dependencies/install-missing-dependencies.js +6 -3
  16. package/dist/cli/domain/handle-dependencies/link-missing-dependencies.d.ts +1 -1
  17. package/dist/cli/domain/handle-dependencies/require-template.d.ts +1 -1
  18. package/dist/cli/domain/init-template/index.d.ts +2 -2
  19. package/dist/cli/domain/init-template/install-template.d.ts +2 -2
  20. package/dist/cli/domain/init-template/scaffold.d.ts +2 -2
  21. package/dist/cli/domain/mock.js +1 -1
  22. package/dist/cli/domain/package-components.d.ts +1 -1
  23. package/dist/cli/domain/registry.js +2 -2
  24. package/dist/cli/facade/dev.d.ts +2 -1
  25. package/dist/cli/facade/dev.js +8 -8
  26. package/dist/cli/facade/init.d.ts +1 -1
  27. package/dist/cli/facade/package.d.ts +1 -1
  28. package/dist/cli/facade/preview.d.ts +1 -1
  29. package/dist/cli/facade/publish.d.ts +1 -0
  30. package/dist/cli/facade/publish.js +10 -5
  31. package/dist/cli/facade/registry-add.d.ts +1 -1
  32. package/dist/cli/facade/registry-ls.d.ts +1 -1
  33. package/dist/cli/facade/registry-ls.js +1 -1
  34. package/dist/cli/facade/registry-remove.d.ts +1 -1
  35. package/dist/cli/facade/registry.d.ts +1 -1
  36. package/dist/cli/facade/registry.js +1 -1
  37. package/dist/cli/logger.d.ts +4 -4
  38. package/dist/cli/logger.js +5 -5
  39. package/dist/cli/programmatic-api.d.ts +2 -0
  40. package/dist/components/oc-client/_package/package.json +1 -1
  41. package/dist/components/oc-client/_package/server.js +1 -1
  42. package/dist/components/oc-client/_package/src/oc-client.min.js +2 -2
  43. package/dist/components/oc-client/_package/src/oc-client.min.map +1 -1
  44. package/dist/components/oc-client/_package/template.js +1 -1
  45. package/dist/components/oc-client/package.json +1 -1
  46. package/dist/components/oc-client/src/oc-client.min.js +2 -2
  47. package/dist/components/oc-client/src/oc-client.min.map +1 -1
  48. package/dist/registry/app-start.d.ts +1 -1
  49. package/dist/registry/app-start.js +1 -1
  50. package/dist/registry/domain/authentication.d.ts +2 -3
  51. package/dist/registry/domain/authentication.js +4 -4
  52. package/dist/registry/domain/components-cache/components-list.d.ts +4 -4
  53. package/dist/registry/domain/components-cache/index.d.ts +3 -3
  54. package/dist/registry/domain/components-cache/index.js +4 -23
  55. package/dist/registry/domain/components-details.d.ts +2 -2
  56. package/dist/registry/domain/components-details.js +6 -21
  57. package/dist/registry/domain/events-handler.d.ts +39 -5
  58. package/dist/registry/domain/events-handler.js +29 -31
  59. package/dist/registry/domain/extract-package.d.ts +2 -2
  60. package/dist/registry/domain/get-package-json-from-temp-dir.d.ts +1 -1
  61. package/dist/registry/domain/nested-renderer.d.ts +3 -3
  62. package/dist/registry/domain/options-sanitiser.js +15 -15
  63. package/dist/registry/domain/plugins-initialiser.d.ts +1 -1
  64. package/dist/registry/domain/plugins-initialiser.js +3 -3
  65. package/dist/registry/domain/register-templates.d.ts +1 -1
  66. package/dist/registry/domain/repository.js +18 -17
  67. package/dist/registry/domain/sanitiser.d.ts +1 -1
  68. package/dist/registry/domain/url-builder.d.ts +2 -2
  69. package/dist/registry/domain/validators/component-parameters.d.ts +3 -3
  70. package/dist/registry/domain/validators/registry-configuration.js +4 -4
  71. package/dist/registry/index.d.ts +33 -4
  72. package/dist/registry/index.js +10 -6
  73. package/dist/registry/middleware/cors.d.ts +1 -1
  74. package/dist/registry/middleware/cors.js +1 -1
  75. package/dist/registry/middleware/file-uploads.js +1 -1
  76. package/dist/registry/middleware/index.js +1 -1
  77. package/dist/registry/middleware/request-handler.js +2 -21
  78. package/dist/registry/router.js +1 -1
  79. package/dist/registry/routes/component-info.js +5 -4
  80. package/dist/registry/routes/component-preview.js +5 -4
  81. package/dist/registry/routes/component.js +2 -2
  82. package/dist/registry/routes/components.js +6 -6
  83. package/dist/registry/routes/dependencies.d.ts +1 -1
  84. package/dist/registry/routes/dependencies.js +1 -1
  85. package/dist/registry/routes/helpers/apply-default-values.d.ts +1 -1
  86. package/dist/registry/routes/helpers/get-component-fallback.d.ts +2 -2
  87. package/dist/registry/routes/helpers/get-component-fallback.js +2 -2
  88. package/dist/registry/routes/helpers/get-component.d.ts +2 -2
  89. package/dist/registry/routes/helpers/get-component.js +9 -9
  90. package/dist/registry/routes/helpers/is-url-discoverable.d.ts +2 -2
  91. package/dist/registry/routes/helpers/is-url-discoverable.js +1 -1
  92. package/dist/registry/routes/index.js +3 -2
  93. package/dist/registry/routes/plugins.d.ts +1 -1
  94. package/dist/registry/routes/plugins.js +1 -1
  95. package/dist/registry/routes/publish.js +5 -6
  96. package/dist/registry/routes/static-redirector.js +4 -4
  97. package/dist/registry/views/info.js +5 -2
  98. package/dist/registry/views/static/info.d.ts +1 -1
  99. package/dist/registry/views/static/info.js +12 -1
  100. package/dist/resources/index.d.ts +1 -1
  101. package/dist/resources/index.js +1 -1
  102. package/dist/types.d.ts +52 -41
  103. package/dist/utils/clean-require.d.ts +16 -4
  104. package/dist/utils/date-stringify.js +8 -9
  105. package/dist/utils/npm-utils.d.ts +4 -4
  106. package/dist/utils/put.d.ts +1 -1
  107. package/logintervals.md +1 -1
  108. package/package.json +34 -35
  109. package/src/cli/commands.ts +10 -0
  110. package/src/cli/domain/clean.ts +12 -4
  111. package/src/cli/domain/get-components-by-dir.ts +21 -1
  112. package/src/cli/domain/get-mocked-plugins.ts +4 -4
  113. package/src/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.ts +1 -1
  114. package/src/cli/domain/handle-dependencies/get-compiler.ts +4 -3
  115. package/src/cli/domain/handle-dependencies/index.ts +21 -17
  116. package/src/cli/domain/handle-dependencies/install-compiler.ts +5 -4
  117. package/src/cli/domain/handle-dependencies/install-missing-dependencies.ts +7 -4
  118. package/src/cli/domain/handle-dependencies/link-missing-dependencies.ts +1 -1
  119. package/src/cli/domain/handle-dependencies/require-template.ts +1 -1
  120. package/src/cli/domain/init-template/index.ts +1 -1
  121. package/src/cli/domain/init-template/install-template.ts +1 -1
  122. package/src/cli/domain/init-template/scaffold.ts +1 -1
  123. package/src/cli/domain/mock.ts +1 -1
  124. package/src/cli/domain/package-components.ts +4 -1
  125. package/src/cli/domain/registry.ts +8 -8
  126. package/src/cli/facade/dev.ts +100 -97
  127. package/src/cli/facade/init.ts +1 -1
  128. package/src/cli/facade/package.ts +1 -1
  129. package/src/cli/facade/preview.ts +1 -1
  130. package/src/cli/facade/publish.ts +25 -10
  131. package/src/cli/facade/registry-add.ts +4 -1
  132. package/src/cli/facade/registry-ls.ts +4 -1
  133. package/src/cli/facade/registry-remove.ts +4 -1
  134. package/src/cli/facade/registry.ts +1 -1
  135. package/src/cli/index.ts +1 -1
  136. package/src/cli/logger.ts +10 -10
  137. package/src/components/oc-client/_package/package.json +1 -1
  138. package/src/components/oc-client/_package/server.js +1 -1
  139. package/src/components/oc-client/_package/src/oc-client.min.js +2 -2
  140. package/src/components/oc-client/_package/src/oc-client.min.map +1 -1
  141. package/src/components/oc-client/_package/template.js +1 -1
  142. package/src/components/oc-client/package.json +1 -1
  143. package/src/components/oc-client/src/oc-client.min.js +2 -2
  144. package/src/components/oc-client/src/oc-client.min.map +1 -1
  145. package/src/globals.d.ts +6 -12
  146. package/src/registry/app-start.ts +2 -2
  147. package/src/registry/domain/authentication.ts +6 -18
  148. package/src/registry/domain/components-cache/components-list.ts +11 -7
  149. package/src/registry/domain/components-cache/index.ts +5 -5
  150. package/src/registry/domain/components-details.ts +14 -8
  151. package/src/registry/domain/events-handler.ts +73 -27
  152. package/src/registry/domain/extract-package.ts +7 -4
  153. package/src/registry/domain/get-package-json-from-temp-dir.ts +1 -1
  154. package/src/registry/domain/nested-renderer.ts +3 -3
  155. package/src/registry/domain/options-sanitiser.ts +15 -15
  156. package/src/registry/domain/plugins-initialiser.ts +8 -5
  157. package/src/registry/domain/register-templates.ts +2 -2
  158. package/src/registry/domain/repository.ts +50 -40
  159. package/src/registry/domain/sanitiser.ts +4 -4
  160. package/src/registry/domain/url-builder.ts +2 -2
  161. package/src/registry/domain/validators/component-parameters.ts +4 -4
  162. package/src/registry/domain/validators/registry-configuration.ts +4 -4
  163. package/src/registry/index.ts +20 -10
  164. package/src/registry/middleware/cors.ts +1 -1
  165. package/src/registry/middleware/file-uploads.ts +1 -1
  166. package/src/registry/middleware/index.ts +1 -1
  167. package/src/registry/middleware/request-handler.ts +6 -21
  168. package/src/registry/router.ts +1 -1
  169. package/src/registry/routes/component-info.ts +7 -6
  170. package/src/registry/routes/component-preview.ts +6 -5
  171. package/src/registry/routes/component.ts +2 -2
  172. package/src/registry/routes/components.ts +7 -7
  173. package/src/registry/routes/dependencies.ts +1 -1
  174. package/src/registry/routes/helpers/apply-default-values.ts +3 -3
  175. package/src/registry/routes/helpers/get-component-fallback.ts +7 -7
  176. package/src/registry/routes/helpers/get-component.ts +16 -13
  177. package/src/registry/routes/helpers/is-url-discoverable.ts +2 -2
  178. package/src/registry/routes/index.ts +3 -2
  179. package/src/registry/routes/plugins.ts +1 -1
  180. package/src/registry/routes/publish.ts +6 -7
  181. package/src/registry/routes/static-redirector.ts +4 -4
  182. package/src/registry/views/info.ts +5 -2
  183. package/src/registry/views/static/info.ts +12 -1
  184. package/src/resources/index.ts +2 -2
  185. package/src/types.ts +85 -41
  186. package/src/utils/clean-require.ts +17 -1
  187. package/src/utils/date-stringify.ts +8 -6
  188. package/src/utils/npm-utils.ts +2 -2
  189. package/src/utils/put.ts +4 -2
  190. package/tsconfig.json +3 -3
  191. package/dist/utils/pad-zero.d.ts +0 -1
  192. package/dist/utils/pad-zero.js +0 -6
  193. package/src/utils/pad-zero.ts +0 -3
package/src/types.ts CHANGED
@@ -40,7 +40,7 @@ export interface ComponentsDetails {
40
40
  }
41
41
 
42
42
  export interface ComponentsList {
43
- components: Dictionary<string[]>;
43
+ components: Record<string, string[]>;
44
44
  lastEdit: number;
45
45
  }
46
46
 
@@ -113,6 +113,22 @@ export interface VM {
113
113
  type: 'oc-registry' | 'oc-registry-local';
114
114
  }
115
115
 
116
+ export type Authentication<T = any> = {
117
+ validate: (config: T) => {
118
+ isValid: boolean;
119
+ message: string;
120
+ };
121
+ middleware: (config: T) => any;
122
+ };
123
+
124
+ export type PublishAuthConfig =
125
+ | {
126
+ type: 'basic';
127
+ username: string;
128
+ password: string;
129
+ }
130
+ | ({ type: string | Authentication } & Record<string, any>);
131
+
116
132
  export interface Config {
117
133
  baseUrl: string;
118
134
  baseUrlFunc?: (opts: { host?: string; secure: boolean }) => string;
@@ -121,24 +137,21 @@ export interface Config {
121
137
  dependencies: string[];
122
138
  discovery: boolean;
123
139
  discoveryFunc?: (opts: { host?: string; secure: boolean }) => boolean;
124
- env: Dictionary<string>;
140
+ env: Record<string, string>;
125
141
  executionTimeout?: number;
126
142
  fallbackRegistryUrl: string;
127
143
  hotReloading: boolean;
128
144
  keepAliveTimeout?: number;
129
145
  liveReloadPort: number;
146
+ components?: string[];
130
147
  local: boolean;
131
148
  path: string;
132
149
  plugins: Record<string, (...args: unknown[]) => void>;
133
150
  pollingInterval: number;
134
- port: number;
151
+ port: number | string;
135
152
  postRequestPayloadSize?: number;
136
153
  prefix: string;
137
- publishAuth?: {
138
- type: string;
139
- username: string;
140
- password: string;
141
- };
154
+ publishAuth?: PublishAuthConfig;
142
155
  publishValidation: (data: unknown) =>
143
156
  | {
144
157
  isValid: boolean;
@@ -160,7 +173,7 @@ export interface Config {
160
173
  };
161
174
  storage: {
162
175
  adapter: any;
163
- options: Dictionary<any> & { componentsDir: string };
176
+ options: Record<string, any> & { componentsDir: string };
164
177
  };
165
178
  tempDir: string;
166
179
  templates: any[];
@@ -170,20 +183,31 @@ export interface Config {
170
183
 
171
184
  export interface Cdn {
172
185
  adapterType: string;
173
- getFile: (filePath: string, cb: Callback<string>) => void;
174
- getJson<T>(filePath: string, force: boolean, cb: Callback<T, string>): void;
175
- getJson<T>(filePath: string, cb: Callback<T, string>): void;
186
+ getFile: (
187
+ filePath: string,
188
+ cb: (err: Error | null, data: string) => void
189
+ ) => void;
190
+ getJson<T>(
191
+ filePath: string,
192
+ force: boolean,
193
+ cb: (err: string | null, data: T) => void
194
+ ): void;
195
+ getJson<T>(filePath: string, cb: (err: string | null, data: T) => void): void;
176
196
  listSubDirectories: (
177
197
  dir: string,
178
- cb: Callback<string[], Error & { code?: string }>
198
+ cb: (err: (Error & { code?: string }) | null, data: string[]) => void
179
199
  ) => void;
180
200
  maxConcurrentRequests: number;
181
- putDir: (folderPath: string, filePath: string, cb: Callback) => void;
201
+ putDir: (
202
+ folderPath: string,
203
+ filePath: string,
204
+ cb: (err: Error | null) => void
205
+ ) => void;
182
206
  putFileContent: (
183
207
  data: unknown,
184
208
  path: string,
185
209
  isPrivate: boolean,
186
- callback: Callback<unknown, string>
210
+ callback: (err: string | null, data: unknown) => void
187
211
  ) => void;
188
212
  }
189
213
 
@@ -203,7 +227,7 @@ interface CompilerOptions {
203
227
  }
204
228
 
205
229
  export interface Template {
206
- compile?: (options: CompilerOptions, cb: Callback) => void;
230
+ compile?: (options: CompilerOptions, cb: (err: Error | null) => void) => void;
207
231
  getCompiledTemplate: (
208
232
  templateString: string,
209
233
  key: string,
@@ -212,7 +236,7 @@ export interface Template {
212
236
  getInfo: () => TemplateInfo;
213
237
  render: (
214
238
  options: { model: unknown; template: CompiledTemplate },
215
- cb: Callback<string>
239
+ cb: (err: Error | null, data: string) => void
216
240
  ) => void;
217
241
  }
218
242
 
@@ -233,15 +257,18 @@ export interface Plugin {
233
257
  }
234
258
 
235
259
  export interface RegistryCli {
236
- add(registry: string, callback: Callback<null, string>): void;
237
- get(callback: Callback<string[], string>): void;
260
+ add(
261
+ registry: string,
262
+ callback: (err: string | null, data: null) => void
263
+ ): void;
264
+ get(callback: (err: string | null, data: string[]) => void): void;
238
265
  getApiComponentByHref(
239
266
  href: string,
240
- callback: Callback<unknown, Error | number>
267
+ callback: (err: Error | number | null, data: unknown) => void
241
268
  ): void;
242
269
  getComponentPreviewUrlByUrl(
243
270
  componentHref: string,
244
- callback: Callback<string, Error | number>
271
+ callback: (err: Error | number | null, data: string) => void
245
272
  ): void;
246
273
  putComponent(
247
274
  options: {
@@ -250,15 +277,21 @@ export interface RegistryCli {
250
277
  route: string;
251
278
  path: string;
252
279
  },
253
- callback: Callback<unknown, string>
280
+ callback: (err: string | null, data: unknown) => void
254
281
  ): void;
255
- remove(registry: string, callback: Callback): void;
282
+ remove(registry: string, callback: (err: Error | null) => void): void;
256
283
  }
257
284
 
258
285
  export interface Local {
259
286
  clean: {
260
- fetchList: (dirPath: string, callback: Callback<string[]>) => void;
261
- remove: (list: string[], callback: Callback<string>) => void;
287
+ fetchList: (
288
+ dirPath: string,
289
+ callback: (err: Error | null, data: string[]) => void
290
+ ) => void;
291
+ remove: (
292
+ list: string[],
293
+ callback: (err: Error | null, data: string) => void
294
+ ) => void;
262
295
  };
263
296
  cleanup: (
264
297
  compressedPackagePath: string,
@@ -271,7 +304,8 @@ export interface Local {
271
304
  ) => void;
272
305
  getComponentsByDir: (
273
306
  componentsDir: string,
274
- callback: Callback<string[]>
307
+ componentsToRun: (err: Error | null, data: string[]) => void | string[],
308
+ callback: (err: Error | null, data: string[]) => void
275
309
  ) => void;
276
310
  init: (
277
311
  options: {
@@ -280,7 +314,7 @@ export interface Local {
280
314
  componentPath: string;
281
315
  templateType: string;
282
316
  },
283
- callback: Callback<string, string>
317
+ callback: (err: string | null, data: string) => void
284
318
  ) => void;
285
319
  mock: (
286
320
  params: { targetType: string; targetValue: string; targetName: string },
@@ -293,7 +327,7 @@ export interface Local {
293
327
  verbose?: boolean;
294
328
  production?: boolean;
295
329
  },
296
- callback: Callback<Component>
330
+ callback: (err: Error | null, data: Component) => void
297
331
  ) => void;
298
332
  }
299
333
 
@@ -301,36 +335,41 @@ export interface Repository {
301
335
  getCompiledView(
302
336
  componentName: string,
303
337
  componentVersion: string,
304
- callback: Callback<string>
338
+ callback: (err: Error | null, data: string) => void
305
339
  ): void;
306
340
  getComponent(
307
341
  componentName: string,
308
342
  componentVersion: string,
309
- calllback: Callback<Component, string>
343
+ calllback: (err: string | null, data: Component) => void
310
344
  ): void;
311
345
  getComponent(
312
346
  componentName: string,
313
- calllback: Callback<Component, string>
347
+ calllback: (err: string | null, data: Component) => void
314
348
  ): void;
315
349
  getComponentInfo(
316
350
  componentName: string,
317
351
  componentVersion: string,
318
- callback: Callback<Component, string>
352
+ callback: (err: string | null, data: Component) => void
319
353
  ): void;
320
354
  getComponentPath(componentName: string, componentVersion: string): void;
321
- getComponents(callback: Callback<string[]>): void;
322
- getComponentsDetails(callback: Callback<ComponentsDetails, string>): void;
355
+ getComponents(callback: (err: Error | null, data: string[]) => void): void;
356
+ getComponentsDetails(
357
+ callback: (err: string | null, data: ComponentsDetails) => void
358
+ ): void;
323
359
  getComponentVersions(
324
360
  componentName: string,
325
- callback: Callback<string[], string>
361
+ callback: (err: string | null, data: string[]) => void
326
362
  ): void;
327
363
  getDataProvider(
328
364
  componentName: string,
329
365
  componentVersion: string,
330
- callback: Callback<{
331
- content: string;
332
- filePath: string;
333
- }>
366
+ callback: (
367
+ err: Error | null,
368
+ data: {
369
+ content: string;
370
+ filePath: string;
371
+ }
372
+ ) => void
334
373
  ): void;
335
374
  getStaticClientMapPath: () => string;
336
375
  getStaticClientPath: () => string;
@@ -341,12 +380,17 @@ export interface Repository {
341
380
  ) => string;
342
381
  getTemplate: (type: string) => Template;
343
382
  getTemplatesInfo: () => TemplateInfo[];
344
- init(callback: Callback<ComponentsList | string>): void;
383
+ init(
384
+ callback: (err: Error | null, data: ComponentsList | string) => void
385
+ ): void;
345
386
  publishComponent(
346
387
  pkgDetails: any,
347
388
  componentName: string,
348
389
  componentVersion: string,
349
- callback: Callback<ComponentsDetails, { code: string; msg: string }>
390
+ callback: (
391
+ err: { code: string; msg: string } | null,
392
+ data: ComponentsDetails
393
+ ) => void
350
394
  ): void;
351
395
  }
352
396
 
@@ -1,9 +1,25 @@
1
1
  import tryRequire from 'try-require';
2
2
 
3
+ export default function cleanRequire(
4
+ path: string,
5
+ opts: { justTry: true; resolve: true }
6
+ ): string | undefined;
7
+ export default function cleanRequire(
8
+ path: string,
9
+ opts: { justTry?: false; resolve: true }
10
+ ): string;
11
+ export default function cleanRequire<T = unknown>(
12
+ path: string,
13
+ opts: { justTry: true; resolve?: false }
14
+ ): T | undefined;
15
+ export default function cleanRequire<T = unknown>(
16
+ path: string,
17
+ opts: { justTry?: false; resolve?: false }
18
+ ): T;
3
19
  export default function cleanRequire(
4
20
  path: string,
5
21
  { justTry = false, resolve = false }: { justTry?: boolean; resolve?: boolean }
6
- ): any {
22
+ ) {
7
23
  const shouldThrow = !justTry;
8
24
 
9
25
  if (require.cache && !!require.cache[path]) {
@@ -1,19 +1,21 @@
1
- import padZero from './pad-zero';
1
+ function padTwoDigits(data: number): string {
2
+ return String(data).padStart(2, '0');
3
+ }
2
4
 
3
5
  export default function dateStringify(date: unknown): string {
4
6
  if (date instanceof Date) {
5
7
  return (
6
8
  date.getFullYear() +
7
9
  '/' +
8
- padZero(2, date.getMonth() + 1) +
10
+ padTwoDigits(date.getMonth() + 1) +
9
11
  '/' +
10
- padZero(2, date.getDate()) +
12
+ padTwoDigits(date.getDate()) +
11
13
  ' ' +
12
- padZero(2, date.getHours()) +
14
+ padTwoDigits(date.getHours()) +
13
15
  ':' +
14
- padZero(2, date.getMinutes()) +
16
+ padTwoDigits(date.getMinutes()) +
15
17
  ':' +
16
- padZero(2, date.getSeconds())
18
+ padTwoDigits(date.getSeconds())
17
19
  );
18
20
  }
19
21
 
@@ -65,7 +65,7 @@ export const installDependencies = (
65
65
  silent: boolean;
66
66
  usePrefix: boolean;
67
67
  },
68
- callback: Callback<{ dest: string }, string | number>
68
+ callback: (err: string | number | null, data: { dest: string }) => void
69
69
  ): void => {
70
70
  const { dependencies, installPath, silent } = options;
71
71
  const npmi = buildInstallCommand(options);
@@ -91,7 +91,7 @@ export const installDependency = (
91
91
  silent?: boolean;
92
92
  usePrefix: boolean;
93
93
  },
94
- callback: Callback<{ dest: string }, string | number>
94
+ callback: (err: string | number | null, data: { dest: string }) => void
95
95
  ): void => {
96
96
  const { dependency, installPath, silent } = options;
97
97
  const npmi = buildInstallCommand(options);
package/src/utils/put.ts CHANGED
@@ -6,8 +6,10 @@ import url from 'url';
6
6
  export default function put(
7
7
  urlPath: string,
8
8
  files: string | string[],
9
- headers: Record<string, string> | Callback<any, Error | string>,
10
- callback: Callback<any, Error | string>
9
+ headers:
10
+ | Record<string, string>
11
+ | ((err: Error | string | null, data: any) => void),
12
+ callback: (err: Error | string | null, data: any) => void
11
13
  ): void {
12
14
  if (typeof headers === 'function') {
13
15
  callback = headers;
package/tsconfig.json CHANGED
@@ -85,13 +85,13 @@
85
85
  "useUnknownInCatchVariables": true /* Type catch clause variables as 'unknown' instead of 'any'. */,
86
86
  "alwaysStrict": true /* Ensure 'use strict' is always emitted. */,
87
87
  "noUnusedLocals": true /* Enable error reporting when a local variables aren't read. */,
88
- // "noUnusedParameters": true /* Raise an error when a function parameter isn't read */,
88
+ "noUnusedParameters": true /* Raise an error when a function parameter isn't read */,
89
89
  // "exactOptionalPropertyTypes": true /* Interpret optional property types as written, rather than adding 'undefined'. */,
90
- // "noImplicitReturns": true /* Enable error reporting for codepaths that do not explicitly return in a function. */,
90
+ "noImplicitReturns": true /* Enable error reporting for codepaths that do not explicitly return in a function. */,
91
91
  "noFallthroughCasesInSwitch": true /* Enable error reporting for fallthrough cases in switch statements. */,
92
92
  // "noUncheckedIndexedAccess": true /* Include 'undefined' in index signature results */,
93
93
  "noImplicitOverride": true /* Ensure overriding members in derived classes are marked with an override modifier. */,
94
- // "noPropertyAccessFromIndexSignature": true /* Enforces using indexed accessors for keys declared using an indexed type */,
94
+ "noPropertyAccessFromIndexSignature": true /* Enforces using indexed accessors for keys declared using an indexed type */,
95
95
  "allowUnusedLabels": false /* Disable error reporting for unused labels. */,
96
96
  "allowUnreachableCode": false /* Disable error reporting for unreachable code. */,
97
97
 
@@ -1 +0,0 @@
1
- export default function padZero(length: number, data: number): string;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function padZero(length, data) {
4
- return Array(length - String(data).length + 1).join('0') + data;
5
- }
6
- exports.default = padZero;
@@ -1,3 +0,0 @@
1
- export default function padZero(length: number, data: number): string {
2
- return Array(length - String(data).length + 1).join('0') + data;
3
- }