oc 0.49.7 → 0.49.8
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/CHANGELOG.md +22 -0
- package/README.md +2 -15
- package/dist/cli/domain/clean.d.ts +2 -2
- package/dist/cli/domain/clean.js +10 -13
- package/dist/cli/domain/get-components-by-dir.d.ts +1 -1
- package/dist/cli/domain/get-components-by-dir.js +8 -15
- package/dist/cli/domain/get-mocked-plugins.js +8 -6
- package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.d.ts +1 -1
- package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.js +4 -5
- package/dist/cli/domain/handle-dependencies/get-compiler.d.ts +1 -1
- package/dist/cli/domain/handle-dependencies/get-compiler.js +3 -3
- package/dist/cli/domain/handle-dependencies/index.d.ts +4 -3
- package/dist/cli/domain/handle-dependencies/index.js +40 -34
- package/dist/cli/domain/handle-dependencies/install-compiler.d.ts +1 -1
- package/dist/cli/domain/handle-dependencies/install-compiler.js +14 -7
- package/dist/cli/domain/handle-dependencies/install-missing-dependencies.d.ts +1 -1
- package/dist/cli/domain/handle-dependencies/install-missing-dependencies.js +13 -9
- package/dist/cli/domain/handle-dependencies/link-missing-dependencies.d.ts +1 -1
- package/dist/cli/domain/handle-dependencies/link-missing-dependencies.js +4 -8
- package/dist/cli/domain/init-template/index.d.ts +2 -2
- package/dist/cli/domain/init-template/index.js +6 -8
- package/dist/cli/domain/init-template/install-template.d.ts +2 -2
- package/dist/cli/domain/init-template/install-template.js +10 -9
- package/dist/cli/domain/init-template/scaffold.d.ts +2 -2
- package/dist/cli/domain/init-template/scaffold.js +7 -7
- package/dist/cli/domain/local.js +11 -10
- package/dist/cli/domain/mock.d.ts +1 -1
- package/dist/cli/domain/mock.js +21 -21
- package/dist/cli/domain/package-components.d.ts +1 -1
- package/dist/cli/domain/package-components.js +14 -17
- package/dist/cli/domain/registry.js +68 -81
- package/dist/cli/domain/watch.js +1 -1
- package/dist/cli/facade/clean.d.ts +10 -4
- package/dist/cli/facade/clean.js +38 -28
- package/dist/cli/facade/dev.d.ts +108 -15
- package/dist/cli/facade/dev.js +85 -99
- package/dist/cli/facade/init.d.ts +12 -5
- package/dist/cli/facade/init.js +22 -20
- package/dist/cli/facade/mock.d.ts +12 -5
- package/dist/cli/facade/mock.js +5 -6
- package/dist/cli/facade/package.d.ts +12 -5
- package/dist/cli/facade/package.js +30 -32
- package/dist/cli/facade/preview.d.ts +8 -3
- package/dist/cli/facade/preview.js +12 -10
- package/dist/cli/facade/publish.d.ts +16 -7
- package/dist/cli/facade/publish.js +94 -114
- package/dist/cli/facade/registry-add.d.ts +8 -3
- package/dist/cli/facade/registry-add.js +10 -9
- package/dist/cli/facade/registry-ls.d.ts +4 -1
- package/dist/cli/facade/registry-ls.js +19 -17
- package/dist/cli/facade/registry-remove.d.ts +8 -3
- package/dist/cli/facade/registry-remove.js +10 -9
- package/dist/cli/facade/registry.d.ts +4 -1
- package/dist/cli/facade/registry.js +6 -3
- package/dist/cli/index.js +3 -5
- package/dist/cli/programmatic-api.d.ts +1 -1
- package/dist/components/oc-client/_package/package.json +1 -1
- package/dist/components/oc-client/package.json +1 -1
- package/dist/registry/app-start.d.ts +2 -2
- package/dist/registry/app-start.js +20 -20
- package/dist/registry/domain/components-cache/components-list.d.ts +7 -6
- package/dist/registry/domain/components-cache/components-list.js +31 -45
- package/dist/registry/domain/components-cache/index.d.ts +6 -5
- package/dist/registry/domain/components-cache/index.js +47 -50
- package/dist/registry/domain/components-details.d.ts +5 -4
- package/dist/registry/domain/components-details.js +27 -38
- package/dist/registry/domain/extract-package.d.ts +2 -2
- package/dist/registry/domain/extract-package.js +9 -12
- package/dist/registry/domain/get-package-json-from-temp-dir.d.ts +1 -1
- package/dist/registry/domain/get-package-json-from-temp-dir.js +2 -2
- package/dist/registry/domain/nested-renderer.d.ts +7 -6
- package/dist/registry/domain/nested-renderer.js +36 -72
- package/dist/registry/domain/options-sanitiser.js +5 -3
- package/dist/registry/domain/plugins-initialiser.d.ts +3 -1
- package/dist/registry/domain/plugins-initialiser.js +29 -33
- package/dist/registry/domain/repository.js +78 -100
- package/dist/registry/domain/require-wrapper.js +1 -2
- package/dist/registry/domain/storage-adapter.d.ts +10 -0
- package/dist/registry/domain/storage-adapter.js +55 -0
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js +15 -28
- package/dist/registry/middleware/index.d.ts +6 -2
- package/dist/registry/middleware/index.js +5 -1
- package/dist/registry/router.d.ts +2 -2
- package/dist/registry/router.js +0 -2
- package/dist/registry/routes/component-info.js +3 -2
- package/dist/registry/routes/component-preview.js +2 -1
- package/dist/registry/routes/components.js +1 -1
- package/dist/registry/routes/helpers/get-component-fallback.d.ts +2 -7
- package/dist/registry/routes/helpers/get-component.d.ts +5 -5
- package/dist/registry/routes/helpers/get-component.js +6 -5
- package/dist/registry/routes/helpers/is-url-discoverable.d.ts +2 -2
- package/dist/registry/routes/helpers/is-url-discoverable.js +15 -9
- package/dist/registry/routes/index.js +4 -3
- package/dist/registry/routes/publish.d.ts +1 -1
- package/dist/registry/routes/publish.js +32 -31
- package/dist/resources/settings.js +1 -1
- package/dist/types.d.ts +35 -43
- package/dist/utils/npm-utils.d.ts +6 -8
- package/dist/utils/npm-utils.js +20 -9
- package/dist/utils/put.d.ts +2 -1
- package/dist/utils/put.js +10 -29
- package/logintervals.md +1 -1
- package/package.json +6 -1
- package/src/cli/domain/clean.ts +10 -20
- package/src/cli/domain/get-components-by-dir.ts +12 -26
- package/src/cli/domain/get-mocked-plugins.ts +32 -26
- package/src/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.ts +8 -12
- package/src/cli/domain/handle-dependencies/get-compiler.ts +8 -11
- package/src/cli/domain/handle-dependencies/index.ts +55 -109
- package/src/cli/domain/handle-dependencies/install-compiler.ts +22 -15
- package/src/cli/domain/handle-dependencies/install-missing-dependencies.ts +19 -13
- package/src/cli/domain/handle-dependencies/link-missing-dependencies.ts +8 -16
- package/src/cli/domain/init-template/index.ts +13 -20
- package/src/cli/domain/init-template/install-template.ts +11 -12
- package/src/cli/domain/init-template/scaffold.ts +9 -12
- package/src/cli/domain/local.ts +19 -22
- package/src/cli/domain/mock.ts +32 -36
- package/src/cli/domain/package-components.ts +14 -25
- package/src/cli/domain/registry.ts +80 -116
- package/src/cli/domain/watch.ts +1 -1
- package/src/cli/facade/clean.ts +37 -37
- package/src/cli/facade/dev.ts +159 -182
- package/src/cli/facade/init.ts +36 -38
- package/src/cli/facade/mock.ts +11 -10
- package/src/cli/facade/package.ts +44 -49
- package/src/cli/facade/preview.ts +20 -18
- package/src/cli/facade/publish.ts +134 -172
- package/src/cli/facade/registry-add.ts +16 -15
- package/src/cli/facade/registry-ls.ts +27 -22
- package/src/cli/facade/registry-remove.ts +16 -15
- package/src/cli/facade/registry.ts +7 -5
- package/src/cli/index.ts +3 -5
- package/src/components/oc-client/_package/package.json +1 -1
- package/src/components/oc-client/package.json +1 -1
- package/src/globals.d.ts +38 -0
- package/src/registry/app-start.ts +27 -31
- package/src/registry/domain/components-cache/components-list.ts +45 -67
- package/src/registry/domain/components-cache/index.ts +55 -60
- package/src/registry/domain/components-details.ts +49 -75
- package/src/registry/domain/extract-package.ts +19 -27
- package/src/registry/domain/get-package-json-from-temp-dir.ts +3 -4
- package/src/registry/domain/nested-renderer.ts +64 -122
- package/src/registry/domain/options-sanitiser.ts +6 -3
- package/src/registry/domain/plugins-initialiser.ts +45 -49
- package/src/registry/domain/repository.ts +129 -235
- package/src/registry/domain/require-wrapper.ts +1 -2
- package/src/registry/domain/storage-adapter.ts +85 -0
- package/src/registry/index.ts +48 -79
- package/src/registry/middleware/index.ts +10 -2
- package/src/registry/router.ts +2 -10
- package/src/registry/routes/component-info.ts +4 -3
- package/src/registry/routes/component-preview.ts +3 -2
- package/src/registry/routes/components.ts +1 -1
- package/src/registry/routes/helpers/get-component-fallback.ts +3 -9
- package/src/registry/routes/helpers/get-component.ts +11 -9
- package/src/registry/routes/helpers/is-url-discoverable.ts +14 -15
- package/src/registry/routes/index.ts +18 -13
- package/src/registry/routes/publish.ts +31 -34
- package/src/resources/settings.ts +1 -1
- package/src/types.ts +63 -136
- package/src/utils/npm-utils.ts +38 -37
- package/src/utils/put.ts +15 -37
|
@@ -1,136 +1,112 @@
|
|
|
1
|
-
import async from 'async';
|
|
2
1
|
import colors from 'colors/safe';
|
|
3
2
|
import path from 'path';
|
|
4
3
|
import fs from 'fs-extra';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import readCb from 'read';
|
|
5
|
+
import { promisify } from 'util';
|
|
7
6
|
import { Logger } from '../logger';
|
|
8
7
|
import { Component, RegistryCli, Local } from '../../types';
|
|
8
|
+
import { fromPromise } from 'universalify';
|
|
9
9
|
|
|
10
10
|
import handleDependencies from '../domain/handle-dependencies';
|
|
11
11
|
import strings from '../../resources/index';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
const read = promisify(readCb);
|
|
14
|
+
|
|
15
|
+
const publish = ({
|
|
16
|
+
logger,
|
|
17
|
+
registry,
|
|
18
|
+
local
|
|
19
|
+
}: {
|
|
20
|
+
logger: Logger;
|
|
21
|
+
registry: RegistryCli;
|
|
22
|
+
local: Local;
|
|
23
|
+
}) =>
|
|
24
|
+
fromPromise(
|
|
25
|
+
async (opts: {
|
|
25
26
|
componentPath: string;
|
|
26
27
|
skipPackage?: boolean;
|
|
27
28
|
username?: string;
|
|
28
29
|
password?: string;
|
|
29
30
|
registries?: string[];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
31
|
+
}): Promise<void> => {
|
|
32
|
+
const componentPath = opts.componentPath;
|
|
33
|
+
const skipPackage = opts.skipPackage;
|
|
34
|
+
const packageDir = path.resolve(componentPath, '_package');
|
|
35
|
+
const compressedPackagePath = path.resolve(
|
|
36
|
+
componentPath,
|
|
37
|
+
'package.tar.gz'
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
let errorMessage;
|
|
41
|
+
|
|
42
|
+
const readPackageJson = () =>
|
|
43
|
+
fs.readJson(path.join(packageDir, 'package.json'));
|
|
44
|
+
|
|
45
|
+
const getCredentials = async (): Promise<{
|
|
46
|
+
username: string;
|
|
47
|
+
password: string;
|
|
48
|
+
}> => {
|
|
49
|
+
if (opts.username && opts.password) {
|
|
50
|
+
logger.ok(strings.messages.cli.USING_CREDS);
|
|
51
|
+
const { username, password } = opts;
|
|
52
|
+
return { username, password };
|
|
53
|
+
}
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
logger.warn(strings.messages.cli.ENTER_USERNAME);
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
const username = await read({});
|
|
58
58
|
logger.warn(strings.messages.cli.ENTER_PASSWORD);
|
|
59
|
+
const password = await read({ silent: true });
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
cb(null, { username, password });
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const compress = (cb: (error: string | Error | null) => void) => {
|
|
67
|
-
local.compress(packageDir, compressedPackagePath, cb);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const packageAndCompress = (
|
|
71
|
-
cb: (err: Error | string | null, data: Component) => void
|
|
72
|
-
) => {
|
|
73
|
-
logger.warn(strings.messages.cli.PACKAGING(packageDir));
|
|
74
|
-
const packageOptions = {
|
|
75
|
-
production: true,
|
|
76
|
-
componentPath: path.resolve(componentPath)
|
|
61
|
+
return { username, password };
|
|
77
62
|
};
|
|
78
63
|
|
|
79
|
-
local.
|
|
80
|
-
if (err) {
|
|
81
|
-
return cb(err, undefined as any);
|
|
82
|
-
}
|
|
64
|
+
const compress = () => local.compress(packageDir, compressedPackagePath);
|
|
83
65
|
|
|
84
|
-
|
|
66
|
+
const packageAndCompress = async (): Promise<Component> => {
|
|
67
|
+
logger.warn(strings.messages.cli.PACKAGING(packageDir));
|
|
68
|
+
const packageOptions = {
|
|
69
|
+
production: true,
|
|
70
|
+
componentPath: path.resolve(componentPath)
|
|
71
|
+
};
|
|
85
72
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
cb(null, component);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const getRegistries = (
|
|
96
|
-
cb: (err: string | null, registryLocations: string[]) => void
|
|
97
|
-
): void => {
|
|
98
|
-
if (opts.registries) return cb(null, opts.registries);
|
|
73
|
+
const component = await local.package(packageOptions);
|
|
74
|
+
logger.warn(strings.messages.cli.COMPRESSING(compressedPackagePath));
|
|
75
|
+
await compress();
|
|
99
76
|
|
|
100
|
-
|
|
101
|
-
|
|
77
|
+
return component;
|
|
78
|
+
};
|
|
102
79
|
|
|
103
|
-
|
|
104
|
-
options: {
|
|
80
|
+
const putComponentToRegistry = async (options: {
|
|
105
81
|
route: string;
|
|
106
82
|
path: string;
|
|
107
83
|
username?: string;
|
|
108
84
|
password?: string;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (err === 'Unauthorized') {
|
|
85
|
+
}): Promise<void> => {
|
|
86
|
+
logger.warn(strings.messages.cli.PUBLISHING(options.route));
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
await registry.putComponent(options);
|
|
90
|
+
logger.ok(strings.messages.cli.PUBLISHED(options.route));
|
|
91
|
+
} catch (err: any) {
|
|
92
|
+
if (err === 'Unauthorized' || err.message === 'Unauthorized') {
|
|
117
93
|
if (!!options.username || !!options.password) {
|
|
118
94
|
logger.err(
|
|
119
95
|
strings.errors.cli.PUBLISHING_FAIL(
|
|
120
96
|
strings.errors.cli.INVALID_CREDENTIALS
|
|
121
97
|
)
|
|
122
98
|
);
|
|
123
|
-
|
|
99
|
+
throw err;
|
|
124
100
|
}
|
|
125
101
|
|
|
126
102
|
logger.warn(strings.messages.cli.REGISTRY_CREDENTIALS_REQUIRED);
|
|
127
103
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
} else if (
|
|
104
|
+
const credentials = await getCredentials();
|
|
105
|
+
|
|
106
|
+
await putComponentToRegistry(Object.assign(options, credentials));
|
|
107
|
+
} else if (err.code === 'cli_version_not_valid') {
|
|
132
108
|
const upgradeCommand = strings.commands.cli.UPGRADE(
|
|
133
|
-
|
|
109
|
+
err.details.suggestedVersion
|
|
134
110
|
);
|
|
135
111
|
const errorDetails =
|
|
136
112
|
strings.errors.cli.OC_CLI_VERSION_NEEDS_UPGRADE(
|
|
@@ -139,107 +115,93 @@ const publish =
|
|
|
139
115
|
|
|
140
116
|
errorMessage = strings.errors.cli.PUBLISHING_FAIL(errorDetails);
|
|
141
117
|
logger.err(errorMessage);
|
|
142
|
-
|
|
143
|
-
|
|
118
|
+
|
|
119
|
+
throw errorMessage;
|
|
120
|
+
} else if (err.code === 'node_version_not_valid') {
|
|
144
121
|
const details = strings.errors.cli.NODE_CLI_VERSION_NEEDS_UPGRADE(
|
|
145
|
-
|
|
122
|
+
err.details.suggestedVersion
|
|
146
123
|
);
|
|
147
124
|
|
|
148
125
|
errorMessage = strings.errors.cli.PUBLISHING_FAIL(details);
|
|
149
126
|
logger.err(errorMessage);
|
|
150
|
-
|
|
127
|
+
|
|
128
|
+
throw errorMessage;
|
|
151
129
|
} else {
|
|
152
|
-
if (
|
|
130
|
+
if (err.message) {
|
|
131
|
+
// eslint-disable-next-line no-ex-assign
|
|
132
|
+
err = err.message;
|
|
133
|
+
} else if (err && typeof err === 'object') {
|
|
153
134
|
try {
|
|
135
|
+
// eslint-disable-next-line no-ex-assign
|
|
154
136
|
err = JSON.stringify(err);
|
|
155
137
|
} catch (er) {}
|
|
156
138
|
}
|
|
157
|
-
errorMessage = strings.errors.cli.PUBLISHING_FAIL(err);
|
|
139
|
+
errorMessage = strings.errors.cli.PUBLISHING_FAIL(String(err));
|
|
158
140
|
logger.err(errorMessage);
|
|
159
|
-
|
|
141
|
+
|
|
142
|
+
throw errorMessage;
|
|
160
143
|
}
|
|
161
|
-
} else {
|
|
162
|
-
logger.ok(strings.messages.cli.PUBLISHED(options.route));
|
|
163
|
-
return cb(null, 'ok');
|
|
164
144
|
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
async.eachSeries(
|
|
173
|
-
registryLocations,
|
|
174
|
-
(registryUrl, next) => {
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const publishToRegistries = async (
|
|
148
|
+
registryLocations: string[],
|
|
149
|
+
component: Component
|
|
150
|
+
) => {
|
|
151
|
+
for (const registryUrl of registryLocations) {
|
|
175
152
|
const registryNormalised = registryUrl.replace(/\/$/, '');
|
|
176
153
|
const componentRoute = `${registryNormalised}/${component.name}/${component.version}`;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
},
|
|
182
|
-
err => {
|
|
183
|
-
local.cleanup(compressedPackagePath, err2 => {
|
|
184
|
-
if (err) {
|
|
185
|
-
return callback(err);
|
|
186
|
-
}
|
|
187
|
-
callback(err2);
|
|
154
|
+
|
|
155
|
+
await putComponentToRegistry({
|
|
156
|
+
route: componentRoute,
|
|
157
|
+
path: compressedPackagePath
|
|
188
158
|
});
|
|
189
159
|
}
|
|
190
|
-
|
|
191
|
-
|
|
160
|
+
await local.cleanup(compressedPackagePath);
|
|
161
|
+
};
|
|
192
162
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
logger.err(err);
|
|
196
|
-
return callback(err);
|
|
197
|
-
}
|
|
163
|
+
try {
|
|
164
|
+
const registryLocations = opts.registries || (await registry.get());
|
|
198
165
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
packageAndCompress((err, component) => {
|
|
208
|
-
if (err) {
|
|
209
|
-
errorMessage = strings.errors.cli.PACKAGE_CREATION_FAIL(
|
|
210
|
-
String(err)
|
|
211
|
-
);
|
|
212
|
-
logger.err(errorMessage);
|
|
213
|
-
return callback(errorMessage);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
publishToRegistries(registryLocations, component);
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
);
|
|
220
|
-
} else {
|
|
221
|
-
if (fs.existsSync(packageDir)) {
|
|
222
|
-
readPackageJson((err, component) => {
|
|
223
|
-
if (err) {
|
|
224
|
-
logger.err(String(err));
|
|
225
|
-
return callback(err);
|
|
226
|
-
}
|
|
227
|
-
compress(err => {
|
|
228
|
-
if (err) {
|
|
229
|
-
logger.err(String(err));
|
|
230
|
-
return callback(err);
|
|
231
|
-
}
|
|
166
|
+
if (!skipPackage) {
|
|
167
|
+
await handleDependencies({
|
|
168
|
+
components: [path.resolve(componentPath)],
|
|
169
|
+
logger
|
|
170
|
+
}).catch(err => {
|
|
171
|
+
logger.err(err);
|
|
172
|
+
return Promise.reject(err);
|
|
173
|
+
});
|
|
232
174
|
|
|
233
|
-
|
|
234
|
-
|
|
175
|
+
const component = await packageAndCompress().catch(err => {
|
|
176
|
+
errorMessage = strings.errors.cli.PACKAGE_CREATION_FAIL(
|
|
177
|
+
String(err)
|
|
178
|
+
);
|
|
179
|
+
logger.err(errorMessage);
|
|
180
|
+
return Promise.reject(errorMessage);
|
|
235
181
|
});
|
|
182
|
+
await publishToRegistries(registryLocations, component);
|
|
236
183
|
} else {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
184
|
+
if (fs.existsSync(packageDir)) {
|
|
185
|
+
const component = await readPackageJson().catch(err => {
|
|
186
|
+
logger.err(String(err));
|
|
187
|
+
return Promise.reject(err);
|
|
188
|
+
});
|
|
189
|
+
await compress().catch(err => {
|
|
190
|
+
logger.err(String(err));
|
|
191
|
+
return Promise.reject(err);
|
|
192
|
+
});
|
|
193
|
+
await publishToRegistries(registryLocations, component);
|
|
194
|
+
} else {
|
|
195
|
+
errorMessage = strings.errors.cli.PACKAGE_FOLDER_MISSING;
|
|
196
|
+
logger.err(errorMessage);
|
|
197
|
+
throw errorMessage;
|
|
198
|
+
}
|
|
240
199
|
}
|
|
200
|
+
} catch (err) {
|
|
201
|
+
logger.err(String(err));
|
|
202
|
+
throw err;
|
|
241
203
|
}
|
|
242
|
-
}
|
|
243
|
-
|
|
204
|
+
}
|
|
205
|
+
);
|
|
244
206
|
|
|
245
207
|
export default publish;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
+
import { fromPromise } from 'universalify';
|
|
1
2
|
import strings from '../../resources/index';
|
|
2
3
|
import { RegistryCli } from '../../types';
|
|
3
4
|
import { Logger } from '../logger';
|
|
4
5
|
|
|
5
|
-
const registryAdd =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
6
|
+
const registryAdd = ({
|
|
7
|
+
registry,
|
|
8
|
+
logger
|
|
9
|
+
}: {
|
|
10
|
+
logger: Logger;
|
|
11
|
+
registry: RegistryCli;
|
|
12
|
+
}) =>
|
|
13
|
+
fromPromise(async (opts: { registryUrl: string }): Promise<void> => {
|
|
14
|
+
try {
|
|
15
|
+
await registry.add(opts.registryUrl);
|
|
17
16
|
logger.ok(strings.messages.cli.REGISTRY_ADDED);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
} catch (err) {
|
|
18
|
+
logger.err(String(err));
|
|
19
|
+
throw err;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
21
22
|
|
|
22
23
|
export default registryAdd;
|
|
@@ -1,31 +1,36 @@
|
|
|
1
|
+
import { fromPromise } from 'universalify';
|
|
2
|
+
|
|
1
3
|
import strings from '../../resources/index';
|
|
2
4
|
import { RegistryCli } from '../../types';
|
|
3
5
|
import { Logger } from '../logger';
|
|
4
6
|
|
|
5
|
-
const registryLs =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
logger.warn(strings.messages.cli.REGISTRY_LIST);
|
|
17
|
-
|
|
18
|
-
if (registries.length === 0) {
|
|
19
|
-
err = strings.errors.cli.REGISTRY_NOT_FOUND;
|
|
20
|
-
logger.err(err);
|
|
21
|
-
return callback(err, undefined as any);
|
|
22
|
-
}
|
|
7
|
+
const registryLs = ({
|
|
8
|
+
registry,
|
|
9
|
+
logger
|
|
10
|
+
}: {
|
|
11
|
+
logger: Logger;
|
|
12
|
+
registry: RegistryCli;
|
|
13
|
+
}) =>
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
+
fromPromise(async (_opts: unknown): Promise<string[]> => {
|
|
16
|
+
try {
|
|
17
|
+
const registries = await registry.get();
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
logger.warn(strings.messages.cli.REGISTRY_LIST);
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
if (registries.length === 0) {
|
|
22
|
+
const err = strings.errors.cli.REGISTRY_NOT_FOUND;
|
|
23
|
+
logger.err(err);
|
|
24
|
+
throw err;
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
|
|
27
|
+
registries.forEach(registryLocation => logger.ok(registryLocation));
|
|
28
|
+
|
|
29
|
+
return registries;
|
|
30
|
+
} catch (err) {
|
|
31
|
+
logger.err(strings.errors.generic(String(err)));
|
|
32
|
+
throw err;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
30
35
|
|
|
31
36
|
export default registryLs;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
+
import { fromPromise } from 'universalify';
|
|
1
2
|
import strings from '../../resources/index';
|
|
2
3
|
import { RegistryCli } from '../../types';
|
|
3
4
|
import { Logger } from '../logger';
|
|
4
5
|
|
|
5
|
-
const registryRemove =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
6
|
+
const registryRemove = ({
|
|
7
|
+
registry,
|
|
8
|
+
logger
|
|
9
|
+
}: {
|
|
10
|
+
logger: Logger;
|
|
11
|
+
registry: RegistryCli;
|
|
12
|
+
}) =>
|
|
13
|
+
fromPromise(async (opts: { registryUrl: string }): Promise<void> => {
|
|
14
|
+
try {
|
|
15
|
+
await registry.remove(opts.registryUrl);
|
|
17
16
|
logger.ok(strings.messages.cli.REGISTRY_REMOVED);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
} catch (err) {
|
|
18
|
+
logger.err(String(err));
|
|
19
|
+
throw err;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
21
22
|
|
|
22
23
|
export default registryRemove;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { fromPromise } from 'universalify';
|
|
2
|
+
|
|
3
|
+
const registry = () =>
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
+
fromPromise((_opts: unknown): Promise<void> => {
|
|
6
|
+
return Promise.resolve();
|
|
7
|
+
});
|
|
6
8
|
|
|
7
9
|
export default registry;
|
package/src/cli/index.ts
CHANGED
|
@@ -115,11 +115,9 @@ function processCommand(
|
|
|
115
115
|
return yargs;
|
|
116
116
|
},
|
|
117
117
|
options => {
|
|
118
|
-
// @ts-ignore
|
|
119
|
-
facade(options
|
|
120
|
-
|
|
121
|
-
return process.exit(1);
|
|
122
|
-
}
|
|
118
|
+
// @ts-ignore not callable
|
|
119
|
+
facade(options).catch(() => {
|
|
120
|
+
process.exit(1);
|
|
123
121
|
});
|
|
124
122
|
}
|
|
125
123
|
);
|
|
@@ -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.8","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.8","packaged":true,"date":1648119460751},"devDependencies":{"oc-template-es6-compiler":"^1.0.1"}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oc-client",
|
|
3
3
|
"description": "The OpenComponents client-side javascript client",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.8",
|
|
5
5
|
"repository": "https://github.com/opencomponents/oc/tree/master/components/oc-client",
|
|
6
6
|
"author": "Matteo Figus <matteofigus@gmail.com>",
|
|
7
7
|
"oc": {
|
package/src/globals.d.ts
CHANGED
|
@@ -2,6 +2,44 @@ declare module 'oc-client';
|
|
|
2
2
|
declare module 'try-require';
|
|
3
3
|
declare module 'basic-auth-connect';
|
|
4
4
|
|
|
5
|
+
declare module 'universalify' {
|
|
6
|
+
export function fromCallback<
|
|
7
|
+
Arguments extends readonly unknown[],
|
|
8
|
+
ErrorValue,
|
|
9
|
+
ReturnValue
|
|
10
|
+
>(
|
|
11
|
+
fn: (
|
|
12
|
+
...arguments_: [
|
|
13
|
+
...Arguments,
|
|
14
|
+
(error: ErrorValue, value: ReturnValue) => void
|
|
15
|
+
]
|
|
16
|
+
) => void
|
|
17
|
+
): {
|
|
18
|
+
(...arguments_: Arguments): Promise<ReturnValue>;
|
|
19
|
+
(
|
|
20
|
+
...arguments_: [
|
|
21
|
+
...Arguments,
|
|
22
|
+
(error: ErrorValue, value: ReturnValue) => void
|
|
23
|
+
]
|
|
24
|
+
): void;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export function fromPromise<
|
|
28
|
+
Arguments extends readonly unknown[],
|
|
29
|
+
ReturnValue
|
|
30
|
+
>(
|
|
31
|
+
fn: (...arguments_: [...Arguments]) => Promise<ReturnValue>
|
|
32
|
+
): {
|
|
33
|
+
(...arguments_: Arguments): Promise<ReturnValue>;
|
|
34
|
+
(
|
|
35
|
+
...arguments_: [
|
|
36
|
+
...Arguments,
|
|
37
|
+
(error: unknown, value: ReturnValue) => void
|
|
38
|
+
]
|
|
39
|
+
): void;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
5
43
|
declare module 'semver-extra' {
|
|
6
44
|
interface SemverExtra {
|
|
7
45
|
max(versions: string[]): string;
|