generated from MetaMask/metamask-module-template
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standardise repo per module template as of April 2023 (#102)
* Standardise repo per module template as of April 2023 * Fix test script * Fix test workflow * Add further standardisation
- Loading branch information
Showing
17 changed files
with
1,360 additions
and
310 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"ignores": [ | ||
"@lavamoat/allow-scripts", | ||
"@lavamoat/preinstall-always-fail", | ||
"@metamask/auto-changelog", | ||
"@types/*", | ||
"prettier-plugin-packagejson", | ||
"ts-node", | ||
"typedoc" | ||
] | ||
} |
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
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
* text=auto | ||
|
||
yarn.lock linguist-generated=false | ||
|
||
# yarn v3 | ||
# See: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored | ||
/.yarn/releases/** binary | ||
/.yarn/plugins/** binary |
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,19 @@ | ||
<!-- | ||
Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: | ||
* What is the current state of things and why does it need to change? | ||
* What is the solution your changes offer and how does it work? | ||
Are there any issues or other links reviewers should consult to understand this pull request better? For instance: | ||
* Fixes #12345 | ||
* See: #67890 | ||
--> | ||
|
||
## Examples | ||
|
||
<!-- | ||
Are there any examples of this change being used in another repository? | ||
When considering changes to the MetaMask module template, it's strongly preferred that the change be experimented with in another repository first. This gives reviewers a better sense of how the change works, making it less likely the change will need to be reverted or adjusted later. | ||
--> |
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
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
v14 | ||
v16 |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,91 @@ | ||
%=============================================================================== | ||
% Utility predicates | ||
%=============================================================================== | ||
|
||
% True if RepoName can be unified with the repository name part of RepoUrl, a | ||
% complete URL for a repository on GitHub. This URL must include the ".git" | ||
% extension. | ||
repo_name(RepoUrl, RepoName) :- | ||
Prefix = 'https://github.com/MetaMask/', | ||
atom_length(Prefix, PrefixLength), | ||
Suffix = '.git', | ||
atom_length(Suffix, SuffixLength), | ||
atom_length(RepoUrl, RepoUrlLength), | ||
sub_atom(RepoUrl, 0, PrefixLength, After, Prefix), | ||
sub_atom(RepoUrl, Before, SuffixLength, 0, Suffix), | ||
Start is RepoUrlLength - After + 1, | ||
End is Before + 1, | ||
RepoNameLength is End - Start, | ||
sub_atom(RepoUrl, PrefixLength, RepoNameLength, SuffixLength, RepoName). | ||
|
||
%=============================================================================== | ||
% Constraints | ||
%=============================================================================== | ||
|
||
% The package must have a name. | ||
\+ gen_enforced_field(WorkspaceCwd, 'name', null). | ||
|
||
% The package must have a description. | ||
\+ gen_enforced_field(WorkspaceCwd, 'description', null). | ||
% The description cannot end with a period. | ||
gen_enforced_field(WorkspaceCwd, 'description', DescriptionWithoutTrailingPeriod) :- | ||
workspace_field(WorkspaceCwd, 'description', Description), | ||
atom_length(Description, Length), | ||
LengthLessOne is Length - 1, | ||
sub_atom(Description, LengthLessOne, 1, 0, LastCharacter), | ||
sub_atom(Description, 0, LengthLessOne, 1, DescriptionWithoutPossibleTrailingPeriod), | ||
( | ||
LastCharacter == '.' -> | ||
DescriptionWithoutTrailingPeriod = DescriptionWithoutPossibleTrailingPeriod ; | ||
DescriptionWithoutTrailingPeriod = Description | ||
). | ||
|
||
% The homepage of the package must match its name (which is in turn based on its | ||
% workspace directory name). | ||
gen_enforced_field(WorkspaceCwd, 'homepage', CorrectHomepageUrl) :- | ||
workspace_field(WorkspaceCwd, 'repository.url', RepoUrl), | ||
repo_name(RepoUrl, RepoName), | ||
atomic_list_concat(['https://github.com/MetaMask/', RepoName, '#readme'], CorrectHomepageUrl). | ||
|
||
% The bugs URL of the package must point to the Issues page for the repository. | ||
gen_enforced_field(WorkspaceCwd, 'bugs.url', CorrectBugsUrl) :- | ||
\+ workspace_field(WorkspaceCwd, 'private', true), | ||
workspace_field(WorkspaceCwd, 'repository.url', RepoUrl), | ||
repo_name(RepoUrl, RepoName), | ||
atomic_list_concat(['https://github.com/MetaMask/', RepoName, '/issues'], CorrectBugsUrl). | ||
|
||
% The package must specify Git as the repository type. | ||
gen_enforced_field(WorkspaceCwd, 'repository.type', 'git'). | ||
|
||
% The package must match the URL of a repo within the MetaMask organization. | ||
gen_enforced_field(WorkspaceCwd, 'repository.url', 'https://github.com/MetaMask/<insert repo name here>.git') :- | ||
workspace_field(WorkspaceCwd, 'repository.url', RepoUrl), | ||
\+ repo_name(RepoUrl, _). | ||
|
||
% The license for the package must be specified. | ||
gen_enforced_field(WorkspaceCwd, 'license'). | ||
|
||
% The entrypoint for the package must be `./dist/index.js`. | ||
gen_enforced_field(WorkspaceCwd, 'main', './dist/index.js'). | ||
|
||
% The type definitions entrypoint the package must be `./dist/index.d.ts`. | ||
gen_enforced_field(WorkspaceCwd, 'types', './dist/index.d.ts'). | ||
|
||
% The list of files included in the package must only include files generated | ||
% during the build step. | ||
gen_enforced_field(WorkspaceCwd, 'files', ['dist/']). | ||
|
||
% If a dependency is listed under "dependencies", it should not be listed under | ||
% "devDependencies". | ||
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, null, DependencyType) :- | ||
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'dependencies'), | ||
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType), | ||
DependencyType == 'devDependencies'. | ||
|
||
% The package must specify a minimum Node version of 16. | ||
gen_enforced_field(WorkspaceCwd, 'engines.node', '>=16.0.0'). | ||
|
||
% The package is public. | ||
gen_enforced_field(WorkspaceCwd, 'publishConfig.access', 'public'). | ||
% The package is available on the NPM registry. | ||
gen_enforced_field(WorkspaceCwd, 'publishConfig.registry', 'https://registry.npmjs.org/'). |
Oops, something went wrong.