pkg-pr-new 0.0.23 → 0.0.25

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.
Files changed (3) hide show
  1. package/dist/index.js +21 -16
  2. package/index.ts +28 -22
  3. package/package.json +2 -2
package/index.ts CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  extractOwnerAndRepo,
15
15
  extractRepository,
16
16
  } from "@pkg-pr-new/utils";
17
- import { glob, globSync } from "tinyglobby";
17
+ import { glob } from "tinyglobby";
18
18
  import ignore from "ignore";
19
19
  import "./environments";
20
20
  import pkg from "./package.json" with { type: "json" };
@@ -87,29 +87,35 @@ const main = defineCommand({
87
87
  },
88
88
  },
89
89
  run: async ({ args }) => {
90
- const paths = (
91
- args._.length
92
- ? args._.flatMap((p) =>
93
- globSync([p], {
94
- expandDirectories: false,
95
- onlyDirectories: true,
96
- }),
97
- )
98
- : ["."]
99
- ).map((p) => path.resolve(p.trim()));
100
-
101
- const templates = (
102
- typeof args.template === "string"
103
- ? [args.template]
104
- : ([...(args.template || [])] as string[])
105
- )
106
- .flatMap((p) =>
107
- globSync([p], {
90
+ const paths = args._.length
91
+ ? await glob(args._, {
108
92
  expandDirectories: false,
109
93
  onlyDirectories: true,
110
- }),
111
- )
112
- .map((p) => path.resolve(p.trim()));
94
+ absolute: true,
95
+ })
96
+ : [process.cwd()];
97
+
98
+ if (args._.includes(".") || args._.includes("./")) {
99
+ paths.push(process.cwd());
100
+ }
101
+
102
+ const templatePatterns =
103
+ typeof args.template === "string"
104
+ ? [args.template]
105
+ : ([...(args.template || [])] as string[]);
106
+
107
+ const templates = await glob(templatePatterns, {
108
+ expandDirectories: false,
109
+ onlyDirectories: true,
110
+ absolute: true,
111
+ });
112
+
113
+ if (
114
+ templatePatterns.includes(".") ||
115
+ templatePatterns.includes("./")
116
+ ) {
117
+ templates.push(process.cwd());
118
+ }
113
119
 
114
120
  const formData = new FormData();
115
121
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pkg-pr-new",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "keywords": [],
21
21
  "author": "",
22
- "license": "ISC",
22
+ "license": "MIT",
23
23
  "dependencies": {
24
24
  "@jsdevtools/ez-spawn": "^3.0.4",
25
25
  "@octokit/action": "^6.1.0",