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

Add support for creating other Flutter project templates #3004

Merged
merged 5 commits into from
Dec 15, 2020
Merged

Add support for creating other Flutter project templates #3004

merged 5 commits into from
Dec 15, 2020

Conversation

BootBlock
Copy link
Contributor

This currently only implements the module template; if it looks good, then there will additional commits implementing the plugin and package templates.

Fixes #2963.

@DanTup
Copy link
Member

DanTup commented Dec 14, 2020

This all looks good to me, go ahead!

Once done, we should also update the places on the website that mention Flutter: New Project to have the updated name + new commands:

https://github.com/Dart-Code/Website

@DanTup DanTup added in flutter Relates to running Flutter apps is enhancement labels Dec 14, 2020
@DanTup DanTup added this to the v3.18.0 milestone Dec 14, 2020
Copy link
Member

@DanTup DanTup left a comment

Choose a reason for hiding this comment

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

LGTM - two minor comments about extracting some of the repeated code. Thanks!


const contents = fs.readFileSync(pubspecFile);
if (contents.indexOf(expectedString) === -1)
assert.fail(`Did not find "${expectedString}'" in the file (${pubspecFile}):\n\n${contents}`);
Copy link
Member

Choose a reason for hiding this comment

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

Given we now essentially have four copies of this test, I think it's worth pulling out a function (just in this file) that takes in the the WorkspaceFolder (vs.workspace.workspaceFolders![4]), the expectedString, and file to check ("pubspec.yaml").

@@ -89,6 +89,72 @@ describe("command", () => {
assert.equal(json?.template === "module", true);
});

it("Flutter: New Package Project can be invoked and creates trigger file", async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Same as above, we could pull a function out here to avoid the duplication (the body of this test was modified recently to check the pre-population of the command, so it could change again and one copy would be easier).

Copy link
Member

@DanTup DanTup left a comment

Choose a reason for hiding this comment

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

one minor nit, but otherwise LGTM!

const contents = fs.readFileSync(mainFile);
if (contents.indexOf(expectedString) === -1)
assert.fail(`Did not find "${expectedString}'" in the sample file (${mainFile}):\n\n${contents}`);
const pubspecFile = path.join(sampleProjectFolder, "lib", "main.dart");
Copy link
Member

Choose a reason for hiding this comment

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

nit: variable name - this isn't a pubspec

Copy link
Member

Choose a reason for hiding this comment

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

(I'll rename this, as landing this now to prepare a pre-release build)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

D'oh - thanks!

@DanTup DanTup merged commit dd869cd into Dart-Code:master Dec 15, 2020
@BootBlock BootBlock deleted the flutter-create-project-types branch December 17, 2020 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in flutter Relates to running Flutter apps is enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add commands to create new Flutter plugin/package/module
2 participants