Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/cs 40776 #981

Merged
merged 20 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2fd2d8a
Merge pull request #949 from contentstack/fix/management-sdk-version
shafeeqd959 Jul 25, 2023
b481560
Merge pull request #941 from contentstack/staging
aman19K Jul 31, 2023
4259ca7
fix: Cannot find module '.cs-launch.json'
antonyagustine Aug 4, 2023
b3bbcda
fix: import unable to update marketplace app config in Destination Stack
antonyagustine Aug 4, 2023
7bda91a
Version bumped
antonyagustine Aug 7, 2023
262799d
fix: bumped version for launch
abhinav-from-contentstack Aug 7, 2023
a6ca62a
ci: Deleted the .github/workflows/sast-scan.yml due to workflow failure
antonyagustine Aug 4, 2023
f4a41e5
fix: updated lock files, manifest and READMEs
abhinav-from-contentstack Aug 7, 2023
ed4cf6d
fix(import): fixed field rules issue
Jul 30, 2023
4962438
fix: added error handling for script to continue
Aug 2, 2023
4f01874
Merge pull request #971 from contentstack/fix/CS-40718
abhinav-from-contentstack Aug 7, 2023
84d3ab0
Merge branch 'main' into staging
abhinav-from-contentstack Aug 7, 2023
b50d398
Merge pull request #973 from contentstack/fix/CS-40721
abhinav-from-contentstack Aug 7, 2023
00fb319
Merge pull request #972 from contentstack/staging
abhinav-from-contentstack Aug 9, 2023
620e45e
fix: added prepack sections for export and import commands
abhinav-from-contentstack Aug 9, 2023
f9dcabf
Merge pull request #976 from contentstack/fix/CS-40771-1
abhinav-from-contentstack Aug 9, 2023
0a3bc78
Merge branch 'main' into fix/CS-40772
abhinav-from-contentstack Aug 9, 2023
c043238
Merge pull request #979 from contentstack/fix/CS-40772
abhinav-from-contentstack Aug 9, 2023
456c84d
Merge pull request #978 from contentstack/staging
abhinav-from-contentstack Aug 9, 2023
aa3658a
Merge branch 'main' into fix/CS-40776
abhinav-from-contentstack Aug 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ jobs:
if: ${{ env.release_releaseAll == 'true' || env.release_plugins_export == 'true'}}
working-directory: ./packages/contentstack-export
run: npm install
- name: Compiling export
if: ${{ steps.export-installation.conclusion == 'success' }}
working-directory: ./packages/contentstack-export
run: npm run prepack
- name: Publishing export
uses: JS-DevTools/npm-publish@v1
if: ${{ steps.export-installation.conclusion == 'success' }}
Expand All @@ -113,6 +117,10 @@ jobs:
if: ${{env.release_releaseAll == 'true' || env.release_plugins_import == 'true'}}
working-directory: ./packages/contentstack-import
run: npm install
- name: Compiling import
if: ${{ steps.import-installation.conclusion == 'success' }}
working-directory: ./packages/contentstack-import
run: npm run prepack
- name: Publishing import
uses: JS-DevTools/npm-publish@v1
if: ${{ steps.import-installation.conclusion == 'success' }}
Expand Down
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/contentstack-auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-auth/1.3.12 darwin-arm64 node-v18.16.0
@contentstack/cli-auth/1.3.12 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $ npm install -g @contentstack/cli-cm-bootstrap
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-bootstrap/1.4.13 darwin-arm64 node-v18.16.0
@contentstack/cli-cm-bootstrap/1.4.13 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-branches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $ npm install -g @contentstack/cli-cm-branches
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-branches/1.0.10 darwin-arm64 node-v18.16.0
@contentstack/cli-cm-branches/1.0.10 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bulk-publish/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-cm-bulk-publish
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-bulk-publish/1.3.10 darwin-arm64 node-v18.16.0
@contentstack/cli-cm-bulk-publish/1.3.10 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-clone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $ npm install -g @contentstack/cli-cm-clone
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-clone/1.4.13 darwin-arm64 node-v18.16.0
@contentstack/cli-cm-clone/1.4.14 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@contentstack/cli-cm-clone",
"description": "Contentstack stack clone plugin",
"version": "1.4.13",
"version": "1.4.14",
"author": "Contentstack",
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
"dependencies": {
"@contentstack/cli-cm-export": "^1.7.0",
"@contentstack/cli-cm-import": "^1.7.0",
"@contentstack/cli-cm-import": "^1.7.1",
"@contentstack/cli-command": "^1.2.11",
"@contentstack/cli-utilities": "^1.5.1",
"@contentstack/management": "~1.10.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-config/1.4.10 darwin-arm64 node-v18.16.0
@contentstack/cli-config/1.4.10 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $ npm install -g @contentstack/cli-cm-export
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-export/1.7.0 darwin-arm64 node-v18.16.0
@contentstack/cli-cm-export/1.7.0 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-import/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-import/1.7.0 darwin-arm64 node-v18.16.0
@contentstack/cli-cm-import/1.7.1 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-import/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-import",
"description": "Contentstack CLI plugin to import content into stack",
"version": "1.7.0",
"version": "1.7.1",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ module.exports = class ImportMarketplaceApps {
}
for (const { extension_uid, name, path, uid, data_type } of _.filter(listOfOldMeta, 'name')) {
const meta =
_.find(listOfNewMeta, { name, path }) || _.find(listOfNewMeta, { name: this.appNameMapping[name], path }) || _.find(listOfNewMeta, { name, uid, data_type });
_.find(listOfNewMeta, { name, path }) ||
_.find(listOfNewMeta, { name: this.appNameMapping[name], path }) ||
_.find(listOfNewMeta, { name, uid, data_type });

if (meta) {
extensionUidMapp[extension_uid] = meta.extension_uid;
Expand Down Expand Up @@ -515,21 +517,16 @@ module.exports = class ImportMarketplaceApps {
return Promise.resolve();
}

let installation = this.client
.organization(this.config.org_uid)
.app(app.manifest.uid)
.installation(uid)

installation = Object.assign(installation, payload)

return installation
.update()
.then(async data => {
if (data) {
log(this.config, `${app.manifest.name} app config updated successfully.!`, 'success');
}
})
.catch((error) => log(this.config, formatError(error), 'error'))
return this.httpClient
.put(`${this.developerHubBaseUrl}/installations/${uid}`, payload)
.then(({ data }) => {
if (data.message) {
log(this.config, formatError(data.message), 'success');
} else {
log(this.config, `${app.manifest.name} app config updated successfully.!`, 'success');
}
})
.catch((error) => log(this.config, formatError(error), 'error'));
}

validateAppName(name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
confirmToCloseProcess,
getAllStackSpecificApps,
ifAppAlreadyExist,
updateAppConfig,
getConfirmationToCreateApps,
fsUtil,
fileHelper,
Expand Down Expand Up @@ -402,6 +401,18 @@ export default class ImportMarketplaceApps extends BaseClass {
if (isEmpty(app) || isEmpty(payload) || !uid) {
return Promise.resolve();
}
await updateAppConfig(this.sdkClient, this.importConfig, app, payload);

// TODO migrate this HTTP API call into SDK
// NOTE Use updateAppConfig(this.sdkClient, this.importConfig, app, payload) utility when migrating to SDK call;
return this.httpClient
.put(`${this.developerHubBaseUrl}/installations/${uid}`, payload)
.then(({ data }) => {
if (data.message) {
log(this.importConfig, formatError(data.message), 'success');
} else {
log(this.importConfig, `${app.manifest.name} app config updated successfully.!`, 'success');
}
})
.catch((error) => log(this.importConfig, formatError(error), 'error'));
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-launch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-launch
$ csdx COMMAND
running command...
$ csdx (--version|-v)
@contentstack/cli-launch/1.0.9 darwin-arm64 node-v18.16.0
@contentstack/cli-launch/1.0.10 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-launch/oclif.manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.9",
"version": "1.0.10",
"commands": {
"launch:base-command": {
"id": "launch:base-command",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-launch/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-launch",
"version": "1.0.9",
"version": "1.0.10",
"description": "Launch related operations",
"author": "Contentstack CLI",
"bin": {
Expand Down
11 changes: 3 additions & 8 deletions packages/contentstack-launch/src/adapters/file-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,19 @@ import omit from 'lodash/omit';
import find from 'lodash/find';
import FormData from 'form-data';
import filter from 'lodash/filter';
import { basename, join } from 'path';
import includes from 'lodash/includes';
import { basename, resolve } from 'path';
import { cliux, ux } from '@contentstack/cli-utilities';
import { createReadStream, existsSync, PathLike, statSync } from 'fs';

import { print } from '../util';
import BaseClass from './base-class';
import { getFileList } from '../util/fs';
import { AdapterConstructorInputs } from '../types';
import { createSignedUploadUrlMutation, importProjectMutation } from '../graphql';

export default class FileUpload extends BaseClass {
private signedUploadUrlData!: Record<string, any>;

constructor(options: AdapterConstructorInputs) {
super(options);
}

/**
* @method run
*
Expand Down Expand Up @@ -181,7 +176,7 @@ export default class FileUpload extends BaseClass {
*/
fileValidation() {
const basePath = this.config.projectBasePath;
const packageJsonPath = join(basePath, 'package.json');
const packageJsonPath = resolve(basePath, 'package.json');

if (!existsSync(packageJsonPath)) {
this.log('Package.json file not found.', 'info');
Expand All @@ -199,7 +194,7 @@ export default class FileUpload extends BaseClass {
ux.action.start('Preparing zip file');
const projectName = basename(this.config.projectBasePath);
const zipName = `${Date.now()}_${projectName}.zip`;
const zipPath = join(this.config.projectBasePath, zipName);
const zipPath = resolve(this.config.projectBasePath, zipName);
const zip = new AdmZip();
const zipEntries = filter(
await getFileList(this.config.projectBasePath, true, true),
Expand Down
11 changes: 2 additions & 9 deletions packages/contentstack-launch/src/adapters/github.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join } from "path";
import map from "lodash/map";
import { resolve } from "path";
import omit from "lodash/omit";
import find from "lodash/find";
import split from "lodash/split";
Expand All @@ -10,7 +10,6 @@ import { cliux as ux } from "@contentstack/cli-utilities";

import { print } from "../util";
import BaseClass from "./base-class";
import { AdapterConstructorInputs } from "../types";
import { getRemoteUrls } from "../util/create-git-meta";
import {
repositoriesQuery,
Expand All @@ -19,10 +18,6 @@ import {
} from "../graphql";

export default class GitHub extends BaseClass {
constructor(options: AdapterConstructorInputs) {
super(options);
}

/**
* @method run - initialization function
*
Expand Down Expand Up @@ -230,9 +225,7 @@ export default class GitHub extends BaseClass {
* @memberof GitHub
*/
async checkGitRemoteAvailableAndValid(): Promise<boolean | void> {
const localRemoteUrl =
(await getRemoteUrls(join(this.config.projectBasePath, ".git/config")))
?.origin || "";
const localRemoteUrl = (await getRemoteUrls(resolve(this.config.projectBasePath, '.git/config')))?.origin || '';

if (!localRemoteUrl) {
this.log("GitHub project not identified!", "error");
Expand Down
Loading