@mainset/cli 0.4.2 → 0.4.4-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.
@@ -10,6 +10,8 @@ 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('--noTypes', 'Skip type-only compilation step', false)
14
+ .option('--noPurge', 'Skip purging the dist folder before build', false)
13
15
  .action((options) => {
14
16
  // Step 0: determinate command params
15
17
  const customRslibConfigPath = path.resolve(runtimePathById.root, options.config);
@@ -23,12 +25,14 @@ function registerNodeSourcerCommand(program) {
23
25
  console.log('\nšŸ—ļø [mainset cli] node-sourcer: build');
24
26
  try {
25
27
  // Step 1: purge dist folder
26
- execImmediatePurgeDist();
28
+ if (!options.noPurge)
29
+ execImmediatePurgeDist();
27
30
  // Step 2: build source code
28
31
  console.log('\nšŸ“¦ Compiling Source Code with Rslib ...');
29
32
  execImmediateRslibCLICommand(`build --config ${rslibConfigPath}`);
30
33
  // Step 3: build type only
31
- execImmediateTypeScriptCompileTypeOnly();
34
+ if (!options.noTypes)
35
+ execImmediateTypeScriptCompileTypeOnly();
32
36
  console.log('\nāœ… Build completed successfully\n');
33
37
  }
34
38
  catch (error) {
@@ -40,7 +44,8 @@ function registerNodeSourcerCommand(program) {
40
44
  console.log('\nšŸ—ļø [mainset cli] node-sourcer: watch');
41
45
  try {
42
46
  // Step 1: purge dist folder
43
- execImmediatePurgeDist();
47
+ if (!options.noPurge)
48
+ execImmediatePurgeDist();
44
49
  // Step 2: watch source code
45
50
  runStreamingRslibCLICommand([
46
51
  'build',
@@ -49,7 +54,8 @@ function registerNodeSourcerCommand(program) {
49
54
  '--watch',
50
55
  ]);
51
56
  // Step 3: watch type only
52
- runStreamingTypeScriptCompileTypeOnly();
57
+ if (!options.noTypes)
58
+ runStreamingTypeScriptCompileTypeOnly();
53
59
  }
54
60
  catch (error) {
55
61
  initProcessCatchErrorLogger('node-sourcer', error, 'watch');
@@ -1,6 +1,6 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- // import { fileURLToPath } from 'url';
3
+ import { fileURLToPath } from 'url';
4
4
  import { runtimePathById } from './path.mjs';
5
5
  function resolveHostPackageNodeModulesPath(hostPackageName, dependencyPackageName) {
6
6
  const hostPackageDependencyPackagePath = path.resolve(runtimePathById.root, `node_modules/${hostPackageName}/node_modules/${dependencyPackageName}`);
@@ -8,8 +8,7 @@ function resolveHostPackageNodeModulesPath(hostPackageName, dependencyPackageNam
8
8
  // Otherwise, return just the package name (for packages installed from the registry)
9
9
  return fs.existsSync(hostPackageDependencyPackagePath)
10
10
  ? hostPackageDependencyPackagePath
11
- : fs.realpathSync(dependencyPackageName);
12
- // : fileURLToPath(import.meta.resolve(dependencyPackageName));
11
+ : fileURLToPath(import.meta.resolve(dependencyPackageName));
13
12
  }
14
13
  function resolveHostPackageBinForCLICommandPath(hostPackageName,
15
14
  // dependencyPackageName: string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mainset/cli",
3
- "version": "0.4.2",
3
+ "version": "0.4.4-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": {