mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-13 01:30:37 +08:00
Refactor: minor changes
This commit is contained in:
parent
1d8c991baf
commit
b4057ef757
@ -19,6 +19,8 @@ const sourceDir = path.resolve(import.meta.dir, '../Source');
|
|||||||
const outputSurgeDir = path.resolve(import.meta.dir, '../List');
|
const outputSurgeDir = path.resolve(import.meta.dir, '../List');
|
||||||
const outputClashDir = path.resolve(import.meta.dir, '../Clash');
|
const outputClashDir = path.resolve(import.meta.dir, '../Clash');
|
||||||
|
|
||||||
|
const domainsetSrcFolder = 'domainset' + path.sep;
|
||||||
|
|
||||||
export const buildCommon = task(import.meta.main, import.meta.path)(async (span) => {
|
export const buildCommon = task(import.meta.main, import.meta.path)(async (span) => {
|
||||||
const promises: Array<Promise<unknown>> = [];
|
const promises: Array<Promise<unknown>> = [];
|
||||||
|
|
||||||
@ -48,7 +50,7 @@ export const buildCommon = task(import.meta.main, import.meta.path)(async (span)
|
|||||||
const relativePath = paths[i];
|
const relativePath = paths[i];
|
||||||
const fullPath = sourceDir + path.sep + relativePath;
|
const fullPath = sourceDir + path.sep + relativePath;
|
||||||
|
|
||||||
if (relativePath.startsWith('domainset/')) {
|
if (relativePath.startsWith(domainsetSrcFolder)) {
|
||||||
promises.push(transformDomainset(span, fullPath, relativePath));
|
promises.push(transformDomainset(span, fullPath, relativePath));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,9 +26,12 @@ export const buildPublic = task(import.meta.main, import.meta.path)(async (span)
|
|||||||
.traceAsyncFn(async () => {
|
.traceAsyncFn(async () => {
|
||||||
const trie = Trie.from(await new Fdir()
|
const trie = Trie.from(await new Fdir()
|
||||||
.withRelativePaths()
|
.withRelativePaths()
|
||||||
.exclude((dirName) => {
|
.exclude((dirName) => (
|
||||||
return dirName === 'node_modules' || dirName === 'Build' || dirName === 'public' || dirName[0] === '.';
|
dirName === 'node_modules'
|
||||||
})
|
|| dirName === 'Build'
|
||||||
|
|| dirName === 'public'
|
||||||
|
|| dirName[0] === '.'
|
||||||
|
))
|
||||||
.crawl(rootPath)
|
.crawl(rootPath)
|
||||||
.withPromise());
|
.withPromise());
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user