-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: jest+typescript setup, package.json order, other minor stuff
- Loading branch information
Showing
21 changed files
with
374 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import type { Config } from 'jest'; | ||
|
||
const config: Config = { | ||
"verbose": true | ||
const config: Config = { | ||
verbose: true, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,33 +3,35 @@ | |
"version": "0.0.0", | ||
"private": true, | ||
"description": "A personal opinionated linting tool.", | ||
"keywords": [ | ||
"lint" | ||
], | ||
"author": "Joel Cox <[email protected]>", | ||
"license": "0BSD", | ||
"type": "module", | ||
"scripts": { | ||
"lint": "node packages/lint/index.js" | ||
"lint": "node packages/lint/index.js", | ||
"test": "jest" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/joelcox22/lint.git" | ||
}, | ||
"keywords": [ | ||
"lint" | ||
], | ||
"author": "Joel Cox <[email protected]>", | ||
"license": "0BSD", | ||
"devDependencies": { | ||
"@types/jest": "^.0.0", | ||
"@types/jest": "^29.0.0", | ||
"eslint": "^8.0.0", | ||
"jest": "^29.7.0", | ||
"semantic-release": "^23.0.2", | ||
"semantic-release-monorepo": "^8.0.0", | ||
"typescript": "^5.0.0", | ||
"ts-jest": "^.0.0" | ||
"ts-jest": "^29.0.0", | ||
"@joelbot/eslint-config": "^1.0.0", | ||
"@joelbot/lint": "^1.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=18" | ||
}, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"dependencies": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
{ | ||
"name": "@joelbot/eslint-config", | ||
"version": "0.0.0", | ||
"description": "A personal opinionated eslint configuration.", | ||
"private": true, | ||
"main": "index.js", | ||
"type": "module", | ||
"description": "A personal opinionated eslint configuration.", | ||
"author": "Joel Cox <[email protected]>", | ||
"license": "0BSD", | ||
"type": "module", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/joelcox22/lint.git" | ||
}, | ||
"dependencies": { | ||
"@eslint/eslintrc": "^3.0.0", | ||
"@typescript-eslint/eslint-plugin": "^7.001", | ||
"@typescript-eslint/parser": "^7.0.0", | ||
"app-root-path": "^3.1.0", | ||
"eslint": "^8.0.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
|
@@ -23,25 +26,10 @@ | |
"eslint-plugin-react-hooks": "^4.6.0", | ||
"flatted": "^3.3.1", | ||
"globals": "^14.0.0", | ||
"prettier": "^3.2.5" | ||
"prettier": "^3.2.5", | ||
"typescript-eslint": "^7.4.0" | ||
}, | ||
"peerDependencies": { | ||
"typescript": "^5.0.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/joelcox22/lint.git" | ||
}, | ||
"private": false, | ||
"devDependencies": { | ||
"semantic-release": "^23.0.2" | ||
}, | ||
"release": { | ||
"branches": [ | ||
"main" | ||
] | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,62 @@ | ||
import * as path from 'path'; | ||
import * as glob from 'glob'; | ||
import root from 'app-root-path'; | ||
import * as packageJson from './packageJson.js'; | ||
import gitignore from './gitignore.js'; | ||
import eslint from './eslint.js'; | ||
import prettier from './prettier.js'; | ||
import vscode from './vscode.js'; | ||
import editorconfig from './editorconfig.js'; | ||
import markdown from './markdown.js'; | ||
import semanticRelease from './semantic-release.js'; | ||
import forceDevDependencies from './force-devDependencies.js'; | ||
import jest from './jest.js'; | ||
import * as gitignore from './gitignore.js'; | ||
import * as eslint from './eslint.js'; | ||
import * as prettier from './prettier.js'; | ||
import * as vscode from './vscode.js'; | ||
import * as editorconfig from './editorconfig.js'; | ||
import * as markdown from './markdown.js'; | ||
import * as semanticRelease from './semantic-release.js'; | ||
import * as forceDevDependencies from './force-devDependencies.js'; | ||
import * as jest from './jest.js'; | ||
import * as util from '../util.js'; | ||
|
||
const debug = util.debug('configure'); | ||
|
||
export default function configure() { | ||
Object.entries({ | ||
prePackageJson: packageJson.pre, | ||
forceDevDependencies, | ||
jest, | ||
gitignore, | ||
eslint, | ||
prettier, | ||
vscode, | ||
editorconfig, | ||
markdown, | ||
semanticRelease, | ||
postPackageJson: packageJson.post, | ||
}).forEach(([name, applyConfig]) => { | ||
debug(`applying config changes for ${name}`); | ||
applyConfig(); | ||
}); | ||
const initialDir = process.cwd(); | ||
try { | ||
process.chdir(root.path); | ||
debug('starting in directory', root.path); | ||
const json = util.readJson('package.json'); | ||
const workspaces = json.workspaces; | ||
const dirs = [root.path]; | ||
if (workspaces) { | ||
const workspacePackages = workspaces.flatMap((pattern) => glob.sync(pattern + '/package.json')); | ||
workspacePackages.forEach((file) => { | ||
dirs.push(path.join(process.cwd(), file, '..')); | ||
}); | ||
} | ||
const plugins = [packageJson, forceDevDependencies, jest, gitignore, eslint, prettier, vscode, editorconfig, markdown, semanticRelease]; | ||
// eslint-disable-next-line no-inner-declarations | ||
function exec(plugin, step) { | ||
if (plugin[step]) { | ||
if (plugin.workspacesSupported) { | ||
for (const dir of dirs) { | ||
debug('executing', step, 'step for', plugin.name, 'in', dir); | ||
process.chdir(dir); | ||
plugin[step](dir === root.path); | ||
} | ||
} else { | ||
debug('executing', step, 'step for', plugin.name, 'in', root.path); | ||
process.chdir(root.path); | ||
plugin[step](true); | ||
} | ||
} | ||
} | ||
for (const plugin of plugins) { | ||
exec(plugin, 'pre'); | ||
} | ||
for (const plugin of plugins) { | ||
exec(plugin, 'default'); | ||
} | ||
const reversed = plugins.reverse(); | ||
for (const plugin of reversed) { | ||
exec(plugin, 'post'); | ||
} | ||
} finally { | ||
process.chdir(initialDir); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.