Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI extracted from Polykey and migrated to Polykey-CLI #2

Merged
merged 17 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
40 changes: 40 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Unused atm (jest sets this to `test`)
NODE_ENV=development

# Debug node modules - https://nodejs.org/api/cli.html#node_debugmodule
# NODE_DEBUG=

# Debug node native modules - https://nodejs.org/api/cli.html#node_debug_nativemodule
# NODE_DEBUG_NATIVE=

# Path to PK executable to override tests/bin target
# PK_TEST_COMMAND=

# If set, indicates that `PK_TEST_COMMAND` is targetting docker
# PK_TEST_COMMAND_DOCKER=
# Accessing AWS for testnet.polykey.io and mainnet.polykey.io deployment
AWS_DEFAULT_REGION='ap-southeast-2'
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=

# Path to container registry authentication file used by `skopeo`
# The file has the same contents as `DOCKER_AUTH_CONFIG`
# Use this command to acquire the auth file at `./tmp/auth.json`:
# ```
# printf 'PASSWORD' | skopeo login \
# --username 'USERNAME' \
# --password-stdin \
# $CI_REGISTRY_IMAGE \
# --authfile=./tmp/auth.json
# ```
# REGISTRY_AUTH_FILE=

# Authenticate to GitHub with `gh`
# GITHUB_TOKEN=

# To allow testing different executables in the bin tests
# Both PK_TEST_COMMAND and PK_TEST_PLATFORM must be set at the same time
# PK_TEST_COMMAND= #Specify the shell command we want to test against
# PK_TEST_PLATFORM=docker #Overrides the auto set `testPlatform` variable used for enabling platform specific tests
# PK_TEST_TMPDIR= #Sets the `global.tmpDir` variable to allow overriding the temp directory used for tests

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/proto/*
177 changes: 177 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true,
"node": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"plugins": [
"import"
],
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"rules": {
"linebreak-style": ["error", "unix"],
"no-empty": 1,
"no-useless-catch": 1,
"no-prototype-builtins": 1,
"no-constant-condition": 0,
"no-useless-escape": 0,
"no-console": "error",
"no-restricted-globals": [
"error",
{
"name": "global",
"message": "Use `globalThis` instead"
},
{
"name": "window",
"message": "Use `globalThis` instead"
}
],
"require-yield": 0,
"eqeqeq": ["error", "smart"],
"spaced-comment": [
"warn",
"always",
{
"line": {
"exceptions": ["-"]
},
"block": {
"exceptions": ["*"]
},
"markers": ["/"]
}
],
"capitalized-comments": [
"warn",
"always",
{
"ignoreInlineComments": true,
"ignoreConsecutiveComments": true
}
],
"curly": [
"error",
"multi-line",
"consistent"
],
"import/order": [
"error",
{
"groups": [
"type",
"builtin",
"external",
"internal",
"index",
"sibling",
"parent",
"object"
],
"pathGroups": [
{
"pattern": "@",
"group": "internal"
},
{
"pattern": "@/**",
"group": "internal"
}
],
"pathGroupsExcludedImportTypes": [
"type"
],
"newlines-between": "never"
}
],
"@typescript-eslint/no-namespace": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-unused-vars": [
"warn",
{
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/no-this-alias": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/consistent-type-imports": ["error"],
"@typescript-eslint/consistent-type-exports": ["error"],
"no-throw-literal": "off",
"@typescript-eslint/no-throw-literal": "off",
"@typescript-eslint/no-floating-promises": ["error", {
"ignoreVoid": true,
"ignoreIIFE": true
}],
"@typescript-eslint/no-misused-promises": ["error", {
"checksVoidReturn": false
}],
"@typescript-eslint/await-thenable": ["error"],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": ["camelCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allowSingleOrDouble"
},
{
"selector": "function",
"format": ["camelCase", "PascalCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allowSingleOrDouble"
},
{
"selector": "variable",
"format": ["camelCase", "UPPER_CASE", "PascalCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allowSingleOrDouble"
},
{
"selector": "parameter",
"format": ["camelCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allowSingleOrDouble"
},
{
"selector": "typeLike",
"format": ["PascalCase"],
"trailingUnderscore": "allowSingleOrDouble"
},
{
"selector": "enumMember",
"format": ["PascalCase", "UPPER_CASE"]
},
{
"selector": "objectLiteralProperty",
"format": null
},
{
"selector": "typeProperty",
"format": null
}
],
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": "allow-with-description"
}
]
}
}
23 changes: 23 additions & 0 deletions .github/workflows/codesee-arch-diagram.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This workflow was added by CodeSee. Learn more at https://codesee.io/
# This is v2.0 of this workflow file
on:
push:
branches:
- staging
pull_request_target:
types: [opened, synchronize, reopened]

name: CodeSee

permissions: read-all

jobs:
codesee:
runs-on: ubuntu-latest
continue-on-error: true
name: Analyze the repo with CodeSee
steps:
- uses: Codesee-io/codesee-action@v2
with:
codesee-token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}
codesee-url: https://app.codesee.io
132 changes: 132 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/tmp
/dist
.env*
!.env.example
# nix
/result*
/builds
# node-gyp
/build
# prebuildify
/prebuilds

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# editor
.vscode/
.idea/
Loading