Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bburns committed Jul 5, 2024
1 parent 3822d7e commit 2359abf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
11 changes: 4 additions & 7 deletions packages/cli/lib/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import ejs from 'ejs';
import * as dotenv from 'dotenv';
import { spawn } from 'child_process';
import type { ChildProcess } from 'node:child_process';
import slash from 'slash';

import { NANGO_INTEGRATIONS_NAME, getNangoRootPath, getPkgVersion, printDebug } from './utils.js';
import { loadYamlAndGenerate } from './services/model.service.js';
Expand Down Expand Up @@ -238,18 +237,17 @@ export function tscWatch({ fullPath, debug = false }: { fullPath: string; debug?
fs.mkdirSync(distDir);
}

// filePath is a relative platform path, eg '.nango\\schema.ts'
watcher.on('add', async (filePath: string) => {
// filePath = filePath.replace(/\\/g, '/');
filePath = slash(filePath);
console.log('watcher add', filePath);
if (filePath === nangoConfigFile) {
return;
}
await compileSingleFile({ fullPath, file: getFileToCompile({ fullPath, filePath }), tsconfig, parsed, debug });
});

watcher.on('unlink', (filePath: string) => {
// filePath = filePath.replace(/\\/g, '/');
// filePath = slash(filePath);
console.log('watcher unlink', filePath);
if (filePath === nangoConfigFile) {
return;
}
Expand All @@ -266,8 +264,7 @@ export function tscWatch({ fullPath, debug = false }: { fullPath: string; debug?
});

watcher.on('change', async (filePath: string) => {
// filePath = filePath.replace(/\\/g, '/');
// filePath = slash(filePath);
console.log('watcher change', filePath);
if (filePath === nangoConfigFile) {
await compileAllFiles({ fullPath, debug });
return;
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/lib/services/compile.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ export interface ListedFile {
baseName: string;
}

// fullPath -
// filePath - abs or relative platform path
// inputPath - absolute platform path
// outputPath - absolute platform path
export function getFileToCompile({ fullPath, filePath }: { fullPath: string; filePath: string }): ListedFile {
Expand Down
4 changes: 3 additions & 1 deletion packages/nango-yaml/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ export function shouldQuote(name: string) {
// return filepath.split(path.sep);
// }

//. filePath is a platform path - relative is okay
export function getProviderConfigurationFromPath({ filePath, parsed }: { filePath: string; parsed: NangoYamlParsed }): NangoYamlParsedIntegration | null {
// const pathSegments = filePath.split('/');
console.log('getProviderConfigurationFromPath', filePath);
const pathSegments = filePath.split(path.sep);
console.log('pathSegments', pathSegments);
const scriptType = pathSegments.length > 1 ? pathSegments[pathSegments.length - 2] : null;
const isNested = scriptType === 'syncs' || scriptType === 'actions' || scriptType === 'post-connection-scripts';

Expand Down

0 comments on commit 2359abf

Please sign in to comment.