✨ A cli can automatically export files of the same type

Overview

auto-export

A cli can automatically export files

NPM version

Why

When you want to export many files of the same type in one folder, you may cost a lot of time to copy and paste the same code. eg if you want to export all images in one folder, you need to copy and paste the same code for each image, and export these images in a index.ts file.Why not have a try to use auto-export πŸ‘»

πŸš€ Features

  • Multiple directory generate support
  • Nested directory generate support
  • Custom output directory support
  • Custom import statement support
  • Auto Prefix support

Usage

Install

pnpm add -D auto-export

Config export.config.ts

  • targetDir (require) : the directory to export files

  • outputDir (optional,default targetDir) : the directory to generate the index.ts file to export files

  • customImport (optional) : custom the import statement to use in the index.ts file

  • depth (optional , default true) : traverse all subdirectories

  • autoPrefix (optional , default false) : auto add prefix to the file name. Note that the if you open the customImport option,this option will be ignored

import { defineExportConfig } from 'auto-export'
export default defineExportConfig({
  configs: [
    {
      targetDir: './src/assets/images',
    },
    {
      targetDir: './src/assets/img',
      depth: true,
      autoPrefix: true
    },
    {
      targetDir: './src/assets/css',
      outputDir: './src/assets/css',
    },
    {
      targetDir: './src/assets/svgs',
      customImport: (fileName, file) => {
        return `import { ReactComponent as ${fileName} } from '${file}'`
      },
    },
    {
      targetDir: './src/assets/gif',
      customImport: (fileName, file, fileType) => {
        return `import ${fileType}${fileName} from '${file}'`
      },
      depth: true
    },
  ],
})

Generate index.ts

pnpm run autoexport

Author

sudongyuer email:[email protected]

License

MIT License Β© 2021 SuDongYu

Comments
  • [ImgBot] Optimize images

    [ImgBot] Optimize images

    Beep boop. Your images are optimized!

    Your image file size has been reduced by 51% πŸŽ‰

    Details

    | File | Before | After | Percent reduction | |:--|:--|:--|:--| | /logo.png | 73.21kb | 27.57kb | 62.34% | | /logo1.png | 52.04kb | 33.95kb | 34.76% | | | | | | | Total : | 125.24kb | 61.51kb | 50.89% |


    πŸ“ docs | :octocat: repo | πŸ™‹πŸΎ issues | πŸͺ marketplace

    ~Imgbot - Part of Optimole family

    opened by imgbot[bot] 1
  • chore: update versions

    chore: update versions

    This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

    Releases

    [email protected]

    Patch Changes

    • d902056: fix: window path
    opened by sudongyuer 0
  • chore: update versions

    chore: update versions

    This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

    Releases

    [email protected]

    Patch Changes

    • 3601af9: update
    opened by sudongyuer 0
  • chore: update versions

    chore: update versions

    This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

    Releases

    [email protected]

    Patch Changes

    • d32ab56: release v0.3.5
    opened by sudongyuer 0
  • chore: update versions

    chore: update versions

    This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

    Releases

    [email protected]

    Patch Changes

    • f05f185: update
    opened by sudongyuer 0
  • chore: update versions

    chore: update versions

    This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

    Releases

    [email protected]

    Patch Changes

    • fbab262: update chalk dep
    opened by sudongyuer 0
  • chore: update versions

    chore: update versions

    This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

    Releases

    [email protected]

    Patch Changes

    • 191f79e: update utils
    opened by sudongyuer 0
  • chore: update versions

    chore: update versions

    This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

    Releases

    [email protected]

    Patch Changes

    • 12d5d45: update readme.md
    opened by sudongyuer 0
  • chore: update versions

    chore: update versions

    This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

    Releases

    [email protected]

    Minor Changes

    • 95dc32d: feature: add depth option to support nested directory
    • 95dc32d: feature: add autoprefix option to support export file with prefix
    opened by sudongyuer 0
  • chore: update versions

    chore: update versions

    This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

    Releases

    [email protected]

    Patch Changes

    • d1f3fa5: update index.ts
    opened by sudongyuer 0
  • chore: update versions

    chore: update versions

    This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

    Releases

    [email protected]

    Patch Changes

    • e88d420: fix remove all files index.ts behavior
    opened by sudongyuer 0
  • Configure Renovate

    Configure Renovate

    Mend Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • .github/workflows/changeset-version.yml (github-actions)
    • package.json (npm)

    Configuration

    πŸ”‘ Renovate has detected a custom config for this PR. Feel free to ask for help if you have any doubts and would like it reviewed.

    Important: Now that this branch is edited, Renovate can't rebase it from the base branch any more. If you make changes to the base branch that could impact this onboarding PR, please merge them manually.

    What to Expect

    With your current configuration, Renovate will create 8 Pull Requests:

    chore(deps): pin dependencies
    chore(deps): update dependency unbuild to v0.8.10
    • Schedule: ["at any time"]
    • Branch name: renovate/unbuild-0.x
    • Merge into: master
    • Upgrade unbuild to 0.8.10
    chore(deps): update dependency vitest to v0.22.1
    • Schedule: ["at any time"]
    • Branch name: renovate/vitest-0.x
    • Merge into: master
    • Upgrade vitest to 0.22.1
    chore(deps): update pnpm to v7.9.5
    • Schedule: ["at any time"]
    • Branch name: renovate/pnpm-7.x
    • Merge into: master
    • Upgrade pnpm to 7.9.5
    chore(deps): update actions/checkout action to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-checkout-3.x
    • Merge into: master
    • Upgrade actions/checkout to v3
    chore(deps): update actions/setup-node action to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-setup-node-3.x
    • Merge into: master
    • Upgrade actions/setup-node to v3
    chore(deps): update dependency vite to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/vite-3.x
    • Merge into: master
    • Upgrade vite to 3.0.9
    fix(deps): update dependency chalk to v5
    • Schedule: ["at any time"]
    • Branch name: renovate/chalk-5.x
    • Merge into: master
    • Upgrade chalk to 5.0.1

    🚸 Branch creation will be limited to maximum 2 per hour, so it doesn't swamp any CI resources or spam the project. See docs for prhourlylimit for details.


    ❓ Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 1
