Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Be more helpful when the default package name won't work #592

Open
truonghoangnguyen opened this issue Dec 20, 2018 · 3 comments
Open

Be more helpful when the default package name won't work #592

truonghoangnguyen opened this issue Dec 20, 2018 · 3 comments

Comments

@truonghoangnguyen
Copy link

> mkdir 2
> cd 2
> stagehand console-full

pubspec.yalm file result content:

name: 2 << ERROR : Error on line 1, column 7 of pubspec.yaml: "name" field must be a string.
description: A sample command-line application.
# version: 1.0.0
# homepage: https://www.example.com
# author: Your Name <email@example.com>

environment:
  sdk: '>=2.1.0 <3.0.0'
@chalin
Copy link
Contributor

chalin commented Dec 20, 2018

I believe that this works as intended: the directory name is used for the app name, and the app name must be a valid identifier. @kevmoo @kwalrath - care to comment further?

@kevmoo
Copy link
Contributor

kevmoo commented Dec 20, 2018

Well, 2 is not a valid package name. So in that respect, this is "works as intended".

Valid follow-up, though:

  • should stagehand support overriding the pkg name via command line flag?
  • should the error here be better? (guessing we're hitting pubspec_parse issue or related)

@kwalrath
Copy link
Contributor

kwalrath commented Dec 20, 2018

I've run into problems like this many times before, where either the directory name wasn't a valid identifier or was the same as (or resolved to be the same as) the name of a package it depended on. E.g., if the directory name is angular-components, you can successfully create all the files using stagehand web-angular, but pub get fails due to the dependency on angular_components.

I think that stagehand could make the developer experience better by making sure that the package name is a valid identifier that isn't listed as a dependency.

If there's an issue, it could either suggest changing the directory name or allow the user to override the package name.

@kwalrath kwalrath changed the title pubspect error when folder name is number Be more helpful when the default package name won't work Dec 20, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Development

No branches or pull requests

4 participants