This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved package name validation (#2687)
- Loading branch information
Showing
2 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/expo-cli/src/commands/eject/__tests__/ConfigValidation-test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { validatePackage } from '../ConfigValidation'; | ||
|
||
describe(validatePackage, () => { | ||
it(`must have at least two components split by a dot`, () => { | ||
expect(validatePackage('somn')).toBe(false); | ||
expect(validatePackage('somn.other')).toBe(true); | ||
expect(validatePackage('a.a.a.a')).toBe(true); | ||
expect(validatePackage('a_.a.a.a')).toBe(true); | ||
}); | ||
it(`requires each segment to start with a letter.`, () => { | ||
expect(validatePackage('1a.2b.c3')).toBe(false); | ||
expect(validatePackage('a.2b.c')).toBe(false); | ||
expect(validatePackage('a.b2.c')).toBe(true); | ||
}); | ||
it(`doesn't allow dashes`, () => { | ||
expect(validatePackage('a.b-c')).toBe(false); | ||
}); | ||
it(`doesn't allow special character`, () => { | ||
expect(validatePackage('com.bacon.©')).toBe(false); | ||
}); | ||
it(`doesn't allow capitalized`, () => { | ||
// simple | ||
expect(validatePackage('a.Catch')).toBe(false); | ||
// test components | ||
expect(validatePackage('foo.BAR.int')).toBe(false); | ||
}); | ||
it(`doesn't allow android reserved words`, () => { | ||
// simple | ||
expect(validatePackage('a.b.catch')).toBe(false); | ||
// test components | ||
expect(validatePackage('foo.bar.int')).toBe(false); | ||
// reserved word not exact match. | ||
expect(validatePackage('somn.foo.falser')).toBe(true); | ||
expect(validatePackage('while1.package2.void3.transient4')).toBe(true); | ||
|
||
// more reserved works | ||
expect(validatePackage('foo.bar.abstract')).toBe(false); | ||
expect(validatePackage('foo.bar.assert')).toBe(false); | ||
}); | ||
}); |
a1b565e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey guys. This commit broke my android package name! I understand I should not have used a capital A, but this is valid on google's end so expo should allow capitals as I show below...
"android": { "package": "app.ridebeep.App", "versionCode": 12, "googleServicesFile": "./google-services.json" },
I made a post on the Expo forums because I suspected an issue.
a1b565e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Expo should implement some warning for capital letters instead of not allowing them.
a1b565e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bnussman - thanks for the heads up. the problem here i think is that we treat applicationId and package as the same thing. we need to investigate what we should do here, i suspect we likely want to let you specify applicationId separately from package name
a1b565e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brentvatne thank you so much for the quick response and action
a1b565e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How now build application with old style package name, with uppercase symbols? Have any solutions? Because google play console sensitive to this one.
a1b565e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue, Capital Letters in my package name, I'm not able to push in play store anymore. I'll try to downgrade expo-cli to 3.27.8
a1b565e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you guys need a temporary work around. Just find the file packages/expo-cli/src/commands/eject/ConfigValidation.js and manually put the old code for validatePackage back in
a1b565e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i just rolled out expo-cli@3.27.11 as the latest release, this reverts this commit so we go back to the old style of validation. we will need to apply these validation rules to the package name in the future, but we will only add them back once we support
applicationId
config as separate frompackage