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

Feat/import setup command base #1627

Draft
wants to merge 22 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c125f6e
import pre setup command base code
shafeeqd959 Sep 3, 2024
c1b5036
Merge branch 'development' into feat/import-setup-command
shafeeqd959 Sep 3, 2024
2afb274
Merge branch 'development' of github.com:contentstack/cli into feat/i…
shafeeqd959 Sep 3, 2024
2524800
Merge branch 'feat/import-setup-command' of github.com:contentstack/c…
shafeeqd959 Sep 3, 2024
de67ada
deleted env
shafeeqd959 Sep 3, 2024
c8df043
changes
shafeeqd959 Sep 3, 2024
6db05e3
content type update
shafeeqd959 Sep 3, 2024
c246db6
Merge pull request #1542 from contentstack/feat/import-setup-command
shafeeqd959 Sep 4, 2024
5b2373d
Merge branch 'development' of github.com:contentstack/cli into feat/i…
shafeeqd959 Oct 9, 2024
93c4a34
content type basic setup
shafeeqd959 Oct 11, 2024
02b9881
Merge branch 'development' of github.com:contentstack/cli into feat/i…
shafeeqd959 Oct 11, 2024
eb000b8
lock file update
shafeeqd959 Oct 11, 2024
ef6afad
feat: added taxonomy mapper file support in import setup
aman19K Oct 23, 2024
574bb3d
Merge pull request #1643 from contentstack/feat/DX-1608
aman19K Oct 23, 2024
ffa4ccf
asset mapper file creation
shafeeqd959 Oct 24, 2024
afa0e11
fixed conflicts
shafeeqd959 Oct 24, 2024
baeaa9f
Merge pull request #1644 from contentstack/feat/import-setup-asset-ma…
shafeeqd959 Oct 25, 2024
93da7af
asset mapper, marketplace
shafeeqd959 Nov 6, 2024
9311979
merged changes
shafeeqd959 Nov 6, 2024
4c35079
Merge branch 'feat/import-setup-command-base' into feat/import-setup-…
shafeeqd959 Nov 6, 2024
dc4db88
Merge pull request #1663 from contentstack/feat/import-setup-asset-ma…
shafeeqd959 Nov 6, 2024
b9506d7
entry integration
shafeeqd959 Nov 7, 2024
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
3,034 changes: 565 additions & 2,469 deletions package-lock.json

Large diffs are not rendered by default.

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.2.0 darwin-arm64 node-v22.8.0
@contentstack/cli-cm-branches/1.2.0 darwin-arm64 node-v22.2.0
$ 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.13.0 darwin-arm64 node-v22.8.0
@contentstack/cli-cm-clone/1.13.0 darwin-arm64 node-v22.2.0
$ 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.14.1 darwin-arm64 node-v22.8.0
@contentstack/cli-cm-export/1.14.1 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 2 additions & 0 deletions packages/contentstack-import-setup/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Build files
./lib
56 changes: 56 additions & 0 deletions packages/contentstack-import-setup/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"env": {
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"extends": [
"oclif-typescript",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "none"
}
],
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"semi": "off",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/no-redeclare": "off",
"eqeqeq": [
"error",
"smart"
],
"id-match": "error",
"no-eval": "error",
"no-var": "error",
"quotes": "off",
"indent": "off",
"camelcase": "off",
"comma-dangle": "off",
"arrow-parens": "off",
"operator-linebreak": "off",
"object-curly-spacing": "off",
"node/no-missing-import": "off",
"lines-between-class-members": "off",
"padding-line-between-statements": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"unicorn/no-abusive-eslint-disable": "off",
"@typescript-eslint/no-explicit-any": "off",
"unicorn/consistent-function-scoping": "off",
"@typescript-eslint/no-use-before-define": "off"
}
}
14 changes: 14 additions & 0 deletions packages/contentstack-import-setup/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*-debug.log
*-error.log
/.nyc_output
/dist
/lib
/tmp
/yarn.lock
node_modules
.DS_Store
coverage
.vscode/
/lib

.env
8 changes: 8 additions & 0 deletions packages/contentstack-import-setup/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"require": ["test/helpers/init.js", "ts-node/register", "source-map-support/register"],
"watch-extensions": [
"ts"
],
"recursive": true,
"timeout": 5000
}
5 changes: 5 additions & 0 deletions packages/contentstack-import-setup/.nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"inlcude": [
"lib/**/*.js"
]
}
7 changes: 7 additions & 0 deletions packages/contentstack-import-setup/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2
}
21 changes: 21 additions & 0 deletions packages/contentstack-import-setup/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Contentstack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
115 changes: 115 additions & 0 deletions packages/contentstack-import-setup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
@contentstack/cli-cm-import

