Skip to content

Commit 8eefa3a

Browse files
Michael DavisMichael Davis
authored andcommitted
delivery token check
1 parent 7521b1b commit 8eefa3a

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/commands/tsgen.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
4141
char: 'd',
4242
description: 'Include documentation comments',
4343
default: true,
44-
allowNo: true
44+
allowNo: true,
4545
}),
4646
};
4747

@@ -54,8 +54,12 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
5454
const includeDocumentation = flags.doc
5555
const outputPath = flags.output
5656

57+
if (token.type !== 'delivery') {
58+
this.warn('Possibly using a management token. You may not be able to connect to your Stack. Please use a delivery token.')
59+
}
60+
5761
if (!outputPath || !outputPath.trim()) {
58-
this.error("Please provide an output path.", {exit: 2})
62+
this.error('Please provide an output path.', {exit: 2})
5963
}
6064

6165
const config: StackConnectionConfig = {

src/lib/tsgen/runner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as path from 'path'
33
import * as prettier from 'prettier'
44

55
import {defaultInterfaces} from '../stack/builtins'
6-
import { DocumentationGenerator } from './docgen/doc'
6+
import {DocumentationGenerator} from './docgen/doc'
77
import JSDocumentationGenerator from './docgen/jsdoc'
88
import NullDocumentationGenerator from './docgen/nulldoc'
99
import tsgenFactory from './factory'
@@ -27,7 +27,7 @@ function createOutputPath(outputFile: string) {
2727
}
2828

2929
export default async function tsgenRunner(outputFile: string, contentTypes: any[], prefix = '', includeDocumentation = true) {
30-
const docgen: DocumentationGenerator = includeDocumentation ? new JSDocumentationGenerator() : new NullDocumentationGenerator();
30+
const docgen: DocumentationGenerator = includeDocumentation ? new JSDocumentationGenerator() : new NullDocumentationGenerator()
3131

3232
const outputPath = createOutputPath(outputFile)
3333
const globalFields = new Set()

0 commit comments

Comments
 (0)