jiek 2.0.2-alpha.6 → 2.0.2-alpha.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.0.2-alpha.5";
119
+ var version = "2.0.2-alpha.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 = {
package/cli-only-build.js CHANGED
@@ -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.0.2-alpha.5";
111
+ var version = "2.0.2-alpha.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 = {
package/cli.cjs CHANGED
@@ -4548,6 +4548,8 @@ async function prepublish() {
4548
4548
  )
4549
4549
  );
4550
4550
  for (const [key, value] of Object.entries(manifest)) {
4551
+ if (key === "version")
4552
+ continue;
4551
4553
  if (JSON.stringify(value) === JSON.stringify(oldJSON[key]))
4552
4554
  continue;
4553
4555
  if (key !== "exports") {
@@ -4615,7 +4617,7 @@ async function prepublish() {
4615
4617
  newJSONString,
4616
4618
  jsoncParser.modify(
4617
4619
  newJSONString,
4618
- ["publishConfig", "peerDependenciesMeta"],
4620
+ ["peerDependenciesMeta"],
4619
4621
  peerDependenciesMeta,
4620
4622
  { formattingOptions }
4621
4623
  )
@@ -4665,6 +4667,33 @@ async function prepublish() {
4665
4667
  modifyVersionPackageJSON,
4666
4668
  jsoncParser.modify(modifyVersionPackageJSON, ["publishConfig", "directory"], resolvedOutdir, { formattingOptions })
4667
4669
  );
4670
+ if (oldJSON.files) {
4671
+ if (!Array.isArray(oldJSON.files)) {
4672
+ throw new Error(`${dir}/package.json files field must be an array`);
4673
+ }
4674
+ if (Array.isArray(oldJSON.files) && oldJSON.files.every((file) => typeof file !== "string")) {
4675
+ throw new Error(`${dir}/package.json files field must be an array of string`);
4676
+ }
4677
+ }
4678
+ const files = oldJSON.files ?? fs__default.default.readdirSync(resolveByDir(".")).filter((file) => file !== "node_modules" && file !== resolvedOutdir);
4679
+ for (const file of files) {
4680
+ const path2 = resolveByDir(file);
4681
+ try {
4682
+ const stat = fs__default.default.statSync(path2);
4683
+ if (stat.isDirectory()) {
4684
+ fs__default.default.symlinkSync(path2, resolveByDir(resolvedOutdir, file), "dir");
4685
+ continue;
4686
+ }
4687
+ if (stat.isFile()) {
4688
+ fs__default.default.symlinkSync(path2, resolveByDir(resolvedOutdir, file), "file");
4689
+ continue;
4690
+ }
4691
+ } catch (e) {
4692
+ console.warn(String(e));
4693
+ continue;
4694
+ }
4695
+ throw new Error(`file type of ${path2} is not supported`);
4696
+ }
4668
4697
  if (!fs__default.default.existsSync(resolveByDir(resolvedOutdir))) {
4669
4698
  fs__default.default.mkdirSync(resolveByDir(resolvedOutdir));
4670
4699
  }
@@ -4685,8 +4714,11 @@ async function postpublish() {
4685
4714
  if (fs__default.default.existsSync(jiekTempPackageJSON)) {
4686
4715
  fs__default.default.copyFileSync(jiekTempPackageJSON, packageJSON);
4687
4716
  fs__default.default.rmSync(jiekTempPackageJSON);
4717
+ console.log(`${dir}/package.json has been restored`);
4688
4718
  } else {
4689
- throw new Error("jiek temp package.json not found, please confirm the jiek pre-publish command has been executed");
4719
+ throw new Error(
4720
+ `jiek temp \`${dir}/package.json\` not found, please confirm the jiek pre-publish command has been executed`
4721
+ );
4690
4722
  }
4691
4723
  });
4692
4724
  }
package/cli.js CHANGED
@@ -4518,6 +4518,8 @@ async function prepublish() {
4518
4518
  )
4519
4519
  );
4520
4520
  for (const [key, value] of Object.entries(manifest)) {
4521
+ if (key === "version")
4522
+ continue;
4521
4523
  if (JSON.stringify(value) === JSON.stringify(oldJSON[key]))
4522
4524
  continue;
4523
4525
  if (key !== "exports") {
@@ -4585,7 +4587,7 @@ async function prepublish() {
4585
4587
  newJSONString,
4586
4588
  modify(
4587
4589
  newJSONString,
4588
- ["publishConfig", "peerDependenciesMeta"],
4590
+ ["peerDependenciesMeta"],
4589
4591
  peerDependenciesMeta,
4590
4592
  { formattingOptions }
4591
4593
  )
@@ -4635,6 +4637,33 @@ async function prepublish() {
4635
4637
  modifyVersionPackageJSON,
4636
4638
  modify(modifyVersionPackageJSON, ["publishConfig", "directory"], resolvedOutdir, { formattingOptions })
4637
4639
  );
4640
+ if (oldJSON.files) {
4641
+ if (!Array.isArray(oldJSON.files)) {
4642
+ throw new Error(`${dir}/package.json files field must be an array`);
4643
+ }
4644
+ if (Array.isArray(oldJSON.files) && oldJSON.files.every((file) => typeof file !== "string")) {
4645
+ throw new Error(`${dir}/package.json files field must be an array of string`);
4646
+ }
4647
+ }
4648
+ const files = oldJSON.files ?? fs.readdirSync(resolveByDir(".")).filter((file) => file !== "node_modules" && file !== resolvedOutdir);
4649
+ for (const file of files) {
4650
+ const path2 = resolveByDir(file);
4651
+ try {
4652
+ const stat = fs.statSync(path2);
4653
+ if (stat.isDirectory()) {
4654
+ fs.symlinkSync(path2, resolveByDir(resolvedOutdir, file), "dir");
4655
+ continue;
4656
+ }
4657
+ if (stat.isFile()) {
4658
+ fs.symlinkSync(path2, resolveByDir(resolvedOutdir, file), "file");
4659
+ continue;
4660
+ }
4661
+ } catch (e) {
4662
+ console.warn(String(e));
4663
+ continue;
4664
+ }
4665
+ throw new Error(`file type of ${path2} is not supported`);
4666
+ }
4638
4667
  if (!fs.existsSync(resolveByDir(resolvedOutdir))) {
4639
4668
  fs.mkdirSync(resolveByDir(resolvedOutdir));
4640
4669
  }
@@ -4655,8 +4684,11 @@ async function postpublish() {
4655
4684
  if (fs.existsSync(jiekTempPackageJSON)) {
4656
4685
  fs.copyFileSync(jiekTempPackageJSON, packageJSON);
4657
4686
  fs.rmSync(jiekTempPackageJSON);
4687
+ console.log(`${dir}/package.json has been restored`);
4658
4688
  } else {
4659
- throw new Error("jiek temp package.json not found, please confirm the jiek pre-publish command has been executed");
4689
+ throw new Error(
4690
+ `jiek temp \`${dir}/package.json\` not found, please confirm the jiek pre-publish command has been executed`
4691
+ );
4660
4692
  }
4661
4693
  });
4662
4694
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jiek",
3
3
  "type": "module",
4
- "version": "2.0.2-alpha.6",
4
+ "version": "2.0.2-alpha.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": {
@@ -85,33 +85,30 @@
85
85
  "rollup-plugin-esbuild": "^6.1.0",
86
86
  "rollup-plugin-swc3": "^0.12.1"
87
87
  },
88
- "publishConfig": {
89
- "version": "2.0.2-alpha.5",
90
- "peerDependenciesMeta": {
91
- "@rollup/plugin-terser": {
92
- "optional": true
93
- },
94
- "@pnpm/filter-workspace-packages": {
95
- "optional": true
96
- },
97
- "esbuild-register": {
98
- "optional": true
99
- },
100
- "postcss": {
101
- "optional": true
102
- },
103
- "rollup-plugin-postcss": {
104
- "optional": true
105
- },
106
- "rollup-plugin-esbuild": {
107
- "optional": true
108
- },
109
- "rollup-plugin-swc3": {
110
- "optional": true
111
- },
112
- "typescript": {
113
- "optional": true
114
- }
88
+ "peerDependenciesMeta": {
89
+ "@rollup/plugin-terser": {
90
+ "optional": true
91
+ },
92
+ "@pnpm/filter-workspace-packages": {
93
+ "optional": true
94
+ },
95
+ "esbuild-register": {
96
+ "optional": true
97
+ },
98
+ "postcss": {
99
+ "optional": true
100
+ },
101
+ "rollup-plugin-postcss": {
102
+ "optional": true
103
+ },
104
+ "rollup-plugin-esbuild": {
105
+ "optional": true
106
+ },
107
+ "rollup-plugin-swc3": {
108
+ "optional": true
109
+ },
110
+ "typescript": {
111
+ "optional": true
115
112
  }
116
113
  },
117
114
  "scripts": {