jiek 2.1.5 → 2.1.7

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -243,7 +243,15 @@ Similar tools to `jiek` include: [tsup](https://github.com/egoist/tsup), [unbuil
243
243
  - There are certain issues with `monorepo` support, and dependencies on other packages in the workspace must be recompiled
244
244
  - The rules for writing entry files are too cumbersome and not natural enough
245
245
  - Unable to handle issues related to `Project Reference` in `tsconfig.json`
246
- - According to `conditions`
246
+ - Unable to fully utilize `conditional` features
247
+ - Unable to choose the required builder, can only replace the entire toolchain
248
+
249
+ ## Who is using Jiek?
250
+
251
+ - [nonzzz/vite-plugin-compression](https://github.com/nonzzz/vite-plugin-compression)
252
+ - [nonzzz/vite-bundle-analyzer](https://github.com/nonzzz/vite-bundle-analyzer)
253
+ - [nonzzz/squarified](https://github.com/nonzzz/squarified)
254
+ - [typp-js/typp](https://github.com/typp-js/typp)
247
255
 
248
256
  ## About this README
249
257
 
@@ -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,
@@ -77,6 +77,7 @@ async function getSelectedProjectsGraph(filter = commander.program.getOptionValu
77
77
  const pnpmWorkspaceFilePath = path__default.default.resolve(wd, "pnpm-workspace.yaml");
78
78
  const pnpmWorkspaceFileContent = fs__default.default.readFileSync(pnpmWorkspaceFilePath, "utf-8");
79
79
  const pnpmWorkspace = jsYaml.load(pnpmWorkspaceFileContent);
80
+ console.log({ root, wd, filter });
80
81
  if (root === wd && !filter) {
81
82
  throw new Error("root path is workspace root, please provide a filter");
82
83
  }
@@ -116,7 +117,7 @@ async function getSelectedProjectsGraph(filter = commander.program.getOptionValu
116
117
 
117
118
  var name = "jiek";
118
119
  var type = "module";
119
- var version = "2.1.4";
120
+ var version = "2.1.6";
120
121
  var description$1 = "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.";
121
122
  var author = "YiJie <yijie4188@gmail.com>";
122
123
  var repository = {
@@ -233,7 +234,7 @@ Support with variables: 'PKG_NAME',
233
234
  const { notWorkspace } = getWD();
234
235
  const IS_WORKSPACE = !notWorkspace;
235
236
 
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");
237
+ commander.program.name("jk/jiek").version(pkg.version).description(`${pkg.description} - Version ${pkg.version}`).option("-c, --config-path <configPath>", "Custom jiek config path");
237
238
  if (type$1 !== "" && IS_WORKSPACE) {
238
239
  commander.program.option("-f, --filter <filter>", filterDescription);
239
240
  }
@@ -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,
@@ -69,6 +69,7 @@ async function getSelectedProjectsGraph(filter = program.getOptionValue("filter"
69
69
  const pnpmWorkspaceFilePath = path.resolve(wd, "pnpm-workspace.yaml");
70
70
  const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, "utf-8");
71
71
  const pnpmWorkspace = load(pnpmWorkspaceFileContent);
72
+ console.log({ root, wd, filter });
72
73
  if (root === wd && !filter) {
73
74
  throw new Error("root path is workspace root, please provide a filter");
74
75
  }
@@ -108,7 +109,7 @@ async function getSelectedProjectsGraph(filter = program.getOptionValue("filter"
108
109
 
109
110
  var name = "jiek";
110
111
  var type = "module";
111
- var version = "2.1.4";
112
+ var version = "2.1.6";
112
113
  var description$1 = "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.";
113
114
  var author = "YiJie <yijie4188@gmail.com>";
114
115
  var repository = {
@@ -225,7 +226,7 @@ Support with variables: 'PKG_NAME',
225
226
  const { notWorkspace } = getWD();
226
227
  const IS_WORKSPACE = !notWorkspace;
227
228
 
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");
229
+ program.name("jk/jiek").version(pkg.version).description(`${pkg.description} - Version ${pkg.version}`).option("-c, --config-path <configPath>", "Custom jiek config path");
229
230
  if (type$1 !== "" && IS_WORKSPACE) {
230
231
  program.option("-f, --filter <filter>", filterDescription);
231
232
  }
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,
@@ -101,6 +101,7 @@ async function getSelectedProjectsGraph(filter = commander.program.getOptionValu
101
101
  const pnpmWorkspaceFilePath = path__default.default.resolve(wd, "pnpm-workspace.yaml");
102
102
  const pnpmWorkspaceFileContent = fs__default.default.readFileSync(pnpmWorkspaceFilePath, "utf-8");
103
103
  const pnpmWorkspace = jsYaml.load(pnpmWorkspaceFileContent);
104
+ console.log({ root, wd, filter });
104
105
  if (root === wd && !filter) {
105
106
  throw new Error("root path is workspace root, please provide a filter");
106
107
  }
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,
@@ -71,6 +71,7 @@ async function getSelectedProjectsGraph(filter = program.getOptionValue("filter"
71
71
  const pnpmWorkspaceFilePath = path.resolve(wd, "pnpm-workspace.yaml");
72
72
  const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, "utf-8");
73
73
  const pnpmWorkspace = load(pnpmWorkspaceFileContent);
74
+ console.log({ root, wd, filter });
74
75
  if (root === wd && !filter) {
75
76
  throw new Error("root path is workspace root, please provide a filter");
76
77
  }
@@ -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.5",
4
+ "version": "2.1.7",
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,
@@ -51,6 +51,7 @@ export async function getSelectedProjectsGraph(
51
51
  const pnpmWorkspace = load(pnpmWorkspaceFileContent) as {
52
52
  packages: string[]
53
53
  }
54
+ console.log({ root, wd, filter })
54
55
  if (root === wd && !filter) {
55
56
  throw new Error('root path is workspace root, please provide a filter')
56
57
  // TODO inquirer prompt support user select packages
@@ -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