Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tscfc

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tscfc - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

45

dist/app.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.startApp = void 0;
const typescript_1 = __importDefault(require("typescript"));

@@ -20,9 +37,9 @@ const path_1 = __importDefault(require("path"));

/**
* @param tsFilesPath files to be checked
* @param sourceFilesPath files to be checked
* @param tsConfOptions with tsconf
*/
function checkFilesWithTSOptions(tsFilesPath, tsConfOptions) {
function checkFilesWithTSOptions(sourceFilesPath, tsConfOptions) {
// Obey 'node_modules/' files
const nodeModulesRE = new RegExp(/node_modules/);
const absolutePathsWithoutNodeModules = tsFilesPath
const absolutePathsWithoutNodeModules = sourceFilesPath
.filter(f => !nodeModulesRE.test(f))

@@ -38,3 +55,3 @@ .map(f => path_1.default.resolve(f));

const filename = dg.file.fileName;
if (tsFilesPath.includes(filename)) {
if (sourceFilesPath.includes(filename)) {
// File is included in inputFiles

@@ -90,3 +107,3 @@ if (filename in errorFiles) {

}
// TODO: Remove this function and use ts.sys.readDirectory(path, [".ts"])
// TODO: Remove this function and use ts.sys.readDirectory(path, [".ts"]) instead
function globFiles(dir, includeJSFiles) {

@@ -106,5 +123,5 @@ const files = typescript_1.default.sys.readDirectory(dir, includeJSFiles ? [".ts", ".js"] : [".ts"]);

}
function updateTSConf(tsconfPath, conf, filenames) {
function updateTSConf(tsconfPath, conf, sourceFilesPath) {
const absDirName = path_1.default.dirname(tsconfPath);
if (!fs_1.existsSync(tsconfPath)) {
if (!(0, fs_1.existsSync)(tsconfPath)) {
utils_1.reporters.throwError(errors_1.EError.TSCONF_NOT_EXISTS, `Provided path '${tsconfPath}' for tsconf doesn't exists`);

@@ -115,3 +132,3 @@ }

}
filenames.forEach(absPath => {
sourceFilesPath.forEach(absPath => {
const relPath = path_1.default.relative(absDirName, absPath);

@@ -122,3 +139,3 @@ if (!conf.files.includes(relPath)) {

});
fs_2.writeFileSync(tsconfPath, JSON.stringify(conf, null, 2));
(0, fs_2.writeFileSync)(tsconfPath, JSON.stringify(conf, null, 2));
}

@@ -125,0 +142,0 @@ function startApp(conf) {

@@ -13,3 +13,3 @@ #!/usr/bin/env node

const errors_1 = require("./errors");
const conf = yargs_parser_1.default(process.argv.slice(2));
const conf = (0, yargs_parser_1.default)(process.argv.slice(2));
if (conf.h || conf.help || conf._.length === 0) {

@@ -38,3 +38,3 @@ process.stdout.write("Usage: tscfc --project TSCONFIG_PATH SRC_PATH\n");

else {
app_1.startApp({
(0, app_1.startApp)({
shouldShowRemainings: conf.remaining || conf.r || false,

@@ -41,0 +41,0 @@ shouldUpdateFiles: conf.update || conf.u || false,

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EError = void 0;
var EError;

@@ -4,0 +5,0 @@ (function (EError) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.reporters = exports.colors = void 0;
exports.colors = {

@@ -4,0 +5,0 @@ red: (str) => `\u001b[31m${str}\u001b[39m`,

{
"name": "tscfc",
"version": "1.2.1",
"version": "1.3.0",
"description": "",

@@ -13,8 +13,8 @@ "main": "index.js",

"dependencies": {
"@types/glob": "^7.1.1",
"@types/node": "^12.7.1",
"@types/yargs-parser": "^13.1.0",
"glob": "^7.1.4",
"typescript": "^3.5.3",
"yargs-parser": "^14.0.0"
"@types/glob": "^8.0.0",
"@types/node": "^18.8.3",
"@types/yargs-parser": "^21.0.0",
"glob": "^8.0.3",
"typescript": "^4.8.4",
"yargs-parser": "^21.1.1"
},

@@ -24,3 +24,3 @@ "devDependencies": {},

"build": "tsc",
"test": "node ./dist/cli.js --verbose --project ./test/tsconfig.strict.json ./test/"
"test": "npm run build && node ./dist/cli.js --verbose --project ./test/tsconfig.strict.json ./test/"
},

@@ -27,0 +27,0 @@ "keywords": [],

@@ -10,3 +10,3 @@ # Tsconf Files Checker

- 2. Command `tscfc --update` will automatically include those files to tsconf
- 3. After that, each `tscfc --update` checks files against tsconf files (from step 2.) and tells user if someone is broken
- 3. After that, each `tscfc --update` checks files against tsconf files (from step 2.) and show user if anything is broken
- 3.1. If there are no broken files, then Ok. User's changes didn't affect any files in tsconf

@@ -22,2 +22,4 @@ - 3.2. If there are files without error, tscfc will add them to tsconf.

## Example
Run from terminal:

@@ -37,1 +39,29 @@

*Note: In order to check javascript files, please include `allowJS: true` to tsconfig.*
## Recommended Settings
If you want to incrementally enforce some rules (e.g. noImplicitAny, strictNullChecks) create
`tsconfig.strict.json` alongside with your `tsconfig.json`. Then add to `tsconfig.strict.json`:
```json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true
}
}
```
in package json add `pretest` script, which will automatically runs
before your test, to check if you broke something or not, even before test.
```json
{
//...
"scripts": {
"pretest": "tscfc --project ./tsconfig.strict.json ./src"
}
//...
}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc