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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
## Change Log
|
|
2
2
|
|
|
3
|
+
### v0.49.7
|
|
4
|
+
- [#1283](https://github.com/opencomponents/oc/pull/1283) add "open" link to component preview page
|
|
5
|
+
- [#1279](https://github.com/opencomponents/oc/pull/1279) improve auth flexibility allowing to pass any library on type field
|
|
6
|
+
|
|
7
|
+
### v0.49.6
|
|
8
|
+
- [#1282](https://github.com/opencomponents/oc/pull/1282) Minor logging improvements
|
|
9
|
+
|
|
10
|
+
### v0.49.5
|
|
11
|
+
- [#1280](https://github.com/opencomponents/oc/pull/1280) [INTERNAL] Allow for non-number port (i.e. pipe)
|
|
12
|
+
|
|
13
|
+
### v0.49.4
|
|
14
|
+
- [#1277](https://github.com/opencomponents/oc/pull/1277) [CLI-FEATURE] add registries options for oc publish
|
|
15
|
+
- [#1276](https://github.com/opencomponents/oc/pull/1276) [CLI-FEATURE] filter components to run when running oc dev
|
|
16
|
+
- [#1270](https://github.com/opencomponents/oc/pull/1270) [INTERNAL] remove code about module.paths pushing on authentication
|
|
17
|
+
- [#1275](https://github.com/opencomponents/oc/pull/1275) [INTERNAL] replace deprecated new Buffer to Buffer.from
|
|
18
|
+
- [#1271](https://github.com/opencomponents/oc/pull/1271) [TYPE IMPROVEMENT] remove global callback and dictionary types
|
|
19
|
+
- [#1268](https://github.com/opencomponents/oc/pull/1268) [IMPROVEMENT] Improve typings of events in events handler
|
|
20
|
+
- [#1264](https://github.com/opencomponents/oc/pull/1264) [INTERNAL] Replace lodash type checkers with typeof
|
|
21
|
+
- [#1263](https://github.com/opencomponents/oc/pull/1263) [INTERNAL] Replace usage of lodash _.extend with Object.assign
|
|
22
|
+
- [#1261](https://github.com/opencomponents/oc/pull/1261) [INTERNAL] type cleanRequire better
|
|
23
|
+
- [#1256](https://github.com/opencomponents/oc/pull/1256) [INTERNAL] enable noUnusedParameters and noImplicitReturns rules. fix problems
|
|
24
|
+
- [#1260](https://github.com/opencomponents/oc/pull/1260) [INTERNAL] Remove pad-zero util
|
|
25
|
+
- [#1255](https://github.com/opencomponents/oc/pull/1255) [INTERNAL] enable noPropertyAccessFromIndexSignature option and fix problems
|
|
26
|
+
- [#1253](https://github.com/opencomponents/oc/pull/1253) [INTERNAL] Simplify log parameter names for newline
|
|
27
|
+
|
|
3
28
|
### v0.49.3
|
|
4
29
|
- [#1262](https://github.com/opencomponents/oc/pull/1262) [BUGFIX] Add back --prefix when installing dependencies
|
|
5
30
|
|
package/dist/cli/commands.d.ts
CHANGED
|
@@ -51,6 +51,10 @@ declare const _default: {
|
|
|
51
51
|
description: string;
|
|
52
52
|
default: string;
|
|
53
53
|
};
|
|
54
|
+
components: {
|
|
55
|
+
array: boolean;
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
54
58
|
};
|
|
55
59
|
usage: string;
|
|
56
60
|
};
|
|
@@ -116,6 +120,10 @@ declare const _default: {
|
|
|
116
120
|
description: string;
|
|
117
121
|
default: boolean;
|
|
118
122
|
};
|
|
123
|
+
registries: {
|
|
124
|
+
array: boolean;
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
119
127
|
};
|
|
120
128
|
description: string;
|
|
121
129
|
usage: string;
|
package/dist/cli/commands.js
CHANGED
|
@@ -50,6 +50,10 @@ exports.default = {
|
|
|
50
50
|
boolean: false,
|
|
51
51
|
description: 'Url prefix for registry server',
|
|
52
52
|
default: ''
|
|
53
|
+
},
|
|
54
|
+
components: {
|
|
55
|
+
array: true,
|
|
56
|
+
description: 'List of component names that you want to be packaged and exposed on dev registry'
|
|
53
57
|
}
|
|
54
58
|
},
|
|
55
59
|
usage: 'Usage: $0 dev <dirPath> [port] [baseUrl] [options]'
|
|
@@ -115,6 +119,10 @@ exports.default = {
|
|
|
115
119
|
boolean: true,
|
|
116
120
|
description: 'Skip packaging step',
|
|
117
121
|
default: false
|
|
122
|
+
},
|
|
123
|
+
registries: {
|
|
124
|
+
array: true,
|
|
125
|
+
description: 'List of registries to publish to. This setting will take precedence over oc.json file'
|
|
118
126
|
}
|
|
119
127
|
},
|
|
120
128
|
description: 'Publish a component',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function fetchList(dirPath: string, callback:
|
|
2
|
-
export declare function remove(list: string[], callback:
|
|
1
|
+
export declare function fetchList(dirPath: string, callback: (err: Error | null, data: string[]) => void): void;
|
|
2
|
+
export declare function remove(list: string[], callback: (err: Error | null, data: string) => void): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function getComponentsByDir(): (componentsDir: string,
|
|
1
|
+
export default function getComponentsByDir(): (componentsDir: string, componentsToRunOrCb: string[] | ((err: Error | null, data: string[]) => void), callbackMaybe?: ((err: Error | null, data: string[]) => void) | undefined) => void;
|
|
@@ -6,7 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
function getComponentsByDir() {
|
|
9
|
-
return (componentsDir,
|
|
9
|
+
return (componentsDir, componentsToRunOrCb, callbackMaybe) => {
|
|
10
|
+
const componentsToRun = typeof componentsToRunOrCb === 'function'
|
|
11
|
+
? undefined
|
|
12
|
+
: componentsToRunOrCb;
|
|
13
|
+
const callback = typeof componentsToRunOrCb === 'function'
|
|
14
|
+
? componentsToRunOrCb
|
|
15
|
+
: callbackMaybe;
|
|
10
16
|
const isOcComponent = function (file) {
|
|
11
17
|
const filePath = path_1.default.resolve(componentsDir, file);
|
|
12
18
|
const packagePath = path_1.default.join(filePath, 'package.json');
|
|
@@ -26,6 +32,9 @@ function getComponentsByDir() {
|
|
|
26
32
|
let dirContent;
|
|
27
33
|
try {
|
|
28
34
|
dirContent = fs_extra_1.default.readdirSync(componentsDir);
|
|
35
|
+
if (componentsToRun) {
|
|
36
|
+
dirContent = dirContent.filter(content => componentsToRun.includes(content));
|
|
37
|
+
}
|
|
29
38
|
}
|
|
30
39
|
catch (err) {
|
|
31
40
|
return callback(null, []);
|
|
@@ -16,7 +16,7 @@ const isMockValid = (plugin) => {
|
|
|
16
16
|
typeof plugin.execute === 'function';
|
|
17
17
|
return isFunction || isValidObject;
|
|
18
18
|
};
|
|
19
|
-
const defaultRegister = (
|
|
19
|
+
const defaultRegister = (_options, _dependencies, next) => {
|
|
20
20
|
next();
|
|
21
21
|
};
|
|
22
22
|
const registerStaticMocks = (mocks, logger) => lodash_1.default.map(mocks, (mockedValue, pluginName) => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { Template } from '../../../types';
|
|
1
2
|
import { Logger } from '../../logger';
|
|
2
3
|
export default function getCompiler(options: {
|
|
3
4
|
compilerDep: string;
|
|
4
5
|
componentPath: string;
|
|
5
6
|
logger: Logger;
|
|
6
7
|
pkg: {
|
|
7
|
-
devDependencies:
|
|
8
|
+
devDependencies: Record<string, string>;
|
|
8
9
|
};
|
|
9
|
-
}, cb:
|
|
10
|
+
}, cb: (err: string | number | null, data: Template) => void): void;
|
|
@@ -3,7 +3,7 @@ export default function handleDependencies(options: {
|
|
|
3
3
|
components: string[];
|
|
4
4
|
logger: Logger;
|
|
5
5
|
useComponentDependencies?: boolean;
|
|
6
|
-
}, callback:
|
|
6
|
+
}, callback: (err: string | null, data: {
|
|
7
7
|
modules: string[];
|
|
8
8
|
templates: Array<(...args: unknown[]) => unknown>;
|
|
9
|
-
}
|
|
9
|
+
}) => void): void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Logger } from '../../logger';
|
|
2
|
+
import { Template } from '../../../types';
|
|
2
3
|
export default function installCompiler(options: {
|
|
3
4
|
compilerPath: string;
|
|
4
5
|
componentPath: string;
|
|
5
6
|
dependency: string;
|
|
6
7
|
logger: Logger;
|
|
7
|
-
}, cb:
|
|
8
|
+
}, cb: (err: string | number | null, data: Template) => void): void;
|
|
@@ -28,7 +28,7 @@ const npm = __importStar(require("../../../utils/npm-utils"));
|
|
|
28
28
|
const index_1 = __importDefault(require("../../../resources/index"));
|
|
29
29
|
function installCompiler(options, cb) {
|
|
30
30
|
const { compilerPath, componentPath, dependency, logger } = options;
|
|
31
|
-
logger.warn(index_1.default.messages.cli.INSTALLING_DEPS(dependency
|
|
31
|
+
logger.warn(index_1.default.messages.cli.INSTALLING_DEPS(dependency, componentPath));
|
|
32
32
|
const npmOptions = {
|
|
33
33
|
dependency,
|
|
34
34
|
installPath: componentPath,
|
|
@@ -32,17 +32,20 @@ function installMissingDependencies(options, callback) {
|
|
|
32
32
|
if (!missing.length) {
|
|
33
33
|
return callback(null);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
const installPath = path_1.default.resolve('.');
|
|
36
|
+
logger.warn(index_1.default.messages.cli.INSTALLING_DEPS(missing.join(', '), installPath));
|
|
36
37
|
const npmOptions = {
|
|
37
38
|
dependencies: missing,
|
|
38
|
-
installPath
|
|
39
|
+
installPath,
|
|
39
40
|
save: false,
|
|
40
|
-
silent:
|
|
41
|
+
silent: false,
|
|
41
42
|
usePrefix: true
|
|
42
43
|
};
|
|
43
44
|
npm.installDependencies(npmOptions, err => {
|
|
44
45
|
if (err || (0, get_missing_dependencies_1.default)(dependencies).length) {
|
|
45
46
|
logger.err('FAIL');
|
|
47
|
+
if (err)
|
|
48
|
+
logger.err(`${err}`);
|
|
46
49
|
return callback(index_1.default.errors.cli.DEPENDENCIES_INSTALL_FAIL);
|
|
47
50
|
}
|
|
48
51
|
logger.ok('OK');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Logger } from '../../logger';
|
|
2
2
|
export default function linkMissingDependencies(options: {
|
|
3
3
|
componentPath: string;
|
|
4
|
-
dependencies:
|
|
4
|
+
dependencies: Record<string, string>;
|
|
5
5
|
logger: Logger;
|
|
6
6
|
}, callback: (err: string | null) => void): void;
|
|
@@ -8,7 +8,7 @@ interface Template {
|
|
|
8
8
|
minify: boolean;
|
|
9
9
|
verbose: boolean;
|
|
10
10
|
production: boolean | undefined;
|
|
11
|
-
}, cb:
|
|
11
|
+
}, cb: (err: Error | null, data: Component) => void) => void;
|
|
12
12
|
}
|
|
13
13
|
export default function requireTemplate(template: string, options: {
|
|
14
14
|
compiler: boolean;
|
|
@@ -5,7 +5,7 @@ interface Options {
|
|
|
5
5
|
compiler: string;
|
|
6
6
|
logger: Logger;
|
|
7
7
|
}
|
|
8
|
-
export default function installTemplate(options: Options, callback:
|
|
8
|
+
export default function installTemplate(options: Options, callback: (err: string | null, data: {
|
|
9
9
|
ok: true;
|
|
10
|
-
}
|
|
10
|
+
}) => void): void;
|
|
11
11
|
export {};
|
|
@@ -5,7 +5,7 @@ interface ScaffoldOptions {
|
|
|
5
5
|
componentPath: string;
|
|
6
6
|
templateType: string;
|
|
7
7
|
}
|
|
8
|
-
export default function scaffold(options: ScaffoldOptions, callback:
|
|
8
|
+
export default function scaffold(options: ScaffoldOptions, callback: (err: string | null, data: {
|
|
9
9
|
ok: true;
|
|
10
|
-
}
|
|
10
|
+
}) => void): void;
|
|
11
11
|
export {};
|
package/dist/cli/domain/mock.js
CHANGED
|
@@ -8,7 +8,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const settings_1 = __importDefault(require("../../resources/settings"));
|
|
9
9
|
function mock() {
|
|
10
10
|
return function (params, callback) {
|
|
11
|
-
fs_extra_1.default.readJson(settings_1.default.configFile.src, (
|
|
11
|
+
fs_extra_1.default.readJson(settings_1.default.configFile.src, (_err, localConfig) => {
|
|
12
12
|
localConfig = localConfig || {};
|
|
13
13
|
const mockType = params.targetType + 's';
|
|
14
14
|
if (!localConfig.mocks) {
|
|
@@ -5,5 +5,5 @@ interface PackageOptions {
|
|
|
5
5
|
verbose?: boolean;
|
|
6
6
|
production?: boolean;
|
|
7
7
|
}
|
|
8
|
-
declare const packageComponents: () => (options: PackageOptions, callback:
|
|
8
|
+
declare const packageComponents: () => (options: PackageOptions, callback: (err: Error | null, data: Component) => void) => void;
|
|
9
9
|
export default packageComponents;
|
|
@@ -102,9 +102,9 @@ function registry(opts = {}) {
|
|
|
102
102
|
},
|
|
103
103
|
putComponent(options, callback) {
|
|
104
104
|
if (!!options.username && !!options.password) {
|
|
105
|
-
requestsHeaders =
|
|
105
|
+
requestsHeaders = Object.assign(requestsHeaders, {
|
|
106
106
|
Authorization: 'Basic ' +
|
|
107
|
-
|
|
107
|
+
Buffer.from(options.username + ':' + options.password).toString('base64')
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
(0, put_1.default)(options.route, options.path, requestsHeaders, (err, res) => {
|
package/dist/cli/facade/dev.d.ts
CHANGED
|
@@ -13,8 +13,9 @@ declare const dev: ({ local, logger }: {
|
|
|
13
13
|
baseUrl: string;
|
|
14
14
|
fallbackRegistryUrl: string;
|
|
15
15
|
hotReloading?: boolean;
|
|
16
|
+
components: string[];
|
|
16
17
|
watch?: boolean;
|
|
17
18
|
verbose?: boolean;
|
|
18
19
|
production?: boolean;
|
|
19
|
-
}, callback:
|
|
20
|
+
}, callback: (err: Error | string | null, data: Registry) => void) => void;
|
|
20
21
|
export default dev;
|
package/dist/cli/facade/dev.js
CHANGED
|
@@ -40,10 +40,8 @@ const dev = ({ local, logger }) => (opts, callback) => {
|
|
|
40
40
|
const port = opts.port || 3000;
|
|
41
41
|
const baseUrl = opts.baseUrl || `http://localhost:${port}/`;
|
|
42
42
|
const fallbackRegistryUrl = opts.fallbackRegistryUrl;
|
|
43
|
-
const hotReloading =
|
|
44
|
-
|
|
45
|
-
: opts.hotReloading;
|
|
46
|
-
const optWatch = lodash_1.default.isUndefined(opts.watch) ? true : opts.watch;
|
|
43
|
+
const hotReloading = typeof opts.hotReloading === 'undefined' ? true : opts.hotReloading;
|
|
44
|
+
const optWatch = typeof opts.watch === 'undefined' ? true : opts.watch;
|
|
47
45
|
let packaging = false;
|
|
48
46
|
const watchForChanges = function ({ components, refreshLiveReload }, cb) {
|
|
49
47
|
(0, watch_1.default)(components, componentsDir, (err, changedFile, componentDir) => {
|
|
@@ -65,12 +63,13 @@ const dev = ({ local, logger }) => (opts, callback) => {
|
|
|
65
63
|
});
|
|
66
64
|
};
|
|
67
65
|
const packageComponents = (componentsDirs, optCb) => {
|
|
68
|
-
const cb =
|
|
66
|
+
const cb = typeof optCb === 'function' ? optCb : lodash_1.default.noop;
|
|
69
67
|
let i = 0;
|
|
70
68
|
if (!packaging) {
|
|
71
69
|
packaging = true;
|
|
72
|
-
logger.warn(cliMessages.PACKAGING_COMPONENTS,
|
|
70
|
+
logger.warn(cliMessages.PACKAGING_COMPONENTS, false);
|
|
73
71
|
async_1.default.eachSeries(componentsDirs, (dir, cb) => {
|
|
72
|
+
logger.warn(cliMessages.PACKAGING(dir), false);
|
|
74
73
|
const packageOptions = {
|
|
75
74
|
componentPath: dir,
|
|
76
75
|
minify: false,
|
|
@@ -105,14 +104,14 @@ const dev = ({ local, logger }) => (opts, callback) => {
|
|
|
105
104
|
const registerPlugins = (registry) => {
|
|
106
105
|
const mockedPlugins = (0, get_mocked_plugins_1.default)(logger, componentsDir);
|
|
107
106
|
mockedPlugins.forEach(p => registry.register(p));
|
|
108
|
-
registry.on('request',
|
|
107
|
+
registry.on('request', data => {
|
|
109
108
|
if (data.errorCode === 'PLUGIN_MISSING_FROM_REGISTRY') {
|
|
110
109
|
logger.err(cliErrors.PLUGIN_MISSING_FROM_REGISTRY(data.errorDetails, safe_1.default.blue(index_1.default.commands.cli.MOCK_PLUGIN)));
|
|
111
110
|
}
|
|
112
111
|
});
|
|
113
112
|
};
|
|
114
113
|
logger.warn(cliMessages.SCANNING_COMPONENTS, true);
|
|
115
|
-
local.getComponentsByDir(componentsDir, (err, components) => {
|
|
114
|
+
local.getComponentsByDir(componentsDir, opts.components, (err, components) => {
|
|
116
115
|
if (lodash_1.default.isEmpty(components)) {
|
|
117
116
|
err = cliErrors.DEV_FAIL(cliErrors.COMPONENTS_NOT_FOUND);
|
|
118
117
|
callback(err, undefined);
|
|
@@ -159,6 +158,7 @@ const dev = ({ local, logger }) => (opts, callback) => {
|
|
|
159
158
|
hotReloading,
|
|
160
159
|
liveReloadPort: liveReload.port,
|
|
161
160
|
local: true,
|
|
161
|
+
components: opts.components,
|
|
162
162
|
path: path_1.default.resolve(componentsDir),
|
|
163
163
|
port,
|
|
164
164
|
templates: dependencies.templates,
|
|
@@ -7,5 +7,5 @@ declare const cliPackage: ({ local, logger }: {
|
|
|
7
7
|
componentPath: string;
|
|
8
8
|
useComponentDependencies?: boolean;
|
|
9
9
|
compress?: boolean;
|
|
10
|
-
}, callback:
|
|
10
|
+
}, callback: (err: string | null, data: Component) => void) => void;
|
|
11
11
|
export default cliPackage;
|
|
@@ -24,9 +24,9 @@ const publish = ({ logger, registry, local }) => (opts, callback) => {
|
|
|
24
24
|
return cb(null, lodash_1.default.pick(opts, 'username', 'password'));
|
|
25
25
|
}
|
|
26
26
|
logger.warn(index_1.default.messages.cli.ENTER_USERNAME);
|
|
27
|
-
(0, read_1.default)({}, (
|
|
27
|
+
(0, read_1.default)({}, (_err, username) => {
|
|
28
28
|
logger.warn(index_1.default.messages.cli.ENTER_PASSWORD);
|
|
29
|
-
(0, read_1.default)({ silent: true }, (
|
|
29
|
+
(0, read_1.default)({ silent: true }, (_err, password) => {
|
|
30
30
|
cb(null, { username, password });
|
|
31
31
|
});
|
|
32
32
|
});
|
|
@@ -53,6 +53,11 @@ const publish = ({ logger, registry, local }) => (opts, callback) => {
|
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
|
+
const getRegistries = (cb) => {
|
|
57
|
+
if (opts.registries)
|
|
58
|
+
return cb(null, opts.registries);
|
|
59
|
+
registry.get(cb);
|
|
60
|
+
};
|
|
56
61
|
const putComponentToRegistry = (options, cb) => {
|
|
57
62
|
logger.warn(index_1.default.messages.cli.PUBLISHING(options.route));
|
|
58
63
|
registry.putComponent(options, err => {
|
|
@@ -63,8 +68,8 @@ const publish = ({ logger, registry, local }) => (opts, callback) => {
|
|
|
63
68
|
return cb(err, undefined);
|
|
64
69
|
}
|
|
65
70
|
logger.warn(index_1.default.messages.cli.REGISTRY_CREDENTIALS_REQUIRED);
|
|
66
|
-
return getCredentials((
|
|
67
|
-
putComponentToRegistry(
|
|
71
|
+
return getCredentials((_err, credentials) => {
|
|
72
|
+
putComponentToRegistry(Object.assign(options, credentials), cb);
|
|
68
73
|
});
|
|
69
74
|
}
|
|
70
75
|
else if (err.code === 'cli_version_not_valid') {
|
|
@@ -112,7 +117,7 @@ const publish = ({ logger, registry, local }) => (opts, callback) => {
|
|
|
112
117
|
});
|
|
113
118
|
});
|
|
114
119
|
};
|
|
115
|
-
|
|
120
|
+
getRegistries((err, registryLocations) => {
|
|
116
121
|
if (err) {
|
|
117
122
|
logger.err(err);
|
|
118
123
|
return callback(err);
|
|
@@ -3,5 +3,5 @@ import { Logger } from '../logger';
|
|
|
3
3
|
declare const registryLs: ({ registry, logger }: {
|
|
4
4
|
logger: Logger;
|
|
5
5
|
registry: RegistryCli;
|
|
6
|
-
}) => (
|
|
6
|
+
}) => (_opts: unknown, callback: (err: string | null, data: string[]) => void) => void;
|
|
7
7
|
export default registryLs;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const index_1 = __importDefault(require("../../resources/index"));
|
|
7
|
-
const registryLs = ({ registry, logger }) => (
|
|
7
|
+
const registryLs = ({ registry, logger }) => (_opts, callback) => {
|
|
8
8
|
registry.get((err, registries) => {
|
|
9
9
|
if (err) {
|
|
10
10
|
logger.err(index_1.default.errors.generic(err));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const registry: () => (
|
|
1
|
+
declare const registry: () => (_opts: unknown, callback: (err: Error | null, data: 'ok') => void) => void;
|
|
2
2
|
export default registry;
|
package/dist/cli/logger.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export interface Logger {
|
|
2
|
-
err: (msg: string,
|
|
3
|
-
log: (msg: string,
|
|
4
|
-
ok: (msg: string,
|
|
5
|
-
warn: (msg: string,
|
|
2
|
+
err: (msg: string, keepLine?: boolean) => void;
|
|
3
|
+
log: (msg: string, keepLine?: boolean) => void;
|
|
4
|
+
ok: (msg: string, keepLine?: boolean) => void;
|
|
5
|
+
warn: (msg: string, keepLine?: boolean) => void;
|
|
6
6
|
}
|
|
7
7
|
declare const logger: Logger;
|
|
8
8
|
export default logger;
|
package/dist/cli/logger.js
CHANGED
|
@@ -9,11 +9,11 @@ const logFns = {
|
|
|
9
9
|
writeLn: console.log,
|
|
10
10
|
write: (msg) => process.stdout.write(msg.toString())
|
|
11
11
|
};
|
|
12
|
-
const log = (msg, color,
|
|
12
|
+
const log = (msg, color, keepLine) => logFns[keepLine ? 'write' : 'writeLn'](color ? safe_1.default[color](msg) : msg);
|
|
13
13
|
const logger = {
|
|
14
|
-
err: (msg,
|
|
15
|
-
log: (msg,
|
|
16
|
-
ok: (msg,
|
|
17
|
-
warn: (msg,
|
|
14
|
+
err: (msg, keepLine) => log(msg, 'red', !!keepLine),
|
|
15
|
+
log: (msg, keepLine) => log(msg, null, !!keepLine),
|
|
16
|
+
ok: (msg, keepLine) => log(msg, 'green', !!keepLine),
|
|
17
|
+
warn: (msg, keepLine) => log(msg, 'yellow', !!keepLine)
|
|
18
18
|
};
|
|
19
19
|
exports.default = logger;
|
|
@@ -18,6 +18,7 @@ declare const _default: {
|
|
|
18
18
|
baseUrl: string;
|
|
19
19
|
fallbackRegistryUrl: string;
|
|
20
20
|
hotReloading?: boolean | undefined;
|
|
21
|
+
components: string[];
|
|
21
22
|
watch?: boolean | undefined;
|
|
22
23
|
verbose?: boolean | undefined;
|
|
23
24
|
production?: boolean | undefined;
|
|
@@ -50,6 +51,7 @@ declare const _default: {
|
|
|
50
51
|
skipPackage?: boolean | undefined;
|
|
51
52
|
username?: string | undefined;
|
|
52
53
|
password?: string | undefined;
|
|
54
|
+
registries?: string[] | undefined;
|
|
53
55
|
} & {
|
|
54
56
|
logger: Logger;
|
|
55
57
|
registry?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"oc-client","description":"The OpenComponents client-side javascript client","version":"0.49.
|
|
1
|
+
{"name":"oc-client","description":"The OpenComponents client-side javascript client","version":"0.49.7","repository":"https://github.com/opencomponents/oc/tree/master/components/oc-client","author":"Matteo Figus <matteofigus@gmail.com>","oc":{"container":false,"renderInfo":false,"minify":false,"parameters":{},"files":{"template":{"type":"oc-template-es6","hashKey":"4bdbbf7249b210dee9a729e8a611eac3dc5eae82","src":"template.js","version":"1.0.7"},"static":["src"],"dataProvider":{"type":"node.js","hashKey":"96eb8b28d43ce2093e13753e54d3f2f938dd0f7d","src":"server.js"}},"version":"0.49.7","packaged":true,"date":1639558995829},"devDependencies":{"oc-template-es6-compiler":"^1.0.1"}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{data:()=>o});const o=(e,t)=>{const{staticPath:o,templates:r}=e;return t(null,{staticPath:o,templates:r})};module.exports=t})();
|