Skip to content

Commit

Permalink
fix(path): fix project loading problem when execute on win32
Browse files Browse the repository at this point in the history
  • Loading branch information
imjuni committed Feb 25, 2024
1 parent 97ed4d4 commit c79c656
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# These are supported funding model platforms

github: [imjuni]
patreon: # Replace with a single Patreon username
open_collective: #
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: # Replace with a single custom sponsorship URL
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest, windows-latest
runs-on: [ubuntu-latest, windows-latest]

strategy:
matrix:
Expand Down
3 changes: 1 addition & 2 deletions src/compilers/getTypeScriptConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { posixResolve } from '#/modules/path/modules/posixResolve';
import path from 'node:path';
import * as tsm from 'ts-morph';

Expand All @@ -8,7 +7,7 @@ import * as tsm from 'ts-morph';
* @param project - project directory
*/
export function getTypeScriptConfig(project: string): tsm.ts.ParsedCommandLine {
const resolvedProjectPath = posixResolve(project);
const resolvedProjectPath = path.resolve(project);
const parseConfigHost: tsm.ts.ParseConfigHost = {
fileExists: tsm.ts.sys.fileExists.bind(tsm.ts),
readFile: tsm.ts.sys.readFile.bind(tsm.ts),
Expand Down
2 changes: 1 addition & 1 deletion src/configs/getExtendOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { settify } from 'my-easy-fp';
import { getDirname, isDescendant, replaceSepToPosix } from 'my-node-fp';

export async function getExtendOptions(project: string): Promise<IExtendOptions> {
const projectPath = replaceSepToPosix(posixResolve(project));
const projectPath = posixResolve(project);
const tsconfig = getTypeScriptConfig(projectPath);
const resolvedProjectDirPath = replaceSepToPosix(await getDirname(projectPath));

Expand Down
10 changes: 5 additions & 5 deletions src/configs/transforms/createBuildOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { transformCreateMode } from '#/configs/transforms/transformCreateMode';
import { transformModuleMode } from '#/configs/transforms/transformModuleMode';
import { getTsExcludeFiles } from '#/modules/file/getTsExcludeFiles';
import { getTsIncludeFiles } from '#/modules/file/getTsIncludeFiles';
import { posixResolve } from '#/modules/path/modules/posixResolve';
import { toArray } from 'my-easy-fp';
import path from 'node:path';
import type { ArgumentsCamelCase } from 'yargs';

export async function createBuildOptions(
Expand Down Expand Up @@ -44,7 +44,7 @@ export async function createBuildOptions(
options.options = await Promise.all(
options.options.map(async (option) => {
if (option.mode === CE_CTIX_BUILD_MODE.MODULE_MODE) {
const projectPath = posixResolve(option.project);
const projectPath = path.resolve(option.project);
const tsconfig = getTypeScriptConfig(projectPath);

const moduleMode = await transformModuleMode(
Expand All @@ -66,7 +66,7 @@ export async function createBuildOptions(
}

if (option.mode === CE_CTIX_BUILD_MODE.CREATE_MODE) {
const projectPath = posixResolve(option.project);
const projectPath = path.resolve(option.project);
const tsconfig = getTypeScriptConfig(projectPath);

const createMode = await transformCreateMode(
Expand All @@ -87,7 +87,7 @@ export async function createBuildOptions(
return createMode;
}

const projectPath = posixResolve(option.project);
const projectPath = path.resolve(option.project);
const tsconfig = getTypeScriptConfig(projectPath);

const bundleMode = transformBundleMode(
Expand All @@ -111,7 +111,7 @@ export async function createBuildOptions(
return options;
}

const projectPath = posixResolve(argv.project);
const projectPath = path.resolve(argv.project);
const tsconfig = getTypeScriptConfig(projectPath);

const include =
Expand Down
3 changes: 2 additions & 1 deletion src/modules/file/ProjectContainer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getTypeScriptProject } from '#/compilers/getTypeScriptProject';
import path from 'node:path';
import type * as tsm from 'ts-morph';

export class ProjectContainer {
Expand Down Expand Up @@ -53,7 +54,7 @@ export class ProjectContainer {
}

const loadedProject = getTypeScriptProject({
tsConfigFilePath: projectPath,
tsConfigFilePath: path.resolve(projectPath),
});

this.#projects.set(projectPath, loadedProject);
Expand Down

0 comments on commit c79c656

Please sign in to comment.