diff --git a/packages/turbo-releaser/src/native.test.ts b/packages/turbo-releaser/src/native.test.ts index 0801a67101707..b0a1de655495f 100644 --- a/packages/turbo-releaser/src/native.test.ts +++ b/packages/turbo-releaser/src/native.test.ts @@ -39,7 +39,7 @@ describe("generateNativePackage", () => { ); // Assert copyFile was called correctly - assert.equal(mockCopyFile.mock.calls.length, 1); + assert.equal(mockCopyFile.mock.calls.length, 2); assert.ok( mockCopyFile.mock.calls[0].arguments[0].endsWith("template/README.md") ); @@ -47,6 +47,13 @@ describe("generateNativePackage", () => { mockCopyFile.mock.calls[0].arguments[1], path.join(outputDir, "README.md") ); + assert.ok( + mockCopyFile.mock.calls[1].arguments[0].endsWith("template/LICENSE") + ); + assert.equal( + mockCopyFile.mock.calls[1].arguments[1], + path.join(outputDir, "LICENSE") + ); // Assert writeFile was called correctly assert.equal(mockWriteFile.mock.calls.length, 1); @@ -91,7 +98,7 @@ describe("generateNativePackage", () => { outputDir, }); - assert.equal(mockCopyFile.mock.calls.length, 2); + assert.equal(mockCopyFile.mock.calls.length, 3); assert.ok( mockCopyFile.mock.calls[0].arguments[0].endsWith("template/bin/turbo") ); diff --git a/packages/turbo-releaser/src/native.ts b/packages/turbo-releaser/src/native.ts index 5bb75b66dff91..1ea2924ee0745 100644 --- a/packages/turbo-releaser/src/native.ts +++ b/packages/turbo-releaser/src/native.ts @@ -25,19 +25,20 @@ async function generateNativePackage({ await rm(outputDir, { recursive: true, force: true }); await mkdir(path.join(outputDir, "bin"), { recursive: true }); - if (os === "windows") { - console.log("Copying Windows-specific files..."); + const copyFromTemplate = async (part: string, ...parts: Array) => { + console.log("Copying ", path.join(part, ...parts)); await copyFile( - path.join(templateDir, "bin", "turbo"), - path.join(outputDir, "bin", "turbo") + path.join(templateDir, part, ...parts), + path.join(outputDir, part, ...parts) ); + }; + + if (os === "windows") { + await copyFromTemplate("bin", "turbo"); } - console.log("Copying README.md..."); - await copyFile( - path.join(templateDir, "README.md"), - path.join(outputDir, "README.md") - ); + await copyFromTemplate("README.md"); + await copyFromTemplate("LICENSE"); console.log("Generating package.json..."); const packageJson = { diff --git a/packages/turbo-releaser/template/LICENSE b/packages/turbo-releaser/template/LICENSE new file mode 100644 index 0000000000000..5c3db8bb6f857 --- /dev/null +++ b/packages/turbo-releaser/template/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2024 Vercel, Inc + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.