From 51d86ab31bec8fe39af05fdadd1bb601d2b5ed2c Mon Sep 17 00:00:00 2001 From: Sahil Ahuja Date: Sun, 16 Feb 2025 22:11:40 +0530 Subject: [PATCH] Adding package.json to template --- repo-template/node-based-repo/.dockerignore | 24 ++++++ repo-template/node-based-repo/.editorconfig | 15 ++++ repo-template/node-based-repo/.gitignore | 76 +++++++++++++++++++ .../node-based-repo/eslint.config.mjs | 25 ++++++ repo-template/node-based-repo/package.json | 44 +++++++++++ repo-template/node-based-repo/sd | 2 + repo-template/node-based-repo/std | 2 + repo-template/node-based-repo/tsconfig.json | 26 +++++++ 8 files changed, 214 insertions(+) create mode 100644 repo-template/node-based-repo/.dockerignore create mode 100644 repo-template/node-based-repo/.editorconfig create mode 100644 repo-template/node-based-repo/.gitignore create mode 100644 repo-template/node-based-repo/eslint.config.mjs create mode 100644 repo-template/node-based-repo/package.json create mode 100755 repo-template/node-based-repo/sd create mode 100755 repo-template/node-based-repo/std create mode 100644 repo-template/node-based-repo/tsconfig.json diff --git a/repo-template/node-based-repo/.dockerignore b/repo-template/node-based-repo/.dockerignore new file mode 100644 index 0000000..1fd1fab --- /dev/null +++ b/repo-template/node-based-repo/.dockerignore @@ -0,0 +1,24 @@ +node_modules/ +.pnpm-store/ + +.npm/ +# Can't include git in docker ignore - needs to be present in publisher image +# .git/ +# #short_ref needed in BUILD_VERSION +# !.git/short_ref + +.idea/ +.vscode/ + +data/ +build/ +cloud/ +snowpack/ + +# ESlint coverage files +.coverage.eslint.codeframe +coverage/ +.nyc_output/ +# test/ -- test folder needs to be a part of the docker context so that it's present in the publisher image (in which tests are run) + +dev/pgadmin4/.pgpass diff --git a/repo-template/node-based-repo/.editorconfig b/repo-template/node-based-repo/.editorconfig new file mode 100644 index 0000000..7e3034e --- /dev/null +++ b/repo-template/node-based-repo/.editorconfig @@ -0,0 +1,15 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +indent_style = space + +# Matches multiple files with brace expansion notation +# Set default charset +[*.{js,jsx,ts,tsx,py,sh,md,njk,json}] +charset = utf-8 +indent_size = 2 diff --git a/repo-template/node-based-repo/.gitignore b/repo-template/node-based-repo/.gitignore new file mode 100644 index 0000000..6ac8a70 --- /dev/null +++ b/repo-template/node-based-repo/.gitignore @@ -0,0 +1,76 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +stats.json +statsProd.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 + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ +.pnpm-store/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# Build folders +data/ +build/ +cloud/ +lib + +# ESlint coverage files +coverage.eslint + +# IDE Specific +.idea/ +.cache/ +.vscode/* +!.vscode/launch.json diff --git a/repo-template/node-based-repo/eslint.config.mjs b/repo-template/node-based-repo/eslint.config.mjs new file mode 100644 index 0000000..8e5cd39 --- /dev/null +++ b/repo-template/node-based-repo/eslint.config.mjs @@ -0,0 +1,25 @@ +import eslint from "@eslint/js"; +import tseslint from "typescript-eslint"; + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommended, + { + "files": ["src/**/*.{js,ts,jsx,tsx}"], + rules: { + "no-undef": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/triple-slash-reference": "warn", + "@typescript-eslint/no-unused-vars": [ + "warn", + { + "ignoreRestSiblings": true, + "argsIgnorePattern": "(^_|^req$|^request$|^res$|^next$|^h$)", + "varsIgnorePattern": "(^_|^req$|^request$|^res$|^next$|^h$)" + } + ], + "@typescript-eslint/ban-ts-comment": "warn", + "no-async-promise-executor": "off" + }, + } +); diff --git a/repo-template/node-based-repo/package.json b/repo-template/node-based-repo/package.json new file mode 100644 index 0000000..395e711 --- /dev/null +++ b/repo-template/node-based-repo/package.json @@ -0,0 +1,44 @@ +{ + "name": "@gmetrivr/definitions", + "version": "1.0.163", + "description": "GMetri Definitions", + "types": "./lib/esm/index.d.ts", + "@comment main": "This key is still kept around until older version of node that don't understand exports key are used", + "main": "./lib/cjs/index.js", + "exports": { + "require": "./lib/cjs/index.js", + "import": "./lib/esm/index.js" + }, + "repository": "https://git.gmetri.io/gmetrivr/definitions", + "author": "GMetri ", + "license": "UNLICENSED", + "sideEffects": false, + "type": "module", + "files": [ + "lib/*" + ], + "scripts": { + "@comment TEST": "Useful for testing", + "check": "$(pnpm bin)/tsc --noEmit", + "lint": "$(pnpm bin)/eslint ./src", + "circular": "npx madge --circular --extensions ts src/index.ts", + "@comment PUBLISH": "Used for publishing this repo", + "build_npm": "rm -rf lib; pnpm buildpackagejson && pnpm buildesm && pnpm buildcjs", + "buildpackagejson": "tsconfig-to-dual-package ./src/tsconfig-esm.json ./src/tsconfig-cjs.json", + "buildesm": "./node_modules/.bin/tsc --project src/ -p src/tsconfig-esm.json;", + "buildcjs": "./node_modules/.bin/tsc --project src/ -p src/tsconfig-cjs.json;" + }, + "peerDependencies": { + "@gmetrixr/gdash": "1.*.*" + }, + "devDependencies": { + "@eslint/js": "^9.20.0", + "@gmetrixr/gdash": "^1.3.87", + "@tsconfig/node22": "^22.0.0", + "eslint": "^9.20.1", + "tsconfig-to-dual-package": "^1.2.0", + "tsx": "^4.19.2", + "typescript": "^5.7.3", + "typescript-eslint": "^8.21.0" + } +} diff --git a/repo-template/node-based-repo/sd b/repo-template/node-based-repo/sd new file mode 100755 index 0000000..b6e3cb1 --- /dev/null +++ b/repo-template/node-based-repo/sd @@ -0,0 +1,2 @@ +#!/bin/sh +./fab/sh/compose_up.sh $@ diff --git a/repo-template/node-based-repo/std b/repo-template/node-based-repo/std new file mode 100755 index 0000000..6436027 --- /dev/null +++ b/repo-template/node-based-repo/std @@ -0,0 +1,2 @@ +#!/bin/sh +./fab/sh/compose_down.sh diff --git a/repo-template/node-based-repo/tsconfig.json b/repo-template/node-based-repo/tsconfig.json new file mode 100644 index 0000000..eb7afbf --- /dev/null +++ b/repo-template/node-based-repo/tsconfig.json @@ -0,0 +1,26 @@ +{ + "extends": "@tsconfig/node22/tsconfig.json", + //https://www.typescriptlang.org/tsconfig/#module + "files": ["src/index.ts"], + "compilerOptions": { + "module": "Node16", + "moduleResolution": "node16", + "outDir": "./out", + // default set of type definitions for built-in JS APIs. Which this a lot of default JS objects become available + "lib": ["es2023", "DOM"], + // allow jsx syntax + "jsx": "preserve", + // Generate .d.ts files + "declaration": true, + "resolveJsonModule": true, + "noImplicitAny": true + // Using isolatedModules. So no longer exporting const enums. Just enums. + // "preserveConstEnums": true, + }, + "ts-node": { + //https://typestrong.org/ts-node/docs/imports/#native-ecmascript-modules + // Tell ts-node CLI to install the --loader automatically, explained below + "esm": true + }, + "include": ["src"], +}