Skip to content

Conversation

RheillyAguilar
Copy link
Contributor

@RheillyAguilar RheillyAguilar commented Dec 3, 2024

What is this PR for?

  • Just updating content and/or documentation
  • This fixes issue #_____
  • Spot fix (no issue #)
  • Merging WIP feature #_____
  • Merging done feature #_____
  • This is a merge from a version branch
  • Adding/Updating tests
  • This is a conflict resolution
  • This is a branch cleanup
  • Other: ________________

I verify that...

  • I have logged my time in the commits
  • I have logged my time in this PR
  • I have tagged all the relevant issues
  • I am using VS Code for type checks and linting, or
  • I have ran npm run test with no errors
  • I have manually checked that this bug or feature is working

Copy link
Contributor

@cblanquera cblanquera left a comment

Choose a reason for hiding this comment

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

I'm going to need explanations on some of the logic changes, before I can approve this PR.

constructor(input: string, options: TransformerOptions = {}) {
this.loader = new FileLoader(options.fs || new NodeFS(), options.cwd);
// Allow custom dependency injection through a constructor
constructor(input: string, options: TransformerOptions = {}, loader?: FileLoader, fs?: NodeFS) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the purpose of adding the 3rd and 4th argument loader?: FileLoader, fs?: NodeFS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

loader?: Fileloader is for custom instance of the FileLoader that can handles file loading logic
fs?: NodeFS it is to allow the Transformer to be flexible and work with different ways of accessing files
Overall is to allow the Transformer to work different types of file handling logics

@RheillyAguilar RheillyAguilar reopened this Dec 4, 2024
Copy link
Contributor

@cblanquera cblanquera left a comment

Choose a reason for hiding this comment

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

Almost there. Just a few spot fixes.

schema.model = schema.model || {};
//loop through child types
for (const [ name, model ] of Object.entries(child.model)) {
for (const [name, model] of Object.entries(child.model)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

spaces at the start and end of inline arrays

import type { PluginConfig, SchemaConfig } from '@stackpress/idea-parser';
import type Terminal from './Terminal';

//--------------------------------------------------------------------//
Copy link
Contributor

Choose a reason for hiding this comment

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

Readd line gap

// Transformer Types

export type TransformerOptions = { cwd?: string, fs?: FileSystem };
export type TransformerOptions = {cwd?: string, fs?: FileSystem};
Copy link
Contributor

Choose a reason for hiding this comment

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

space at the start and end of an inline object

//if no plugins defined throw error
if (!this.schema.plugin) {
// The first condition is for missing
// The second condtion is forr not an oject
Copy link
Contributor

Choose a reason for hiding this comment

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

typo forr

//if parent isnt final
}
//I remove the else to make the code easier to read and
//understand and to check separete the condition
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove commit and code change notes. If someone were to randomly read this file, this would have no context. We should use notes to explain the current logic.

const parent = schema.model[name];
//if type from child doesn't exist in schema (parent)
if (!parent) {
//I add !parent.mutable to make sure before adding to
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove commit and code change notes. If someone were to randomly read this file, this would have no context. We should use notes to explain the current logic.

// I use to logical Operator OR to combine the 2 condition
// Ensure that the plugin is exist its must be an object
// It is for error handling it's either the condition is true
// it can throw exception or if its not true will stop the tests
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove commit and code change notes. If someone were to randomly read this file, this would have no context. We should use notes to explain the current logic.

//if parent isnt final
}
// If the parent is mutable, perform a soft merge
if (parent.mutable ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove space after mutable

@cblanquera cblanquera merged commit 74ab375 into stackpress:main Dec 5, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants