@mainset/cli 0.3.2 → 0.4.0-rc.1
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/esm/commands/index.mjs +1 -1
- package/dist/esm/commands/{node-package.mjs → node-sourcer.mjs} +10 -10
- package/dist/esm/commands/web-app.mjs +1 -1
- package/dist/esm/dotenv-config.mjs +1 -1
- package/dist/esm/mainset-cli.mjs +2 -2
- package/dist/types/commands/index.d.mts +1 -1
- package/dist/types/commands/node-sourcer.d.mts +3 -0
- package/package.json +1 -1
- package/dist/types/commands/node-package.d.mts +0 -3
|
@@ -3,10 +3,10 @@ import path from 'path';
|
|
|
3
3
|
import { runtimePathById } from '../runtime/index.mjs';
|
|
4
4
|
import { consoleColorize, initProcessCatchErrorLogger, } from '../utils/index.mjs';
|
|
5
5
|
import { execImmediatePurgeDist, execImmediateRslibCLICommand, execImmediateTypeScriptCompileTypeOnly, runStreamingRslibCLICommand, runStreamingTypeScriptCompileTypeOnly, } from './process-runner-chunks/index.mjs';
|
|
6
|
-
function
|
|
6
|
+
function registerNodeSourcerCommand(program) {
|
|
7
7
|
program
|
|
8
|
-
.command('node-
|
|
9
|
-
.description('Run node
|
|
8
|
+
.command('node-sourcer')
|
|
9
|
+
.description('Run node-sourcer build or watch using Rslib')
|
|
10
10
|
.requiredOption('-e, --exec <type>', 'Execution mode: build or watch')
|
|
11
11
|
// .option('-b, --builder <builder>', 'Builder tool (default: rslib)', 'rslib')
|
|
12
12
|
.option('-c, --config <path>', 'Path to config file', './rslib.config.mts')
|
|
@@ -17,10 +17,10 @@ function registerNodePackageCommand(program) {
|
|
|
17
17
|
? customRslibConfigPath
|
|
18
18
|
: path.resolve(runtimePathById.root,
|
|
19
19
|
// NOTE: possibility to check if package is installed, otherwise throw error
|
|
20
|
-
'node_modules', '@mainset/builder-rslib/dist/esm/rslib.node-
|
|
20
|
+
'node_modules', '@mainset/builder-rslib/dist/esm/rslib.node-sourcer.config.mjs');
|
|
21
21
|
if (options.exec === 'build') {
|
|
22
22
|
// ========== Build mode ==========
|
|
23
|
-
console.log('\n🏗️ [mainset cli] node-
|
|
23
|
+
console.log('\n🏗️ [mainset cli] node-sourcer: build');
|
|
24
24
|
try {
|
|
25
25
|
// Step 1: purge dist folder
|
|
26
26
|
execImmediatePurgeDist();
|
|
@@ -32,12 +32,12 @@ function registerNodePackageCommand(program) {
|
|
|
32
32
|
console.log('\n✅ Build completed successfully\n');
|
|
33
33
|
}
|
|
34
34
|
catch (error) {
|
|
35
|
-
initProcessCatchErrorLogger('node-
|
|
35
|
+
initProcessCatchErrorLogger('node-sourcer', error, 'build');
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
else if (options.exec === 'watch') {
|
|
39
39
|
// ========== Watch mode ==========
|
|
40
|
-
console.log('\n🏗️ [mainset cli] node-
|
|
40
|
+
console.log('\n🏗️ [mainset cli] node-sourcer: watch');
|
|
41
41
|
try {
|
|
42
42
|
// Step 1: purge dist folder
|
|
43
43
|
execImmediatePurgeDist();
|
|
@@ -52,13 +52,13 @@ function registerNodePackageCommand(program) {
|
|
|
52
52
|
runStreamingTypeScriptCompileTypeOnly();
|
|
53
53
|
}
|
|
54
54
|
catch (error) {
|
|
55
|
-
initProcessCatchErrorLogger('node-
|
|
55
|
+
initProcessCatchErrorLogger('node-sourcer', error, 'watch');
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
|
-
console.error(consoleColorize('BRIGHT_YELLOW', `[mainset cli][node-
|
|
59
|
+
console.error(consoleColorize('BRIGHT_YELLOW', `[mainset cli][node-sourcer] Unknown exec mode: "${options.exec}"`));
|
|
60
60
|
process.exit(1);
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
export {
|
|
64
|
+
export { registerNodeSourcerCommand };
|
|
@@ -18,7 +18,7 @@ function registerWebAppCommand(program) {
|
|
|
18
18
|
.option('--serveMode <mode>', 'Serve mode: ssr or csr (default: ssr)', 'ssr')
|
|
19
19
|
.action((options) => {
|
|
20
20
|
// !IMPORTANT: Load environment variables from .env file ONLY when we are compiling Web Applications
|
|
21
|
-
// as it logs {missing .env file} console error during {
|
|
21
|
+
// as it logs {missing .env file} console error during {source-code} / {node-sourcer} compilation
|
|
22
22
|
initDotenv();
|
|
23
23
|
// Step 0: determinate command params
|
|
24
24
|
const customWebpackConfigPath = path.resolve(runtimePathById.root, options.config || './config/webpack.config.mjs');
|
|
@@ -3,7 +3,7 @@ function initDotenv() {
|
|
|
3
3
|
// Load environment-specific .env file
|
|
4
4
|
return dotenv.config();
|
|
5
5
|
}
|
|
6
|
-
// REVIEW: investigate if {.env} file need's to be loaded during {
|
|
6
|
+
// REVIEW: investigate if {.env} file need's to be loaded during {source-code} / {node-sourcer} compilation
|
|
7
7
|
// Auto-execute configuration
|
|
8
8
|
// initDotenv();
|
|
9
9
|
export { initDotenv };
|
package/dist/esm/mainset-cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
-
import {
|
|
3
|
+
import { registerNodeSourcerCommand, registerSourceCodeCommand, registerWebAppCommand, } from './commands/index.mjs';
|
|
4
4
|
import { verifyOrSetNodeEnv } from './utils/index.mjs';
|
|
5
5
|
// !IMPORTANT: Set NODE_ENV is case it is not passed
|
|
6
6
|
verifyOrSetNodeEnv();
|
|
@@ -10,6 +10,6 @@ program
|
|
|
10
10
|
.description('CLI to manage frontend tooling and infrastructure')
|
|
11
11
|
.version('0.1.0');
|
|
12
12
|
registerSourceCodeCommand(program);
|
|
13
|
-
|
|
13
|
+
registerNodeSourcerCommand(program);
|
|
14
14
|
registerWebAppCommand(program);
|
|
15
15
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mainset/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-rc.1",
|
|
4
4
|
"description": "A unified CLI tool for accelerating development, based on mainset vision of front-end infrastructure",
|
|
5
5
|
"homepage": "https://github.com/mainset/dev-stack-fe/tree/main/packages/cli",
|
|
6
6
|
"bugs": {
|