Skip to content

Commit 5309da2

Browse files
updated importer file
1 parent 60d07ef commit 5309da2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

packages/contentstack-seed/src/seed/importer.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as fs from 'fs';
12
import * as process from 'process';
23
import * as path from 'path';
34
import ImportCommand from '@contentstack/cli-cm-import';
@@ -16,7 +17,13 @@ export interface ImporterOptions {
1617
}
1718

1819
export async function run(options: ImporterOptions) {
19-
const importPath = pathValidator(path.resolve(sanitizePath(options.tmpPath), STACK_FOLDER));
20+
const tmpPathResolved = path.resolve(sanitizePath(options.tmpPath));
21+
const stackPath = path.join(tmpPathResolved, STACK_FOLDER);
22+
23+
// Support both structures: repo with stack/ folder (per docs) or content at root
24+
const importPath = fs.existsSync(stackPath)
25+
? pathValidator(stackPath)
26+
: pathValidator(tmpPathResolved);
2027

2128
const args = options.alias
2229
? ['-k', options.api_key, '-d', importPath, '--alias', options.alias!]

0 commit comments

Comments
 (0)