Socket
Book a DemoInstallSign in
Socket

autofs

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autofs

Automations with file system

0.2.1
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

npm-autofs

Automations with file system

Examples

generateFile

import { generateFile } from 'autofs';

const buildFileObject = {
    imports: [
        { path: 'dotenv/config' },
        { name: 'dotenv', path: 'dotenv' }
    ],
    body: [],
    exports: [
        { name: 'doUsername', as: 'getUsername' },
        { name: 'getSomething' }
    ],
    defaultExports: {
        nodeEnv: 'process.env.NODE_ENV',
        port: 'process.env.PORT',
        host: 'process.env.HOST',
        apiKey: 'process.env.API_KEY',
        mailshrimpApiKey: 'process.env.MAILSHRIMP_API_KEY',
        token: 'process.env.TOKEN',
        id: 'process.env.ID',
        username: 'process.env.USERNAME',
        doSomethingAmazing: 'process.env.DO_SOMETHING_AMAZING',
    },
};

const result = await generateFile(path, buildFileObject);
console.log(result);

Console log from the above code

import 'dotenv/config';
import dotenv from 'dotenv';

export {
        doUsername as getUsername,
        getSomething
};

export default {
        nodeEnv: process.env.NODE_ENV,
        port: process.env.PORT,
        host: process.env.HOST,
        apiKey: process.env.API_KEY,
        mailshrimpApiKey: process.env.MAILSHRIMP_API_KEY,
        token: process.env.TOKEN,
        id: process.env.ID,
        username: process.env.USERNAME,
        doSomethingAmazing: process.env.DO_SOMETHING_AMAZING
};

generateIndex

import { generateIndex } from 'autofs';

await generateIndex('./test/components', true);

writeInFile

Add the following comments in the file you want to write

  • // ### START DYNAMIC CONTENT ###
  • // ### END DYNAMIC CONTENT ###

The second parameter you pass to the function will be an array with lines of code to write between these tags

import { writeInFile } from 'autofs';

await writeInFile('./test/writeInsideMe.js', [`const alibaba = 123;`, `const testMe = 'Testing';`]);

Keywords

generate

FAQs

Package last updated on 23 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.