It is Contentstack’s CLI plugin to import content in the stack. To learn how to export and import content in Contentstack, refer to the [Migration guide](https://www.contentstack.com/docs/developers/cli/migration/).

[![License](https://img.shields.io/npm/l/@contentstack/cli)](https://github.com/contentstack/cli/blob/main/LICENSE)it -m

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->

For switching to EU region update the hosts at config/default.js

```js
{
host:'https://eu-api.contentstack.com/v3',
cdn: 'https://eu-cdn.contentstack.com/v3',
...
}
```

For switching to AZURE-NA region update the hosts at config/default.js

```js
{
host:'https://azure-na-api.contentstack.com/v3',
cdn: 'https://azure-na-cdn.contentstack.com/v3'
...
}
```

For switching to AZURE-EU region update the hosts at config/default.js

```js
{
host:'https://azure-eu-api.contentstack.com/v3',
cdn: 'https://azure-eu-cdn.contentstack.com/v3'
...
}
```

# Usage

<!-- usage -->
```sh-session
$ npm install -g @contentstack/cli-cm-import-setup
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-import-setup/1.0.0-beta.0 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
...
```
<!-- usagestop -->

# Commands

<!-- commands -->
* [`csdx cm:stacks:import [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]`](#csdx-cmstacksimport--k-value--d-value--a-value---modules-valuevalue)
* [`csdx cm:stacks:import [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]`](#csdx-cmstacksimport--k-value--d-value--a-value---modules-valuevalue-1)

## `csdx cm:stacks:import [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]`

Import content from a stack

```
USAGE
$ csdx cm:stacks:import [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]

FLAGS
-a, --alias=<value> alias of the management token
-d, --data-dir=<value> path and location where data is stored
-k, --stack-api-key=<value> API key of the target stack
--modules=<option> [optional] specific module name
<options: content-types|entries|both>

DESCRIPTION
Import content from a stack

ALIASES
$ csdx cm:import

EXAMPLES
$ csdx cm:stacks:import-setup --stack-api-key <stack_api_key> --data-dir <path/of/export/destination/dir> --modules <module_name, module_name>
```

## `csdx cm:stacks:import [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]`

Import content from a stack

```
USAGE
$ csdx cm:stacks:import [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]

FLAGS
-a, --alias=<value> alias of the management token
-d, --data-dir=<value> path and location where data is stored
-k, --stack-api-key=<value> API key of the target stack
--modules=<option> [optional] specific module name
<options: content-types|entries|both>

DESCRIPTION
Import content from a stack

ALIASES
$ csdx cm:import

EXAMPLES
$ csdx cm:stacks:import-setup --stack-api-key <stack_api_key> --data-dir <path/of/export/destination/dir> --modules <module_name, module_name>
```

_See code: [src/commands/cm/stacks/import-setup.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-import-setup/src/commands/cm/stacks/import-setup.ts)_
<!-- commandsstop -->
3 changes: 3 additions & 0 deletions packages/contentstack-import-setup/bin/dev.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\dev" %*
6 changes: 6 additions & 0 deletions packages/contentstack-import-setup/bin/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env node_modules/.bin/ts-node
// eslint-disable-next-line node/shebang, unicorn/prefer-top-level-await
(async () => {
const oclif = await import('@oclif/core');
await oclif.execute({ development: true, dir: __dirname });
})();
3 changes: 3 additions & 0 deletions packages/contentstack-import-setup/bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\run" %*
7 changes: 7 additions & 0 deletions packages/contentstack-import-setup/bin/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env node

// eslint-disable-next-line unicorn/prefer-top-level-await
(async () => {
const oclif = await import('@oclif/core');
await oclif.execute({ development: false, dir: __dirname });
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"master_locale": {
"name": "English - United States",
"code": "en-us"
},
"data": "file path",
"target_stack": "bltXXXXXXXXXX",
"branchName": "example1",
"moduleName": "content-types",
"concurrency": 1,
"importConcurrency": 5,
"fetchConcurrency": 5,
"writeConcurrency": 5,
"securedAssets": false,
"developerHubBaseUrl": "",
"createBackupDir": "./temp",
"cliLogsPath": "./tmp"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"master_locale": {
"name": "English - United States",
"code": "en-us"
},
"data": "file path",
"branchName": "example1",
"moduleName": "content-types",
"concurrency": 1,
"importConcurrency": 5,
"fetchConcurrency": 5,
"writeConcurrency": 5,
"securedAssets": false,
"developerHubBaseUrl": "",
"cliLogsPath": "./tmp"
}
1 change: 1 addition & 0 deletions packages/contentstack-import-setup/messages/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading
Loading