File tree Expand file tree Collapse file tree 4 files changed +4
-13
lines changed
Expand file tree Collapse file tree 4 files changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -42,10 +42,7 @@ export async function Build(OptionsParam?: BuildOptions): Promise<void> {
4242 }
4343 }
4444
45- let ProjectRoot = Process . cwd ( )
46- if ( Process . cwd ( ) . endsWith ( '/builder' ) ) {
47- ProjectRoot = Process . cwd ( ) + '/..'
48- }
45+ let ProjectRoot = Process . env . INIT_CWD ? Process . env . INIT_CWD : Process . cwd ( )
4946
5047 const Banner = CreateBanner ( {
5148 Version : Options . Version ?? ( await PackageJson . load ( ProjectRoot ) ) . content . version ?? '0.0.0' ,
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import * as Fs from 'node:fs'
33import * as Process from 'node:process'
44import { FetchAdShieldDomains } from './references/index.js'
55
6- const CachePath = Process . cwd ( ) + '/.buildcache'
6+ const CachePath = ( Process . env . INIT_CWD ? Process . env . INIT_CWD : Process . cwd ( ) ) + '/.buildcache'
77const CacheDomainsPath = CachePath + '/domains.json'
88
99export function CreateCache ( Domains : Set < string > ) {
Original file line number Diff line number Diff line change @@ -6,10 +6,7 @@ import * as Fs from 'node:fs'
66import { RunDebugServer } from './utils/http-server.js'
77import { Build } from './build.js'
88
9- let ProjectRoot = Process . cwd ( )
10- if ( Process . cwd ( ) . endsWith ( '/builder' ) ) {
11- ProjectRoot = Process . cwd ( ) . replaceAll ( / \/ b u i l d e r $ / g, '' )
12- }
9+ let ProjectRoot = Process . env . INIT_CWD ? Process . env . INIT_CWD : Process . cwd ( )
1310const WatchingGlob = [ ] ;
1411[ 'builder/' , 'userscript/' , '' ] . forEach ( Dir => {
1512 WatchingGlob . push ( ...Fs . globSync ( `${ ProjectRoot } /${ Dir } source/**/*.ts` ) )
Original file line number Diff line number Diff line change @@ -9,10 +9,7 @@ function IsLoopBack(IP: string) {
99
1010export function RunDebugServer ( Port : number , FileName : string [ ] , ShouldPreventHTTPResponse : boolean ) {
1111 const HTTPServer = HTTP . createServer ( ( Req , Res ) => {
12- let ProjectRoot = Process . cwd ( )
13- if ( Process . cwd ( ) . endsWith ( '/builder' ) ) {
14- ProjectRoot = Process . cwd ( ) + '/..'
15- }
12+ let ProjectRoot = Process . env . INIT_CWD ? Process . env . INIT_CWD : Process . cwd ( )
1613 const RequestPath = Req . url ?. substring ( 1 ) || ''
1714 const ResolvedPath = Path . resolve ( ProjectRoot + '/dist' , RequestPath )
1815 const RelativePath = Path . relative ( ProjectRoot + '/dist' , ResolvedPath )
You can’t perform that action at this time.
0 commit comments