Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP #1

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

WIP #1

wants to merge 1 commit into from

Conversation

bertdeblock
Copy link
Owner

No description provided.

import emberSourceChannelURL from "ember-source-channel-url";
// import { embroiderOptimized, embroiderSafe } from "@embroider/test-setup";
// import emberSourceChannelURL from "ember-source-channel-url";
import { fileHandlers } from "../dist/index.js";
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { fileHandlers } from "../dist/index.js";
import { fileOperations } from "../dist/index.js";

Maybe? Naming still feels a bit weird.

Copy link

@gossi gossi Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as fileOperations sounds more accurate, fileHandlers gives a bit more "familiar" feeling.

🤷

const restoreFiles = await backUpFiles(cwd, [
// "package.json",
lockfile,
...Object.keys(scenario.files),
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure all files are backed up first.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must also include package.json when config.packageJson is present

/**
* Apply a scenario's files.
*/
export function applyScenarioFiles(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main logic regarding files.

@@ -0,0 +1,22 @@
import { flattenObject } from "flatten-anything";
Copy link
Owner Author

@bertdeblock bertdeblock Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An operation that allows you to modify the contents of a JSON file more easily would also be useful I think:

files: {
  'package.json': fileOperations.modifyJson((pkg) => {
    delete pkg.foo.bar;

    return pkg;
  }),
},

Or something similar.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good idea 👍

Copy link

@gossi gossi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job. How can I help here?

const restoreFiles = await backUpFiles(cwd, [
// "package.json",
lockfile,
...Object.keys(scenario.files),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must also include package.json when config.packageJson is present

@@ -0,0 +1,22 @@
import { flattenObject } from "flatten-anything";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good idea 👍

import emberSourceChannelURL from "ember-source-channel-url";
// import { embroiderOptimized, embroiderSafe } from "@embroider/test-setup";
// import emberSourceChannelURL from "ember-source-channel-url";
import { fileHandlers } from "../dist/index.js";
Copy link

@gossi gossi Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as fileOperations sounds more accurate, fileHandlers gives a bit more "familiar" feeling.

🤷

@bertdeblock
Copy link
Owner Author

Awesome job. How can I help here?

I'm def planning on finishing this properly, but I probably need a bit more time.
Also want to make sure the API is future-proof.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants