Skip to content
This repository was archived by the owner on Sep 7, 2020. It is now read-only.

Allow directories on import again. #539

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 10 additions & 3 deletions cli/packages/graphcool-cli-core/src/commands/import/Importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ export class Importer {
throw new Error(`Import path ${importPath} does not exist`)
}
this.config = config
this.importPath = importPath
this.importDir = path.join(config.cwd, '.import/')
if (importPath.endsWith('.zip')) {
this.importPath = importPath
this.importDir = path.resolve(config.cwd, '.import/')
}
else {
this.importDir = path.resolve(config.cwd, importPath)
}
this.client = client
this.types = types
this.out = out
Expand Down Expand Up @@ -88,7 +93,9 @@ export class Importer {
})
}
async upload(projectId: string) {
await this.unzip()
if (this.importPath) {
await this.unzip()
}
let before = Date.now()
this.out.action.start('Validating data')
const files = await this.getFiles()
Expand Down
4 changes: 0 additions & 4 deletions cli/packages/graphcool-cli-core/src/commands/import/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export default class Import extends Command {

const { id } = await this.env.getTarget(target)

if (!source.endsWith('.zip')) {
throw new Error(`Source must end with .zip`)
}

if (!fs.pathExistsSync(source)) {
throw new Error(`Path ${source} does not exist`)
}
Expand Down