generated from MetaMask/metamask-module-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All of the commits up to now have been adding code to support an MVP version of this tool. This commit ties up the MVP by adding a first rule, which merely verifies that a project has a `src/` directory, the entrypoint function to the tool, and the executable which kicks off the whole thing. This commit also adds a package script, `run-tool`, which can be used in development to quickly smoke test new changes.
- Loading branch information
Showing
17 changed files
with
988 additions
and
5 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
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
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,22 @@ | ||
#!/usr/bin/env node | ||
|
||
import { | ||
DEFAULT_PROJECT_NAMES, | ||
DEFAULT_CACHED_REPOSITORIES_DIRECTORY_PATH, | ||
} from './constants'; | ||
import { main } from './main'; | ||
|
||
main({ | ||
argv: process.argv, | ||
stdout: process.stdout, | ||
stderr: process.stderr, | ||
config: { | ||
cachedRepositoriesDirectoryPath: DEFAULT_CACHED_REPOSITORIES_DIRECTORY_PATH, | ||
defaultProjectNames: DEFAULT_PROJECT_NAMES, | ||
}, | ||
}).catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); | ||
|
||
// vi: ft=typescript |
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,5 +1,129 @@ | ||
import path from 'path'; | ||
|
||
/** | ||
* The number of milliseconds in an hour, used to determine when to pull the | ||
* latest changes for previously cached repositories. | ||
*/ | ||
export const ONE_HOUR = 60 * 60 * 1000; | ||
|
||
/** | ||
* The name of this project. Used to exclude this repo as a lintable project. | ||
*/ | ||
export const THIS_PROJECT_NAME = 'module-lint'; | ||
|
||
/** | ||
* The root directory of this project. | ||
*/ | ||
export const THIS_PROJECT_DIRECTORY_PATH = path.resolve(__dirname, '..'); | ||
|
||
/** | ||
* Wherever the tool was run. | ||
*/ | ||
export const WORKING_DIRECTORY_PATH = process.cwd(); | ||
|
||
/** | ||
* The usage text printed when the user requests help or provides invalid input. | ||
*/ | ||
export const USAGE_TEXT = ` | ||
Analyzes one or more repos for divergence from a template repo. | ||
${THIS_PROJECT_NAME} OPTIONS [ARGUMENTS...] | ||
Pass the names of one or more MetaMask repositories to lint them, or pass | ||
nothing to lint all MetaMask repositories. | ||
`.trim(); | ||
|
||
/** | ||
* In order to lint a remote repository, that repository must be cloned first. | ||
* This is the temporary directory where the clone lives. | ||
*/ | ||
export const DEFAULT_CACHED_REPOSITORIES_DIRECTORY_PATH = path.join( | ||
THIS_PROJECT_DIRECTORY_PATH, | ||
'tmp/repositories', | ||
); | ||
|
||
/** | ||
* The name of the template repository that project repositories will be | ||
* compared to. The only such repository we have is the module template. | ||
*/ | ||
export const DEFAULT_TEMPLATE_REPOSITORY_NAME = 'metamask-module-template'; | ||
|
||
/** | ||
* All of the remote MetaMask repositories that will be linted if a list is not | ||
* explicitly provided. | ||
* | ||
* Derived from: <https://github.com/MetaMask/core/issues/1079> | ||
*/ | ||
export const DEFAULT_PROJECT_NAMES = [ | ||
'KeyringController', | ||
'abi-utils', | ||
'action-create-release-pr', | ||
'action-is-release', | ||
'action-npm-publish', | ||
'action-publish-gh-pages', | ||
'action-publish-release', | ||
'action-tech-challenge-setup', | ||
'action-utils', | ||
'actions-test-repo', | ||
'api-playground', | ||
'api-specs', | ||
'auto-changelog', | ||
'bify-module-groups', | ||
'browser-passworder', | ||
'contract-metadata', | ||
'create-release-branch', | ||
'design-tokens', | ||
'detect-provider', | ||
'docusaurus-openrpc', | ||
'eth-block-tracker', | ||
'eth-hd-keyring', | ||
'eth-json-rpc-filters', | ||
'eth-json-rpc-infura', | ||
'eth-json-rpc-middleware', | ||
'eth-json-rpc-provider', | ||
'eth-ledger-bridge-keyring', | ||
'eth-method-registry', | ||
'eth-phishing-detect', | ||
'eth-sig-util', | ||
'eth-simple-keyring', | ||
'eth-snap-keyring', | ||
'eth-token-tracker', | ||
'eth-trezor-keyring', | ||
'ethereum-provider-openrpc-generator', | ||
'etherscan-link', | ||
'extension-port-stream', | ||
'extension-provider', | ||
'iframe-ee-openrpc-inspector-transport', | ||
'json-rpc-engine', | ||
'json-rpc-middleware-stream', | ||
'key-tree', | ||
'keyring-api', | ||
'keyring-snaps-registry', | ||
'logo', | ||
'metamask-eth-abis', | ||
'metamask-onboarding', | ||
'mobile-provider', | ||
'noble-secp256k1-compat-wrapper', | ||
'nonce-tracker', | ||
'object-multiplex', | ||
'obs-store', | ||
'open-rpc-docs-react', | ||
'openrpc-inspector-transport', | ||
'phishing-warning', | ||
'post-message-stream', | ||
'ppom-validator', | ||
'providers', | ||
'rpc-errors', | ||
'safe-event-emitter', | ||
'smart-transactions-controller', | ||
'snap-simple-keyring', | ||
'snaps-registry', | ||
'state-log-explorer', | ||
'swappable-obj-proxy', | ||
'template-sync', | ||
'test-dapp', | ||
'types', | ||
'utils', | ||
'vault-decryptor', | ||
'web3-stream-provider', | ||
]; |
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
Oops, something went wrong.