Skip to content

Commit

Permalink
Merge pull request #1146 from contentstack/revert-1126-fix/CS-42005
Browse files Browse the repository at this point in the history
Revert "fix: added pathValidator utility method"
  • Loading branch information
abhinav-from-contentstack authored Nov 6, 2023
2 parents 7d12114 + 4aba84d commit 4c9e87f
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 29 deletions.
4 changes: 1 addition & 3 deletions packages/contentstack-bootstrap/src/bootstrap/interactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const inquirer = require('inquirer');
import { cliux } from '@contentstack/cli-utilities';

import messageHandler from '../messages';
import { pathValidator } from '@contentstack/cli-utilities';

/**
* @description Inquire starter app
Expand Down Expand Up @@ -59,8 +58,7 @@ export async function inquireCloneDirectory(): Promise<string> {
message: messageHandler.parse('CLI_BOOTSTRAP_APP_COPY_SOURCE_CODE_DESTINATION_ENQUIRY'),
},
]);
pathValidator.validatePath(selectedCustomPath.path);
selectedCustomPath = path.normalize(selectedCustomPath.path);
selectedCustomPath = path.resolve(selectedCustomPath.path);
return selectedCustomPath;
}

Expand Down
1 change: 0 additions & 1 deletion packages/contentstack-bootstrap/src/bootstrap/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ const envFileHandler = async (
customHost = region.cma && region.cma.substring('8');
}
const production = environmentVariables.environment === 'production' ? true : false;
// Note: clonedDirectory is already sanitised.
switch (appConfigKey) {
case 'reactjs':
case 'reactjs-starter':
Expand Down
2 changes: 0 additions & 2 deletions packages/contentstack-bulk-publish/src/util/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const fs = require('fs');
const path = require('path');
const config = require('../config/index.js');
const chalk = require('chalk');
const { pathValidator } = require('@contentstack/cli-utilities');

function save(key, data) {
let bulkPublish = config ? config : {};
Expand Down Expand Up @@ -50,7 +49,6 @@ function get(key, filePath) {

function updateMissing(key, flags) {
let savedConfig;
pathValidator.validatePath(flags.config);
savedConfig = get(key, path.resolve(flags.config));
Object.keys(savedConfig).forEach((element) => {
if (flags[element] === undefined) {
Expand Down
2 changes: 0 additions & 2 deletions packages/contentstack-clone/src/lib/util/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var winston = require('winston');
var path = require('path');
var mkdirp = require('mkdirp');
var slice = Array.prototype.slice;
const { pathValidator } = require('@contentstack/cli-utilities');

function returnString(args) {
var returnStr = '';
Expand Down Expand Up @@ -42,7 +41,6 @@ var myCustomLevels = {
};

function init(_logPath, logfileName) {
pathValidator.validatePath(logfileName);
var logsDir = path.resolve(_logPath, 'logs', 'import');
// Create dir if doesn't already exist
mkdirp.sync(logsDir);
Expand Down
2 changes: 0 additions & 2 deletions packages/contentstack-migrate-rte/src/lib/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const {
isPlainObject,
} = require('lodash');
const Validator = require('jsonschema').Validator;
const { pathValidator } = require('@contentstack/cli-utilities');
const configSchema = require('./config_schema.json');
const { JSDOM } = require('jsdom');
const collapseWithSpace = require('collapse-whitespace');
Expand Down Expand Up @@ -89,7 +88,6 @@ async function getConfig(flags) {
let config;
if (flags['config-path']) {
const configPath = flags['config-path'];
pathValidator.validatePath(configPath);
config = require(nodePath.resolve(configPath));
} else {
config = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const Listr = require('listr');
const { resolve, extname } = require('path');
const { Command } = require('@contentstack/cli-command');
const { waterfall } = require('async');
const { pathValidator } = require('@contentstack/cli-utilities');
const { Parser } = require('../../../modules');
const { ActionList } = require('../../../actions');
const fs = require('fs');
Expand Down Expand Up @@ -130,14 +129,14 @@ class MigrationCommand extends Command {
}

async execSingleFile(filePath, mapInstance) {
try {
pathValidator.validatePath(filePath);
// Resolved absolute path
const resolvedMigrationPath = resolve(filePath);
// User provided migration function
const migrationFunc = require(resolvedMigrationPath);
// Resolved absolute path
const resolvedMigrationPath = resolve(filePath);
// User provided migration function
const migrationFunc = require(resolvedMigrationPath);

const parser = new Parser();
const parser = new Parser();

try {
const migrationParser = await parser.getMigrationParser(migrationFunc);
if (migrationParser.hasErrors) {
errorHelper(migrationParser.hasErrors);
Expand Down
1 change: 0 additions & 1 deletion packages/contentstack-utilities/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export { default as CLIError } from './cli-error';
export { default as messageHandler } from './message-handler';
export { default as authHandler } from './auth-handler';
export { default as configHandler } from './config-handler';
export { default as pathValidator } from './path-validator';
export {
default as managementSDKClient,
managementSDKInitiator,
Expand Down
10 changes: 0 additions & 10 deletions packages/contentstack-utilities/src/path-validator.ts

This file was deleted.

0 comments on commit 4c9e87f

Please sign in to comment.