Socket
Socket
Sign inDemoInstall

recursive-directory-case-changer

Package Overview
Dependencies
6
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

dist/program.d.ts

6

dist/cli.d.ts

@@ -0,2 +1,8 @@

#!/usr/bin/env node
/**
* > Please make sure that your file(s) referenced in bin starts with #!/usr/bin/env node.
* > Otherwise the scripts are started without the node executable!
* [npm bin](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#bin)
*/
export {};
//# sourceMappingURL=cli.d.ts.map

55

dist/cli.js

@@ -0,50 +1,11 @@

#!/usr/bin/env node
"use strict";
/* eslint-disable @typescript-eslint/no-explicit-any */
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
/**
* > Please make sure that your file(s) referenced in bin starts with #!/usr/bin/env node.
* > Otherwise the scripts are started without the node executable!
* [npm bin](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#bin)
*/
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
const case_type_1 = require("./case-type");
const recursive_directory_case_changer_1 = require("./recursive-directory-case-changer");
function validateDirs(dirs) {
if (!Array.isArray(dirs))
throw new Error('Dirs is not an array.');
if (!dirs.length)
throw new Error('Dirs is empty.');
}
function processOptions(options) {
if (!options.caseType)
throw new Error('Case type not specified.');
return {
caseType: options.caseType,
shouldAdjustImportAndExportStatements: options.shouldAdjustImportAndExportStatements === 'true'
};
}
commander_1.program
.version('0.0.0')
.command('execute', { isDefault: true })
.addOption(new commander_1.Option('-c, --case-type <caseType>', 'Case type to change to.')
.choices(Object.values(case_type_1.CaseType))
.default(case_type_1.CaseType.KebabCase))
.addOption(new commander_1.Option('-a, --adjust <boolean>', 'Adjust import and export statements.')
.choices(['true', 'false'])
.default('true'))
.argument('<dirs...>')
.action(async function (dirs, opts) {
validateDirs(dirs);
const options = processOptions(opts);
console.info('Changing case of directories: %s', dirs.join(', '));
await Promise.all(dirs.map((dir) => {
if (!fs_extra_1.default.existsSync(dir))
return console.error('Directory %s does not exist.', dir);
else
return (0, recursive_directory_case_changer_1.recursiveDirectoryCaseChanger)(options.caseType, path_1.default.resolve(dir))
.then(() => console.info('Done.'))
.catch((err) => console.error('Something went wrong: ', err));
}));
});
commander_1.program.parse(process.argv);
const program_1 = require("./program");
program_1.program.parse();
//# sourceMappingURL=cli.js.map
{
"name": "recursive-directory-case-changer",
"version": "0.1.1",
"version": "0.1.2",
"keywords": [

@@ -5,0 +5,0 @@ "recursive",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc