mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
patch: ignore package.json & support framework path
This commit is contained in:
1 parent
a7a49bf791
commit
4cf647c49b
1 file changed
+6
-2
@@ -10,8 +10,8 @@ const logger = new Logger('patch');
|
|||||||
|
|
||||||
function locateFile(file: string): string | null {
|
function locateFile(file: string): string | null {
|
||||||
const candidates = [file];
|
const candidates = [file];
|
||||||
if (file.startsWith('packages/')) {
|
if (['packages/', 'framework/'].some((p) => file.startsWith(p))) {
|
||||||
candidates.push(file.replace(/^packages\//, ''), file.replace(/^packages\//, '@hydrooj/'));
|
candidates.push(file.replace(/^(packages|framework)\//, ''), file.replace(/^(packages|framework)\//, '@hydrooj/'));
|
||||||
}
|
}
|
||||||
for (const candidate of candidates) {
|
for (const candidate of candidates) {
|
||||||
try {
|
try {
|
||||||
@@ -45,6 +45,10 @@ export function register(cli: CAC) {
|
|||||||
const match = line.match(/diff --git a\/(.+?) b\/(.+?)(?:\s|$)/);
|
const match = line.match(/diff --git a\/(.+?) b\/(.+?)(?:\s|$)/);
|
||||||
if (!match) continue;
|
if (!match) continue;
|
||||||
const filename = match[2];
|
const filename = match[2];
|
||||||
|
if (path.basename(filename) === 'package.json') {
|
||||||
|
logger.info('Skipping %s (package.json changes are ignored)', filename);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const startLine = i;
|
const startLine = i;
|
||||||
let endLine = lines.length;
|
let endLine = lines.length;
|
||||||
for (let j = i + 1; j < lines.length; j++) {
|
for (let j = i + 1; j < lines.length; j++) {
|
||||||
|
|||||||
Reference in new issue
Block a user