From 7060eb1e9552ba14d69cc20964cfb6cca226f31e Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sat, 3 Feb 2024 15:08:27 -0700 Subject: [PATCH] Add a flake and move code to index.tsx --- .editorconfig | 9 +++ .envrc | 5 ++ codegen.yml | 2 +- flake.lock | 82 ++++++++++++++++++++++++ flake.nix | 27 ++++++++ package.json | 26 ++++---- src/{generated/graphql.tsx => index.tsx} | 0 7 files changed, 137 insertions(+), 14 deletions(-) create mode 100644 .editorconfig create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix rename src/{generated/graphql.tsx => index.tsx} (100%) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c4bd5fb --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*.json] +end_of_line = lf +charset = utf-8 +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..4c203ce --- /dev/null +++ b/.envrc @@ -0,0 +1,5 @@ +use flake . --impure + +if [ -f .envrc.local ]; then + source .envrc.local +fi diff --git a/codegen.yml b/codegen.yml index 82737a9..34dbb6b 100644 --- a/codegen.yml +++ b/codegen.yml @@ -2,7 +2,7 @@ overwrite: true schema: "src/schema.gql" documents: "src/**/*.gql" generates: - src/generated/graphql.tsx: + src/index.tsx: plugins: - "typescript" - "typescript-operations" diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..988b051 --- /dev/null +++ b/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703887061, + "narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1706732774, + "narHash": "sha256-hqJlyJk4MRpcItGYMF+3uHe8HvxNETWvlGtLuVpqLU0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b8b232ae7b8b144397fdb12d20f592e5e7c1a64d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..abe5978 --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + description = "Sample Nix ts-node build"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + gitignore = { + url = "github:hercules-ci/gitignore.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + outputs = { + self, + nixpkgs, + flake-utils, + gitignore, + ... + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs {inherit system;}; + nodejs = pkgs.nodejs-18_x; + in + with pkgs; { + devShell = mkShell { + buildInputs = [nodejs yarn watchman alejandra nodePackages.prettier]; + }; + }); +} diff --git a/package.json b/package.json index d51dba3..07093b0 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { - "name": "railbird-gql", - "version": "1.0.0", - "main": "index.js", - "repository": "ssh://gitea@dev.railbird.ai:1123/railbird/railbird-gql.git", - "author": "Ivan Malison ", - "license": "MIT", - "dependencies": { - "@graphql-codegen/cli": "^5.0.0", - "@graphql-codegen/typescript": "^4.0.1", - "@graphql-codegen/typescript-operations": "^4.0.1", - "@graphql-codegen/typescript-react-apollo": "^4.2.0", - "graphql": "^16.8.1" - } + "name": "railbird-gql", + "version": "1.0.0", + "main": "generated/index.js", + "repository": "ssh://gitea@dev.railbird.ai:1123/railbird/railbird-gql.git", + "author": "Ivan Malison ", + "license": "MIT", + "dependencies": { + "@graphql-codegen/cli": "^5.0.0", + "@graphql-codegen/typescript": "^4.0.1", + "@graphql-codegen/typescript-operations": "^4.0.1", + "@graphql-codegen/typescript-react-apollo": "^4.2.0", + "graphql": "^16.8.1" + } } diff --git a/src/generated/graphql.tsx b/src/index.tsx similarity index 100% rename from src/generated/graphql.tsx rename to src/index.tsx