Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Commit 7a722bc

Browse files
changed local launch to compile first
1 parent 6e077b7 commit 7a722bc

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

src/commands/service/dev.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { bootstrap } from '../../lib/launcher';
55
import { installDependencies } from '../../lib/child-cli';
66
import compile from '../../lib/compiler';
77

8+
89
export const flow = (context: { localConfiguration; command: Command}): ListrTask[] => [
910
{
1011
title: 'Installing dependencies',

src/lib/compiler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export default async (files: any, command: Command): Promise<void> => {
77
const program = ts.createProgram(files, {
88
declaration: true,
99
importHelpers: true,
10-
module: 1, // commonjs
11-
target: 4, // es2017
10+
module: ts.ModuleKind.CommonJS, // commonjs
11+
target: ts.ScriptTarget.ES2017, // es2017
1212
esModuleInterop: true,
1313
strictNullChecks: true,
1414
emitDecoratorMetadata: true,
@@ -32,5 +32,5 @@ export default async (files: any, command: Command): Promise<void> => {
3232
}
3333
});
3434

35-
await PromisifiedFs.rimraf(join(process.cwd(), 'temp'));
35+
// await PromisifiedFs.rimraf(join(process.cwd(), 'temp'));
3636
};

src/lib/launcher/GraphQLLoader.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import { logger } from 'codestore-utils';
66
import { IResolver } from './interfaces/graphql.interface';
77

88
export default class GraphqlLoader {
9-
private resolversPath = join(process.cwd(), 'src', 'resolvers');
9+
// private resolversPath = join(process.cwd(), 'src', 'resolvers');
1010

1111
private schemaPath = join(process.cwd(), 'src', 'schema.graphql');
1212

13+
private resolversPath = join(process.cwd(), 'temp', 'resolvers');
14+
1315
private resolvers: IResolvers = {};
1416

1517
private getResolverName = (file): string => path.parse(file).name;
@@ -20,7 +22,7 @@ export default class GraphqlLoader {
2022
let files;
2123

2224
try {
23-
files = fs.readdirSync(normalizedPath).filter((file) => /.ts$/.test(file));
25+
files = fs.readdirSync(normalizedPath).filter((file) => /.js$/.test(file));
2426
} catch (e) {
2527
if (e?.code !== 'ENOENT') {
2628
logger.error(e, undefined, this.constructor.name);
@@ -55,7 +57,7 @@ export default class GraphqlLoader {
5557
}
5658

5759
private async loadResolversFromFile(): Promise<void> {
58-
const resolversFile = await import(path.join(this.resolversPath, 'resolvers.ts'));
60+
const resolversFile = await import(path.join(this.resolversPath, 'resolvers.js'));
5961

6062
this.resolvers.Query = {
6163
...this.resolvers.Query,

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"strictNullChecks": true,
1111
"emitDecoratorMetadata": true,
1212
"experimentalDecorators": true,
13-
"strict": false
13+
"strict": false,
14+
"resolveJsonModule": true
1415
},
1516
"include": [
1617
"src/**/*",

0 commit comments

Comments
 (0)