diff --git a/.talismanrc b/.talismanrc index 8b3510206f..2430771d64 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,4 +1,4 @@ fileignoreconfig: - - filename: pnpm-lock.yaml - checksum: 9adb49c9ba560758c6d4550fd318c53554534c3f883ba6b824c1a4338d2f50a7 + - filename: packages/contentstack/README.md + checksum: 1846c4aefe667bf30c352009ac7aa90f6f966af5a9dfc71c4b5a7c66cd444c9c version: '1.0' diff --git a/eslint.config.base.js b/eslint.config.base.js new file mode 100644 index 0000000000..7a9d1d4da9 --- /dev/null +++ b/eslint.config.base.js @@ -0,0 +1,15 @@ +import tseslint from 'typescript-eslint'; + +export const typescriptConfig = tseslint.configs.recommended; + +export const baseRules = { + eqeqeq: ['error', 'smart'], + 'id-match': 'error', + 'no-eval': 'error', + 'no-var': 'error', + '@typescript-eslint/no-unused-vars': ['error', { args: 'none' }], + '@typescript-eslint/prefer-namespace-keyword': 'error', + semi: 'off', + '@typescript-eslint/no-redeclare': 'off', + '@typescript-eslint/no-explicit-any': 'off', +}; diff --git a/packages/contentstack-auth/.eslintignore b/packages/contentstack-auth/.eslintignore deleted file mode 100644 index 72d230bac9..0000000000 --- a/packages/contentstack-auth/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -# Build files -./lib \ No newline at end of file diff --git a/packages/contentstack-auth/.eslintrc b/packages/contentstack-auth/.eslintrc deleted file mode 100644 index 7b112a1df8..0000000000 --- a/packages/contentstack-auth/.eslintrc +++ /dev/null @@ -1,36 +0,0 @@ -{ - "env": { - "node": true - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.json", - "sourceType": "module" - }, - "extends": [ - "plugin:@typescript-eslint/recommended" - ], - "rules": { - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - "args": "none" - } - ], - "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/quotes": "off", - "semi": "off", - "@typescript-eslint/type-annotation-spacing": "off", - "@typescript-eslint/no-redeclare": "off", - "eqeqeq": [ - "error", - "smart" - ], - "id-match": "error", - "no-eval": "error", - "no-var": "error", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unsafe-function-type": "off" - } -} \ No newline at end of file diff --git a/packages/contentstack-auth/README.md b/packages/contentstack-auth/README.md index 21e157a7ff..69ad0517d0 100644 --- a/packages/contentstack-auth/README.md +++ b/packages/contentstack-auth/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-auth/1.8.0 darwin-arm64 node-v22.13.1 +@contentstack/cli-auth/1.8.1 darwin-arm64 node-v24.14.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-auth/eslint.config.js b/packages/contentstack-auth/eslint.config.js new file mode 100644 index 0000000000..26de1c803a --- /dev/null +++ b/packages/contentstack-auth/eslint.config.js @@ -0,0 +1,17 @@ +import { typescriptConfig, baseRules } from '../../eslint.config.base.js'; + +export default [ + ...typescriptConfig, + { + files: ['src/**/*.ts'], + rules: { + ...baseRules, + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/quotes': 'off', + '@typescript-eslint/type-annotation-spacing': 'off', + }, + }, + { + ignores: ['lib/**'], + }, +]; diff --git a/packages/contentstack-auth/package.json b/packages/contentstack-auth/package.json index 5184d2ada5..395d4f242f 100644 --- a/packages/contentstack-auth/package.json +++ b/packages/contentstack-auth/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli-auth", "description": "Contentstack CLI plugin for authentication activities", - "version": "1.8.1", + "version": "1.8.2", "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "scripts": { @@ -15,10 +15,9 @@ "lint": "eslint src/**/*.ts" }, "dependencies": { - "@contentstack/cli-command": "~1.8.1", - "@contentstack/cli-utilities": "~1.18.2", + "@contentstack/cli-command": "~1.8.2", + "@contentstack/cli-utilities": "~1.18.3", "@oclif/core": "^4.10.5", - "@oclif/plugin-help": "^6.2.44", "otplib": "^12.0.1" }, "overrides": { @@ -27,20 +26,18 @@ } }, "devDependencies": { - "@fancy-test/nock": "^0.1.1", - "@oclif/plugin-help": "^6.2.28", "@oclif/test": "^4.1.13", "@types/chai": "^4.3.20", - "@types/mkdirp": "^1.0.2", "@types/mocha": "^8.2.3", "@types/node": "^14.18.63", "@types/sinon": "^21.0.0", "chai": "^4.5.0", "dotenv": "^16.4.7", - "eslint": "^8.57.1", + "eslint": "^9.26.0", "eslint-config-oclif": "^5.2.2", "eslint-config-oclif-typescript": "^3.1.14", "mocha": "10.8.2", + "nock": "^13.5.6", "nyc": "^15.1.0", "oclif": "^4.17.46", "sinon": "^21.0.1", diff --git a/packages/contentstack-auth/src/interfaces/index.ts b/packages/contentstack-auth/src/interfaces/index.ts index d0bcde92f4..9be0dc0f42 100644 --- a/packages/contentstack-auth/src/interfaces/index.ts +++ b/packages/contentstack-auth/src/interfaces/index.ts @@ -1,4 +1,3 @@ -// eslint-disable-next-line @typescript-eslint/no-redeclare export interface AuthOptions { contentstackClient: any; } diff --git a/packages/contentstack-command/.eslintignore b/packages/contentstack-command/.eslintignore deleted file mode 100644 index 72d230bac9..0000000000 --- a/packages/contentstack-command/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -# Build files -./lib \ No newline at end of file diff --git a/packages/contentstack-command/.eslintrc b/packages/contentstack-command/.eslintrc deleted file mode 100644 index cd91b82a66..0000000000 --- a/packages/contentstack-command/.eslintrc +++ /dev/null @@ -1,31 +0,0 @@ -{ - "env": { - "node": true - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.json", - "sourceType": "module" - }, - "extends": [ - "plugin:@typescript-eslint/recommended" - ], - "rules": { - "@typescript-eslint/no-unused-vars": [ - "error", - { - "args": "none" - } - ], - "@typescript-eslint/prefer-namespace-keyword": "error", - "semi": "off", - "@typescript-eslint/no-redeclare": "off", - "eqeqeq": [ - "error", - "smart" - ], - "id-match": "error", - "no-eval": "error", - "no-var": "error" - } -} \ No newline at end of file diff --git a/packages/contentstack-command/eslint.config.js b/packages/contentstack-command/eslint.config.js new file mode 100644 index 0000000000..000cf19a89 --- /dev/null +++ b/packages/contentstack-command/eslint.config.js @@ -0,0 +1,12 @@ +import { typescriptConfig, baseRules } from '../../eslint.config.base.js'; + +export default [ + ...typescriptConfig, + { + files: ['src/**/*.ts'], + rules: baseRules, + }, + { + ignores: ['lib/**'], + }, +]; diff --git a/packages/contentstack-command/package.json b/packages/contentstack-command/package.json index 8ce563172f..0c267b1763 100644 --- a/packages/contentstack-command/package.json +++ b/packages/contentstack-command/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli-command", "description": "Contentstack CLI plugin for configuration", - "version": "1.8.1", + "version": "1.8.2", "author": "Contentstack", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -14,10 +14,9 @@ "lint": "eslint src/**/*.ts" }, "dependencies": { - "@contentstack/cli-utilities": "~1.18.2", + "@contentstack/cli-utilities": "~1.18.3", "contentstack": "^3.27.0", - "@oclif/core": "^4.10.5", - "@oclif/plugin-help": "^6.2.28" + "@oclif/core": "^4.10.5" }, "overrides": { "@oclif/core": { @@ -26,10 +25,9 @@ }, "devDependencies": { "@oclif/test": "^4.1.13", - "@types/mkdirp": "^1.0.2", "@types/mocha": "^8.2.3", "@types/node": "^14.18.63", - "eslint": "^8.57.1", + "eslint": "^9.26.0", "eslint-config-oclif": "^6.0.15", "eslint-config-oclif-typescript": "^3.1.13", "mocha": "10.8.2", diff --git a/packages/contentstack-config/.eslintignore b/packages/contentstack-config/.eslintignore deleted file mode 100644 index 72d230bac9..0000000000 --- a/packages/contentstack-config/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -# Build files -./lib \ No newline at end of file diff --git a/packages/contentstack-config/.eslintrc b/packages/contentstack-config/.eslintrc deleted file mode 100644 index 25135802f1..0000000000 --- a/packages/contentstack-config/.eslintrc +++ /dev/null @@ -1,34 +0,0 @@ -{ - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:mocha/recommended"], - "parser": "@typescript-eslint/parser", - "plugins": ["@typescript-eslint", "mocha"], - "rules": { - "unicorn/no-abusive-eslint-disable": "off", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/ban-ts-ignore": "off", - "indent": "off", - "object-curly-spacing": "off", - "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], - "mocha/no-async-describe": "off", - "mocha/no-identical-title": "off", - "mocha/no-mocha-arrows": "off", - "mocha/no-setup-in-describe": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-var-requires": "off", - "prefer-const": "error", - "no-fallthrough": "error", - "no-prototype-builtins": "off" - }, - "env": { - "node": true, - "mocha": true - }, - "overrides": [ - { - "files": ["*.d.ts"], - "rules": { - "@typescript-eslint/no-explicit-any": "off" - } - } - ] -} diff --git a/packages/contentstack-config/README.md b/packages/contentstack-config/README.md index e39ce4a065..aab6ff8958 100644 --- a/packages/contentstack-config/README.md +++ b/packages/contentstack-config/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-config/1.20.1 darwin-arm64 node-v22.13.1 +@contentstack/cli-config/1.20.2 darwin-arm64 node-v24.14.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-config/eslint.config.js b/packages/contentstack-config/eslint.config.js new file mode 100644 index 0000000000..722ed43da6 --- /dev/null +++ b/packages/contentstack-config/eslint.config.js @@ -0,0 +1,43 @@ +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import mochaPlugin from 'eslint-plugin-mocha'; +import { FlatCompat } from '@eslint/eslintrc'; +import { baseRules } from '../../eslint.config.base.js'; + +const compat = new FlatCompat(); + +export default [ + eslint.configs.recommended, + ...tseslint.configs.recommended, + ...compat.config(mochaPlugin.configs.recommended), + { + files: ['src/**/*.ts', 'test/**/*.ts'], + rules: { + ...baseRules, + 'unicorn/no-abusive-eslint-disable': 'off', + '@typescript-eslint/no-use-before-define': 'off', + '@typescript-eslint/ban-ts-ignore': 'off', + indent: 'off', + 'object-curly-spacing': 'off', + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + 'mocha/no-async-describe': 'off', + 'mocha/no-identical-title': 'off', + 'mocha/no-mocha-arrows': 'off', + 'mocha/no-setup-in-describe': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-var-requires': 'off', + 'prefer-const': 'error', + 'no-fallthrough': 'error', + 'no-prototype-builtins': 'off', + }, + }, + { + files: ['*.d.ts'], + rules: { + '@typescript-eslint/no-explicit-any': 'off', + }, + }, + { + ignores: ['lib/**'], + }, +]; diff --git a/packages/contentstack-config/package.json b/packages/contentstack-config/package.json index 0201bba2a9..513e04ddbc 100644 --- a/packages/contentstack-config/package.json +++ b/packages/contentstack-config/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli-config", "description": "Contentstack CLI plugin for configuration", - "version": "1.20.2", + "version": "1.20.3", "author": "Contentstack", "scripts": { "build": "pnpm compile && oclif manifest && oclif readme", @@ -14,12 +14,10 @@ "lint": "eslint src/**/*.ts" }, "dependencies": { - "@contentstack/cli-command": "~1.8.1", - "@contentstack/cli-utilities": "~1.18.2", + "@contentstack/cli-command": "~1.8.2", + "@contentstack/cli-utilities": "~1.18.3", "@contentstack/utils": "~1.9.1", - "@oclif/core": "^4.8.3", - "@oclif/plugin-help": "^6.2.28", - "lodash": "^4.18.1" + "@oclif/core": "^4.8.3" }, "overrides": { "@oclif/core": { @@ -33,7 +31,7 @@ "@types/node": "^14.18.63", "@types/sinon": "^21.0.0", "chai": "^4.5.0", - "eslint": "^8.57.1", + "eslint": "^9.26.0", "eslint-config-oclif": "^6.0.62", "eslint-config-oclif-typescript": "^3.1.14", "mocha": "10.8.2", diff --git a/packages/contentstack-utilities/.eslintignore b/packages/contentstack-utilities/.eslintignore deleted file mode 100644 index 72d230bac9..0000000000 --- a/packages/contentstack-utilities/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -# Build files -./lib \ No newline at end of file diff --git a/packages/contentstack-utilities/.eslintrc b/packages/contentstack-utilities/.eslintrc deleted file mode 100644 index b9fcf5f446..0000000000 --- a/packages/contentstack-utilities/.eslintrc +++ /dev/null @@ -1,36 +0,0 @@ -{ - "env": { - "node": true - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.json", - "sourceType": "module" - }, - "extends": [ - "plugin:@typescript-eslint/recommended" - ], - "rules": { - "@typescript-eslint/no-empty-object-type": "off", - "@typescript-eslint/no-this-alias": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - "args": "none", - "varsIgnorePattern": "^_" - } - ], - "@typescript-eslint/prefer-namespace-keyword": "error", - "semi": "off", - "@typescript-eslint/no-redeclare": "off", - "@typescript-eslint/no-explicit-any": "off", - "eqeqeq": [ - "error", - "smart" - ], - "id-match": "error", - "no-eval": "error", - "no-var": "error" - } -} \ No newline at end of file diff --git a/packages/contentstack-utilities/eslint.config.js b/packages/contentstack-utilities/eslint.config.js new file mode 100644 index 0000000000..12252a8229 --- /dev/null +++ b/packages/contentstack-utilities/eslint.config.js @@ -0,0 +1,17 @@ +import { typescriptConfig, baseRules } from '../../eslint.config.base.js'; + +export default [ + ...typescriptConfig, + { + files: ['src/**/*.ts'], + rules: { + ...baseRules, + '@typescript-eslint/no-empty-object-type': 'off', + '@typescript-eslint/no-this-alias': 'off', + '@typescript-eslint/no-unsafe-function-type': 'off', + }, + }, + { + ignores: ['lib/**'], + }, +]; diff --git a/packages/contentstack-utilities/package.json b/packages/contentstack-utilities/package.json index 133c82bb49..f8f4ccd4b6 100644 --- a/packages/contentstack-utilities/package.json +++ b/packages/contentstack-utilities/package.json @@ -1,6 +1,6 @@ { "name": "@contentstack/cli-utilities", - "version": "1.18.2", + "version": "1.18.3", "description": "Utilities for contentstack projects", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -30,7 +30,7 @@ "@contentstack/management": "~1.30.1", "@contentstack/marketplace-sdk": "^1.5.1", "@oclif/core": "^4.10.5", - "axios": "^1.15.1", + "axios": "^1.15.2", "chalk": "^4.1.2", "cli-cursor": "^3.1.0", "cli-progress": "^3.12.0", @@ -53,7 +53,8 @@ "traverse": "^0.6.11", "tty-table": "^4.2.3", "unique-string": "^2.0.0", - "uuid": "^9.0.1", + "short-uuid": "^6.0.0", + "uuid": "^14.0.0", "winston": "^3.19.0", "xdg-basedir": "^4.0.0" }, @@ -71,7 +72,7 @@ "@types/sinon": "^21.0.0", "@types/traverse": "^0.6.37", "chai": "^4.5.0", - "eslint": "^8.57.1", + "eslint": "^9.26.0", "eslint-config-oclif": "^6.0.62", "eslint-config-oclif-typescript": "^3.1.14", "fancy-test": "^2.0.42", diff --git a/packages/contentstack-utilities/src/fs-utility/core.ts b/packages/contentstack-utilities/src/fs-utility/core.ts index 17ce3972b4..de02ae6f48 100644 --- a/packages/contentstack-utilities/src/fs-utility/core.ts +++ b/packages/contentstack-utilities/src/fs-utility/core.ts @@ -458,7 +458,6 @@ export async function getFileList(dirName: string, onlyName = true): Promise { /** * The Axios response object. diff --git a/packages/contentstack-utilities/src/logger/cli-error-handler.ts b/packages/contentstack-utilities/src/logger/cli-error-handler.ts index 7d7aa2bd5a..1a57af5e23 100644 --- a/packages/contentstack-utilities/src/logger/cli-error-handler.ts +++ b/packages/contentstack-utilities/src/logger/cli-error-handler.ts @@ -178,7 +178,7 @@ export default class CLIErrorHandler { * Extracts only essential error payload information for clear debugging. */ private extractErrorPayload(error: Error & Record): Record { - const { name, message: _message, code, status, response, request, config, statusText } = error; + const { name, code, status, response, request, config, statusText } = error; const payload: Record = { name, diff --git a/packages/contentstack-utilities/test/unit/auth-handler.test.ts b/packages/contentstack-utilities/test/unit/auth-handler.test.ts index 295da6f037..551f6bf7f8 100644 --- a/packages/contentstack-utilities/test/unit/auth-handler.test.ts +++ b/packages/contentstack-utilities/test/unit/auth-handler.test.ts @@ -166,25 +166,17 @@ describe('Auth Handler', () => { refresh_token: refreshToken, }; - try { - const expectedPayload = { - grant_type: 'authorization_code', - client_id: authHandler.OAuthClientId, - code_verifier: authHandler.codeVerifier, - redirect_uri: authHandler.OAuthRedirectURL, - code, - }; - - const httpClientStub = sandbox.stub(HttpClient.prototype, 'post').resolves({ data: userData }); - const getUserDetailsStub = sandbox.stub(authHandler, 'getUserDetails').resolves(userData); - const setConfigDataStub = sandbox.stub(authHandler, 'setConfigData').resolves(); - - await authHandler.getAccessToken(code); - - assert.calledWith(httpClientStub, `${authHandler.OAuthBaseURL}/apps-api/apps/token`, expectedPayload); - assert.calledWith(getUserDetailsStub, userData); - assert.calledWith(setConfigDataStub, 'oauth', userData); - } catch (error) {} + const exchangeStub = sandbox.stub().resolves(userData); + sandbox.stub(authHandler, 'oauthHandler').value({ + exchangeCodeForToken: exchangeStub, + }); + const getUserDetailsStub = sandbox.stub(authHandler, 'getUserDetails').resolves(userData); + const setConfigDataStub = sandbox.stub(authHandler, 'setConfigData').resolves(); + await authHandler.getAccessToken(code); + // Verify the actual calls made: + assert.calledWith(exchangeStub, code); // exchangeCodeForToken called with code + assert.calledWith(getUserDetailsStub, userData); // getUserDetails called with result from exchange + assert.calledWith(setConfigDataStub, 'oauth', userData); // setConfigData called with 'oauth' and userData }); }); @@ -296,30 +288,31 @@ describe('Auth Handler', () => { }); it('should refresh the token and resolve with data when refresh token is valid', async () => { - const configOauthRefreshToken = 'valid_refresh_token'; // Set a valid refresh token here + const configOauthRefreshToken = 'valid_refresh_token'; const configAuthorisationType = authHandler.authorisationTypeOAUTHValue; const expectedData = { - access_token: config.access_token, + access_token: 'new_access_token', refresh_token: 'new_refresh_token', }; - - const postStub = sandbox.stub().resolves({ data: expectedData }); - const httpClientStub = { - post: postStub, - }; - const httpClientInstance = new HttpClient().headers().asFormParams(); - sandbox.stub(httpClientInstance, 'post').value(httpClientStub); - - sandbox.stub(authHandler, 'setConfigData').resolves(expectedData); - + // Stub oauthHandler with refreshAccessToken method + const refreshAccessTokenStub = sandbox.stub().resolves(expectedData); + sandbox.stub(authHandler, 'oauthHandler').value({ + refreshAccessToken: refreshAccessTokenStub, + }); + // Stub configHandler.get to return proper values sandbox .stub(configHandler, 'get') .withArgs(authHandler.oauthRefreshTokenKeyName) .returns(configOauthRefreshToken) .withArgs(authHandler.authorisationTypeKeyName) .returns(configAuthorisationType); - - authHandler.refreshToken(); + // Stub setConfigData + sandbox.stub(authHandler, 'setConfigData').resolves(expectedData); + const result = await authHandler.refreshToken(); + // Verify calls + assert.calledWith(refreshAccessTokenStub, configOauthRefreshToken); + assert.calledWith(authHandler.setConfigData, 'refreshToken', expectedData); + expect(result).to.deep.equal(expectedData); }); }); @@ -354,7 +347,7 @@ describe('Auth Handler', () => { const data = { access_token: '', }; - + try { await authHandler.getUserDetails(data); throw new Error('Expected getUserDetails to throw'); // ensure failure if no error is thrown @@ -362,7 +355,7 @@ describe('Auth Handler', () => { expect(error).to.be.instanceOf(Error); expect(error.message).to.equal('Invalid or empty access token.'); } - }); + }); }); describe('isAuthenticated', () => { diff --git a/packages/contentstack-utilities/test/unit/helper.test.ts b/packages/contentstack-utilities/test/unit/helper.test.ts index 2a7e716e4b..4d735bfcf9 100644 --- a/packages/contentstack-utilities/test/unit/helper.test.ts +++ b/packages/contentstack-utilities/test/unit/helper.test.ts @@ -1,4 +1,4 @@ -import { cliux, validatePath, getBranchFromAlias } from '../../lib'; +import { cliux, validatePath, getBranchFromAlias, generateUid, generateShortUid } from '../../lib'; import { expect } from 'chai'; import { fancy } from 'fancy-test'; @@ -246,3 +246,32 @@ describe('Testing the getBranchFromAlias function', () => { }); }); }); + +describe('generateUid', () => { + it('should return a string', () => { + expect(generateUid()).to.be.a('string'); + }); + + it('should return a valid UUID v4 format', () => { + const uuidV4Regex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; + expect(generateUid()).to.match(uuidV4Regex); + }); + + it('should return a unique value on each call', () => { + expect(generateUid()).to.not.equal(generateUid()); + }); +}); + +describe('generateShortUid', () => { + it('should return a string', () => { + expect(generateShortUid()).to.be.a('string'); + }); + + it('should return a non-empty string', () => { + expect(generateShortUid().length).to.be.greaterThan(0); + }); + + it('should return a unique value on each call', () => { + expect(generateShortUid()).to.not.equal(generateShortUid()); + }); +}); diff --git a/packages/contentstack/.eslintignore b/packages/contentstack/.eslintignore deleted file mode 100644 index 72d230bac9..0000000000 --- a/packages/contentstack/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -# Build files -./lib \ No newline at end of file diff --git a/packages/contentstack/.eslintrc b/packages/contentstack/.eslintrc deleted file mode 100644 index 332273081e..0000000000 --- a/packages/contentstack/.eslintrc +++ /dev/null @@ -1,33 +0,0 @@ -{ - "env": { - "node": true - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.json", - "sourceType": "module" - }, - "extends": [ - "plugin:@typescript-eslint/recommended" - ], - "rules": { - "@typescript-eslint/no-unused-vars": [ - "error", - { - "args": "none" - } - ], - "@typescript-eslint/prefer-namespace-keyword": "error", - "semi": "off", - "@typescript-eslint/no-redeclare": "off", - "eqeqeq": [ - "error", - "smart" - ], - "id-match": "error", - "no-eval": "error", - "no-var": "error", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unsafe-function-type": "off" - } -} \ No newline at end of file diff --git a/packages/contentstack/README.md b/packages/contentstack/README.md index 72470f249b..849e6b303b 100644 --- a/packages/contentstack/README.md +++ b/packages/contentstack/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli $ csdx COMMAND running command... $ csdx (--version|-v) -@contentstack/cli/1.60.1 darwin-arm64 node-v22.13.1 +@contentstack/cli/1.61.1 darwin-arm64 node-v24.14.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND @@ -45,6 +45,7 @@ USAGE * [`csdx cm:branches:delete [-uid ] [-k ]`](#csdx-cmbranchesdelete--uid-value--k-value) * [`csdx cm:branches:diff [--base-branch ] [--compare-branch ] [-k ][--module ] [--format ] [--csv-path ]`](#csdx-cmbranchesdiff---base-branch-value---compare-branch-value--k-value--module-value---format-value---csv-path-value) * [`csdx cm:branches:merge [-k ][--compare-branch ] [--no-revert] [--export-summary-path ] [--use-merge-summary ] [--comment ] [--base-branch ]`](#csdx-cmbranchesmerge--k-value--compare-branch-value---no-revert---export-summary-path-value---use-merge-summary-value---comment-value---base-branch-value) +* [`csdx cm:branches:merge-status -k --merge-uid `](#csdx-cmbranchesmerge-status--k-value---merge-uid-value) * [`csdx cm:bulk-publish`](#csdx-cmbulk-publish) * [`csdx cm:entries:update-and-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-types ] [-t ] [-e ] [-c ] [-y] [--locales ] [--branch ]`](#csdx-cmentriesupdate-and-publish--a-value---retry-failed-value---bulk-publish-value---content-types-value--t-value--e-value--c-value--y---locales-value---branch-value) * [`csdx cm:assets:publish [-a ] [--retry-failed ] [-e ] [--folder-uid ] [--bulk-publish ] [-c ] [-y] [--locales ] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmassetspublish--a-value---retry-failed-value--e-value---folder-uid-value---bulk-publish-value--c-value--y---locales-value---branch-value---delivery-token-value---source-env-value) @@ -793,6 +794,29 @@ EXAMPLES _See code: [@contentstack/cli-cm-branches](https://github.com/contentstack/cli/blob/main/packages/contentstack-export/src/commands/cm/branches/merge.ts)_ +## `csdx cm:branches:merge-status -k --merge-uid ` + +Check the status of a branch merge job + +``` +USAGE + $ csdx cm:branches:merge-status -k --merge-uid + +FLAGS + -k, --stack-api-key= (required) Provide your stack API key. + --merge-uid= (required) Merge job UID to check status for. + +DESCRIPTION + Check the status of a branch merge job + +EXAMPLES + $ csdx cm:branches:merge-status -k bltxxxxxxxx --merge-uid merge_abc123 + + $ csdx cm:branches:merge-status --stack-api-key bltxxxxxxxx --merge-uid merge_abc123 +``` + +_See code: [@contentstack/cli-cm-branches](https://github.com/contentstack/cli/blob/main/packages/contentstack-export/src/commands/cm/branches/merge-status.ts)_ + ## `csdx cm:bulk-publish` Bulk Publish script for managing entries and assets @@ -3838,10 +3862,11 @@ Launch related operations ``` USAGE $ csdx launch [-d ] [-c ] [--type GitHub|FileUpload] [--framework Gatsby|NextJs|CRA (Create - React App)|CSR (Client-Side Rendered)|Angular|Nuxt|VueJs|Remix|Other] [--org ] [-n ] [-e ] - [--branch ] [--build-command ] [--out-dir ] [--server-command ] [--variable-type Import - variables from a stack|Manually add custom variables to the list|Import variables from the .env.local file|Skip - adding environment variables...] [-a ] [--env-variables ] [--redeploy-latest] [--redeploy-last-upload] + React App)|CSR (Client-Side Rendered)|Analog|Angular|Nuxt|Astro|VueJs|Remix|Other] [--org ] [-n ] [-e + ] [--branch ] [--build-command ] [--out-dir ] [--server-command ] + [--variable-type Import variables from a stack|Manually add custom variables to the list|Import variables from the + .env.local file|Skip adding environment variables...] [-a ] [--env-variables ] [--redeploy-latest] + [--redeploy-last-upload] FLAGS -a, --alias= [optional] Alias (name) for the delivery token. @@ -3855,7 +3880,7 @@ FLAGS comma. For example: APP_ENV:prod, TEST_ENV:testVal. --framework=