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.
- package/.github/workflows/node.js.yml +1 -1
- package/CHANGELOG.md +25 -0
- package/dist/cli/commands.d.ts +8 -0
- package/dist/cli/commands.js +8 -0
- package/dist/cli/domain/clean.d.ts +2 -2
- package/dist/cli/domain/get-components-by-dir.d.ts +1 -1
- package/dist/cli/domain/get-components-by-dir.js +10 -1
- package/dist/cli/domain/get-mocked-plugins.js +1 -1
- package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.d.ts +1 -1
- package/dist/cli/domain/handle-dependencies/get-compiler.d.ts +3 -2
- package/dist/cli/domain/handle-dependencies/index.d.ts +2 -2
- package/dist/cli/domain/handle-dependencies/install-compiler.d.ts +2 -1
- package/dist/cli/domain/handle-dependencies/install-compiler.js +1 -1
- package/dist/cli/domain/handle-dependencies/install-missing-dependencies.d.ts +1 -1
- package/dist/cli/domain/handle-dependencies/install-missing-dependencies.js +6 -3
- package/dist/cli/domain/handle-dependencies/link-missing-dependencies.d.ts +1 -1
- package/dist/cli/domain/handle-dependencies/require-template.d.ts +1 -1
- package/dist/cli/domain/init-template/index.d.ts +2 -2
- package/dist/cli/domain/init-template/install-template.d.ts +2 -2
- package/dist/cli/domain/init-template/scaffold.d.ts +2 -2
- package/dist/cli/domain/mock.js +1 -1
- package/dist/cli/domain/package-components.d.ts +1 -1
- package/dist/cli/domain/registry.js +2 -2
- package/dist/cli/facade/dev.d.ts +2 -1
- package/dist/cli/facade/dev.js +8 -8
- package/dist/cli/facade/init.d.ts +1 -1
- package/dist/cli/facade/package.d.ts +1 -1
- package/dist/cli/facade/preview.d.ts +1 -1
- package/dist/cli/facade/publish.d.ts +1 -0
- package/dist/cli/facade/publish.js +10 -5
- package/dist/cli/facade/registry-add.d.ts +1 -1
- package/dist/cli/facade/registry-ls.d.ts +1 -1
- package/dist/cli/facade/registry-ls.js +1 -1
- package/dist/cli/facade/registry-remove.d.ts +1 -1
- package/dist/cli/facade/registry.d.ts +1 -1
- package/dist/cli/facade/registry.js +1 -1
- package/dist/cli/logger.d.ts +4 -4
- package/dist/cli/logger.js +5 -5
- package/dist/cli/programmatic-api.d.ts +2 -0
- package/dist/components/oc-client/_package/package.json +1 -1
- package/dist/components/oc-client/_package/server.js +1 -1
- package/dist/components/oc-client/_package/src/oc-client.min.js +2 -2
- package/dist/components/oc-client/_package/src/oc-client.min.map +1 -1
- package/dist/components/oc-client/_package/template.js +1 -1
- package/dist/components/oc-client/package.json +1 -1
- package/dist/components/oc-client/src/oc-client.min.js +2 -2
- package/dist/components/oc-client/src/oc-client.min.map +1 -1
- package/dist/registry/app-start.d.ts +1 -1
- package/dist/registry/app-start.js +1 -1
- package/dist/registry/domain/authentication.d.ts +2 -3
- package/dist/registry/domain/authentication.js +4 -4
- package/dist/registry/domain/components-cache/components-list.d.ts +4 -4
- package/dist/registry/domain/components-cache/index.d.ts +3 -3
- package/dist/registry/domain/components-cache/index.js +4 -23
- package/dist/registry/domain/components-details.d.ts +2 -2
- package/dist/registry/domain/components-details.js +6 -21
- package/dist/registry/domain/events-handler.d.ts +39 -5
- package/dist/registry/domain/events-handler.js +29 -31
- package/dist/registry/domain/extract-package.d.ts +2 -2
- package/dist/registry/domain/get-package-json-from-temp-dir.d.ts +1 -1
- package/dist/registry/domain/nested-renderer.d.ts +3 -3
- package/dist/registry/domain/options-sanitiser.js +15 -15
- package/dist/registry/domain/plugins-initialiser.d.ts +1 -1
- package/dist/registry/domain/plugins-initialiser.js +3 -3
- package/dist/registry/domain/register-templates.d.ts +1 -1
- package/dist/registry/domain/repository.js +18 -17
- package/dist/registry/domain/sanitiser.d.ts +1 -1
- package/dist/registry/domain/url-builder.d.ts +2 -2
- package/dist/registry/domain/validators/component-parameters.d.ts +3 -3
- package/dist/registry/domain/validators/registry-configuration.js +4 -4
- package/dist/registry/index.d.ts +33 -4
- package/dist/registry/index.js +10 -6
- package/dist/registry/middleware/cors.d.ts +1 -1
- package/dist/registry/middleware/cors.js +1 -1
- package/dist/registry/middleware/file-uploads.js +1 -1
- package/dist/registry/middleware/index.js +1 -1
- package/dist/registry/middleware/request-handler.js +2 -21
- package/dist/registry/router.js +1 -1
- package/dist/registry/routes/component-info.js +5 -4
- package/dist/registry/routes/component-preview.js +5 -4
- package/dist/registry/routes/component.js +2 -2
- package/dist/registry/routes/components.js +6 -6
- package/dist/registry/routes/dependencies.d.ts +1 -1
- package/dist/registry/routes/dependencies.js +1 -1
- package/dist/registry/routes/helpers/apply-default-values.d.ts +1 -1
- package/dist/registry/routes/helpers/get-component-fallback.d.ts +2 -2
- package/dist/registry/routes/helpers/get-component-fallback.js +2 -2
- package/dist/registry/routes/helpers/get-component.d.ts +2 -2
- package/dist/registry/routes/helpers/get-component.js +9 -9
- package/dist/registry/routes/helpers/is-url-discoverable.d.ts +2 -2
- package/dist/registry/routes/helpers/is-url-discoverable.js +1 -1
- package/dist/registry/routes/index.js +3 -2
- package/dist/registry/routes/plugins.d.ts +1 -1
- package/dist/registry/routes/plugins.js +1 -1
- package/dist/registry/routes/publish.js +5 -6
- package/dist/registry/routes/static-redirector.js +4 -4
- package/dist/registry/views/info.js +5 -2
- package/dist/registry/views/static/info.d.ts +1 -1
- package/dist/registry/views/static/info.js +12 -1
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.js +1 -1
- package/dist/types.d.ts +52 -41
- package/dist/utils/clean-require.d.ts +16 -4
- package/dist/utils/date-stringify.js +8 -9
- package/dist/utils/npm-utils.d.ts +4 -4
- package/dist/utils/put.d.ts +1 -1
- package/logintervals.md +1 -1
- package/package.json +34 -35
- package/src/cli/commands.ts +10 -0
- package/src/cli/domain/clean.ts +12 -4
- package/src/cli/domain/get-components-by-dir.ts +21 -1
- package/src/cli/domain/get-mocked-plugins.ts +4 -4
- package/src/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.ts +1 -1
- package/src/cli/domain/handle-dependencies/get-compiler.ts +4 -3
- package/src/cli/domain/handle-dependencies/index.ts +21 -17
- package/src/cli/domain/handle-dependencies/install-compiler.ts +5 -4
- package/src/cli/domain/handle-dependencies/install-missing-dependencies.ts +7 -4
- package/src/cli/domain/handle-dependencies/link-missing-dependencies.ts +1 -1
- package/src/cli/domain/handle-dependencies/require-template.ts +1 -1
- package/src/cli/domain/init-template/index.ts +1 -1
- package/src/cli/domain/init-template/install-template.ts +1 -1
- package/src/cli/domain/init-template/scaffold.ts +1 -1
- package/src/cli/domain/mock.ts +1 -1
- package/src/cli/domain/package-components.ts +4 -1
- package/src/cli/domain/registry.ts +8 -8
- package/src/cli/facade/dev.ts +100 -97
- package/src/cli/facade/init.ts +1 -1
- package/src/cli/facade/package.ts +1 -1
- package/src/cli/facade/preview.ts +1 -1
- package/src/cli/facade/publish.ts +25 -10
- package/src/cli/facade/registry-add.ts +4 -1
- package/src/cli/facade/registry-ls.ts +4 -1
- package/src/cli/facade/registry-remove.ts +4 -1
- package/src/cli/facade/registry.ts +1 -1
- package/src/cli/index.ts +1 -1
- package/src/cli/logger.ts +10 -10
- package/src/components/oc-client/_package/package.json +1 -1
- package/src/components/oc-client/_package/server.js +1 -1
- package/src/components/oc-client/_package/src/oc-client.min.js +2 -2
- package/src/components/oc-client/_package/src/oc-client.min.map +1 -1
- package/src/components/oc-client/_package/template.js +1 -1
- package/src/components/oc-client/package.json +1 -1
- package/src/components/oc-client/src/oc-client.min.js +2 -2
- package/src/components/oc-client/src/oc-client.min.map +1 -1
- package/src/globals.d.ts +6 -12
- package/src/registry/app-start.ts +2 -2
- package/src/registry/domain/authentication.ts +6 -18
- package/src/registry/domain/components-cache/components-list.ts +11 -7
- package/src/registry/domain/components-cache/index.ts +5 -5
- package/src/registry/domain/components-details.ts +14 -8
- package/src/registry/domain/events-handler.ts +73 -27
- package/src/registry/domain/extract-package.ts +7 -4
- package/src/registry/domain/get-package-json-from-temp-dir.ts +1 -1
- package/src/registry/domain/nested-renderer.ts +3 -3
- package/src/registry/domain/options-sanitiser.ts +15 -15
- package/src/registry/domain/plugins-initialiser.ts +8 -5
- package/src/registry/domain/register-templates.ts +2 -2
- package/src/registry/domain/repository.ts +50 -40
- package/src/registry/domain/sanitiser.ts +4 -4
- package/src/registry/domain/url-builder.ts +2 -2
- package/src/registry/domain/validators/component-parameters.ts +4 -4
- package/src/registry/domain/validators/registry-configuration.ts +4 -4
- package/src/registry/index.ts +20 -10
- package/src/registry/middleware/cors.ts +1 -1
- package/src/registry/middleware/file-uploads.ts +1 -1
- package/src/registry/middleware/index.ts +1 -1
- package/src/registry/middleware/request-handler.ts +6 -21
- package/src/registry/router.ts +1 -1
- package/src/registry/routes/component-info.ts +7 -6
- package/src/registry/routes/component-preview.ts +6 -5
- package/src/registry/routes/component.ts +2 -2
- package/src/registry/routes/components.ts +7 -7
- package/src/registry/routes/dependencies.ts +1 -1
- package/src/registry/routes/helpers/apply-default-values.ts +3 -3
- package/src/registry/routes/helpers/get-component-fallback.ts +7 -7
- package/src/registry/routes/helpers/get-component.ts +16 -13
- package/src/registry/routes/helpers/is-url-discoverable.ts +2 -2
- package/src/registry/routes/index.ts +3 -2
- package/src/registry/routes/plugins.ts +1 -1
- package/src/registry/routes/publish.ts +6 -7
- package/src/registry/routes/static-redirector.ts +4 -4
- package/src/registry/views/info.ts +5 -2
- package/src/registry/views/static/info.ts +12 -1
- package/src/resources/index.ts +2 -2
- package/src/types.ts +85 -41
- package/src/utils/clean-require.ts +17 -1
- package/src/utils/date-stringify.ts +8 -6
- package/src/utils/npm-utils.ts +2 -2
- package/src/utils/put.ts +4 -2
- package/tsconfig.json +3 -3
- package/dist/utils/pad-zero.d.ts +0 -1
- package/dist/utils/pad-zero.js +0 -6
- 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:
|
|
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:
|
|
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:
|
|
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: (
|
|
174
|
-
|
|
175
|
-
|
|
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:
|
|
198
|
+
cb: (err: (Error & { code?: string }) | null, data: string[]) => void
|
|
179
199
|
) => void;
|
|
180
200
|
maxConcurrentRequests: number;
|
|
181
|
-
putDir: (
|
|
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:
|
|
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:
|
|
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:
|
|
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(
|
|
237
|
-
|
|
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:
|
|
267
|
+
callback: (err: Error | number | null, data: unknown) => void
|
|
241
268
|
): void;
|
|
242
269
|
getComponentPreviewUrlByUrl(
|
|
243
270
|
componentHref: string,
|
|
244
|
-
callback:
|
|
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:
|
|
280
|
+
callback: (err: string | null, data: unknown) => void
|
|
254
281
|
): void;
|
|
255
|
-
remove(registry: string, callback:
|
|
282
|
+
remove(registry: string, callback: (err: Error | null) => void): void;
|
|
256
283
|
}
|
|
257
284
|
|
|
258
285
|
export interface Local {
|
|
259
286
|
clean: {
|
|
260
|
-
fetchList: (
|
|
261
|
-
|
|
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
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
338
|
+
callback: (err: Error | null, data: string) => void
|
|
305
339
|
): void;
|
|
306
340
|
getComponent(
|
|
307
341
|
componentName: string,
|
|
308
342
|
componentVersion: string,
|
|
309
|
-
calllback:
|
|
343
|
+
calllback: (err: string | null, data: Component) => void
|
|
310
344
|
): void;
|
|
311
345
|
getComponent(
|
|
312
346
|
componentName: string,
|
|
313
|
-
calllback:
|
|
347
|
+
calllback: (err: string | null, data: Component) => void
|
|
314
348
|
): void;
|
|
315
349
|
getComponentInfo(
|
|
316
350
|
componentName: string,
|
|
317
351
|
componentVersion: string,
|
|
318
|
-
callback:
|
|
352
|
+
callback: (err: string | null, data: Component) => void
|
|
319
353
|
): void;
|
|
320
354
|
getComponentPath(componentName: string, componentVersion: string): void;
|
|
321
|
-
getComponents(callback:
|
|
322
|
-
getComponentsDetails(
|
|
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:
|
|
361
|
+
callback: (err: string | null, data: string[]) => void
|
|
326
362
|
): void;
|
|
327
363
|
getDataProvider(
|
|
328
364
|
componentName: string,
|
|
329
365
|
componentVersion: string,
|
|
330
|
-
callback:
|
|
331
|
-
|
|
332
|
-
|
|
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(
|
|
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:
|
|
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
|
-
)
|
|
22
|
+
) {
|
|
7
23
|
const shouldThrow = !justTry;
|
|
8
24
|
|
|
9
25
|
if (require.cache && !!require.cache[path]) {
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
10
|
+
padTwoDigits(date.getMonth() + 1) +
|
|
9
11
|
'/' +
|
|
10
|
-
|
|
12
|
+
padTwoDigits(date.getDate()) +
|
|
11
13
|
' ' +
|
|
12
|
-
|
|
14
|
+
padTwoDigits(date.getHours()) +
|
|
13
15
|
':' +
|
|
14
|
-
|
|
16
|
+
padTwoDigits(date.getMinutes()) +
|
|
15
17
|
':' +
|
|
16
|
-
|
|
18
|
+
padTwoDigits(date.getSeconds())
|
|
17
19
|
);
|
|
18
20
|
}
|
|
19
21
|
|
package/src/utils/npm-utils.ts
CHANGED
|
@@ -65,7 +65,7 @@ export const installDependencies = (
|
|
|
65
65
|
silent: boolean;
|
|
66
66
|
usePrefix: boolean;
|
|
67
67
|
},
|
|
68
|
-
callback:
|
|
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:
|
|
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:
|
|
10
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
package/dist/utils/pad-zero.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function padZero(length: number, data: number): string;
|
package/dist/utils/pad-zero.js
DELETED
package/src/utils/pad-zero.ts
DELETED