Skip to content

Commit

Permalink
chore: switch to --app-id (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
imhoffd authored Dec 21, 2020
1 parent e5ff983 commit db2dc7c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ You can also try the following methods to use this package:

```
--name <name> ............. Human-friendly app name
--package-id <id> ......... Unique app ID in reverse-DNS notation
--app-id <id> ............. Unique app ID in reverse-DNS notation
```
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const writeFile = util.promisify(fs.writeFile);
export const createConfigFile = async ({
name: appName,
dir,
'package-id': appId,
'app-id': appId,
}: OptionValues): Promise<void> => {
const config = {
appId,
Expand Down
2 changes: 1 addition & 1 deletion src/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const help = `
Options:
--name <name> ............. Human-friendly app name
--package-id <id> ......... Unique app ID in reverse-DNS notation
--app-id <id> ............. Unique app ID in reverse-DNS notation
-h, --help ................ Print help, then quit
--verbose ................. Print verbose output to stderr
Expand Down
8 changes: 4 additions & 4 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ export type Options = {
export interface OptionValues {
dir: string;
name: string;
'package-id': string;
'app-id': string;
}

export type Validators = {
[K in keyof Required<OptionValues>]: (value: any) => string | true;
};

export const CLI_ARGS = ['dir'] as const;
export const CLI_OPTIONS = ['name', 'package-id'] as const;
export const CLI_OPTIONS = ['name', 'app-id'] as const;

export const VALIDATORS: Validators = {
name: value =>
typeof value !== 'string' || value.trim().length === 0
? `Must provide an app name, e.g. "Spacebook"`
: true,
'package-id': value =>
'app-id': value =>
typeof value !== 'string' || value.trim().length === 0
? 'Must provide a Package ID, e.g. "com.example.app"'
? 'Must provide an App ID, e.g. "com.example.app"'
: /[A-Z]/.test(value)
? 'Must be lowercase'
: /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$/.test(value)
Expand Down
8 changes: 4 additions & 4 deletions src/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ export const gatherDetails = (
},
{
type: 'text',
name: 'package-id',
name: 'app-id',
message:
`What should be the Package ID for your app?\n\n` +
`What should be the App ID for your app?\n\n` +
`${kleur.reset(
` Package IDs (aka Bundle ID in iOS and Application ID in Android) are unique\n` +
` App IDs (aka Bundle ID in iOS and Application ID in Android) are unique\n` +
` identifiers for apps. They must be in reverse domain name notation, generally\n` +
` representing a domain name that you or your company owns.\n`,
)}\n`,
initial: 'com.example.app',
validate: VALIDATORS['package-id'],
validate: VALIDATORS['app-id'],
format: value => value.trim(),
},
],
Expand Down

0 comments on commit db2dc7c

Please sign in to comment.