Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wshcmx/cli",
"version": "3.3.0",
"version": "3.4.0",
"main": "dist/index.js",
"type": "module",
"repository": "github:wshcmx/cli",
Expand Down
34 changes: 0 additions & 34 deletions src/core/build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import fs from 'node:fs';
import { dirname, extname, normalize, resolve } from 'node:path';

import ts from 'typescript';

import { enumsToObjects } from '../transformers/enums_to_objects.js';
Expand Down Expand Up @@ -35,37 +32,6 @@ export function buildTypescriptFiles(configuration: ts.ParsedCommandLine) {
return emitResult;
}

export function collectNonTypescriptFiles(configuration: ts.ParsedCommandLine) {
const { outDir } = configuration.options;

if (outDir === undefined) {
throw new Error('The outDir option is not set in the tsconfig.json file.');
}

if (process.versions.node.split('.')[0] < '22') {
throw new Error('The watch mode for non TypeScript files is available only since Node.js v22');
}

const { exclude, files, include } = configuration.raw;
const configFilePath = typeof configuration.options.configFilePath === 'string'
? configuration.options.configFilePath
: resolve('tsconfig.json');
const configDirectoryPath = dirname(configFilePath);
const includePatterns = Array.isArray(include) ? include.filter((pattern): pattern is string => typeof pattern === 'string') : [];
const filePatterns = Array.isArray(files) ? files.filter((pattern): pattern is string => typeof pattern === 'string') : [];
const excludePatterns = Array.isArray(exclude) ? exclude.filter((pattern): pattern is string => typeof pattern === 'string') : [];
const fileNames = new Set(configuration.fileNames.map((fileName) => normalize(fileName)));
const normalizedExclude = new Set(excludePatterns.map((filePath) => normalize(resolve(configDirectoryPath, filePath))));
const compilableExtensions = new Set(['.js', '.jsx', '.ts', '.tsx']);

return fs.globSync([...includePatterns, ...filePatterns], { cwd: configDirectoryPath })
.map((filePath: string) => normalize(resolve(configDirectoryPath, filePath)))
.filter((filePath: string) => !fileNames.has(filePath))
.filter((filePath: string) => !normalizedExclude.has(filePath))
.filter((filePath: string) => !compilableExtensions.has(extname(filePath)))
.filter((filePath: string) => fs.statSync(filePath).isFile());
}

function reportDiagnostic(diagnostic: ts.Diagnostic) {
if (diagnostic.file) {
const { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start!);
Expand Down
18 changes: 0 additions & 18 deletions test/core/build/build.test.js

This file was deleted.

1 change: 0 additions & 1 deletion test/core/build/fixture/lib/lib.ts

This file was deleted.

1 change: 0 additions & 1 deletion test/core/build/fixture/src/exclude_submodule.ts

This file was deleted.

1 change: 0 additions & 1 deletion test/core/build/fixture/src/main.ts

This file was deleted.

1 change: 0 additions & 1 deletion test/core/build/fixture/src/template.xml

This file was deleted.

17 changes: 0 additions & 17 deletions test/core/build/fixture/tsconfig.json

This file was deleted.