Skip to content
This repository was archived by the owner on Nov 23, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/steps/commit_changes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export default async (options: Map<string, any>) => {
const v1Files: string[] = sync("/*", {
dot: true,
root: `${src}`,
ignore: [`${src}/v2/**`, `${src}/v2`, `${src}/**/.git*/**`]
ignore: [`${src}/v2/**`, `${src}/v2`, `${src}/v1`, `${src}/**/.git*/**`]
});
// Create the v1 directory
mkdir("-p", `${src}/v1`);
// Move all the v1 files across to the backup directory
mv(v1Files, `${src}/v1/`);
// Move the v2 files to the root directory
mv("-n", `${src}/v2/*`, `${src}/`);
mv("-n", [`${src}/v2/*`, `${src}/v2/.[!.]*`], `${src}/`);
// Remove the old v2 directory
rm("-fR", `${src}/v2`);
// Set the new dest on to options so that scripts will
Expand Down
4 changes: 4 additions & 0 deletions src/test/steps/commit_changes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("commit changes", () => {
editor = fsEditor.create(memFs.create());
editor.write(`${src}/app.js`, "");
editor.write(`${src}/v2/src/javascripts/legacy_app.js`, "");
editor.write(`${src}/v2/.babelrc`, "");
options = Map({ src, editor });
});

Expand All @@ -42,6 +43,9 @@ describe("commit changes", () => {
expect(dest).to.equal(src);
expect(test("-e", `${dest}/v2/src/javascripts/legacy_app.js`)).to.be.false;
expect(test("-e", `${dest}/src/javascripts/legacy_app.js`)).to.be.true;

expect(test("-e", `${dest}/v2/.babelrc`)).to.be.false;
expect(test("-e", `${dest}/.babelrc`)).to.be.true;
});

it("should backup the v1 app source files to a v1 folder", async () => {
Expand Down