mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 17:20:35 +08:00
Chore: minor changes
This commit is contained in:
parent
f706b8fdc4
commit
730eec003e
@ -7,6 +7,7 @@ import { CN_CIDR_MISSING_IN_CHNROUTE, NON_CN_CIDR_INCLUDED_IN_CHNROUTE } from '.
|
|||||||
import { appendArrayInPlace } from './lib/append-array-in-place';
|
import { appendArrayInPlace } from './lib/append-array-in-place';
|
||||||
import { IPListOutput } from './lib/create-file';
|
import { IPListOutput } from './lib/create-file';
|
||||||
import { cachedOnlyFail } from './lib/fs-memo';
|
import { cachedOnlyFail } from './lib/fs-memo';
|
||||||
|
import { createFileDescription } from './constants/description';
|
||||||
|
|
||||||
const PROBE_CHN_CIDR_V4 = [
|
const PROBE_CHN_CIDR_V4 = [
|
||||||
// NetEase Hangzhou
|
// NetEase Hangzhou
|
||||||
@ -48,12 +49,7 @@ export const buildChnCidr = task(require.main === module, __filename)(async (spa
|
|||||||
const [filteredCidr4, cidr6] = await span.traceChildAsync('download chnroutes2', getChnCidrPromise);
|
const [filteredCidr4, cidr6] = await span.traceChildAsync('download chnroutes2', getChnCidrPromise);
|
||||||
|
|
||||||
// Can not use SHARED_DESCRIPTION here as different license
|
// Can not use SHARED_DESCRIPTION here as different license
|
||||||
const description = [
|
const description = createFileDescription('CC BY-SA 2.0');
|
||||||
'License: CC BY-SA 2.0',
|
|
||||||
'Homepage: https://ruleset.skk.moe',
|
|
||||||
'GitHub: https://github.com/SukkaW/Surge',
|
|
||||||
''
|
|
||||||
];
|
|
||||||
|
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
new IPListOutput(span, 'china_ip', false)
|
new IPListOutput(span, 'china_ip', false)
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
export const SHARED_DESCRIPTION = [
|
export function createFileDescription(license = 'AGPL 3.0') {
|
||||||
'License: AGPL 3.0',
|
return [
|
||||||
'Homepage: https://ruleset.skk.moe',
|
`License: ${license}`,
|
||||||
'GitHub: https://github.com/SukkaW/Surge'
|
'Homepage: https://ruleset.skk.moe',
|
||||||
];
|
'GitHub: https://github.com/SukkaW/Surge'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SHARED_DESCRIPTION = createFileDescription('AGPL 3.0');
|
||||||
|
|||||||
@ -63,7 +63,18 @@ export const downloadPreviousBuild = task(require.main === module, __filename)(a
|
|||||||
const extract = tarExtract(
|
const extract = tarExtract(
|
||||||
publicDir,
|
publicDir,
|
||||||
{
|
{
|
||||||
ignore: tarOnIgnore,
|
ignore(_: string, header?: TarEntryHeaders) {
|
||||||
|
if (header) {
|
||||||
|
if (header.type !== 'file' && header.type !== 'directory') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (header.type === 'file' && path.extname(header.name) === '.ts') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
map(header) {
|
map(header) {
|
||||||
header.name = header.name.replace(pathPrefix, '');
|
header.name = header.name.replace(pathPrefix, '');
|
||||||
return header;
|
return header;
|
||||||
@ -78,18 +89,3 @@ export const downloadPreviousBuild = task(require.main === module, __filename)(a
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function tarOnIgnore(_: string, header?: TarEntryHeaders) {
|
|
||||||
if (header) {
|
|
||||||
if (header.type !== 'file' && header.type !== 'directory') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const extname = path.extname(header.name);
|
|
||||||
if (extname === '.ts') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user