motia 0.13.1-beta.163-010752 → 0.13.2-beta.163
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/cjs/cli.d.ts +1 -1
- package/dist/cjs/cli.d.ts.map +1 -1
- package/dist/cjs/cli.js +11 -89
- package/dist/cjs/cloud/build/builders/node/index.js +2 -2
- package/dist/cjs/cloud/build/validations/api-endpoints.validator.js +4 -4
- package/dist/cjs/cloud/build/validations/cron-expressions.validator.js +2 -2
- package/dist/cjs/cloud/build/validations/duplicate-step-names.validator.js +2 -2
- package/dist/cjs/cloud/build/validations/infrastructure-configs.validator.js +3 -3
- package/dist/cjs/cloud/build/validations/router-bundle-sizes.validator.js +4 -4
- package/dist/cjs/cloud/build/validations/step-bundle-sizes.validator.js +4 -4
- package/dist/cjs/cloud/build/validations/step-name-lengths.validator.js +2 -2
- package/dist/cjs/cloud/cli-output-manager.d.ts +9 -10
- package/dist/cjs/cloud/cli-output-manager.d.ts.map +1 -1
- package/dist/cjs/cloud/cli-output-manager.js +46 -75
- package/dist/cjs/cloud/new-deployment/listeners/build-printer.js +15 -15
- package/dist/cjs/cloud/new-deployment/listeners/cli-listener.js +3 -3
- package/dist/cjs/cloud/new-deployment/listeners/print-deployment-status.d.ts +3 -2
- package/dist/cjs/cloud/new-deployment/listeners/print-deployment-status.d.ts.map +1 -1
- package/dist/cjs/cloud/new-deployment/listeners/print-deployment-status.js +10 -10
- package/dist/cjs/cloud/new-deployment/listeners/printer.js +13 -13
- package/dist/cjs/create/index.d.ts.map +1 -1
- package/dist/cjs/create/index.js +16 -18
- package/dist/cjs/create/interactive.d.ts.map +1 -1
- package/dist/cjs/create/interactive.js +3 -5
- package/dist/cjs/create-step/getAnswers.js +2 -2
- package/dist/cjs/create-step/index.js +6 -6
- package/dist/cjs/generate-locked-data.js +8 -8
- package/dist/cjs/generate-types.d.ts.map +1 -1
- package/dist/cjs/generate-types.js +5 -1
- package/dist/cjs/utils/analytics.d.ts.map +1 -1
- package/dist/cjs/utils/analytics.js +4 -3
- package/dist/cjs/utils/internal-logger.js +8 -8
- package/dist/esm/cli.d.ts +1 -1
- package/dist/esm/cli.d.ts.map +1 -1
- package/dist/esm/cli.js +9 -87
- package/dist/esm/cloud/build/builders/node/index.js +2 -2
- package/dist/esm/cloud/build/validations/api-endpoints.validator.js +4 -4
- package/dist/esm/cloud/build/validations/cron-expressions.validator.js +2 -2
- package/dist/esm/cloud/build/validations/duplicate-step-names.validator.js +2 -2
- package/dist/esm/cloud/build/validations/infrastructure-configs.validator.js +3 -3
- package/dist/esm/cloud/build/validations/router-bundle-sizes.validator.js +4 -4
- package/dist/esm/cloud/build/validations/step-bundle-sizes.validator.js +4 -4
- package/dist/esm/cloud/build/validations/step-name-lengths.validator.js +2 -2
- package/dist/esm/cloud/cli-output-manager.d.ts +9 -10
- package/dist/esm/cloud/cli-output-manager.d.ts.map +1 -1
- package/dist/esm/cloud/cli-output-manager.js +46 -75
- package/dist/esm/cloud/new-deployment/listeners/build-printer.js +15 -15
- package/dist/esm/cloud/new-deployment/listeners/cli-listener.js +3 -3
- package/dist/esm/cloud/new-deployment/listeners/print-deployment-status.d.ts +3 -2
- package/dist/esm/cloud/new-deployment/listeners/print-deployment-status.d.ts.map +1 -1
- package/dist/esm/cloud/new-deployment/listeners/print-deployment-status.js +10 -10
- package/dist/esm/cloud/new-deployment/listeners/printer.js +13 -13
- package/dist/esm/create/index.d.ts.map +1 -1
- package/dist/esm/create/index.js +16 -18
- package/dist/esm/create/interactive.d.ts.map +1 -1
- package/dist/esm/create/interactive.js +3 -5
- package/dist/esm/create-step/getAnswers.js +2 -2
- package/dist/esm/create-step/index.js +6 -6
- package/dist/esm/generate-locked-data.js +8 -8
- package/dist/esm/generate-types.d.ts.map +1 -1
- package/dist/esm/generate-types.js +2 -1
- package/dist/esm/utils/analytics.d.ts.map +1 -1
- package/dist/esm/utils/analytics.js +2 -1
- package/dist/esm/utils/internal-logger.js +8 -8
- package/dist/types/cli.d.ts +1 -1
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/cloud/cli-output-manager.d.ts +9 -10
- package/dist/types/cloud/cli-output-manager.d.ts.map +1 -1
- package/dist/types/cloud/new-deployment/listeners/print-deployment-status.d.ts +3 -2
- package/dist/types/cloud/new-deployment/listeners/print-deployment-status.d.ts.map +1 -1
- package/dist/types/create/index.d.ts.map +1 -1
- package/dist/types/create/interactive.d.ts.map +1 -1
- package/dist/types/generate-types.d.ts.map +1 -1
- package/dist/types/utils/analytics.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/cjs/cli.d.ts
CHANGED
package/dist/cjs/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAIA,OAAO,SAAS,CAAA"}
|
package/dist/cjs/cli.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const core_1 = require("@motiadev/core");
|
|
4
5
|
const commander_1 = require("commander");
|
|
6
|
+
require("./cloud");
|
|
5
7
|
const config_utils_1 = require("./cloud/config-utils");
|
|
8
|
+
const load_motia_config_1 = require("./load-motia-config");
|
|
6
9
|
const analytics_1 = require("./utils/analytics");
|
|
7
10
|
const version_1 = require("./version");
|
|
8
11
|
const defaultPort = 3000;
|
|
9
12
|
const defaultHost = '0.0.0.0';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
};
|
|
13
|
+
require('dotenv/config');
|
|
14
|
+
require('ts-node').register({
|
|
15
|
+
transpileOnly: true,
|
|
16
|
+
compilerOptions: { module: 'commonjs' },
|
|
17
|
+
});
|
|
17
18
|
commander_1.program
|
|
18
19
|
.command('version')
|
|
19
20
|
.description('Display detailed version information')
|
|
@@ -26,7 +27,7 @@ commander_1.program
|
|
|
26
27
|
.description('Create a new motia project')
|
|
27
28
|
.option('-t, --template <template>', 'The template to use for your project')
|
|
28
29
|
.option('-p, --plugin', 'Create a plugin project')
|
|
29
|
-
.option('-i, --interactive', 'Use interactive prompts to create project')
|
|
30
|
+
.option('-i, --interactive', 'Use interactive prompts to create project') // it's default
|
|
30
31
|
.action((projectName, options) => {
|
|
31
32
|
const mergedArgs = { ...options, name: projectName };
|
|
32
33
|
return (0, config_utils_1.handler)(async (arg, context) => {
|
|
@@ -51,7 +52,6 @@ commander_1.program
|
|
|
51
52
|
.command('generate-types')
|
|
52
53
|
.description('Generate types.d.ts file for your project')
|
|
53
54
|
.action((0, analytics_1.wrapAction)(async () => {
|
|
54
|
-
registerTsNode();
|
|
55
55
|
const { generateTypes } = require('./generate-types');
|
|
56
56
|
await generateTypes(process.cwd());
|
|
57
57
|
process.exit(0);
|
|
@@ -74,7 +74,6 @@ commander_1.program
|
|
|
74
74
|
.option('-m, --mermaid', 'Enable mermaid diagram generation')
|
|
75
75
|
.option('--motia-dir <path>', 'Path where .motia folder will be created')
|
|
76
76
|
.action((0, analytics_1.wrapAction)(async (arg) => {
|
|
77
|
-
registerTsNode();
|
|
78
77
|
if (arg.debug) {
|
|
79
78
|
console.log('🔍 Debug logging enabled');
|
|
80
79
|
process.env.LOG_LEVEL = 'debug';
|
|
@@ -93,7 +92,6 @@ commander_1.program
|
|
|
93
92
|
.option('-d, --debug', 'Enable debug logging')
|
|
94
93
|
.option('--motia-dir <path>', 'Path where .motia folder will be created')
|
|
95
94
|
.action((0, analytics_1.wrapAction)(async (arg) => {
|
|
96
|
-
registerTsNode();
|
|
97
95
|
if (arg.debug) {
|
|
98
96
|
console.log('🔍 Debug logging enabled');
|
|
99
97
|
process.env.LOG_LEVEL = 'debug';
|
|
@@ -144,16 +142,13 @@ generate
|
|
|
144
142
|
.option('-v, --version <version>', 'Version for the OpenAPI document. Defaults to 1.0.0', '1.0.0')
|
|
145
143
|
.option('-o, --output <output>', 'Output file for the OpenAPI document. Defaults to openapi.json', 'openapi.json')
|
|
146
144
|
.action((0, analytics_1.wrapAction)(async (options) => {
|
|
147
|
-
registerTsNode();
|
|
148
|
-
const { MemoryStreamAdapterManager } = require('@motiadev/core');
|
|
149
|
-
const { loadMotiaConfig } = require('./load-motia-config');
|
|
150
145
|
const { generateLockedData } = require('./generate-locked-data');
|
|
151
146
|
const { generateOpenApi } = require('./openapi/generate');
|
|
152
147
|
const baseDir = process.cwd();
|
|
153
|
-
const appConfig = await loadMotiaConfig(baseDir);
|
|
148
|
+
const appConfig = await (0, load_motia_config_1.loadMotiaConfig)(baseDir);
|
|
154
149
|
const lockedData = await generateLockedData({
|
|
155
150
|
projectDir: baseDir,
|
|
156
|
-
streamAdapter: new MemoryStreamAdapterManager(),
|
|
151
|
+
streamAdapter: new core_1.MemoryStreamAdapterManager(),
|
|
157
152
|
streamAuth: appConfig.streamAuth,
|
|
158
153
|
});
|
|
159
154
|
const apiSteps = lockedData.apiSteps();
|
|
@@ -189,79 +184,6 @@ docker
|
|
|
189
184
|
await build(arg.projectName);
|
|
190
185
|
process.exit(0);
|
|
191
186
|
}));
|
|
192
|
-
const cloud = commander_1.program.command('cloud').description('Motia cloud commands');
|
|
193
|
-
cloud
|
|
194
|
-
.command('build')
|
|
195
|
-
.description('Build the project')
|
|
196
|
-
.action((0, config_utils_1.handler)(async (_, context) => {
|
|
197
|
-
const { buildValidation } = require('./cloud/build/build-validation');
|
|
198
|
-
const { build } = require('./cloud/new-deployment/build');
|
|
199
|
-
const { CliListener } = require('./cloud/new-deployment/listeners/cli-listener');
|
|
200
|
-
const listener = new CliListener(context);
|
|
201
|
-
const builder = await build(listener);
|
|
202
|
-
const isValid = buildValidation(builder, listener);
|
|
203
|
-
if (!isValid) {
|
|
204
|
-
process.exit(1);
|
|
205
|
-
}
|
|
206
|
-
context.log('build-completed', (message) => message.tag('success').append('Build completed'));
|
|
207
|
-
}));
|
|
208
|
-
cloud
|
|
209
|
-
.command('deploy')
|
|
210
|
-
.description('Deploy a new version to Motia Cloud')
|
|
211
|
-
.requiredOption('-k, --api-key <key>', 'The API key for authentication', process.env.MOTIA_API_KEY)
|
|
212
|
-
.requiredOption('-v, --version-name <version>', 'The version to deploy')
|
|
213
|
-
.option('-p, --project-id <id>', 'Project ID (Deprecated)')
|
|
214
|
-
.option('-n, --project-name <name>', 'Project name (used when creating a new project)')
|
|
215
|
-
.option('-s, --environment-id <id>', 'Environment ID', process.env.MOTIA_ENVIRONMENT_ID)
|
|
216
|
-
.option('--environment-name <name>', 'Environment name')
|
|
217
|
-
.option('-e, --env-file <path>', 'Path to environment file')
|
|
218
|
-
.option('-d, --version-description <description>', 'The description of the version')
|
|
219
|
-
.option('-c, --ci', 'CI mode', process.env.CI)
|
|
220
|
-
.action((0, config_utils_1.handler)(async (arg, context) => {
|
|
221
|
-
const { buildValidation } = require('./cloud/build/build-validation');
|
|
222
|
-
const { build } = require('./cloud/new-deployment/build');
|
|
223
|
-
const { cloudApi } = require('./cloud/new-deployment/cloud-api');
|
|
224
|
-
const { deploy } = require('./cloud/new-deployment/deploy');
|
|
225
|
-
const { CliListener } = require('./cloud/new-deployment/listeners/cli-listener');
|
|
226
|
-
const { uploadArtifacts } = require('./cloud/new-deployment/upload-artifacts');
|
|
227
|
-
const { loadEnvData } = require('./cloud/new-deployment/utils/load-env-data');
|
|
228
|
-
const listener = new CliListener(context);
|
|
229
|
-
const builder = await build(listener);
|
|
230
|
-
const isValid = buildValidation(builder, listener);
|
|
231
|
-
if (!isValid) {
|
|
232
|
-
process.exit(1);
|
|
233
|
-
}
|
|
234
|
-
context.log('build-completed', (message) => message.tag('success').append('Build completed'));
|
|
235
|
-
context.log('creating-deployment', (message) => message.tag('progress').append('Creating deployment...'));
|
|
236
|
-
const deployment = await cloudApi
|
|
237
|
-
.createDeployment({
|
|
238
|
-
apiKey: arg.apiKey,
|
|
239
|
-
projectName: arg.projectName,
|
|
240
|
-
environmentId: arg.environmentId,
|
|
241
|
-
environmentName: arg.environmentName,
|
|
242
|
-
versionName: arg.versionName,
|
|
243
|
-
versionDescription: arg.versionDescription,
|
|
244
|
-
})
|
|
245
|
-
.catch((error) => {
|
|
246
|
-
context.log('creating-deployment', (message) => message.tag('failed').append('Failed to create deployment'));
|
|
247
|
-
throw error;
|
|
248
|
-
});
|
|
249
|
-
context.log('creating-deployment', (message) => message.tag('success').append('Deployment created'));
|
|
250
|
-
context.log('uploading-artifacts', (message) => message.tag('progress').append('Uploading artifacts...'));
|
|
251
|
-
await uploadArtifacts(builder, deployment.deploymentToken, listener);
|
|
252
|
-
context.log('uploading-artifacts', (message) => message.tag('success').append('Artifacts uploaded'));
|
|
253
|
-
context.log('starting-deployment', (message) => message.tag('progress').append('Starting deployment...'));
|
|
254
|
-
await deploy({
|
|
255
|
-
envVars: loadEnvData(arg.envFile, context),
|
|
256
|
-
deploymentId: deployment.deploymentId,
|
|
257
|
-
deploymentToken: deployment.deploymentToken,
|
|
258
|
-
builder,
|
|
259
|
-
listener,
|
|
260
|
-
context,
|
|
261
|
-
ci: arg.ci,
|
|
262
|
-
});
|
|
263
|
-
context.exit(0);
|
|
264
|
-
}));
|
|
265
187
|
commander_1.program.version(version_1.version, '-V, --version', 'Output the current version');
|
|
266
188
|
commander_1.program.parseAsync(process.argv).catch(() => {
|
|
267
189
|
process.exit(1);
|
|
@@ -37,10 +37,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.NodeBuilder = void 0;
|
|
40
|
-
const colors_1 = __importDefault(require("colors"));
|
|
41
40
|
const esbuild = __importStar(require("esbuild"));
|
|
42
41
|
const fs_1 = __importDefault(require("fs"));
|
|
43
42
|
const path_1 = __importDefault(require("path"));
|
|
43
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
44
44
|
const constants_1 = require("../../../new-deployment/constants");
|
|
45
45
|
const archiver_1 = require("../archiver");
|
|
46
46
|
const include_static_files_1 = require("../include-static-files");
|
|
@@ -59,7 +59,7 @@ class NodeBuilder {
|
|
|
59
59
|
return JSON.parse(configContent);
|
|
60
60
|
}
|
|
61
61
|
catch (err) {
|
|
62
|
-
console.warn(
|
|
62
|
+
console.warn(picocolors_1.default.yellow(`Warning: Failed to load esbuild config from ${configFile}`));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.apiEndpointsValidator = void 0;
|
|
7
|
-
const colors_1 = __importDefault(require("colors"));
|
|
8
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
9
9
|
const apiEndpointsValidator = (builder) => {
|
|
10
10
|
const errors = [];
|
|
11
11
|
const endpoints = new Map();
|
|
@@ -19,9 +19,9 @@ const apiEndpointsValidator = (builder) => {
|
|
|
19
19
|
relativePath,
|
|
20
20
|
message: [
|
|
21
21
|
`Endpoint conflict`,
|
|
22
|
-
` ${
|
|
23
|
-
` ${
|
|
24
|
-
` ${
|
|
22
|
+
` ${picocolors_1.default.red('➜')} ${picocolors_1.default.magenta(endpoint)} is defined in the following files`,
|
|
23
|
+
` ${picocolors_1.default.red('➜')} ${picocolors_1.default.blue(entrypoint)}`,
|
|
24
|
+
` ${picocolors_1.default.red('➜')} ${picocolors_1.default.blue(endpoints.get(endpoint))}`,
|
|
25
25
|
].join('\n'),
|
|
26
26
|
step,
|
|
27
27
|
});
|
|
@@ -37,9 +37,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.cronExpressionsValidator = void 0;
|
|
40
|
-
const colors_1 = __importDefault(require("colors"));
|
|
41
40
|
const cron = __importStar(require("node-cron"));
|
|
42
41
|
const path_1 = __importDefault(require("path"));
|
|
42
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
43
43
|
const cronExpressionsValidator = (builder) => {
|
|
44
44
|
const errors = [];
|
|
45
45
|
for (const step of Object.values(builder.stepsConfig)) {
|
|
@@ -50,7 +50,7 @@ const cronExpressionsValidator = (builder) => {
|
|
|
50
50
|
relativePath,
|
|
51
51
|
message: [
|
|
52
52
|
'Cron step has an invalid cron expression.',
|
|
53
|
-
` ${
|
|
53
|
+
` ${picocolors_1.default.red('➜')} ${picocolors_1.default.magenta(step.config.cron)}`,
|
|
54
54
|
].join('\n'),
|
|
55
55
|
step,
|
|
56
56
|
});
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.duplicateStepNamesValidator = void 0;
|
|
7
|
-
const colors_1 = __importDefault(require("colors"));
|
|
8
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
9
9
|
const duplicateStepNamesValidator = (builder) => {
|
|
10
10
|
const errors = [];
|
|
11
11
|
const stepNames = new Set();
|
|
@@ -13,7 +13,7 @@ const duplicateStepNamesValidator = (builder) => {
|
|
|
13
13
|
if (stepNames.has(step.config.name)) {
|
|
14
14
|
errors.push({
|
|
15
15
|
relativePath: path_1.default.relative(builder.projectDir, step.filePath),
|
|
16
|
-
message: [`Duplicate step names: ${
|
|
16
|
+
message: [`Duplicate step names: ${picocolors_1.default.red(step.config.name)}`].join('\n'),
|
|
17
17
|
step,
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.infrastructureConfigsValidator = void 0;
|
|
7
7
|
const core_1 = require("@motiadev/core");
|
|
8
|
-
const colors_1 = __importDefault(require("colors"));
|
|
9
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
10
10
|
const infrastructureConfigsValidator = (builder) => {
|
|
11
11
|
const errors = [];
|
|
12
12
|
const eventSteps = Object.values(builder.stepsConfig).filter((step) => step.config.type === 'event' && step.config.infrastructure);
|
|
@@ -19,8 +19,8 @@ const infrastructureConfigsValidator = (builder) => {
|
|
|
19
19
|
errors.push({
|
|
20
20
|
relativePath,
|
|
21
21
|
message: [
|
|
22
|
-
`Infrastructure configuration error in step ${
|
|
23
|
-
` ${
|
|
22
|
+
`Infrastructure configuration error in step ${picocolors_1.default.magenta(step.config.name)}:`,
|
|
23
|
+
` ${picocolors_1.default.red('➜')} ${error.path}: ${picocolors_1.default.red(error.message)}`,
|
|
24
24
|
].join('\n'),
|
|
25
25
|
step,
|
|
26
26
|
});
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.routerBundleSizesValidator = void 0;
|
|
7
|
-
const
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
9
|
const routerBundleSizesValidator = (builder) => {
|
|
10
10
|
const errors = [];
|
|
@@ -18,9 +18,9 @@ const routerBundleSizesValidator = (builder) => {
|
|
|
18
18
|
relativePath: `${routerType} API router`,
|
|
19
19
|
message: [
|
|
20
20
|
`${routerType.charAt(0).toUpperCase() + routerType.slice(1)} API router bundle size exceeds ${constants_1.BUNDLE_SIZE_LIMITS.ROUTER_MAX_MB}MB limit (uncompressed).`,
|
|
21
|
-
` ${
|
|
22
|
-
` ${
|
|
23
|
-
` ${
|
|
21
|
+
` ${picocolors_1.default.red('➜')} Uncompressed size: ${picocolors_1.default.magenta(uncompressedSizeMB + 'MB')}`,
|
|
22
|
+
` ${picocolors_1.default.red('➜')} Compressed size: ${picocolors_1.default.cyan(compressedSizeMB + 'MB')}`,
|
|
23
|
+
` ${picocolors_1.default.red('➜')} Maximum allowed: ${picocolors_1.default.blue(constants_1.BUNDLE_SIZE_LIMITS.ROUTER_MAX_MB + 'MB')}`,
|
|
24
24
|
].join('\n'),
|
|
25
25
|
step: Object.values(builder.stepsConfig)[0],
|
|
26
26
|
});
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.stepBundleSizesValidator = void 0;
|
|
7
|
-
const colors_1 = __importDefault(require("colors"));
|
|
8
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
9
9
|
const constants_1 = require("./constants");
|
|
10
10
|
const stepBundleSizesValidator = (builder) => {
|
|
11
11
|
const errors = [];
|
|
@@ -22,9 +22,9 @@ const stepBundleSizesValidator = (builder) => {
|
|
|
22
22
|
relativePath,
|
|
23
23
|
message: [
|
|
24
24
|
`Step bundle size exceeds ${constants_1.BUNDLE_SIZE_LIMITS.STEP_MAX_MB}MB limit (uncompressed).`,
|
|
25
|
-
` ${
|
|
26
|
-
` ${
|
|
27
|
-
` ${
|
|
25
|
+
` ${picocolors_1.default.red('➜')} Uncompressed size: ${picocolors_1.default.magenta(sizeMB + 'MB')}`,
|
|
26
|
+
` ${picocolors_1.default.red('➜')} Compressed size: ${picocolors_1.default.cyan(compressedSizeMB + 'MB')}`,
|
|
27
|
+
` ${picocolors_1.default.red('➜')} Maximum allowed: ${picocolors_1.default.blue(constants_1.BUNDLE_SIZE_LIMITS.STEP_MAX_MB + 'MB')}`,
|
|
28
28
|
].join('\n'),
|
|
29
29
|
step,
|
|
30
30
|
});
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.stepNameLengthsValidator = void 0;
|
|
7
|
-
const colors_1 = __importDefault(require("colors"));
|
|
8
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
9
9
|
const constants_1 = require("./constants");
|
|
10
10
|
const stepNameLengthsValidator = (builder) => {
|
|
11
11
|
const errors = [];
|
|
@@ -16,7 +16,7 @@ const stepNameLengthsValidator = (builder) => {
|
|
|
16
16
|
relativePath,
|
|
17
17
|
message: [
|
|
18
18
|
`Step name is too long. Maximum is ${constants_1.BUNDLE_SIZE_LIMITS.STEP_NAME_MAX_LENGTH} characters.`,
|
|
19
|
-
` ${
|
|
19
|
+
` ${picocolors_1.default.red('➜')} ${picocolors_1.default.magenta(step.config.name)}`,
|
|
20
20
|
].join('\n'),
|
|
21
21
|
step,
|
|
22
22
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import colors from 'colors';
|
|
2
1
|
declare const tags: {
|
|
3
2
|
readonly success: string;
|
|
4
3
|
readonly failed: string;
|
|
@@ -7,15 +6,15 @@ declare const tags: {
|
|
|
7
6
|
readonly info: string;
|
|
8
7
|
};
|
|
9
8
|
declare const colorTags: {
|
|
10
|
-
readonly gray:
|
|
11
|
-
readonly dark:
|
|
12
|
-
readonly red:
|
|
13
|
-
readonly green:
|
|
14
|
-
readonly yellow:
|
|
15
|
-
readonly blue:
|
|
16
|
-
readonly magenta:
|
|
17
|
-
readonly cyan:
|
|
18
|
-
readonly white:
|
|
9
|
+
readonly gray: import("picocolors/types").Formatter;
|
|
10
|
+
readonly dark: import("picocolors/types").Formatter;
|
|
11
|
+
readonly red: import("picocolors/types").Formatter;
|
|
12
|
+
readonly green: import("picocolors/types").Formatter;
|
|
13
|
+
readonly yellow: import("picocolors/types").Formatter;
|
|
14
|
+
readonly blue: import("picocolors/types").Formatter;
|
|
15
|
+
readonly magenta: import("picocolors/types").Formatter;
|
|
16
|
+
readonly cyan: import("picocolors/types").Formatter;
|
|
17
|
+
readonly white: import("picocolors/types").Formatter;
|
|
19
18
|
};
|
|
20
19
|
export declare class Message {
|
|
21
20
|
private output;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-output-manager.d.ts","sourceRoot":"","sources":["../../../src/cloud/cli-output-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-output-manager.d.ts","sourceRoot":"","sources":["../../../src/cloud/cli-output-manager.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,IAAI;;;;;;CAMA,CAAA;AAEV,QAAA,MAAM,SAAS;;;;;;;;;;CAUL,CAAA;AAEV,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAU;;IAMxB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI7B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAK9B,GAAG,CAAC,GAAG,EAAE,MAAM,OAAO,IAAI,GAAG,OAAO;IAKpC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,OAAO,SAAS,GAAG,OAAO;IAShE,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,GAAE,MAAM,OAAO,SAAkB,GAAG,OAAO;IAgBxE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO;IAiC/D,QAAQ,IAAI,MAAM;CAGnB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,SAAS,CAAI;IAErB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI;IAsBpD,aAAa,IAAI,OAAO;CAGzB"}
|
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CLIOutputManager = exports.Message = void 0;
|
|
7
|
-
const
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
8
|
const readline_1 = __importDefault(require("readline"));
|
|
9
9
|
const table_1 = require("table");
|
|
10
|
-
const progress =
|
|
11
|
-
const success =
|
|
12
|
-
const failed =
|
|
13
|
-
const warning =
|
|
14
|
-
const info =
|
|
10
|
+
const progress = picocolors_1.default.yellow('➜ [PROGRESS]');
|
|
11
|
+
const success = picocolors_1.default.green('✓ [SUCCESS]');
|
|
12
|
+
const failed = picocolors_1.default.red('✘ [ERROR]');
|
|
13
|
+
const warning = picocolors_1.default.yellow('! [WARNING]');
|
|
14
|
+
const info = picocolors_1.default.blue('i [INFO]');
|
|
15
15
|
const tags = {
|
|
16
16
|
success,
|
|
17
17
|
failed,
|
|
@@ -20,22 +20,22 @@ const tags = {
|
|
|
20
20
|
info,
|
|
21
21
|
};
|
|
22
22
|
const colorTags = {
|
|
23
|
-
gray:
|
|
24
|
-
dark:
|
|
25
|
-
red:
|
|
26
|
-
green:
|
|
27
|
-
yellow:
|
|
28
|
-
blue:
|
|
29
|
-
magenta:
|
|
30
|
-
cyan:
|
|
31
|
-
white:
|
|
23
|
+
gray: picocolors_1.default.gray,
|
|
24
|
+
dark: picocolors_1.default.magenta,
|
|
25
|
+
red: picocolors_1.default.red,
|
|
26
|
+
green: picocolors_1.default.green,
|
|
27
|
+
yellow: picocolors_1.default.yellow,
|
|
28
|
+
blue: picocolors_1.default.blue,
|
|
29
|
+
magenta: picocolors_1.default.magenta,
|
|
30
|
+
cyan: picocolors_1.default.cyan,
|
|
31
|
+
white: picocolors_1.default.white,
|
|
32
32
|
};
|
|
33
33
|
class Message {
|
|
34
34
|
constructor() {
|
|
35
35
|
this.output = [];
|
|
36
36
|
}
|
|
37
37
|
dark(message) {
|
|
38
|
-
return
|
|
38
|
+
return picocolors_1.default.magenta(message);
|
|
39
39
|
}
|
|
40
40
|
text(message) {
|
|
41
41
|
this.output.push(message);
|
|
@@ -55,73 +55,44 @@ class Message {
|
|
|
55
55
|
return this;
|
|
56
56
|
}
|
|
57
57
|
box(messages, color = 'blue') {
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const border = '─'.repeat(
|
|
58
|
+
const message = messages.join('\n \n');
|
|
59
|
+
const lines = message.match(/.{1,40}/g) || [message];
|
|
60
|
+
const width = Math.min(40, Math.max(...lines.map((line) => line.length)));
|
|
61
|
+
const border = '─'.repeat(width + 2);
|
|
62
62
|
const borderColor = colorTags[color];
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
return;
|
|
68
|
-
const visibleLength = stripAnsi(trimmed).length;
|
|
69
|
-
if (visibleLength <= contentWidth) {
|
|
70
|
-
processedLines.push(trimmed);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
const words = trimmed.split(/\s+/);
|
|
74
|
-
let currentLine = '';
|
|
75
|
-
words.forEach((word) => {
|
|
76
|
-
const wordLength = stripAnsi(word).length;
|
|
77
|
-
const currentLength = stripAnsi(currentLine).length;
|
|
78
|
-
if (currentLength + wordLength + 1 <= contentWidth) {
|
|
79
|
-
currentLine = currentLine ? `${currentLine} ${word}` : word;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
if (currentLine)
|
|
83
|
-
processedLines.push(currentLine);
|
|
84
|
-
currentLine = word;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
if (currentLine)
|
|
88
|
-
processedLines.push(currentLine);
|
|
89
|
-
}
|
|
63
|
+
this.output.push(borderColor('\n ┌' + border + '┐\n'));
|
|
64
|
+
lines.forEach((line) => {
|
|
65
|
+
const padding = ' '.repeat(width - line.trim().length);
|
|
66
|
+
this.output.push(borderColor('│ ') + line.trim() + padding + borderColor(' │\n'));
|
|
90
67
|
});
|
|
91
|
-
this.output.push(borderColor(
|
|
92
|
-
processedLines.forEach((line) => {
|
|
93
|
-
const lineLength = stripAnsi(line).length;
|
|
94
|
-
const padding = ' '.repeat(contentWidth - lineLength);
|
|
95
|
-
this.output.push(`${borderColor(' │')} ${line}${padding} ${borderColor('│\n')}`);
|
|
96
|
-
});
|
|
97
|
-
this.output.push(borderColor(` └${border}┘`));
|
|
68
|
+
this.output.push(borderColor('└' + border + '┘'));
|
|
98
69
|
return this;
|
|
99
70
|
}
|
|
100
71
|
table(headers, rows) {
|
|
101
|
-
const colouredHeaders = headers?.map((header) =>
|
|
72
|
+
const colouredHeaders = headers?.map((header) => picocolors_1.default.blue(picocolors_1.default.bold(header)));
|
|
102
73
|
const records = [colouredHeaders, ...rows].filter((record) => record !== undefined);
|
|
103
74
|
this.output.push((0, table_1.table)(records, {
|
|
104
75
|
border: {
|
|
105
|
-
topBody:
|
|
106
|
-
topJoin:
|
|
107
|
-
topLeft:
|
|
108
|
-
topRight:
|
|
109
|
-
bodyLeft:
|
|
110
|
-
bodyRight:
|
|
111
|
-
bottomBody:
|
|
112
|
-
bottomJoin:
|
|
113
|
-
bottomLeft:
|
|
114
|
-
bottomRight:
|
|
115
|
-
joinLeft:
|
|
116
|
-
joinRight:
|
|
117
|
-
joinMiddleDown:
|
|
118
|
-
joinMiddleUp:
|
|
119
|
-
joinMiddleLeft:
|
|
120
|
-
joinMiddleRight:
|
|
121
|
-
bodyJoin:
|
|
122
|
-
joinBody:
|
|
123
|
-
headerJoin:
|
|
124
|
-
joinJoin:
|
|
76
|
+
topBody: picocolors_1.default.blue('─'),
|
|
77
|
+
topJoin: picocolors_1.default.blue('┬'),
|
|
78
|
+
topLeft: picocolors_1.default.blue('┌'),
|
|
79
|
+
topRight: picocolors_1.default.blue('┐'),
|
|
80
|
+
bodyLeft: picocolors_1.default.blue('│'),
|
|
81
|
+
bodyRight: picocolors_1.default.blue('│'),
|
|
82
|
+
bottomBody: picocolors_1.default.blue('─'),
|
|
83
|
+
bottomJoin: picocolors_1.default.blue('┴'),
|
|
84
|
+
bottomLeft: picocolors_1.default.blue('└'),
|
|
85
|
+
bottomRight: picocolors_1.default.blue('┘'),
|
|
86
|
+
joinLeft: picocolors_1.default.blue('├'),
|
|
87
|
+
joinRight: picocolors_1.default.blue('┤'),
|
|
88
|
+
joinMiddleDown: picocolors_1.default.blue('│'),
|
|
89
|
+
joinMiddleUp: picocolors_1.default.blue(''),
|
|
90
|
+
joinMiddleLeft: picocolors_1.default.blue('│'),
|
|
91
|
+
joinMiddleRight: picocolors_1.default.blue('│'),
|
|
92
|
+
bodyJoin: picocolors_1.default.blue('│'),
|
|
93
|
+
joinBody: picocolors_1.default.blue('─'),
|
|
94
|
+
headerJoin: picocolors_1.default.blue('│'),
|
|
95
|
+
joinJoin: picocolors_1.default.blue('┼'),
|
|
125
96
|
},
|
|
126
97
|
}));
|
|
127
98
|
return this;
|
|
@@ -5,14 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BuildPrinter = void 0;
|
|
7
7
|
const printer_1 = require("@motiadev/core/dist/src/printer");
|
|
8
|
-
const
|
|
8
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
9
9
|
const cli_output_manager_1 = require("../../cli-output-manager");
|
|
10
10
|
const pretty_bytes_1 = require("../utils/pretty-bytes");
|
|
11
|
-
const building =
|
|
12
|
-
const built =
|
|
13
|
-
const failed =
|
|
14
|
-
const skipped =
|
|
15
|
-
const baseTag = (tag) =>
|
|
11
|
+
const building = picocolors_1.default.yellow('➜ [BUILDING]');
|
|
12
|
+
const built = picocolors_1.default.green('✓ [BUILT]');
|
|
13
|
+
const failed = picocolors_1.default.red('✘ [FAILED]');
|
|
14
|
+
const skipped = picocolors_1.default.gray('- [SKIPPED]');
|
|
15
|
+
const baseTag = (tag) => picocolors_1.default.bold(picocolors_1.default.magenta(tag));
|
|
16
16
|
const streamTag = baseTag('Stream');
|
|
17
17
|
const stepTag = baseTag('Step');
|
|
18
18
|
const routerTag = baseTag('Router');
|
|
@@ -23,15 +23,15 @@ class BuildPrinter {
|
|
|
23
23
|
}
|
|
24
24
|
getLanguage(language) {
|
|
25
25
|
if (language === 'python') {
|
|
26
|
-
return
|
|
26
|
+
return picocolors_1.default.bold(picocolors_1.default.blue('Python'));
|
|
27
27
|
}
|
|
28
28
|
else if (language === 'node') {
|
|
29
|
-
return
|
|
29
|
+
return picocolors_1.default.bold(picocolors_1.default.green('Node'));
|
|
30
30
|
}
|
|
31
31
|
else if (language === 'ruby') {
|
|
32
|
-
return
|
|
32
|
+
return picocolors_1.default.bold(picocolors_1.default.red('Ruby'));
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return picocolors_1.default.bold(picocolors_1.default.gray('Unknown'));
|
|
35
35
|
}
|
|
36
36
|
getStepLanguage(step) {
|
|
37
37
|
if (step.filePath.endsWith('.py')) {
|
|
@@ -52,7 +52,7 @@ class BuildPrinter {
|
|
|
52
52
|
this.output.log(step.filePath, (message) => {
|
|
53
53
|
message.append(`${building} ${stepTag} ${stepLanguage} ${stepType} ${stepPath}`);
|
|
54
54
|
if (progressMessage) {
|
|
55
|
-
message.append(
|
|
55
|
+
message.append(picocolors_1.default.yellow(progressMessage));
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
}
|
|
@@ -66,7 +66,7 @@ class BuildPrinter {
|
|
|
66
66
|
}
|
|
67
67
|
printApiRouterBuilding(language) {
|
|
68
68
|
const fileName = `router-${language}.zip`;
|
|
69
|
-
const coloredFileName =
|
|
69
|
+
const coloredFileName = picocolors_1.default.bold(picocolors_1.default.cyan(fileName));
|
|
70
70
|
this.output.log(fileName, (message) => message //
|
|
71
71
|
.append(routerTag)
|
|
72
72
|
.append(building)
|
|
@@ -75,7 +75,7 @@ class BuildPrinter {
|
|
|
75
75
|
}
|
|
76
76
|
printApiRouterBuilt(language, size) {
|
|
77
77
|
const fileName = `router-${language}.zip`;
|
|
78
|
-
const coloredFileName =
|
|
78
|
+
const coloredFileName = picocolors_1.default.bold(picocolors_1.default.cyan(fileName));
|
|
79
79
|
this.output.log(fileName, (message) => message
|
|
80
80
|
.append(built)
|
|
81
81
|
.append(routerTag)
|
|
@@ -97,11 +97,11 @@ class BuildPrinter {
|
|
|
97
97
|
}
|
|
98
98
|
printStreamCreated(stream) {
|
|
99
99
|
const streamPath = this.getStreamPath(stream);
|
|
100
|
-
const streamName =
|
|
100
|
+
const streamName = picocolors_1.default.gray(`[${stream.config.name}]`);
|
|
101
101
|
this.output.log(stream.filePath, (message) => message.append(`${built} ${streamTag} ${streamName} ${streamPath}`));
|
|
102
102
|
}
|
|
103
103
|
getStreamPath(stream) {
|
|
104
|
-
return
|
|
104
|
+
return picocolors_1.default.bold(picocolors_1.default.cyan(this.printer.getRelativePath(stream.filePath)));
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
exports.BuildPrinter = BuildPrinter;
|