@mainset/cli 0.5.0-rc.1 → 0.5.0-rc.2
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/init/init.mjs +9 -4
- package/dist/esm/commands/node-sourcer.mjs +21 -3
- package/dist/esm/commands/process-runner-chunks/rslib.chunk.mjs +4 -4
- package/dist/types/commands/process-runner-chunks/rslib.chunk.d.mts +3 -2
- package/package.json +1 -1
- package/src/commands/init/templates/application/package.json +3 -3
|
@@ -43,13 +43,18 @@ async function handleConfigurationDependencies(targetDir) {
|
|
|
43
43
|
// assume 'other' is the binary name user typed if not in basic list
|
|
44
44
|
installCommand = `${packageManager} i -D ${packages}`;
|
|
45
45
|
}
|
|
46
|
-
console.log(consoleColorize('BLUE', `\nInstalling dependencies with
|
|
46
|
+
console.log(consoleColorize('BLUE', `\n\nInstalling dependencies with:\n${installCommand}\n`));
|
|
47
47
|
try {
|
|
48
|
-
execSync(installCommand, {
|
|
49
|
-
|
|
48
|
+
execSync(installCommand, {
|
|
49
|
+
cwd: targetDir,
|
|
50
|
+
stdio: 'inherit',
|
|
51
|
+
env: Object.assign(Object.assign({}, process.env), { NODE_ENV: 'development' }),
|
|
52
|
+
});
|
|
53
|
+
console.log(consoleColorize('BRIGHT_GREEN', 'Dependencies installed successfully.'));
|
|
50
54
|
}
|
|
51
55
|
catch (error) {
|
|
52
|
-
console.error(consoleColorize('BRIGHT_RED', `\n❌ Failed to install dependencies
|
|
56
|
+
console.error(consoleColorize('BRIGHT_RED', `\n❌ Failed to install dependencies automatically.`));
|
|
57
|
+
console.log(consoleColorize('BRIGHT_YELLOW', `Please run the following command manually:\n\n ${installCommand}\n`));
|
|
53
58
|
}
|
|
54
59
|
// Close readline if not installing
|
|
55
60
|
}
|
|
@@ -10,14 +10,23 @@ function registerNodeSourcerCommand(program) {
|
|
|
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')
|
|
13
|
+
.option('-t, --target <name>', 'Execution mode: node, web, react', 'node')
|
|
14
|
+
.option('--bundless', 'Bundleless mode, means that each source file is compiled and built separately.')
|
|
13
15
|
.action((options) => {
|
|
14
16
|
// Step 0: determinate command params
|
|
17
|
+
const CONFIG_FILE_NAME__BY_TARGET = {
|
|
18
|
+
node: 'node-sourcer',
|
|
19
|
+
web: 'web-package',
|
|
20
|
+
react: 'react',
|
|
21
|
+
};
|
|
22
|
+
const configFileName = CONFIG_FILE_NAME__BY_TARGET[options.target ||
|
|
23
|
+
CONFIG_FILE_NAME__BY_TARGET.node];
|
|
15
24
|
const customRslibConfigPath = path.resolve(runtimePathById.root, options.config);
|
|
16
25
|
const rslibConfigPath = fs.existsSync(customRslibConfigPath)
|
|
17
26
|
? customRslibConfigPath
|
|
18
27
|
: path.resolve(runtimePathById.root,
|
|
19
28
|
// NOTE: possibility to check if package is installed, otherwise throw error
|
|
20
|
-
'node_modules',
|
|
29
|
+
'node_modules', `@mainset/builder-rslib/dist/esm/rslib.${configFileName}.config.mjs`);
|
|
21
30
|
if (options.exec === 'build') {
|
|
22
31
|
// ========== Build mode ==========
|
|
23
32
|
console.log('\n🏗️ [mainset cli] node-sourcer: build');
|
|
@@ -26,7 +35,11 @@ function registerNodeSourcerCommand(program) {
|
|
|
26
35
|
execImmediatePurgeDist();
|
|
27
36
|
// Step 2: build source code
|
|
28
37
|
console.log('\n📦 Compiling Source Code with Rslib ...');
|
|
29
|
-
execImmediateRslibCLICommand(`build --config ${rslibConfigPath}
|
|
38
|
+
execImmediateRslibCLICommand(`build --config ${rslibConfigPath}${options.bundless ? ' --no-bundle' : ''}`, {
|
|
39
|
+
env: {
|
|
40
|
+
MS_CLI__RSLIB_BUNDLESS_MODE: options.bundless,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
30
43
|
// Step 3: build type only
|
|
31
44
|
execImmediateTypeScriptCompileTypeOnly();
|
|
32
45
|
console.log('\n✅ Build completed successfully\n');
|
|
@@ -46,8 +59,13 @@ function registerNodeSourcerCommand(program) {
|
|
|
46
59
|
'build',
|
|
47
60
|
'--config',
|
|
48
61
|
rslibConfigPath,
|
|
62
|
+
options.bundless ? '--no-bundle' : '',
|
|
49
63
|
'--watch',
|
|
50
|
-
]
|
|
64
|
+
], {
|
|
65
|
+
env: {
|
|
66
|
+
MS_CLI__RSLIB_BUNDLESS_MODE: options.bundless,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
51
69
|
// Step 3: watch type only
|
|
52
70
|
runStreamingTypeScriptCompileTypeOnly();
|
|
53
71
|
}
|
|
@@ -4,12 +4,12 @@ function getRslibCLICommandPath() {
|
|
|
4
4
|
const rslibCLICommandPath = resolveHostPackageBinForCLICommandPath('@mainset/builder-rslib', 'rslib');
|
|
5
5
|
return rslibCLICommandPath;
|
|
6
6
|
}
|
|
7
|
-
function execImmediateRslibCLICommand(command) {
|
|
7
|
+
function execImmediateRslibCLICommand(command, options = {}) {
|
|
8
8
|
const rslibCLICommandPath = getRslibCLICommandPath();
|
|
9
|
-
return execImmediateCommand(`${rslibCLICommandPath} ${command}
|
|
9
|
+
return execImmediateCommand(`${rslibCLICommandPath} ${command}`, options);
|
|
10
10
|
}
|
|
11
|
-
function runStreamingRslibCLICommand(commandParams) {
|
|
11
|
+
function runStreamingRslibCLICommand(commandParams, options = {}) {
|
|
12
12
|
const rslibCLICommandPath = getRslibCLICommandPath();
|
|
13
|
-
return runStreamingCommand(rslibCLICommandPath, [...commandParams]);
|
|
13
|
+
return runStreamingCommand(rslibCLICommandPath, [...commandParams], options);
|
|
14
14
|
}
|
|
15
15
|
export { execImmediateRslibCLICommand, runStreamingRslibCLICommand };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare function
|
|
1
|
+
import type { ExecSyncOptions, SpawnOptions } from 'child_process';
|
|
2
|
+
declare function execImmediateRslibCLICommand(command: string, options?: ExecSyncOptions): void;
|
|
3
|
+
declare function runStreamingRslibCLICommand(commandParams: string[], options?: SpawnOptions): import("child_process").ChildProcess | undefined;
|
|
3
4
|
export { execImmediateRslibCLICommand, runStreamingRslibCLICommand };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mainset/cli",
|
|
3
|
-
"version": "0.5.0-rc.
|
|
3
|
+
"version": "0.5.0-rc.2",
|
|
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": {
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"react-dom": "^19.2.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@mainset/bundler-webpack": "^0.
|
|
19
|
-
"@mainset/cli": "^0.
|
|
20
|
-
"@mainset/dev-stack-fe": "^0.
|
|
18
|
+
"@mainset/bundler-webpack": "^0.3.1",
|
|
19
|
+
"@mainset/cli": "^0.5.0-rc.1",
|
|
20
|
+
"@mainset/dev-stack-fe": "^0.2.0",
|
|
21
21
|
"@types/react": "^19.2.2",
|
|
22
22
|
"@types/react-dom": "^19.2.1"
|
|
23
23
|
}
|