@enonic/tsup-plugin-manifest
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

tsup-plugin-manifest

Installation

npm install --save-dev @enonic/tsup-plugin-manifest
yarn add --dev @enonic/tsup-plugin-manifest
pnpm add --save-dev @enonic/tsup-plugin-manifest

Usage

import TsupPluginManifest from '@enonic/tsup-plugin-manifest';

export default defineConfig((options) => {
    return {
        // ...
        esbuildPlugins: [
            TsupPluginManifest({
                // Manipulate the manifest keys and values.
                generate: (entries) => {
                    const newEntries = {} as typeof entries;
                    Object.entries(entries).forEach(([k,v]) => {
                        // console.log(k,v);
                        const ext = v.split('.').pop() as string;
                        const parts = k.replace(`${SOME_DIR}/`, '').split('.');
                        parts.pop();
                        parts.push(ext);
                        newEntries[parts.join('.')] = v.replace(`${SOME_DIR}/`, '');
                    });
                    return newEntries;
                }
            })
        ],
        format: [
            'cjs', // Legacy browser support, also css in manifest.cjs.json
            'esm', // cjs needed because css files are not reported in manifest.esm.json
        ],
        // ...
    }
}

Release

git tag vX.Y.Z
git push origin vX.Y.Z

This will trigger release & publish on NPM.

Options

options?.generate

Type: (entries: Record<string,string>) => Record<string,string>

Callback used to manipulate the content of the produced manifest file.

License

MIT

Package Sidebar

Install

npm i @enonic/tsup-plugin-manifest

Weekly Downloads

66

Version

0.0.1

License

MIT

Unpacked Size

11.4 kB

Total Files

6

Last publish

Collaborators

  • edloidas
  • sigdestad
  • cwe_at_enonic.com
  • alansemenov