Skip to content

Commit

Permalink
chore: initial project structure [part 1/5] (#1)
Browse files Browse the repository at this point in the history
* chore: added initial yarn + typescript structure

* chore: added hathor-rpc-handler

* chore: update flake inputs

* chore: added github PR templates

* chore: added tsconfig and eslint.config

* chore: opt-out of yarn's PnP

* chore: removed release candidate and release PR templates

* chore: using yarn-berry from nix stable

* chore: stop ignoring eslint config

* chore: removed gitattributes

* chore: ignoring all of .yarn

* refactor: added hathor header
  • Loading branch information
andreabadesso authored Jun 21, 2024
1 parent d34cf65 commit f0d2dd5
Show file tree
Hide file tree
Showing 14 changed files with 1,459 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2
7 changes: 7 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if [[ $(type -t use_flake) != function ]]; then
echo "ERROR: use_flake function missing."
echo "Please update direnv to v2.30.0 or later."
exit 1
fi

use flake
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Please go the the `Preview` tab and select the appropriate Pull Request template:

* [Feature Branch](?expand=1&template=feature_branch_pr_template.md) - Use this PR template when you are merging a feature branch into `master`
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/feature_branch_pr_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Motivation

What was the motivation for the changes in this PR?

### Acceptance Criteria

- Include here all things that this PR should solve

### Checklist
- [ ] If you are requesting a merge into `master`, confirm this code is production-ready and can be included in future releases as soon as it gets merged
- [ ] Make sure either the unit tests and/or the QA tests are capable of testing the new features
- [ ] Make sure you do not include new dependencies in the project unless strictly necessary and do not include dev-dependencies as production ones. More dependencies increase the possibility of one of them being hijacked and affecting us.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.yarn/*
node_modules/
.pnp.*
.direnv/
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
128 changes: 128 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
description = "virtual environments";

inputs = {
devshell.url = "github:numtide/devshell";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, flake-utils, devshell, nixpkgs, ... }@inputs:
let
overlays.default = final: prev:
let
packages = self.packages.${final.system};
inherit (packages) node-packages;
in
{
nodejs = final.nodejs_20;
nodePackages = prev.nodePackages;
};
in
flake-utils.lib.eachDefaultSystem (system: {
devShell =
let pkgs = import nixpkgs {
inherit system;

overlays = [
devshell.overlays.default
overlays.default
];
};
in
pkgs.devshell.mkShell {
packages = with pkgs; [
nixpkgs-fmt
nodejs_20
yarn-berry
];
};
});
}
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "hathor-rpc-lib",
"private": true,
"packageManager": "[email protected]",
"workspaces": [
"packages/hathor-rpc-handler"
]
}
14 changes: 14 additions & 0 deletions packages/hathor-rpc-handler/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
ignores: [
'dist/**/*.js',
],
}
)
28 changes: 28 additions & 0 deletions packages/hathor-rpc-handler/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "hathor-rpc-handler",
"license": "MIT",
"main": "dist/index.js",
"type": "module",
"typings": "dist/index.d.ts",
"files": [
"dist",
"src"
],
"engines": {
"node": ">=20"
},
"scripts": {
"lint": "eslint .",
"build": "tsc",
"watch": "tsc -w"
},
"author": "André Abadesso",
"devDependencies": {
"@eslint/js": "9.4.0",
"@types/eslint__js": "8.42.3",
"@types/node": "20.14.2",
"eslint": "9.4.0",
"typescript": "5.4.5",
"typescript-eslint": "7.13.0"
}
}
9 changes: 9 additions & 0 deletions packages/hathor-rpc-handler/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Copyright (c) Hathor Labs and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

export default () => {
};
18 changes: 18 additions & 0 deletions packages/hathor-rpc-handler/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "CommonJS",
"sourceMap": true,
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./dist",
"types": ["node"]
},
"exclude": [
"node_modules",
"dist"
]
}

Loading

0 comments on commit f0d2dd5

Please sign in to comment.