jiek 2.0.2-alpha.7 → 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.6";
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.6";
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
@@ -4667,6 +4667,33 @@ async function prepublish() {
4667
4667
  modifyVersionPackageJSON,
4668
4668
  jsoncParser.modify(modifyVersionPackageJSON, ["publishConfig", "directory"], resolvedOutdir, { formattingOptions })
4669
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
+ }
4670
4697
  if (!fs__default.default.existsSync(resolveByDir(resolvedOutdir))) {
4671
4698
  fs__default.default.mkdirSync(resolveByDir(resolvedOutdir));
4672
4699
  }
@@ -4687,8 +4714,7 @@ async function postpublish() {
4687
4714
  if (fs__default.default.existsSync(jiekTempPackageJSON)) {
4688
4715
  fs__default.default.copyFileSync(jiekTempPackageJSON, packageJSON);
4689
4716
  fs__default.default.rmSync(jiekTempPackageJSON);
4690
- console.log(`
4691
- ${dir}/package.json has been restored`);
4717
+ console.log(`${dir}/package.json has been restored`);
4692
4718
  } else {
4693
4719
  throw new Error(
4694
4720
  `jiek temp \`${dir}/package.json\` not found, please confirm the jiek pre-publish command has been executed`
package/cli.js CHANGED
@@ -4637,6 +4637,33 @@ async function prepublish() {
4637
4637
  modifyVersionPackageJSON,
4638
4638
  modify(modifyVersionPackageJSON, ["publishConfig", "directory"], resolvedOutdir, { formattingOptions })
4639
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
+ }
4640
4667
  if (!fs.existsSync(resolveByDir(resolvedOutdir))) {
4641
4668
  fs.mkdirSync(resolveByDir(resolvedOutdir));
4642
4669
  }
@@ -4657,8 +4684,7 @@ async function postpublish() {
4657
4684
  if (fs.existsSync(jiekTempPackageJSON)) {
4658
4685
  fs.copyFileSync(jiekTempPackageJSON, packageJSON);
4659
4686
  fs.rmSync(jiekTempPackageJSON);
4660
- console.log(`
4661
- ${dir}/package.json has been restored`);
4687
+ console.log(`${dir}/package.json has been restored`);
4662
4688
  } else {
4663
4689
  throw new Error(
4664
4690
  `jiek temp \`${dir}/package.json\` not found, please confirm the jiek pre-publish command has been executed`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jiek",
3
3
  "type": "module",
4
- "version": "2.0.2-alpha.7",
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": {