How to use the fs-extra.outputFileSync function in fs-extra

To help you get started, we’ve selected a few fs-extra 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 ant-move / Antmove / packages / @antmove / wx-alipay-plugin / generate / generateAxml.js View on Github external
let wxsPath = filename;
                wxsPath = wxsPath.replace(_fileInfo.output, '');

                wxsPath = wxsPath + moduleName + 'sjs.js';

                if (sjsCode.match(/\s*getRegExp/g)) {
                    let preCode = `
                    function getRegExp (p1, p2) {
                        return new RegExp(p1, p2);
                    }
                    \n
                    `;
                    sjsCode = preCode + sjsCode;
                }

                fs.outputFileSync(filename + moduleName + 'sjs.js', sjsCode);
                _ast.children[0].value = '';

                
                wxsApp.createDep(route, wxsPath, moduleName, _fileInfo.output);
                
                // _ast.props.src = { type: 'double', value: [ './' + _relativePath ] };
                bool = true;
            } catch (e) {
                if (e) {
                    console.error(e);
                }
            }
        } else {
            let filename = _fileInfo.dist;
            let moduleName = _ast.props.module.value[0];
            let wxsPath = _ast.props.src.value[0] + '.js';
github Fannon / mobo / lib / processing / buildRegistry.js View on Github external
//////////////////////////////////////////

        validateSchema.validateBatch('field', registry.field);
        validateSchema.validateBatch('model', registry.model);
        validateSchema.validateBatch('form', registry.form);


        //////////////////////////////////////////
        // EXPAND REGISTRY THROUGH INHERITANCE  //
        //////////////////////////////////////////

        registry.expandedModel = exports.expandModels(registry);
        registry.expandedForm = exports.expandForms(registry);

        // Write Registry to file
        fs.outputFileSync(settings.processedModelDir + '/_registry.json', JSON.stringify(registry, null, 4));

        callback(false, registry);


    }).catch(function(error){
        callback(error, false);
github firebase / superstatic / test / unit / middleware / slashify.js View on Github external
beforeEach(function () {
    
    fs.outputFileSync('.tmp/index.html', 'index', 'utf8');
    fs.outputFileSync('.tmp/me.html', 'testing', 'utf8');
    fs.outputFileSync('.tmp/about/index.html', 'about index', 'utf8');
    
    app = connect()
      .use(function (req, res, next) {
        
        responder({
          req: req,
          res: res,
          provider: provider
        });
        next();
      });
  });
github danethurber / webpack-manifest-plugin / spec / plugin.integration.spec.js View on Github external
beforeAll(() => {
      fse.outputFileSync(path.join(__dirname, 'output/watch-import-chunk/chunk1.js'), 'console.log(\'chunk 1\')');
      fse.outputFileSync(path.join(__dirname, 'output/watch-import-chunk/chunk2.js'), 'console.log(\'chunk 2\')');
      fse.outputFileSync(path.join(__dirname, 'output/watch-import-chunk/index.js'), 'import(\'./chunk1\')\nimport(\'./chunk2\')');
      isFirstRun = true;
    });
github szwacz / fs-jetpack / spec / find.spec.ts View on Github external
const preparations = () => {
      fse.outputFileSync("a/b/file.txt", "1");
      fse.outputFileSync("a/b/c/file.txt", "2");
      fse.outputFileSync("a/b/c/file.md", "3");
      fse.outputFileSync("a/x/y/z", "Zzzzz...");
    };
github teambit / bit / src / e2e-helper / e2e-fs-helper.ts View on Github external
outputFile(filePathRelativeToLocalScope: string, data = ''): void {
    return fs.outputFileSync(path.join(this.scopes.localPath, filePathRelativeToLocalScope), data);
  }
github arrowrowe / tam / lib / worker.js View on Github external
contents.forEach(function (content, index) {
      if (self.hashLength) {
        output[index] = self.rename(output[index], self.hash.string(content), self.hashLength);
      }
      log.trace('Write %s.', chalk.blue(output[index]));
      fs.outputFileSync(output[index], content);
    });
  }
github iamjoel / easy-cms-generator / server / api / utils / generator-code / server / crud.js View on Github external
}
      if(col.dataType === 'string') {
        rule.max = col.maxLength || 10
      }
      return {
        key: `${col.key}`,
        name: `${col.label}`,
        rule,
        validType: 'all'
      }
    })
  }

  const template = 
`module.exports = ${JSON.stringify(model, null, '  ')}`
  fs.outputFileSync(dist, template)
}
github embroider-build / embroider / packages / compat / src / v1-config.ts View on Github external
build() {
    let filename = join(this.outputPath, 'config/environment.js');
    let contents;
    if (this.storeConfigInMeta) {
      contents = metaLoader(this.appName);
    } else {
      contents = `export default ${JSON.stringify(this.inputTree.readConfig())};`;
    }
    if (!this.lastContents || this.lastContents !== contents) {
      outputFileSync(filename, contents);
    }
    this.lastContents = contents;
  }
}
github Soluto / dynamico / server / fs-storage / lib / index.spec.ts View on Github external
const prepareComponent = (comp: Component) => {
    const componentPath = path.join(tmpdir, comp.name, comp.version);
    fs.outputFileSync(path.join(componentPath, 'index.js'), comp.code);
    fs.outputFileSync(
      path.join(componentPath, 'package.json'),
      JSON.stringify({ main: 'index.js', peerDependencies: comp.peerDependencies })
    );
  };