How to use the gluegun/toolbox.filesystem function in gluegun

To help you get started, we’ve selected a few gluegun 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 graphprotocol / graph-cli / src / compiler.js View on Github external
async writeSubgraphToOutputDirectory(subgraph) {
    const displayDir = `${this.displayPath(this.options.outputDir)}${
      toolbox.filesystem.separator
    }`

    return await withSpinner(
      `Write compiled subgraph to ${displayDir}`,
      `Failed to write compiled subgraph to ${displayDir}`,
      `Warnings while writing compiled subgraph to ${displayDir}`,
      async spinner => {
        // Copy schema and update its path
        subgraph = subgraph.updateIn(['schema', 'file'], schemaFile =>
          path.relative(
            this.options.outputDir,
            this._copySubgraphFile(
              schemaFile,
              this.sourceDir,
              this.options.outputDir,
              spinner,
github graphprotocol / graph-cli / src / commands / init.js View on Github external
const loadAbiFromFile = async filename => {
  let exists = await toolbox.filesystem.exists(filename)

  if (!exists) {
    throw Error('File does not exist.')
  } else if (exists === 'dir') {
    throw Error('Path points to a directory, not a file.')
  } else if (exists === 'other') {
    throw Error('Not sure what this path points to.')
  } else {
    return await ABI.load('Contract', filename)
  }
}
github graphprotocol / graph-cli / src / migrations / indexed-event-params.js View on Github external
apply: async ({ manifestFile }) => {
    let subgraph = (await Subgraph.load(manifestFile, { skipValidation: true })).result

    subgraph = subgraph.update('dataSources', dataSources =>
      dataSources.map(dataSource => maybeMigrateDataSource(manifestFile, dataSource)),
    )

    let newManifest = Subgraph.dump(subgraph)
    await toolbox.filesystem.write(manifestFile, newManifest, { atomic: true })
  },
}