This commit is contained in:
Alex
2023-07-26 01:41:45 -04:00
parent 3debdb9e74
commit 08cf6729ae
6 changed files with 49 additions and 7 deletions

View File

@ -6,9 +6,9 @@ import { name } from '../dist/package.json';
const pkgPath = resolve(process.cwd(), 'package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
pkg.devDependencies ??= {};
const devDeps = (pkg.devDependencies ??= {});
Object.assign(pkg.devDependencies, {
Object.assign(devDeps, {
'eslint-plugin-import': `file:./node_modules/${name}/import`,
'eslint-plugin-jsx-a11y': `file:./node_modules/${name}/jsx-a11y`,
'eslint-plugin-local': `file:./node_modules/${name}/local`,
@ -17,4 +17,19 @@ Object.assign(pkg.devDependencies, {
'eslint-plugin-react-hooks': `file:./node_modules/${name}/react-hooks`,
});
devDeps['@typescript-eslint/eslint-plugin'] ??= '6.2.0';
devDeps['@typescript-eslint/parser'] ??= '6.2.0';
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
const eslintrc = resolve(process.cwd(), '.eslintrc.js');
if (fs.existsSync(eslintrc)) {
fs.writeFileSync(
eslintrc,
`const { extendConfig } = require('@aet/eslint-rules/basic');
module.exports = extendConfig({
extends: [],
});`,
);
}

23
src/remove-alias.ts Normal file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env node
import fs from 'node:fs';
import { resolve } from 'node:path';
import { name } from '../dist/package.json';
const pkgPath = resolve(process.cwd(), 'package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
const devDeps = (pkg.devDependencies ??= {});
for (const dep of [
'eslint-plugin-import',
'eslint-plugin-jsx-a11y',
'eslint-plugin-local',
'eslint-plugin-rules',
'eslint-plugin-react',
'eslint-plugin-react-hooks',
]) {
if (devDeps[dep]?.startsWith(`file:./node_modules/${name}/`)) {
delete devDeps[dep];
}
}
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));