Skip to content

Idea - Migrate towards more structured project layout? #163

@bgribaudo

Description

@bgribaudo

Both the legacy and current SDK expect an extension project's assets to be contained in a single directory (a flat structure; no subdirectories).

While this works, it brings with it some potential downsides, such as:

  • The compile process excludes certain files from the mez it outputs based on file extension (principally .test.pq files). Otherwise, it seems to bundle up everything into the mez. This can inadvertently lead to unexpected/unneeded files (such as the project’s readme) being packaged into the extension.
  • The flat structure limits the ability to organize files into related groupings (such as putting all test files together). While legacy SDK projects support only one .test.pq file, the new SDK allows multiple—which means more files can end up lumped into a single directory.

In contrast, many programming projects use a more structured project layout, where subfolders are used to group related files. For example:

/src -> contains code to build for distribution
/tests -> contains tests
{other files go here, as desired, such as a readme or license file}

Would it make sense to encourage PQ extension projects towards a more structured project layout?

Possible Implementation

An implementation of this might look like:

  • Have a configurable project setting specifying the subdirectory containing the extension’s actual code (default to:/src, or maybe something like /extension).
  • When the SDK triggers the build process, it passes makePQX compile the above-specified subdirectory.
  • makePQX compile would:
    • Assume that everything in the specified directory should go into the extension (so no more excluding files based on their extension; exclusions shouldn’t be needed as non-extension files [like .query.pq files], should not be in the /src subfolder).
    • Validate that exactly one .pq extension file is present. Error if not true.
    • Validate that no subdirectories are present. Error if not true. (Or should subdirectories be allowed in mez files?)
  • Disable the “Evaluate this file” action when a file in the /src directory is selected.
  • When creating new projects, the default template used should include/src and /tests directories.
    • Technically, though, the user can put their test files in any directory other than the source directory (including in multiple directories, e.g. /tests-quick and /tests-longrunning), as “Evaluate this file” would work on any .pq file that is outside of the source directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions