-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
- Loading branch information
Showing
9 changed files
with
84 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/core/src/install/migrations/20240329200200-eslint-ignore.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { PackageJson } from "../../services/PackageJson"; | ||
import { | ||
createTestProjectDirWithFixtures, | ||
removeTestProjectDir, | ||
restorePackageJson, | ||
} from "../../tests/project"; | ||
import { up } from "./20240329200200-eslint-ignore"; | ||
|
||
describe("Migration 20240329200200-eslint-ignore", () => { | ||
let testProjectDir: string; | ||
|
||
beforeAll(() => { | ||
testProjectDir = createTestProjectDirWithFixtures(__filename); | ||
}); | ||
|
||
afterAll(() => { | ||
removeTestProjectDir(__filename); | ||
}); | ||
|
||
describe("Up", () => { | ||
afterEach(() => { | ||
restorePackageJson(__filename); | ||
}); | ||
|
||
it("should apply migration", async () => { | ||
await up(testProjectDir); | ||
|
||
const packageJsonContent = PackageJson.fromDirPath(testProjectDir).getContent(); | ||
|
||
expect(packageJsonContent).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
packages/core/src/install/migrations/20240329200200-eslint-ignore.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { MigrationUpFunction } from "../../services/MigrationsService"; | ||
import { PackageJson } from "../../services/PackageJson"; | ||
|
||
export const up: MigrationUpFunction = async (absoluteProjectDir: string): Promise<void> => { | ||
const eslintConfig = { | ||
ignorePatterns: ["dist", "node_modules"], | ||
}; | ||
|
||
const packageJson = PackageJson.fromDirPath(absoluteProjectDir); | ||
packageJson.merge({ | ||
eslintConfig, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/core/src/install/migrations/__snapshots__/20240329200200-eslint-ignore.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Migration 20240329200200-eslint-ignore Up should apply migration 1`] = ` | ||
{ | ||
"eslintConfig": { | ||
"ignorePatterns": [ | ||
"dist", | ||
"node_modules", | ||
], | ||
}, | ||
"version": "1.0.0", | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters