jiek 2.1.6 → 2.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,7 +21,7 @@ let root;
21
21
  function getRoot() {
22
22
  if (root)
23
23
  return root;
24
- const rootOption = commander.program.getOptionValue("root");
24
+ const rootOption = process.env.JIEK_ROOT;
25
25
  root = rootOption ? path__default.default.isAbsolute(rootOption) ? rootOption : path__default.default.resolve(process.cwd(), rootOption) : void 0;
26
26
  return root;
27
27
  }
@@ -42,7 +42,7 @@ function getWD() {
42
42
  wd = getWorkspaceDir.getWorkspaceDir(type$1);
43
43
  } catch (e) {
44
44
  if ("message" in e && e.message === "workspace root not found") {
45
- wd = root;
45
+ wd = root ?? process.cwd();
46
46
  notWorkspace$1 = true;
47
47
  } else {
48
48
  throw e;
@@ -62,8 +62,8 @@ function filterPackagesGraph(filters) {
62
62
  return Promise.all(filters.map(async (filter) => getSelectedProjectsGraph(filter)));
63
63
  }
64
64
  async function getSelectedProjectsGraph(filter = commander.program.getOptionValue("filter")) {
65
- let root = getRoot();
66
65
  const { wd, notWorkspace } = getWD();
66
+ let root = getRoot();
67
67
  if (notWorkspace) {
68
68
  return {
69
69
  wd,
@@ -116,7 +116,7 @@ async function getSelectedProjectsGraph(filter = commander.program.getOptionValu
116
116
 
117
117
  var name = "jiek";
118
118
  var type = "module";
119
- var version = "2.1.5";
119
+ var version = "2.1.7";
120
120
  var description$1 = "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.";
121
121
  var author = "YiJie <yijie4188@gmail.com>";
122
122
  var repository = {
@@ -233,7 +233,7 @@ Support with variables: 'PKG_NAME',
233
233
  const { notWorkspace } = getWD();
234
234
  const IS_WORKSPACE = !notWorkspace;
235
235
 
236
- commander.program.name("jk/jiek").version(pkg.version).description(`${pkg.description} - Version ${pkg.version}`).option("--root <root>", "The root path of the project").option("-c, --config-path <configPath>", "Custom jiek config path");
236
+ commander.program.name("jk/jiek").version(pkg.version).description(`${pkg.description} - Version ${pkg.version}`).option("-c, --config-path <configPath>", "Custom jiek config path");
237
237
  if (type$1 !== "" && IS_WORKSPACE) {
238
238
  commander.program.option("-f, --filter <filter>", filterDescription);
239
239
  }
@@ -13,7 +13,7 @@ let root;
13
13
  function getRoot() {
14
14
  if (root)
15
15
  return root;
16
- const rootOption = program.getOptionValue("root");
16
+ const rootOption = process.env.JIEK_ROOT;
17
17
  root = rootOption ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : void 0;
18
18
  return root;
19
19
  }
@@ -34,7 +34,7 @@ function getWD() {
34
34
  wd = getWorkspaceDir(type$1);
35
35
  } catch (e) {
36
36
  if ("message" in e && e.message === "workspace root not found") {
37
- wd = root;
37
+ wd = root ?? process.cwd();
38
38
  notWorkspace$1 = true;
39
39
  } else {
40
40
  throw e;
@@ -54,8 +54,8 @@ function filterPackagesGraph(filters) {
54
54
  return Promise.all(filters.map(async (filter) => getSelectedProjectsGraph(filter)));
55
55
  }
56
56
  async function getSelectedProjectsGraph(filter = program.getOptionValue("filter")) {
57
- let root = getRoot();
58
57
  const { wd, notWorkspace } = getWD();
58
+ let root = getRoot();
59
59
  if (notWorkspace) {
60
60
  return {
61
61
  wd,
@@ -108,7 +108,7 @@ async function getSelectedProjectsGraph(filter = program.getOptionValue("filter"
108
108
 
109
109
  var name = "jiek";
110
110
  var type = "module";
111
- var version = "2.1.5";
111
+ var version = "2.1.7";
112
112
  var description$1 = "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.";
113
113
  var author = "YiJie <yijie4188@gmail.com>";
114
114
  var repository = {
@@ -225,7 +225,7 @@ Support with variables: 'PKG_NAME',
225
225
  const { notWorkspace } = getWD();
226
226
  const IS_WORKSPACE = !notWorkspace;
227
227
 
228
- program.name("jk/jiek").version(pkg.version).description(`${pkg.description} - Version ${pkg.version}`).option("--root <root>", "The root path of the project").option("-c, --config-path <configPath>", "Custom jiek config path");
228
+ program.name("jk/jiek").version(pkg.version).description(`${pkg.description} - Version ${pkg.version}`).option("-c, --config-path <configPath>", "Custom jiek config path");
229
229
  if (type$1 !== "" && IS_WORKSPACE) {
230
230
  program.option("-f, --filter <filter>", filterDescription);
231
231
  }
package/dist/cli.cjs CHANGED
@@ -48,7 +48,7 @@ let root;
48
48
  function getRoot() {
49
49
  if (root)
50
50
  return root;
51
- const rootOption = commander.program.getOptionValue("root");
51
+ const rootOption = process.env.JIEK_ROOT;
52
52
  root = rootOption ? path__default.default.isAbsolute(rootOption) ? rootOption : path__default.default.resolve(process.cwd(), rootOption) : void 0;
53
53
  return root;
54
54
  }
@@ -69,7 +69,7 @@ function getWD() {
69
69
  wd = getWorkspaceDir.getWorkspaceDir(type);
70
70
  } catch (e) {
71
71
  if ("message" in e && e.message === "workspace root not found") {
72
- wd = root;
72
+ wd = root ?? process.cwd();
73
73
  notWorkspace = true;
74
74
  } else {
75
75
  throw e;
@@ -86,8 +86,8 @@ try {
86
86
  } catch {
87
87
  }
88
88
  async function getSelectedProjectsGraph(filter = commander.program.getOptionValue("filter")) {
89
- let root = getRoot();
90
89
  const { wd, notWorkspace } = getWD();
90
+ let root = getRoot();
91
91
  if (notWorkspace) {
92
92
  return {
93
93
  wd,
package/dist/cli.js CHANGED
@@ -18,7 +18,7 @@ let root;
18
18
  function getRoot() {
19
19
  if (root)
20
20
  return root;
21
- const rootOption = program.getOptionValue("root");
21
+ const rootOption = process.env.JIEK_ROOT;
22
22
  root = rootOption ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : void 0;
23
23
  return root;
24
24
  }
@@ -39,7 +39,7 @@ function getWD() {
39
39
  wd = getWorkspaceDir(type);
40
40
  } catch (e) {
41
41
  if ("message" in e && e.message === "workspace root not found") {
42
- wd = root;
42
+ wd = root ?? process.cwd();
43
43
  notWorkspace = true;
44
44
  } else {
45
45
  throw e;
@@ -56,8 +56,8 @@ try {
56
56
  } catch {
57
57
  }
58
58
  async function getSelectedProjectsGraph(filter = program.getOptionValue("filter")) {
59
- let root = getRoot();
60
59
  const { wd, notWorkspace } = getWD();
60
+ let root = getRoot();
61
61
  if (notWorkspace) {
62
62
  return {
63
63
  wd,
@@ -4240,7 +4240,7 @@ let root;
4240
4240
  function getRoot() {
4241
4241
  if (root)
4242
4242
  return root;
4243
- const rootOption = commander.program.getOptionValue("root");
4243
+ const rootOption = process.env.JIEK_ROOT;
4244
4244
  root = rootOption ? path__default.default.isAbsolute(rootOption) ? rootOption : path__default.default.resolve(process.cwd(), rootOption) : void 0;
4245
4245
  return root;
4246
4246
  }
@@ -4269,7 +4269,7 @@ function getWD() {
4269
4269
  wd = getWorkspaceDir.getWorkspaceDir(type);
4270
4270
  } catch (e) {
4271
4271
  if ("message" in e && e.message === "workspace root not found") {
4272
- wd = root;
4272
+ wd = root ?? process.cwd();
4273
4273
  notWorkspace = true;
4274
4274
  } else {
4275
4275
  throw e;
@@ -4227,7 +4227,7 @@ let root;
4227
4227
  function getRoot() {
4228
4228
  if (root)
4229
4229
  return root;
4230
- const rootOption = program.getOptionValue("root");
4230
+ const rootOption = process.env.JIEK_ROOT;
4231
4231
  root = rootOption ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : void 0;
4232
4232
  return root;
4233
4233
  }
@@ -4256,7 +4256,7 @@ function getWD() {
4256
4256
  wd = getWorkspaceDir(type);
4257
4257
  } catch (e) {
4258
4258
  if ("message" in e && e.message === "workspace root not found") {
4259
- wd = root;
4259
+ wd = root ?? process.cwd();
4260
4260
  notWorkspace = true;
4261
4261
  } else {
4262
4262
  throw e;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jiek",
3
3
  "type": "module",
4
- "version": "2.1.6",
4
+ "version": "2.1.8",
5
5
  "description": "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.",
6
6
  "author": "YiJie <yijie4188@gmail.com>",
7
7
  "repository": {
@@ -9,7 +9,6 @@ program
9
9
  .name('jk/jiek')
10
10
  .version(pkg.version)
11
11
  .description(`${pkg.description} - Version ${pkg.version}`)
12
- .option('--root <root>', 'The root path of the project')
13
12
  .option('-c, --config-path <configPath>', 'Custom jiek config path')
14
13
 
15
14
  if (type !== '' && IS_WORKSPACE) {
@@ -19,7 +19,7 @@ try {
19
19
 
20
20
  export interface ProjectsGraph {
21
21
  wd: string
22
- root: string
22
+ root?: string
23
23
  value?: Record<string, {
24
24
  name?: string
25
25
  type?: string
@@ -34,8 +34,8 @@ export function filterPackagesGraph(filters: string[]): Promise<ProjectsGraph[]>
34
34
  export async function getSelectedProjectsGraph(
35
35
  filter = program.getOptionValue('filter')
36
36
  ): Promise<ProjectsGraph> {
37
- let root = getRoot()
38
37
  const { wd, notWorkspace } = getWD()
38
+ let root = getRoot()
39
39
  if (notWorkspace) {
40
40
  return {
41
41
  wd,
@@ -1,12 +1,10 @@
1
1
  import path from 'node:path'
2
2
 
3
- import { program } from 'commander'
4
-
5
- let root: string
3
+ let root: string | undefined
6
4
  export function getRoot() {
7
5
  if (root) return root
8
6
 
9
- const rootOption = program.getOptionValue('root')
7
+ const rootOption = process.env.JIEK_ROOT
10
8
  root = rootOption
11
9
  ? path.isAbsolute(rootOption)
12
10
  ? rootOption
@@ -21,7 +21,7 @@ export function getWD() {
21
21
  } catch (e) {
22
22
  // @ts-ignore
23
23
  if ('message' in e && e.message === 'workspace root not found') {
24
- wd = root
24
+ wd = root ?? process.cwd()
25
25
  notWorkspace = true
26
26
  } else {
27
27
  throw e