projen-javascript-configuration-file
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

npm version GitHub Workflow Status (branch) License

Javascript config file component for projen

WIP and subject to change

Assumptions

  • Config file supports ESM import/export (use .mjs file as needed)
  • Only a single export, which is a default export
  • Works best if export is a function (can work around that)

Usage

Add "projen-javascript-configuration-file" to devDeps in projenrc

Note: End a line with //! to remove it from the final output

In projenrc:

import { Configuration } from "webpack";

const projectName = project.name;
new JavascriptConfigComponent<Configuration>(
    project,
    "webpack.config.mjs",
    (webpackEnv) => {
      console.log("test"); //!
      return {
        name: projectName,
      };
    },
    {
      imports: [
        {
          module: "webpack-merge",
          nameImports: ["merge"],
        },
      ],
      variables: {
        projectName,
      },
    }
  );

Resulting webpack.config.mjs

import { merge } from "webpack-merge";
const projectName = "test-project";

export default () => {
    return {
        name: projectName,
    };
};

Readme

Keywords

none

Package Sidebar

Install

npm i projen-javascript-configuration-file

Weekly Downloads

2

Version

0.1.4

License

Apache-2.0

Unpacked Size

33.5 kB

Total Files

12

Last publish

Collaborators

  • mark.mcculloh