Skip to content

Commit

Permalink
Merge pull request #1290 from contentstack/staging
Browse files Browse the repository at this point in the history
Sprint 51 Release
  • Loading branch information
aman19K authored Feb 12, 2024
2 parents 3fac956 + 0218452 commit 6dc4a5b
Show file tree
Hide file tree
Showing 70 changed files with 565 additions and 734 deletions.
582 changes: 79 additions & 503 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/contentstack-audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
$ csdx COMMAND
running command...
$ csdx (--version|-v)
@contentstack/cli-audit/1.3.4 darwin-arm64 node-v18.12.1
@contentstack/cli-audit/1.3.5 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-audit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-audit",
"version": "1.3.4",
"version": "1.3.5",
"description": "Contentstack audit plugin",
"author": "Contentstack CLI",
"homepage": "https://github.com/contentstack/cli",
Expand Down Expand Up @@ -31,7 +31,7 @@
},
"devDependencies": {
"@contentstack/cli-dev-dependencies": "^1.2.4",
"@oclif/test": "^2.0.3",
"@oclif/test": "^2.5.6",
"@types/chai": "^4.3.5",
"@types/fs-extra": "^11.0.2",
"@types/mocha": "^10.0.6",
Expand Down
13 changes: 0 additions & 13 deletions packages/contentstack-audit/src/audit-base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
* `gfSchema`. The values of these properties are the parsed JSON data from two different files.
*/
getCtAndGfSchema() {
const modules = this.sharedConfig.flags.modules || this.sharedConfig.modules;
const ctPath = join(
this.sharedConfig.basePath,
this.sharedConfig.moduleConfig['content-types'].dirName,
Expand All @@ -176,18 +175,6 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
this.sharedConfig.moduleConfig['global-fields'].fileName,
);

if (modules.includes('content-types')) {
if (!existsSync(ctPath)) {
this.log(this.$t(auditMsg.NOT_VALID_PATH, { path: ctPath }), 'error');
}
}

if (modules.includes('global-fields')) {
if (!existsSync(gfPath)) {
this.log(this.$t(auditMsg.NOT_VALID_PATH, { path: ctPath }), 'error');
}
}

const gfSchema = existsSync(gfPath) ? (JSON.parse(readFileSync(gfPath, 'utf8')) as ContentTypeStruct[]) : [];
const ctSchema = existsSync(ctPath) ? (JSON.parse(readFileSync(ctPath, 'utf8')) as ContentTypeStruct[]) : [];

Expand Down
4 changes: 3 additions & 1 deletion packages/contentstack-audit/src/modules/content-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export default class ContentType {
this.inMemoryFix = returnFixSchema;

if (!existsSync(this.folderPath)) {
throw new Error($t(auditMsg.NOT_VALID_PATH, { path: this.folderPath }));
this.log(`Skipping ${this.moduleName} audit`, 'warn');
this.log($t(auditMsg.NOT_VALID_PATH, { path: this.folderPath }), { color: 'yellow' });
return returnFixSchema ? [] : {};
}

this.schema = this.moduleName === 'content-types' ? this.ctSchema : this.gfSchema;
Expand Down
11 changes: 8 additions & 3 deletions packages/contentstack-audit/src/modules/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ export default class Entries {
*/
async run() {
if (!existsSync(this.folderPath)) {
throw new Error($t(auditMsg.NOT_VALID_PATH, { path: this.folderPath }));
this.log(`Skipping ${this.moduleName} audit`, 'warn');
this.log($t(auditMsg.NOT_VALID_PATH, { path: this.folderPath }), { color: 'yellow' });
return {};
}

await this.prepareEntryMetaData();
Expand Down Expand Up @@ -799,8 +801,11 @@ export default class Entries {
const localesFolderPath = resolve(this.config.basePath, this.config.moduleConfig.locales.dirName);
const localesPath = join(localesFolderPath, this.config.moduleConfig.locales.fileName);
const masterLocalesPath = join(localesFolderPath, 'master-locale.json');
this.locales = values(JSON.parse(readFileSync(masterLocalesPath, 'utf8')));
this.locales.push(...values(JSON.parse(readFileSync(localesPath, 'utf8'))));
this.locales = existsSync(masterLocalesPath) ? values(JSON.parse(readFileSync(masterLocalesPath, 'utf8'))) : [];

if (existsSync(localesPath)) {
this.locales.push(...values(JSON.parse(readFileSync(localesPath, 'utf8'))));
}

for (const { code } of this.locales) {
for (const { uid } of this.ctSchema) {
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"devDependencies": {
"@fancy-test/nock": "^0.1.1",
"@oclif/plugin-help": "^5.1.19",
"@oclif/test": "^2.2.10",
"@oclif/test": "^2.5.6",
"@types/chai": "^4.2.18",
"@types/inquirer": "^9.0.3",
"@types/mkdirp": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-auth/test/integration/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const messageFilePath = path.join(__dirname, '..', '..', '..', 'contentstack-uti
const crypto = new NodeCrypto({
typeIdentifier: '◈',
algorithm: 'aes-192-cbc',
encryptionKey: process.env.ENCRYPTION_KEY || '***REMOVED***'
encryptionKey: process.env.ENCRYPTION_KEY || 'gjh67567mn'
});
const username = process.env.ENCRYPTION_KEY ? crypto.decrypt(process.env.USERNAME) : process.env.USERNAME
const password = process.env.ENCRYPTION_KEY ? crypto.decrypt(process.env.PASSWORD) : process.env.PASSWORD
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-auth/test/unit/auth-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { authHandler, interactive } from '../../src/utils';
import { CLIError, cliux } from '@contentstack/cli-utilities';
import { User } from '../../src/interfaces';

const user: User = { email: '***REMOVED***', authtoken: 'testtoken' };
const credentials = { email: '***REMOVED***', password: 'testpassword' };
const invalidCredentials = { email: '***REMOVED***', password: 'invalidpassword' };
const user: User = { email: '[email protected]', authtoken: 'testtoken' };
const credentials = { email: '[email protected]', password: 'testpassword' };
const invalidCredentials = { email: '[email protected]', password: 'invalidpassword' };
let TFAEnabled = false;
let TFAChannel = 'authy';
const TFATestToken = '24563992';
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-auth/test/unit/commands/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { configHandler, cliux } from '@contentstack/cli-utilities';

const config = configHandler;

const user = { email: '***REMOVED***', authtoken: 'testtoken' };
const credentials = { email: '***REMOVED***', password: 'testpassword' };
const invalidCredentials = { email: '***REMOVED***', password: 'invalidpassword' };
const user = { email: '[email protected]', authtoken: 'testtoken' };
const credentials = { email: '[email protected]', password: 'testpassword' };
const invalidCredentials = { email: '[email protected]', password: 'invalidpassword' };
const TFATestToken = '24563992';

describe('Login Command', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import LogoutCommand from '../../../src/commands/auth/logout';
import { authHandler } from '../../../src/utils';
import { CLIError, cliux } from '@contentstack/cli-utilities';

const user = { email: '***REMOVED***', authtoken: 'testtoken' };
const user = { email: '[email protected]', authtoken: 'testtoken' };
const validAuthToken = 'bltadjkjdkjfd';

describe('Logout Command', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Tokens Add Command', () => {
let environmentTokenValidationStub;
let printStub;
const validAPIKey = 'adasdfagsf';
const validDeliveryToken = 'cdae3493fkdflklssw';
const validDeliveryToken = '***REMOVED***';
const validmanagementToken = 'cmajhsd98939482';
const validEnvironment = 'textenv';

Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-auth/test/unit/commands/whoami.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('Whoami Command', () => {
let getEmailStub;
before(function () {
getEmailStub = sinon.stub(WhoamiCommand.prototype, 'email').get(function getterFn() {
return '***REMOVED***';
return '[email protected]';
});
});

Expand All @@ -17,7 +17,7 @@ describe('Whoami Command', () => {

it('Logged in user, displays the username', async function () {
const getEmailStub = sinon.stub(WhoamiCommand.prototype, 'email').get(function getterFn() {
return '***REMOVED***';
return '[email protected]';
});
const successMessageStub = sinon.stub(cliux, 'print').returns();
await WhoamiCommand.run([]);
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-bootstrap",
"description": "Bootstrap contentstack apps",
"version": "1.7.1",
"version": "1.8.0",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"scripts": {
Expand All @@ -25,7 +25,7 @@
"tar": "^6.1.13"
},
"devDependencies": {
"@oclif/test": "^2.2.10",
"@oclif/test": "^2.5.6",
"@types/inquirer": "^9.0.3",
"@types/mkdirp": "^1.0.1",
"@types/node": "^14.14.32",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Stream } from 'stream';
import * as zlib from 'zlib';
import * as tar from 'tar';
import * as mkdirp from 'mkdirp';
const mkdirp = require('mkdirp')
import { HttpRequestConfig, HttpClient } from '@contentstack/cli-utilities';

import GithubError from './github-error';
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bootstrap/src/bootstrap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default class Bootstrap {

if (this.options.livePreviewEnabled) {
cliux.print(
'Important: set management token and app host in the environment file before running the application',
'Note: Before running the app, please configure a preview token, preview host, and app host in the environment file',
{
color: 'yellow',
},
Expand Down
11 changes: 11 additions & 0 deletions packages/contentstack-bootstrap/src/bootstrap/interactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,14 @@ export async function inquireLivePreviewSupport() {
});
return livePreviewEnabled;
}

export async function continueBootstrapCommand() {
const { shouldContinue } = await inquirer.prompt({
type: 'list',
name: 'shouldContinue',
message: `To continue with the Bootstrap command without Live Preview, please select Yes.`,
choices: ['yes', 'no'],
loop: false,
});
return shouldContinue;
}
Loading

0 comments on commit 6dc4a5b

Please sign in to comment.