Migrate from V1 to V2
Breaking Changes​
Output file format​
Between the major versions we've made a few small formatting changes to the outputted file content.
None!
Line Endings​
In v1, generate-license-file preserved the line endings within license text. The --eol
property only applied to the text added around the licenses.
In v2, the --eol
property applies to all text in the output to create a consistent file.
Capitalisation of npm​
In v1, the output text wrote "npm" in capital letters.
In v2, the output now correctly writes npm in lowercase.
Credit​
In v1, credit to generate-license-file was only put at the bottom of the file.
In v2, credit is now also added at the top of the file.
End-of-line flag (EOL)​
In v1, the eol
arguement took in either windows
or posix
to set the line ending values in the output to either \r\n
or \n
respectively.
In v2, the eol
arguement now takes either crlf
or lf
for either \r\n
or \n
respectively.
- CLI
- Programmatic use
Change --eol windows
to --eol crlf
.
Change --eol posix
to --eol lf
.
await generateLicenseFile(myInput, myOutput, "windows");
await generateLicenseFile(myInput, myOutput, "posix");
await getLicenseFileText(myInput, "windows");
await getLicenseFileText(myInput, "posix");
await generateLicenseFile(myInput, myOutput, "crlf");
await generateLicenseFile(myInput, myOutput, "lf");
await getLicenseFileText(myInput, "crlf");
await getLicenseFileText(myInput, "lf");
Input​
In v1, the input
parameter was a path to the directory containing the package.json
file.
In v2, the input
parameter needs to be a path to the package.json
file itself.
- CLI
- Programmatic use
Change --input ./
to --input ./package.json
.
Change -i ./
to -i ./package.json
.
await generateLicenseFile("./", myOutput);
await getLicenseFileText("./");
await getProjectLicenses("./");
await generateLicenseFile("./package.json", myOutput);
await getLicenseFileText("./package.json");
await getProjectLicenses("./package.json");
New features to consider​
CI Mode​
If you're running the generate-license-file CLI as a part of your CI/CD pipelines/processes then you'll probably want to include our new --ci
flag.
This flag ensures that the CLI fails with a non-zero exitcode whenever it would normally prompt the user for an input. This can stop your processes from needlessly hanging until they hit your configured timeout, saving you time as well as debug effort due to the messages it will log before it exits.