oc 0.49.8 → 0.49.9
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/dist/cli/commands.d.ts +163 -163
- package/dist/cli/commands.js +162 -162
- package/dist/cli/domain/clean.d.ts +2 -2
- package/dist/cli/domain/clean.js +24 -24
- package/dist/cli/domain/get-components-by-dir.d.ts +1 -1
- package/dist/cli/domain/get-components-by-dir.js +41 -41
- package/dist/cli/domain/get-mocked-plugins.d.ts +10 -10
- package/dist/cli/domain/get-mocked-plugins.js +89 -89
- package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.d.ts +6 -6
- package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.js +16 -16
- package/dist/cli/domain/handle-dependencies/get-compiler.d.ts +10 -10
- package/dist/cli/domain/handle-dependencies/get-compiler.js +28 -28
- package/dist/cli/domain/handle-dependencies/get-missing-dependencies.d.ts +1 -1
- package/dist/cli/domain/handle-dependencies/get-missing-dependencies.js +18 -18
- package/dist/cli/domain/handle-dependencies/index.d.ts +10 -10
- package/dist/cli/domain/handle-dependencies/index.js +70 -70
- package/dist/cli/domain/handle-dependencies/install-compiler.d.ts +8 -8
- package/dist/cli/domain/handle-dependencies/install-compiler.js +54 -54
- package/dist/cli/domain/handle-dependencies/install-missing-dependencies.d.ts +5 -5
- package/dist/cli/domain/handle-dependencies/install-missing-dependencies.js +59 -59
- package/dist/cli/domain/handle-dependencies/link-missing-dependencies.d.ts +6 -6
- package/dist/cli/domain/handle-dependencies/link-missing-dependencies.js +32 -32
- package/dist/cli/domain/handle-dependencies/require-template.d.ts +17 -17
- package/dist/cli/domain/handle-dependencies/require-template.js +34 -34
- package/dist/cli/domain/init-template/index.d.ts +10 -10
- package/dist/cli/domain/init-template/index.js +40 -40
- package/dist/cli/domain/init-template/install-template.d.ts +11 -11
- package/dist/cli/domain/init-template/install-template.js +54 -54
- package/dist/cli/domain/init-template/scaffold.d.ts +11 -11
- package/dist/cli/domain/init-template/scaffold.js +30 -30
- package/dist/cli/domain/local.d.ts +2 -2
- package/dist/cli/domain/local.js +82 -82
- package/dist/cli/domain/mock.d.ts +5 -5
- package/dist/cli/domain/mock.js +33 -33
- package/dist/cli/domain/package-components.d.ts +9 -9
- package/dist/cli/domain/package-components.js +67 -67
- package/dist/cli/domain/registry.d.ts +6 -6
- package/dist/cli/domain/registry.js +136 -136
- package/dist/cli/domain/url-parser.d.ts +14 -14
- package/dist/cli/domain/url-parser.js +31 -31
- package/dist/cli/domain/watch.d.ts +1 -1
- package/dist/cli/domain/watch.js +29 -29
- package/dist/cli/facade/clean.d.ts +16 -16
- package/dist/cli/facade/clean.js +58 -58
- package/dist/cli/facade/dev.d.ts +114 -114
- package/dist/cli/facade/dev.js +176 -176
- package/dist/cli/facade/init.d.ts +18 -18
- package/dist/cli/facade/init.js +39 -39
- package/dist/cli/facade/mock.d.ts +18 -18
- package/dist/cli/facade/mock.js +12 -12
- package/dist/cli/facade/package.d.ts +18 -18
- package/dist/cli/facade/package.js +49 -49
- package/dist/cli/facade/preview.d.ts +14 -14
- package/dist/cli/facade/preview.js +20 -20
- package/dist/cli/facade/publish.d.ts +23 -23
- package/dist/cli/facade/publish.js +145 -145
- package/dist/cli/facade/registry-add.d.ts +14 -14
- package/dist/cli/facade/registry-add.js +18 -18
- package/dist/cli/facade/registry-ls.d.ts +10 -10
- package/dist/cli/facade/registry-ls.js +27 -27
- package/dist/cli/facade/registry-remove.d.ts +14 -14
- package/dist/cli/facade/registry-remove.js +18 -18
- package/dist/cli/facade/registry.d.ts +5 -5
- package/dist/cli/facade/registry.js +9 -9
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +91 -91
- package/dist/cli/logger.d.ts +8 -8
- package/dist/cli/logger.js +19 -19
- package/dist/cli/programmatic-api.d.ts +84 -84
- package/dist/cli/programmatic-api.js +66 -66
- package/dist/cli/validate-command.d.ts +2 -2
- package/dist/cli/validate-command.js +18 -18
- package/dist/components/oc-client/_package/package.json +1 -1
- package/dist/components/oc-client/package.json +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -12
- package/dist/oc-cli.d.ts +2 -2
- package/dist/oc-cli.js +3 -3
- package/dist/registry/app-start.d.ts +2 -2
- package/dist/registry/app-start.js +44 -44
- package/dist/registry/domain/authentication.d.ts +7 -7
- package/dist/registry/domain/authentication.js +53 -53
- package/dist/registry/domain/components-cache/components-list.d.ts +8 -8
- package/dist/registry/domain/components-cache/components-list.js +50 -50
- package/dist/registry/domain/components-cache/index.d.ts +7 -7
- package/dist/registry/domain/components-cache/index.js +76 -76
- package/dist/registry/domain/components-details.d.ts +6 -6
- package/dist/registry/domain/components-details.js +64 -64
- package/dist/registry/domain/events-handler.d.ts +40 -40
- package/dist/registry/domain/events-handler.js +37 -37
- package/dist/registry/domain/extract-package.d.ts +8 -8
- package/dist/registry/domain/extract-package.js +26 -26
- package/dist/registry/domain/get-package-json-from-temp-dir.d.ts +2 -2
- package/dist/registry/domain/get-package-json-from-temp-dir.js +11 -11
- package/dist/registry/domain/nested-renderer.d.ts +14 -14
- package/dist/registry/domain/nested-renderer.js +59 -59
- package/dist/registry/domain/options-sanitiser.d.ts +6 -6
- package/dist/registry/domain/options-sanitiser.js +106 -106
- package/dist/registry/domain/plugins-initialiser.d.ts +3 -3
- package/dist/registry/domain/plugins-initialiser.js +95 -95
- package/dist/registry/domain/register-templates.d.ts +5 -5
- package/dist/registry/domain/register-templates.js +30 -30
- package/dist/registry/domain/repository.d.ts +2 -2
- package/dist/registry/domain/repository.js +237 -237
- package/dist/registry/domain/require-wrapper.d.ts +2 -2
- package/dist/registry/domain/require-wrapper.js +33 -33
- package/dist/registry/domain/sanitiser.d.ts +2 -2
- package/dist/registry/domain/sanitiser.js +52 -52
- package/dist/registry/domain/storage-adapter.d.ts +10 -10
- package/dist/registry/domain/storage-adapter.js +55 -55
- package/dist/registry/domain/url-builder.d.ts +10 -10
- package/dist/registry/domain/url-builder.js +60 -60
- package/dist/registry/domain/validators/component-parameters.d.ts +11 -11
- package/dist/registry/domain/validators/component-parameters.js +79 -79
- package/dist/registry/domain/validators/index.d.ts +16 -16
- package/dist/registry/domain/validators/index.js +29 -29
- package/dist/registry/domain/validators/node-version.d.ts +15 -15
- package/dist/registry/domain/validators/node-version.js +40 -40
- package/dist/registry/domain/validators/oc-cli-version.d.ts +15 -15
- package/dist/registry/domain/validators/oc-cli-version.js +34 -34
- package/dist/registry/domain/validators/package-json-validator.d.ts +13 -13
- package/dist/registry/domain/validators/package-json-validator.js +23 -23
- package/dist/registry/domain/validators/plugins-requirements.d.ts +9 -9
- package/dist/registry/domain/validators/plugins-requirements.js +22 -22
- package/dist/registry/domain/validators/registry-configuration.d.ts +9 -9
- package/dist/registry/domain/validators/registry-configuration.js +113 -113
- package/dist/registry/domain/validators/uploaded-package.d.ts +14 -14
- package/dist/registry/domain/validators/uploaded-package.js +25 -25
- package/dist/registry/domain/version-handler.d.ts +2 -2
- package/dist/registry/domain/version-handler.js +22 -22
- package/dist/registry/index.d.ts +48 -48
- package/dist/registry/index.js +107 -107
- package/dist/registry/middleware/base-url-handler.d.ts +2 -2
- package/dist/registry/middleware/base-url-handler.js +12 -12
- package/dist/registry/middleware/cors.d.ts +2 -2
- package/dist/registry/middleware/cors.js +11 -11
- package/dist/registry/middleware/discovery-handler.d.ts +2 -2
- package/dist/registry/middleware/discovery-handler.js +15 -15
- package/dist/registry/middleware/file-uploads.d.ts +2 -2
- package/dist/registry/middleware/file-uploads.js +23 -23
- package/dist/registry/middleware/index.d.ts +7 -7
- package/dist/registry/middleware/index.js +51 -51
- package/dist/registry/middleware/request-handler.d.ts +2 -2
- package/dist/registry/middleware/request-handler.js +30 -30
- package/dist/registry/router.d.ts +3 -3
- package/dist/registry/router.js +56 -56
- package/dist/registry/routes/component-info.d.ts +3 -3
- package/dist/registry/routes/component-info.js +90 -90
- package/dist/registry/routes/component-preview.d.ts +3 -3
- package/dist/registry/routes/component-preview.js +68 -68
- package/dist/registry/routes/component.d.ts +3 -3
- package/dist/registry/routes/component.js +43 -43
- package/dist/registry/routes/components.d.ts +3 -3
- package/dist/registry/routes/components.js +78 -78
- package/dist/registry/routes/dependencies.d.ts +3 -3
- package/dist/registry/routes/dependencies.js +28 -28
- package/dist/registry/routes/helpers/apply-default-values.d.ts +2 -2
- package/dist/registry/routes/helpers/apply-default-values.js +13 -13
- package/dist/registry/routes/helpers/get-available-dependencies.d.ts +8 -8
- package/dist/registry/routes/helpers/get-available-dependencies.js +24 -24
- package/dist/registry/routes/helpers/get-component-fallback.d.ts +17 -17
- package/dist/registry/routes/helpers/get-component-fallback.js +91 -91
- package/dist/registry/routes/helpers/get-component-retrieving-info.d.ts +20 -20
- package/dist/registry/routes/helpers/get-component-retrieving-info.js +24 -24
- package/dist/registry/routes/helpers/get-component.d.ts +33 -33
- package/dist/registry/routes/helpers/get-component.js +406 -406
- package/dist/registry/routes/helpers/get-components-history.d.ts +8 -8
- package/dist/registry/routes/helpers/get-components-history.js +28 -28
- package/dist/registry/routes/helpers/is-url-discoverable.d.ts +3 -3
- package/dist/registry/routes/helpers/is-url-discoverable.js +22 -22
- package/dist/registry/routes/index.d.ts +3 -3
- package/dist/registry/routes/index.js +93 -93
- package/dist/registry/routes/plugins.d.ts +3 -3
- package/dist/registry/routes/plugins.js +17 -17
- package/dist/registry/routes/publish.d.ts +3 -3
- package/dist/registry/routes/publish.js +97 -97
- package/dist/registry/routes/static-redirector.d.ts +3 -3
- package/dist/registry/routes/static-redirector.js +63 -63
- package/dist/registry/views/index.d.ts +2 -2
- package/dist/registry/views/index.js +39 -39
- package/dist/registry/views/info.d.ts +16 -16
- package/dist/registry/views/info.js +39 -39
- package/dist/registry/views/partials/component-author.d.ts +8 -8
- package/dist/registry/views/partials/component-author.js +20 -20
- package/dist/registry/views/partials/component-parameters.d.ts +5 -5
- package/dist/registry/views/partials/component-parameters.js +24 -24
- package/dist/registry/views/partials/component-state.d.ts +5 -5
- package/dist/registry/views/partials/component-state.js +6 -6
- package/dist/registry/views/partials/component-versions.d.ts +5 -5
- package/dist/registry/views/partials/component-versions.js +9 -9
- package/dist/registry/views/partials/components-dependencies.d.ts +2 -2
- package/dist/registry/views/partials/components-dependencies.js +12 -12
- package/dist/registry/views/partials/components-history.d.ts +2 -2
- package/dist/registry/views/partials/components-history.js +10 -10
- package/dist/registry/views/partials/components-list.d.ts +2 -2
- package/dist/registry/views/partials/components-list.js +26 -26
- package/dist/registry/views/partials/components-plugins.d.ts +2 -2
- package/dist/registry/views/partials/components-plugins.js +8 -8
- package/dist/registry/views/partials/components-templates.d.ts +2 -2
- package/dist/registry/views/partials/components-templates.js +14 -14
- package/dist/registry/views/partials/layout.d.ts +8 -8
- package/dist/registry/views/partials/layout.js +11 -11
- package/dist/registry/views/partials/property.d.ts +2 -2
- package/dist/registry/views/partials/property.js +11 -11
- package/dist/registry/views/partials/selected-checkbox.d.ts +4 -4
- package/dist/registry/views/partials/selected-checkbox.js +7 -7
- package/dist/registry/views/preview.d.ts +8 -8
- package/dist/registry/views/preview.js +9 -9
- package/dist/registry/views/static/index.d.ts +2 -2
- package/dist/registry/views/static/index.js +3 -3
- package/dist/registry/views/static/info.d.ts +2 -2
- package/dist/registry/views/static/info.js +3 -3
- package/dist/registry/views/static/style.d.ts +2 -2
- package/dist/registry/views/static/style.js +3 -3
- package/dist/resources/index.d.ts +134 -134
- package/dist/resources/index.js +145 -145
- package/dist/resources/settings.d.ts +17 -17
- package/dist/resources/settings.js +18 -18
- package/dist/types.d.ts +287 -287
- package/dist/types.js +2 -2
- package/dist/utils/clean-require.d.ts +16 -16
- package/dist/utils/clean-require.js +18 -18
- package/dist/utils/date-stringify.d.ts +1 -1
- package/dist/utils/date-stringify.js +22 -22
- package/dist/utils/error-to-string.d.ts +1 -1
- package/dist/utils/error-to-string.js +15 -15
- package/dist/utils/is-template-legacy.d.ts +3 -3
- package/dist/utils/is-template-legacy.js +6 -6
- package/dist/utils/is-template-valid.d.ts +4 -4
- package/dist/utils/is-template-valid.js +12 -12
- package/dist/utils/module-exists.d.ts +1 -1
- package/dist/utils/module-exists.js +15 -15
- package/dist/utils/npm-utils.d.ts +20 -20
- package/dist/utils/npm-utils.js +74 -74
- package/dist/utils/put.d.ts +2 -2
- package/dist/utils/put.js +29 -29
- package/dist/utils/strip-version.d.ts +1 -1
- package/dist/utils/strip-version.js +11 -11
- package/logintervals.md +1 -1
- package/package.json +1 -1
- package/src/cli/facade/dev.ts +1 -1
- package/src/components/oc-client/_package/package.json +1 -1
- package/src/components/oc-client/package.json +1 -1
- package/src/oc-cli.js +0 -0
package/dist/cli/domain/clean.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.remove = exports.fetchList = void 0;
|
|
7
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
-
const get_components_by_dir_1 = __importDefault(require("./get-components-by-dir"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const getComponentsByDir = (0, get_components_by_dir_1.default)();
|
|
11
|
-
async function fetchList(dirPath) {
|
|
12
|
-
const list = await getComponentsByDir(dirPath);
|
|
13
|
-
if (list.length === 0)
|
|
14
|
-
return [];
|
|
15
|
-
const toRemove = list.map(folder => path_1.default.join(folder, 'node_modules'));
|
|
16
|
-
return toRemove.filter(fs_extra_1.default.existsSync);
|
|
17
|
-
}
|
|
18
|
-
exports.fetchList = fetchList;
|
|
19
|
-
async function remove(list) {
|
|
20
|
-
for (const item of list) {
|
|
21
|
-
await fs_extra_1.default.remove(item);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.remove = remove;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.remove = exports.fetchList = void 0;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const get_components_by_dir_1 = __importDefault(require("./get-components-by-dir"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const getComponentsByDir = (0, get_components_by_dir_1.default)();
|
|
11
|
+
async function fetchList(dirPath) {
|
|
12
|
+
const list = await getComponentsByDir(dirPath);
|
|
13
|
+
if (list.length === 0)
|
|
14
|
+
return [];
|
|
15
|
+
const toRemove = list.map(folder => path_1.default.join(folder, 'node_modules'));
|
|
16
|
+
return toRemove.filter(fs_extra_1.default.existsSync);
|
|
17
|
+
}
|
|
18
|
+
exports.fetchList = fetchList;
|
|
19
|
+
async function remove(list) {
|
|
20
|
+
for (const item of list) {
|
|
21
|
+
await fs_extra_1.default.remove(item);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.remove = remove;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function getComponentsByDir(): (componentsDir: string, componentsToRun?: string[] | undefined) => Promise<string[]>;
|
|
1
|
+
export default function getComponentsByDir(): (componentsDir: string, componentsToRun?: string[] | undefined) => Promise<string[]>;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
function getComponentsByDir() {
|
|
9
|
-
return async (componentsDir, componentsToRun) => {
|
|
10
|
-
const isOcComponent = (file) => {
|
|
11
|
-
const filePath = path_1.default.resolve(componentsDir, file);
|
|
12
|
-
const packagePath = path_1.default.join(filePath, 'package.json');
|
|
13
|
-
let content;
|
|
14
|
-
try {
|
|
15
|
-
content = fs_extra_1.default.readJsonSync(packagePath);
|
|
16
|
-
}
|
|
17
|
-
catch (err) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
if (!content.oc) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
const packagedProperty = content.oc && content.oc.packaged;
|
|
24
|
-
return typeof packagedProperty === 'undefined';
|
|
25
|
-
};
|
|
26
|
-
try {
|
|
27
|
-
let dirContent = await fs_extra_1.default.readdir(componentsDir);
|
|
28
|
-
if (componentsToRun) {
|
|
29
|
-
dirContent = dirContent.filter(content => componentsToRun.includes(content));
|
|
30
|
-
}
|
|
31
|
-
const components = dirContent
|
|
32
|
-
.filter(isOcComponent)
|
|
33
|
-
.map(component => path_1.default.resolve(componentsDir, component));
|
|
34
|
-
return components;
|
|
35
|
-
}
|
|
36
|
-
catch (err) {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
exports.default = getComponentsByDir;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
function getComponentsByDir() {
|
|
9
|
+
return async (componentsDir, componentsToRun) => {
|
|
10
|
+
const isOcComponent = (file) => {
|
|
11
|
+
const filePath = path_1.default.resolve(componentsDir, file);
|
|
12
|
+
const packagePath = path_1.default.join(filePath, 'package.json');
|
|
13
|
+
let content;
|
|
14
|
+
try {
|
|
15
|
+
content = fs_extra_1.default.readJsonSync(packagePath);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (!content.oc) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
const packagedProperty = content.oc && content.oc.packaged;
|
|
24
|
+
return typeof packagedProperty === 'undefined';
|
|
25
|
+
};
|
|
26
|
+
try {
|
|
27
|
+
let dirContent = await fs_extra_1.default.readdir(componentsDir);
|
|
28
|
+
if (componentsToRun) {
|
|
29
|
+
dirContent = dirContent.filter(content => componentsToRun.includes(content));
|
|
30
|
+
}
|
|
31
|
+
const components = dirContent
|
|
32
|
+
.filter(isOcComponent)
|
|
33
|
+
.map(component => path_1.default.resolve(componentsDir, component));
|
|
34
|
+
return components;
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
exports.default = getComponentsByDir;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Logger } from '../logger';
|
|
2
|
-
interface PluginMock {
|
|
3
|
-
name: string;
|
|
4
|
-
register: {
|
|
5
|
-
register: (options: unknown, dependencies: unknown, next: () => void) => void;
|
|
6
|
-
execute: (...args: unknown[]) => unknown;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export default function getMockedPlugins(logger: Logger, componentsDir: string): PluginMock[];
|
|
10
|
-
export {};
|
|
1
|
+
import { Logger } from '../logger';
|
|
2
|
+
interface PluginMock {
|
|
3
|
+
name: string;
|
|
4
|
+
register: {
|
|
5
|
+
register: (options: unknown, dependencies: unknown, next: () => void) => void;
|
|
6
|
+
execute: (...args: unknown[]) => unknown;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export default function getMockedPlugins(logger: Logger, componentsDir: string): PluginMock[];
|
|
10
|
+
export {};
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const settings_1 = __importDefault(require("../../resources/settings"));
|
|
9
|
-
const resources_1 = __importDefault(require("../../resources/"));
|
|
10
|
-
const isMockValid = (plugin) => {
|
|
11
|
-
const isFunction = typeof plugin === 'function';
|
|
12
|
-
const isValidObject = !!plugin &&
|
|
13
|
-
typeof plugin === 'object' &&
|
|
14
|
-
typeof plugin.register === 'function' &&
|
|
15
|
-
typeof plugin.execute === 'function';
|
|
16
|
-
return isFunction || isValidObject;
|
|
17
|
-
};
|
|
18
|
-
const defaultRegister = (_options, _dependencies, next) => {
|
|
19
|
-
next();
|
|
20
|
-
};
|
|
21
|
-
const registerStaticMocks = (mocks, logger) => Object.entries(mocks).map(([pluginName, mockedValue]) => {
|
|
22
|
-
logger.ok(`├── ${pluginName} () => ${mockedValue}`);
|
|
23
|
-
return {
|
|
24
|
-
name: pluginName,
|
|
25
|
-
register: {
|
|
26
|
-
register: defaultRegister,
|
|
27
|
-
execute: () => mockedValue
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
const registerDynamicMocks = (ocJsonLocation, mocks, logger) => Object.entries(mocks)
|
|
32
|
-
.map(([pluginName, source]) => {
|
|
33
|
-
let pluginMock;
|
|
34
|
-
try {
|
|
35
|
-
pluginMock = require(path_1.default.resolve(ocJsonLocation, source));
|
|
36
|
-
}
|
|
37
|
-
catch (er) {
|
|
38
|
-
logger.err(String(er));
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (!isMockValid(pluginMock)) {
|
|
42
|
-
logger.err(`├── ${pluginName} () => Error (skipping)`);
|
|
43
|
-
logger.err(resources_1.default.errors.cli.MOCK_PLUGIN_IS_NOT_VALID);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const register = pluginMock.register || defaultRegister;
|
|
47
|
-
const execute = pluginMock.execute || pluginMock;
|
|
48
|
-
logger.ok(`├── ${pluginName} () => [Function]`);
|
|
49
|
-
return {
|
|
50
|
-
name: pluginName,
|
|
51
|
-
register: { execute, register }
|
|
52
|
-
};
|
|
53
|
-
})
|
|
54
|
-
.filter((pluginMock) => !!pluginMock);
|
|
55
|
-
const findPath = (pathToResolve, fileName) => {
|
|
56
|
-
const rootDir = fs_extra_1.default.realpathSync('.');
|
|
57
|
-
const fileToResolve = path_1.default.join(pathToResolve, fileName);
|
|
58
|
-
if (!fs_extra_1.default.existsSync(fileToResolve)) {
|
|
59
|
-
if (pathToResolve === rootDir) {
|
|
60
|
-
return undefined;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
const getParent = (pathToResolve) => pathToResolve.split('/').slice(0, -1).join('/');
|
|
64
|
-
const parentDir = pathToResolve ? getParent(pathToResolve) : rootDir;
|
|
65
|
-
return findPath(parentDir, fileName);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return fileToResolve;
|
|
69
|
-
};
|
|
70
|
-
function getMockedPlugins(logger, componentsDir) {
|
|
71
|
-
var _a, _b;
|
|
72
|
-
componentsDir = path_1.default.resolve(componentsDir || '.');
|
|
73
|
-
let plugins = [];
|
|
74
|
-
const ocJsonFileName = settings_1.default.configFile.src.replace('./', '');
|
|
75
|
-
const ocJsonPath = findPath(componentsDir, ocJsonFileName);
|
|
76
|
-
if (!ocJsonPath) {
|
|
77
|
-
return plugins;
|
|
78
|
-
}
|
|
79
|
-
const content = fs_extra_1.default.readJsonSync(ocJsonPath);
|
|
80
|
-
const ocJsonLocation = ocJsonPath.slice(0, -ocJsonFileName.length);
|
|
81
|
-
if (!content.mocks || !content.mocks.plugins) {
|
|
82
|
-
return plugins;
|
|
83
|
-
}
|
|
84
|
-
logger.warn(resources_1.default.messages.cli.REGISTERING_MOCKED_PLUGINS);
|
|
85
|
-
plugins = plugins.concat(registerStaticMocks((_a = content.mocks.plugins.static) !== null && _a !== void 0 ? _a : {}, logger));
|
|
86
|
-
plugins = plugins.concat(registerDynamicMocks(ocJsonLocation, (_b = content.mocks.plugins.dynamic) !== null && _b !== void 0 ? _b : {}, logger));
|
|
87
|
-
return plugins;
|
|
88
|
-
}
|
|
89
|
-
exports.default = getMockedPlugins;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const settings_1 = __importDefault(require("../../resources/settings"));
|
|
9
|
+
const resources_1 = __importDefault(require("../../resources/"));
|
|
10
|
+
const isMockValid = (plugin) => {
|
|
11
|
+
const isFunction = typeof plugin === 'function';
|
|
12
|
+
const isValidObject = !!plugin &&
|
|
13
|
+
typeof plugin === 'object' &&
|
|
14
|
+
typeof plugin.register === 'function' &&
|
|
15
|
+
typeof plugin.execute === 'function';
|
|
16
|
+
return isFunction || isValidObject;
|
|
17
|
+
};
|
|
18
|
+
const defaultRegister = (_options, _dependencies, next) => {
|
|
19
|
+
next();
|
|
20
|
+
};
|
|
21
|
+
const registerStaticMocks = (mocks, logger) => Object.entries(mocks).map(([pluginName, mockedValue]) => {
|
|
22
|
+
logger.ok(`├── ${pluginName} () => ${mockedValue}`);
|
|
23
|
+
return {
|
|
24
|
+
name: pluginName,
|
|
25
|
+
register: {
|
|
26
|
+
register: defaultRegister,
|
|
27
|
+
execute: () => mockedValue
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
const registerDynamicMocks = (ocJsonLocation, mocks, logger) => Object.entries(mocks)
|
|
32
|
+
.map(([pluginName, source]) => {
|
|
33
|
+
let pluginMock;
|
|
34
|
+
try {
|
|
35
|
+
pluginMock = require(path_1.default.resolve(ocJsonLocation, source));
|
|
36
|
+
}
|
|
37
|
+
catch (er) {
|
|
38
|
+
logger.err(String(er));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!isMockValid(pluginMock)) {
|
|
42
|
+
logger.err(`├── ${pluginName} () => Error (skipping)`);
|
|
43
|
+
logger.err(resources_1.default.errors.cli.MOCK_PLUGIN_IS_NOT_VALID);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const register = pluginMock.register || defaultRegister;
|
|
47
|
+
const execute = pluginMock.execute || pluginMock;
|
|
48
|
+
logger.ok(`├── ${pluginName} () => [Function]`);
|
|
49
|
+
return {
|
|
50
|
+
name: pluginName,
|
|
51
|
+
register: { execute, register }
|
|
52
|
+
};
|
|
53
|
+
})
|
|
54
|
+
.filter((pluginMock) => !!pluginMock);
|
|
55
|
+
const findPath = (pathToResolve, fileName) => {
|
|
56
|
+
const rootDir = fs_extra_1.default.realpathSync('.');
|
|
57
|
+
const fileToResolve = path_1.default.join(pathToResolve, fileName);
|
|
58
|
+
if (!fs_extra_1.default.existsSync(fileToResolve)) {
|
|
59
|
+
if (pathToResolve === rootDir) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const getParent = (pathToResolve) => pathToResolve.split('/').slice(0, -1).join('/');
|
|
64
|
+
const parentDir = pathToResolve ? getParent(pathToResolve) : rootDir;
|
|
65
|
+
return findPath(parentDir, fileName);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return fileToResolve;
|
|
69
|
+
};
|
|
70
|
+
function getMockedPlugins(logger, componentsDir) {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
componentsDir = path_1.default.resolve(componentsDir || '.');
|
|
73
|
+
let plugins = [];
|
|
74
|
+
const ocJsonFileName = settings_1.default.configFile.src.replace('./', '');
|
|
75
|
+
const ocJsonPath = findPath(componentsDir, ocJsonFileName);
|
|
76
|
+
if (!ocJsonPath) {
|
|
77
|
+
return plugins;
|
|
78
|
+
}
|
|
79
|
+
const content = fs_extra_1.default.readJsonSync(ocJsonPath);
|
|
80
|
+
const ocJsonLocation = ocJsonPath.slice(0, -ocJsonFileName.length);
|
|
81
|
+
if (!content.mocks || !content.mocks.plugins) {
|
|
82
|
+
return plugins;
|
|
83
|
+
}
|
|
84
|
+
logger.warn(resources_1.default.messages.cli.REGISTERING_MOCKED_PLUGINS);
|
|
85
|
+
plugins = plugins.concat(registerStaticMocks((_a = content.mocks.plugins.static) !== null && _a !== void 0 ? _a : {}, logger));
|
|
86
|
+
plugins = plugins.concat(registerDynamicMocks(ocJsonLocation, (_b = content.mocks.plugins.dynamic) !== null && _b !== void 0 ? _b : {}, logger));
|
|
87
|
+
return plugins;
|
|
88
|
+
}
|
|
89
|
+
exports.default = getMockedPlugins;
|
package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Component } from '../../../types';
|
|
2
|
-
export default function ensureCompilerIsDeclaredAsDevDependency(options: {
|
|
3
|
-
componentPath: string;
|
|
4
|
-
pkg: Component;
|
|
5
|
-
template: string;
|
|
6
|
-
}): string;
|
|
1
|
+
import { Component } from '../../../types';
|
|
2
|
+
export default function ensureCompilerIsDeclaredAsDevDependency(options: {
|
|
3
|
+
componentPath: string;
|
|
4
|
+
pkg: Component;
|
|
5
|
+
template: string;
|
|
6
|
+
}): string;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const resources_1 = __importDefault(require("../../../resources"));
|
|
7
|
-
function ensureCompilerIsDeclaredAsDevDependency(options) {
|
|
8
|
-
var _a;
|
|
9
|
-
const { componentPath, pkg, template } = options;
|
|
10
|
-
const compilerDep = `${template}-compiler`;
|
|
11
|
-
const isOk = (_a = pkg.devDependencies) === null || _a === void 0 ? void 0 : _a[compilerDep];
|
|
12
|
-
if (!isOk)
|
|
13
|
-
throw resources_1.default.errors.cli.TEMPLATE_DEP_MISSING(template, componentPath);
|
|
14
|
-
return compilerDep;
|
|
15
|
-
}
|
|
16
|
-
exports.default = ensureCompilerIsDeclaredAsDevDependency;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const resources_1 = __importDefault(require("../../../resources"));
|
|
7
|
+
function ensureCompilerIsDeclaredAsDevDependency(options) {
|
|
8
|
+
var _a;
|
|
9
|
+
const { componentPath, pkg, template } = options;
|
|
10
|
+
const compilerDep = `${template}-compiler`;
|
|
11
|
+
const isOk = (_a = pkg.devDependencies) === null || _a === void 0 ? void 0 : _a[compilerDep];
|
|
12
|
+
if (!isOk)
|
|
13
|
+
throw resources_1.default.errors.cli.TEMPLATE_DEP_MISSING(template, componentPath);
|
|
14
|
+
return compilerDep;
|
|
15
|
+
}
|
|
16
|
+
exports.default = ensureCompilerIsDeclaredAsDevDependency;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Template } from '../../../types';
|
|
2
|
-
import { Logger } from '../../logger';
|
|
3
|
-
export default function getCompiler(options: {
|
|
4
|
-
compilerDep: string;
|
|
5
|
-
componentPath: string;
|
|
6
|
-
logger: Logger;
|
|
7
|
-
pkg: {
|
|
8
|
-
devDependencies: Record<string, string>;
|
|
9
|
-
};
|
|
10
|
-
}): Promise<Template>;
|
|
1
|
+
import { Template } from '../../../types';
|
|
2
|
+
import { Logger } from '../../logger';
|
|
3
|
+
export default function getCompiler(options: {
|
|
4
|
+
compilerDep: string;
|
|
5
|
+
componentPath: string;
|
|
6
|
+
logger: Logger;
|
|
7
|
+
pkg: {
|
|
8
|
+
devDependencies: Record<string, string>;
|
|
9
|
+
};
|
|
10
|
+
}): Promise<Template>;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const clean_require_1 = __importDefault(require("../../../utils/clean-require"));
|
|
8
|
-
const install_compiler_1 = __importDefault(require("./install-compiler"));
|
|
9
|
-
function getCompiler(options) {
|
|
10
|
-
const { compilerDep, componentPath, logger, pkg } = options;
|
|
11
|
-
const compilerPath = path_1.default.join(componentPath, 'node_modules', compilerDep);
|
|
12
|
-
const compiler = (0, clean_require_1.default)(compilerPath, { justTry: true });
|
|
13
|
-
if (compiler) {
|
|
14
|
-
return Promise.resolve(compiler);
|
|
15
|
-
}
|
|
16
|
-
let dependency = compilerDep;
|
|
17
|
-
if (pkg.devDependencies[compilerDep]) {
|
|
18
|
-
dependency += `@${pkg.devDependencies[compilerDep]}`;
|
|
19
|
-
}
|
|
20
|
-
const installOptions = {
|
|
21
|
-
compilerPath,
|
|
22
|
-
componentPath,
|
|
23
|
-
dependency,
|
|
24
|
-
logger
|
|
25
|
-
};
|
|
26
|
-
return (0, install_compiler_1.default)(installOptions);
|
|
27
|
-
}
|
|
28
|
-
exports.default = getCompiler;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const clean_require_1 = __importDefault(require("../../../utils/clean-require"));
|
|
8
|
+
const install_compiler_1 = __importDefault(require("./install-compiler"));
|
|
9
|
+
function getCompiler(options) {
|
|
10
|
+
const { compilerDep, componentPath, logger, pkg } = options;
|
|
11
|
+
const compilerPath = path_1.default.join(componentPath, 'node_modules', compilerDep);
|
|
12
|
+
const compiler = (0, clean_require_1.default)(compilerPath, { justTry: true });
|
|
13
|
+
if (compiler) {
|
|
14
|
+
return Promise.resolve(compiler);
|
|
15
|
+
}
|
|
16
|
+
let dependency = compilerDep;
|
|
17
|
+
if (pkg.devDependencies[compilerDep]) {
|
|
18
|
+
dependency += `@${pkg.devDependencies[compilerDep]}`;
|
|
19
|
+
}
|
|
20
|
+
const installOptions = {
|
|
21
|
+
compilerPath,
|
|
22
|
+
componentPath,
|
|
23
|
+
dependency,
|
|
24
|
+
logger
|
|
25
|
+
};
|
|
26
|
+
return (0, install_compiler_1.default)(installOptions);
|
|
27
|
+
}
|
|
28
|
+
exports.default = getCompiler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function getMissingDependencies(dependencies?: Record<string, string>): string[];
|
|
1
|
+
export default function getMissingDependencies(dependencies?: Record<string, string>): string[];
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const module_exists_1 = __importDefault(require("../../../utils/module-exists"));
|
|
8
|
-
function getMissingDependencies(dependencies = {}) {
|
|
9
|
-
const missing = [];
|
|
10
|
-
Object.entries(dependencies).forEach(([dependency, version]) => {
|
|
11
|
-
const pathToModule = path_1.default.resolve('node_modules/', dependency);
|
|
12
|
-
if (!(0, module_exists_1.default)(pathToModule)) {
|
|
13
|
-
missing.push(`${dependency}@${version || 'latest'}`);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return missing;
|
|
17
|
-
}
|
|
18
|
-
exports.default = getMissingDependencies;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const module_exists_1 = __importDefault(require("../../../utils/module-exists"));
|
|
8
|
+
function getMissingDependencies(dependencies = {}) {
|
|
9
|
+
const missing = [];
|
|
10
|
+
Object.entries(dependencies).forEach(([dependency, version]) => {
|
|
11
|
+
const pathToModule = path_1.default.resolve('node_modules/', dependency);
|
|
12
|
+
if (!(0, module_exists_1.default)(pathToModule)) {
|
|
13
|
+
missing.push(`${dependency}@${version || 'latest'}`);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return missing;
|
|
17
|
+
}
|
|
18
|
+
exports.default = getMissingDependencies;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Logger } from '../../logger';
|
|
2
|
-
import { Template } from '../../../types';
|
|
3
|
-
export default function handleDependencies(options: {
|
|
4
|
-
components: string[];
|
|
5
|
-
logger: Logger;
|
|
6
|
-
useComponentDependencies?: boolean;
|
|
7
|
-
}): Promise<{
|
|
8
|
-
modules: string[];
|
|
9
|
-
templates: Array<Template>;
|
|
10
|
-
}>;
|
|
1
|
+
import { Logger } from '../../logger';
|
|
2
|
+
import { Template } from '../../../types';
|
|
3
|
+
export default function handleDependencies(options: {
|
|
4
|
+
components: string[];
|
|
5
|
+
logger: Logger;
|
|
6
|
+
useComponentDependencies?: boolean;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
modules: string[];
|
|
9
|
+
templates: Array<Template>;
|
|
10
|
+
}>;
|