How to use the @file-services/node.findClosestFileSync function in @file-services/node

To help you get started, we’ve selected a few @file-services/node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wix / stylable / packages / language-service / test-kit / stylable-fixtures-lsp.ts View on Github external
import fs from '@file-services/node';
import { Stylable } from '@stylable/core';
import { StylableLanguageService } from '../src/lib/service';

export const CASES_PATH = fs.join(
    fs.dirname(fs.findClosestFileSync(__dirname, 'package.json')!),
    'test',
    'fixtures',
    'server-cases'
);

function requireModule(request: string) {
    return require(require.resolve(request, { paths: [CASES_PATH] }));
}

export const stylableLSP = new StylableLanguageService({
    fs,
    stylable: new Stylable(CASES_PATH, fs as any, requireModule)
});

@file-services/node

Node.js file system implementation.

MIT
Latest version published 3 months ago

Package Health Score

72 / 100
Full package analysis

Similar packages