Skip to content

Add generated file header to bundle same as regular transpiled files #1005

@Zamiell

Description

@Zamiell

Greetings,

In the configuration management world (e.g. Puppet, Chef), it is best practice for the tool to append a comment to the beginning of the file.

Something like:

# DO NOT EDIT THIS SCRIPT - THIS SCRIPT IS MANAGED BY PUPPET AND ANY CHANGES WILL BE OVERWRITTEN
mkdir foo1
mkdir foo2
mkdir foo3

Currently, this is the top 5 lines of my "main.lua" file that was generated by TypeScriptToLua:

local ____modules = {}
local ____moduleCache = {}
local ____originalRequire = require
local function require(file)

I propose that TypeScriptToLua should do the same thing for the lua files it outputs:

--[[

This file was automatically generated with TypeScriptToLua.
https://typescripttolua.github.io/
DO NOT EDIT THIS FILE, as any changes will be overwritten.

--]]

local ____modules = {}
local ____moduleCache = {}
local ____originalRequire = require
local function require(file)

I think this would be valuable for various reasons. For example, someone just submitted a pull request to one of my projects that edited the generated Lua file instead of the actual TypeScript files, and maybe this header would have prevented that.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions