Skip to content
On this page

๐Ÿšง @bridge/project

This module allows access to specific functions related to the current project. View Source Code

js
import { ... } from "@bridge/project"

โšก Functions

hasPacks

The hasPacks functions checks if the packs specified exists in the current project.

  • Signature: hasPacks(packs: TPackTypeId[])
  • Returns: boolean
js
//TODO

registerExporter

The registerExporter function registers a pack exporter to be used to export the project.

  • Signature: registerExporter(exporter: IExporter)
  • Returns: void
js
//TODO

compile

The compile function forces compilation of the project using the name of the compiler config to compile with. The config should be in the "/.bridge/compiler/" directory.

  • Signature: compile(configFile: string)
  • Returns: Promise<void>
js
await compile('Default')
//TODO MORE

compileFiles

This function forces the compilation of specified files at the paths specified.

  • Signature: compileFiles(paths: string[])
  • Returns: Promise<void>
js
await compileFiles([
	'projects/example/exampleFolder',
	'projects/example/exampleFolder2',
])
//TODO MORE?

unlinkFile

This unlinkFile function removes a file from the fileSystem, compiler and packIndexer.

  • Signature: unlinkFile(path: string)
  • Returns: Promise<void>
js
await unlinkFile('projects/example/exampleFile.json')
//TODO MORE?

onProjectChanged

This onProjectChanged function executes when the project changes to a different project.

  • Signature: onProjectChanged(cb: (projectName: string) => any)
  • Returns: IDisposable
js
onProjectChanged((project) => {
	console.log(`Project has changed to: ${project.name}`)
})
//TODO MORE?

onFileChanged

This onFileChanged function executes when the user selects a new file.

  • Signature: onFileChanged(filePath: string, cb: (filePath: string) => any)
  • Returns: IDisposable
js
onFileChanged((file) => {
	console.log(`File has changed to: ${file.name}`)
})
//TODO MORE?

openFile

This openFile function opens a new file from the file handle in a new tab.

  • Signature: openFile(fileHandle: AnyFileHandle, opts: IOpenTabOptions)
  • Returns: Promise<TODO>
js
await openFile()
//TODO MORE?

๐Ÿ“Ÿ Interfaces

TPackTypeId

js
//TODO
//Where is TPackTypeId?

IExporter

ts
export interface IExporter {
	icon: string
	name: string
	isDisabled?: () => Promise<boolean> | boolean
	export: () => Promise<void>
}

IOpenTabOptions

ts
export interface IOpenTabOptions {
	selectTab?: boolean
	isTemporary?: boolean
	readOnlyMode?: TReadOnlyMode
}

Released under the GPL-3.0 License.