Skip to content

Commit

Permalink
stop overwriting sources
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Oct 27, 2020
1 parent fd743df commit fcc75a4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 37 deletions.
10 changes: 1 addition & 9 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,7 @@ const modifyManifest = (manifest, manifestPath, runTests = false) => {
}
const module = manifest["modules"].slice(-1)[0]
module["run-tests"] = runTests
module["sources"] = module.sources.map((source) => {
if (source.type === "git") {
return {
type: "dir",
path: path.relative(path.dirname(manifestPath), "."),
}
}
return source
})

return manifest
}

Expand Down
22 changes: 3 additions & 19 deletions tests/parser.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const path = require("path")
const { parseManifest, modifyManifest } = require("../index")

test("The manifest should be parsed correctly", async () => {
Expand Down Expand Up @@ -35,12 +34,7 @@ test("The manifest should be modified correctly if tests are enabled", async ()
const lastModule = modifiedManifest["modules"].slice(-1)[0]
expect(lastModule.name).toBe("testproject")
expect(lastModule["run-tests"]).toBe(true)
expect(lastModule.sources).toEqual([
{
type: "dir",
path: "..",
},
])

})

test("The manifest should be modified correctly if tests are enabled & has a build-options", async () => {
Expand All @@ -64,12 +58,7 @@ test("The manifest should be modified correctly if tests are enabled & has a bui
const lastModule = modifiedManifest["modules"].slice(-1)[0]
expect(lastModule.name).toBe("contrast")
expect(lastModule["run-tests"]).toBe(true)
expect(lastModule.sources).toEqual([
{
type: "dir",
path: "..",
},
])

})

test("The manifest should be modified correctly if in a subdirectory", async () => {
Expand All @@ -81,10 +70,5 @@ test("The manifest should be modified correctly if in a subdirectory", async ()
const lastModule = modifiedManifest["modules"].slice(-1)[0]
expect(lastModule.name).toBe("testproject")
expect(lastModule["run-tests"]).toBe(false)
expect(lastModule.sources).toEqual([
{
type: "dir",
path: "../..",
},
])

})

0 comments on commit fcc75a4

Please sign in to comment.