Owner
Frozen FIsh
βŠ™οΉβŠ™β€–βˆ£Β° 🐟🐟🐟
Frozen FIsh
Generate deterministic fake values: The same input will always generate the same fake-output.

import { copycat } from '@snaplet/copycat' copycat.email('foo') // => '[email protected]' copycat.email('bar') // => 'Thurman.Schowalter668@

Snaplet 201 Dec 30, 2022
Automatically make same-page links scroll smoothly

Smooth Scroll Plugin Allows for easy implementation of smooth scrolling for same-page links. Note: Version 2.0+ of this plugin requires jQuery version

Karl Swedberg 2k Dec 25, 2022
End-to-End type safety for REST APIs written in Fastify. Only problem is you have to explicity export and register route handlers. LOL

Chino intelligence in japaneese End-to-End type safety for REST APIs written in Fastify. Only problem is you have to explicity export and register rou

sambit sahoo 2 Sep 12, 2022
Zero runtime type-safe CSS in the same file as components

macaron comptime-css is now called macaron! macaron is a zero-runtime and type-safe CSS-in-JS library made with performance in mind Powered by vanilla

Mokshit Jain 205 Jan 4, 2023
This simple extension can automatically load NBN availability information for properties on realestate.com.au & domain.com.au including technology type, maximum line speed, and co-existance status if available.

NBN Availability Check Chrome Extension This simple extension can automatically load NBN availability information for properties on realestate.com.au

Luke Prior 17 Aug 17, 2022
Export AWS SSM Parameter Store values in bulk to .env files

aws-parameter-bulk Utility to read parameters from AWS Systems Manager (SSM) Parameter Store in bulk and output them in environment-file or json forma

Adam Malik 18 Oct 18, 2022
An Obsidian Plugin that allows to export tables from a pane in reading mode to CSV files.

Obsidian Plugin "Table to CSV Exporter" This is my very first attempt in writing a plugin for Obsidian. I didn't even know TypeScript before (but Java

Stefan Wolfrum 26 Dec 27, 2022
JavaScript library for parsing Dirtywave M8 files, complete with a CLI for interacting with M8 files.

m8-js This repository contains a JavaScript library for parsing Dirtywave M8 files, as well as a CLI for interacting with M8 files. The hopes are not

Jeremy Whitlock 20 Dec 17, 2022
Autocompletion, in-code secret peeking πŸ”Ž, syncing, and more, for your .env files in VSCode. πŸ‘‘ From the same people who pioneered dotenv.

Dotenv Official (with Vault) for VSCode Official Dotenv. Syntax highlighting, autocompletion, in-code secret peeking, and .env file syncing with Doten

Dotenv 38 Dec 19, 2022
🐼 A cli can automatically compress images with tinypng.com

easy-tinypng-cli A cli can automatically compress images with tinypng.com. Why When delevoping a website, we often need to compress images to reduce t

Frozen FIsh 58 Dec 14, 2022
A simple web text editor which can export HTML

Rich Text Editor A simple web text editor which can export HTML Explore the docs Β» View Demo Β· Report Bug Β· Request Feature Table of Contents About Th

JuSoft 1 Apr 8, 2022
A Javascript library to export svg charts from the DOM and download them as an SVG file, PDF, or raster image (JPEG, PNG) format. Can be done all in client-side.

svg-exportJS An easy-to-use client-side Javascript library to export SVG graphics from web pages and download them as an SVG file, PDF, or raster imag

null 23 Oct 5, 2022
A Tempermonky / Greasemonkey plugin which can help you export your class schedule to the calendar on your phone / pad / PC / Mac.

WHU Class Schedule Export as iCS Languages: English | η°‘ι«”δΈ­ζ–‡ | 繁體中文 Changelog v0.90.1 - Sep 18, 2022 Fix bugs: Fix an error when a class have multiple s

Ostrich_B 6 Sep 7, 2022
Aron 8 Dec 17, 2022
The world's fastest game! User gets ten dice. Then rolls and rolls as fast as they can until he gets all their dice on the same number.

tenzies-game The world's fastest game! User gets ten dice. Then rolls and rolls as fast as they can until he gets all their dice on the same number. I

Babur Shah Sayer 6 Nov 26, 2022
A project where you can keep track of your goal's progress, and contribute to open source in the same time.

Asakatsu-Website A project where you can keep track of your goal's progress, and contribute to open source in the same time. AsaKatsu is a Japanese te

null 8 Dec 27, 2022
Vaultacks lets users store files off-chain on Gaia. Files are encrypted by default but also can be made public and shared

Vaultacks Vaultacks is built on the Stacks Chain. It lets users upload files to Gaia, a off-chain data storage system. Vaultacks currently uses the de

Anish De 5 Sep 14, 2022
Type predicate functions for checking if a value is of a specific type or asserting that it is.

As-Is Description As-Is contains two modules. Is - Type predicates for checking values are of certain types. As - Asserting values are of a certain ty

Declan Fitzpatrick 8 Feb 10, 2022