Skip to content

WIP#1

Draft
bertdeblock wants to merge 1 commit into
mainfrom
files
Draft

WIP#1
bertdeblock wants to merge 1 commit into
mainfrom
files

Conversation

@bertdeblock

Copy link
Copy Markdown
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
Copy Markdown
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.

@gossi gossi Feb 4, 2025

Copy link
Copy Markdown

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.

🤷

Comment thread src/run-scenario.ts
const restoreFiles = await backUpFiles(cwd, [
// "package.json",
lockfile,
...Object.keys(scenario.files),

Copy link
Copy Markdown
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
Copy Markdown

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

Comment thread src/files.ts
/**
* Apply a scenario's files.
*/
export function applyScenarioFiles(

Copy link
Copy Markdown
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.

Comment thread src/file-handlers.ts
@@ -0,0 +1,22 @@
import { flattenObject } from "flatten-anything";

@bertdeblock bertdeblock Feb 4, 2025

Copy link
Copy Markdown
Owner Author

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
Copy Markdown

Choose a reason for hiding this comment

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

very good idea 👍

@gossi gossi left a comment

Copy link
Copy Markdown

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?

Comment thread src/run-scenario.ts
const restoreFiles = await backUpFiles(cwd, [
// "package.json",
lockfile,
...Object.keys(scenario.files),

Copy link
Copy Markdown

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

Comment thread src/file-handlers.ts
@@ -0,0 +1,22 @@
import { flattenObject } from "flatten-anything";

Copy link
Copy Markdown

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";

@gossi gossi Feb 4, 2025

Copy link
Copy Markdown

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
Copy Markdown
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