include folder not being created

I am working on a monorepo, and the include folder is not created when running the transpiler
Solution:
and as i said before, i am working on a monorepo, so my project was being treated as a package because it matches the regex
const PACKAGE_REGEX = /^@[a-z0-9-]*\//;
const PACKAGE_REGEX = /^@[a-z0-9-]*\//;
...
Jump to solution
2 Replies
Felipe Lira
Felipe LiraOP2w ago
i solved the problem looking at the compiler code i found this function
const PACKAGE_REGEX = /^@[a-z0-9-]*\//;

export function createProjectData(tsConfigPath: string, projectOptions: ProjectOptions): ProjectData {
const projectPath = path.dirname(tsConfigPath);

const pkgJsonPath = ts.findPackageJson(projectPath, ts.sys as unknown as ts.LanguageServiceHost);
if (!pkgJsonPath) {
throw new ProjectError("Unable to find package.json");
}

let isPackage = false;
try {
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath).toString());
isPackage = PACKAGE_REGEX.test(pkgJson.name ?? "");
} catch {
// errors if no pkgJson, so assume not a package
}

// intentionally use || here for empty string case
projectOptions.includePath = path.resolve(projectOptions.includePath || path.join(projectPath, "include"));

const nodeModulesPath = path.join(path.dirname(pkgJsonPath), NODE_MODULES);

let rojoConfigPath: string | undefined;
// Checking truthiness covers empty string case
if (projectOptions.rojo) {
rojoConfigPath = path.resolve(projectOptions.rojo);
} else {
const { path, warnings } = RojoResolver.findRojoConfigFilePath(projectPath);
rojoConfigPath = path;
for (const warning of warnings) {
LogService.warn(warning);
}
}

return {
tsConfigPath,
isPackage,
nodeModulesPath,
projectOptions,
projectPath,
rojoConfigPath,
};
}
const PACKAGE_REGEX = /^@[a-z0-9-]*\//;

export function createProjectData(tsConfigPath: string, projectOptions: ProjectOptions): ProjectData {
const projectPath = path.dirname(tsConfigPath);

const pkgJsonPath = ts.findPackageJson(projectPath, ts.sys as unknown as ts.LanguageServiceHost);
if (!pkgJsonPath) {
throw new ProjectError("Unable to find package.json");
}

let isPackage = false;
try {
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath).toString());
isPackage = PACKAGE_REGEX.test(pkgJson.name ?? "");
} catch {
// errors if no pkgJson, so assume not a package
}

// intentionally use || here for empty string case
projectOptions.includePath = path.resolve(projectOptions.includePath || path.join(projectPath, "include"));

const nodeModulesPath = path.join(path.dirname(pkgJsonPath), NODE_MODULES);

let rojoConfigPath: string | undefined;
// Checking truthiness covers empty string case
if (projectOptions.rojo) {
rojoConfigPath = path.resolve(projectOptions.rojo);
} else {
const { path, warnings } = RojoResolver.findRojoConfigFilePath(projectPath);
rojoConfigPath = path;
for (const warning of warnings) {
LogService.warn(warning);
}
}

return {
tsConfigPath,
isPackage,
nodeModulesPath,
projectOptions,
projectPath,
rojoConfigPath,
};
}
Solution
Felipe Lira
Felipe Lira2w ago
and as i said before, i am working on a monorepo, so my project was being treated as a package because it matches the regex
const PACKAGE_REGEX = /^@[a-z0-9-]*\//;
const PACKAGE_REGEX = /^@[a-z0-9-]*\//;

Did you find this page helpful?