Skip to content

Commit

Permalink
refactor: scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Negin-Ulster committed Nov 14, 2023
1 parent db5701a commit 05b3fbc
Show file tree
Hide file tree
Showing 25 changed files with 9,861 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
max_line_length = off

[*.yml]
indent_size = 2

[{CHANGELOG.md,package.json,yarn.lock}]
indent_size = false
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
reports
coverage
!.eslintrc.js
node_modules
39 changes: 39 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
root: true,
extends: ['@tophat/eslint-config/base', '@tophat/eslint-config/jest'],
parserOptions: {
project: './tsconfig.lint.json',
},
rules: {
'prettier/prettier': [
'error',
{
printWidth: 100,
tabWidth: 4,
semi: false,
trailingComma: 'all' /* Reduces git diff. */,
singleQuote: true,
arrowParens: 'always', // Reduces character diff when adding Typescript types.
},
],
'@typescript-eslint/no-non-null-assertion': 'off',
'no-empty': ['error', { allowEmptyCatch: true }],
'import/order': [
'error',
{
alphabetize: { order: 'asc' },
'newlines-between': 'always',
groups: [
'unknown',
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
},
],
},
ignorePatterns: ['**/.*', 'packages/**/*.js', '**/lib'],
}
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# OS Specific
.DS_STORE

# IDE
.idea/
.vim/
.vscode/*
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/settings.json

# Dependency Management
node_modules
.yarn/*
!.yarn/releases
!.yarn/plugins
!.yarn/versions
!.yarn/patches
!.yarn/sdks
.pnp.*

# Transient Files
*.tsbuildinfo
*.log
*.tmp
.tmp

# Build Artifacts
lib
./reports
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/iron
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
20 changes: 20 additions & 0 deletions .yarn/sdks/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint/bin/eslint.js your application uses
module.exports = absRequire(`eslint/bin/eslint.js`);
14 changes: 14 additions & 0 deletions .yarn/sdks/eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "eslint",
"version": "8.53.0-sdk",
"main": "./lib/api.js",
"type": "commonjs",
"bin": {
"eslint": "./bin/eslint.js"
},
"exports": {
"./package.json": "./package.json",
".": "./lib/api.js",
"./use-at-your-own-risk": "./lib/unsupported-api.js"
}
}
6 changes: 6 additions & 0 deletions .yarn/sdks/integrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file is automatically generated by @yarnpkg/sdks.
# Manual changes might be lost!

integrations:
- vscode
- vim
20 changes: 20 additions & 0 deletions .yarn/sdks/prettier/bin/prettier.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier/bin/prettier.cjs
require(absPnpApiPath).setup();
}
}

// Defer to the real prettier/bin/prettier.cjs your application uses
module.exports = absRequire(`prettier/bin/prettier.cjs`);
20 changes: 20 additions & 0 deletions .yarn/sdks/prettier/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier
require(absPnpApiPath).setup();
}
}

// Defer to the real prettier your application uses
module.exports = absRequire(`prettier`);
7 changes: 7 additions & 0 deletions .yarn/sdks/prettier/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "prettier",
"version": "3.1.0-sdk",
"main": "./index.cjs",
"type": "commonjs",
"bin": "./bin/prettier.cjs"
}
20 changes: 20 additions & 0 deletions .yarn/sdks/typescript/bin/tsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsc
require(absPnpApiPath).setup();
}
}

// Defer to the real typescript/bin/tsc your application uses
module.exports = absRequire(`typescript/bin/tsc`);
20 changes: 20 additions & 0 deletions .yarn/sdks/typescript/bin/tsserver
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsserver
require(absPnpApiPath).setup();
}
}

// Defer to the real typescript/bin/tsserver your application uses
module.exports = absRequire(`typescript/bin/tsserver`);
10 changes: 10 additions & 0 deletions .yarn/sdks/typescript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "typescript",
"version": "5.2.2-sdk",
"main": "./lib/typescript.js",
"type": "commonjs",
"bin": {
"tsc": "./bin/tsc",
"tsserver": "./bin/tsserver"
}
}
2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
nodeLinker: pnp
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# validate-schema
# NodeJS Tools Monorepo
50 changes: 50 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// @ts-check

const CI = Boolean(process.env.CI)

/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
...(CI && {
reporters: [
'default',
[
'jest-junit',
{
suiteName: 'Jest Tests',
outputDirectory: 'reports/jest/',
outputName: 'jest.junit.xml',
},
],
],
collectCoverage: true,
}),
transform: {
'^.+\\.tsx?$': require.resolve('ts-jest'),
},
setupFiles: ['<rootDir>/testUtils/setup.ts'],
coverageReporters: CI ? ['json'] : ['text', 'json'],
coverageDirectory: 'raw-coverage/jest/',
collectCoverageFrom: ['packages/**/src/**/*.ts', '.yarn/__virtual__/**/packages/**/*.ts'],
coveragePathIgnorePatterns: ['/node_modules/', '/__mocks__/', '\\.test.ts$', '\\.mock.ts$'],
watchPathIgnorePatterns: [
'<rootDir>/example-monorepo',
'<rootDir>/artifacts',
'<rootDir>/packages/.*/lib',
'<rootDir>/packages/.*/.*\\.js',
],
testPathIgnorePatterns: [
'/node_modules/',
'/.yarn/',
'<rootDir>/.*\\.js',
'<rootDir>/.*/lib/',
'<rootDir>/packages',
],
haste: {
throwOnModuleCollision: true,
},
modulePathIgnorePatterns: ['<rootDir>/.*/lib'],
testTimeout: 30000,
resolver: require.resolve('@tophat/jest-resolver'),
}

module.exports = config
66 changes: 66 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "@noahnu/nodejs-tools",
"private": true,
"description": "NodeJS tools.",
"author": {
"name": "noahnu",
"email": "[email protected]",
"url": "https://noahnu.com"
},
"repository": {
"type": "git",
"url": "https://github.com/noahnu/nodejs-tools.git"
},
"license": "MIT",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"workspaces": [
"packages/*"
],
"packageManager": "[email protected]",
"devDependencies": {
"@jest/types": "^29.6.3",
"@monodeploy/plugin-github": "^2.0.1",
"@tophat/commitizen-adapter": "^1.0.2",
"@tophat/commitlint-config": "^1.0.2",
"@tophat/conventional-changelog-config": "^1.0.1",
"@tophat/eslint-config": "^9.0.0",
"@tophat/eslint-import-resolver-require": "^1.0.0",
"@tophat/jest-resolver": "^0.1.0",
"@types/jest": "^29.5.8",
"@types/node": "^20",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"@yarnpkg/sdks": "^3.1.0",
"commitizen": "^4.3.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
"lint-staged": "^15.1.0",
"monodeploy": "^5.0.1",
"prettier": "^3.1.0",
"ts-jest": "^29.1.1",
"typescript": "5.2.2"
},
"scripts": {
"clean": "rm -rf ${ARTIFACT_DIR:-artifacts} && yarn workspaces foreach -vpi --worktree run clean",
"build": "yarn workspaces foreach -vpi --worktree --topological-dev run prepack",
"lint:ci": "eslint . --format junit --output-file reports/eslint.junit.xml",
"lint:fix": "eslint . --fix",
"lint": "eslint .",
"test:ci": "CI=1 run test --ci --runInBand",
"test:watch": "run test --watch",
"test": "jest --config=jest.config.js",
"types:watch": "tsc --noEmit --emitDeclarationOnly false --pretty --watch"
}
}
Empty file added packages/.gitkeep
Empty file.
Loading

0 comments on commit 05b3fbc

Please sign in to comment.