path#delimiter TypeScript Examples
The following examples show how to use
path#delimiter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: addEnv.ts From setup-cpp with Apache License 2.0 | 6 votes |
/** An add path function that works locally or inside GitHub Actions */
export async function addPath(path: string) {
process.env.PATH = `${path}${delimiter}${process.env.PATH}`
try {
if (isGitHubCI()) {
try {
ghAddPath(path)
} catch (err) {
error(err as Error)
await addPathSystem(path)
}
} else {
await addPathSystem(path)
}
} catch (err) {
error(err as Error)
setFailed(`Failed to add ${path} to the percistent PATH. You should add it manually.`)
}
}
Example #2
Source File: server.ts From plugin-vscode with Apache License 2.0 | 6 votes |
export function getServerOptions(ballerinaCmd: string): ServerOptions {
debug(`Using Ballerina CLI command '${ballerinaCmd}' for Language server.`);
let cmd = process.platform === 'win32' ? getConvertedPath(ballerinaCmd) : ballerinaCmd;
let args = ["start-language-server"];
let opt: ExecutableOptions = {};
opt.env = Object.assign({}, process.env);
if (process.env.LS_EXTENSIONS_PATH !== "") {
if (opt.env.BALLERINA_CLASSPATH_EXT) {
opt.env.BALLERINA_CLASSPATH_EXT += delimiter + process.env.LS_EXTENSIONS_PATH;
} else {
opt.env.BALLERINA_CLASSPATH_EXT = process.env.LS_EXTENSIONS_PATH;
}
}
if (process.env.LSDEBUG === "true") {
debug('Language Server is starting in debug mode.');
let debugPort = 5005;
opt.env.BAL_JAVA_DEBUG = debugPort;
opt.env.BAL_DEBUG_OPTS = "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + debugPort + ",quiet=y";
}
if (process.env.LS_CUSTOM_CLASSPATH) {
args.push('--classpath', process.env.LS_CUSTOM_CLASSPATH);
}
return {
command: cmd,
args,
options: opt
};
}
Example #3
Source File: malagu-main.ts From malagu with MIT License | 5 votes |
async function execute() {
const pkg = CommandUtil.getPkg();
let projectPath = pkg.rootComponentPackage.malaguComponent?.projectPath;
projectPath = projectPath ? resolve(process.cwd(), projectPath) : process.cwd();
try {
const malaguMainPath = require.resolve('@malagu/cli/lib/malagu-main', { paths: [ projectPath ] });
if (dirname(malaguMainPath) !== __dirname) {
const subprocess = fork(malaguMainPath, argv, { stdio: 'inherit', cwd: projectPath });
subprocess.on('exit', exitListener);
subprocess.on('error', () => process.exit(-1));
return;
}
} catch (error) {
if (error?.code !== 'MODULE_NOT_FOUND') {
throw error;
}
}
if (current?.killed === false) {
current.removeListener('exit', exitListener);
current.kill();
}
const { runtime, framework, settings } = await RuntimeUtil.initRuntime(projectPath);
const nodePaths = Array.from(new Set<string>([
join(projectPath, 'node_modules'),
join(projectPath, '..', 'node_modules'),
join(projectPath, '..', '..', 'node_modules'),
join(projectPath, '..', '..', '..', 'node_modules')
]));
process.env.MALAGU_RFS = JSON.stringify({ runtime, settings, framework });
const runtimePath = PathUtil.getRuntimePath(runtime);
if (runtimePath !== projectPath) {
nodePaths.push(join(runtimePath, 'node_modules'));
}
process.env.NODE_PATH = nodePaths.join(delimiter);
const malaguPath = require.resolve('@malagu/cli/lib/malagu', { paths: [ __dirname ] });
current = fork(malaguPath, argv, { stdio: 'inherit', cwd: projectPath });
// eslint-disable-next-line no-null/no-null
current.on('exit', exitListener);
current.on('error', () => process.exit(-1));
current.on('message', (messageEvent: MessageEvent<Data>) => {
if (messageEvent.type === 'cliContext') {
const { components, webpackHookModules, configHookModules, buildHookModules,
serveHookModules, deployHookModules, propsHookModules, infoHookModules } = messageEvent.data;
const files = [
...(webpackHookModules || []).map(m => m.path),
...(configHookModules || []).map(m => m.path),
...(buildHookModules || []).map(m => m.path),
...(serveHookModules || []).map(m => m.path),
...(deployHookModules || []).map(m => m.path),
...(propsHookModules || []).map(m => m.path),
...(infoHookModules || []).map(m => m.path),
...(components || []).reduce<string[]>((prev, curr) => prev.concat(curr.configFiles), [])
];
watchpack.watch({
files: files.map(f => f?.split('/').join(sep)),
aggregateTimeout: 1000
});
watchpack.on('aggregated', () => {
execute();
});
}
});
}