@vidavidorra/create-project 4.2.4 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  const config = {
2
- '*.{ts,tsx,js,jsx}': ['xo --fix', () => 'ava'],
2
+ '*.{ts,tsx,js,jsx}': ['eslint --fix', () => 'ava'],
3
3
  '(package*|tsconfig).json': [() => 'ava'],
4
4
  '*.{vue,css,less,scss,html,htm,json,md,markdown,yml,yaml}':
5
5
  'prettier --write',
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  Interactively create a project.
4
4
 
5
5
  - Standardised project and repository setup.
6
+ - Linting using [**ESLint**](https://eslint.org/).
6
7
  - Code style using [**XO**](https://github.com/xojs/xo).
7
8
  - Code formatting using [**Prettier**](https://prettier.io/).
8
9
  - Commit style using [**`commitlint`**](https://commitlint.js.org/).
@@ -53,6 +54,7 @@ Please [create an issue](https://github.com/vidavidorra/create-project/issues/ne
53
54
  Refer to the [contributing guide](https://github.com/vidavidorra/.github/blob/main/CONTRIBUTING.md) for detailed information about other contributions, like pull requests.
54
55
 
55
56
  [![Conventional Commits: 1.0.0](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow?style=flat-square)](https://conventionalcommits.org)
57
+ [![Linter](https://img.shields.io/badge/Linter-ESLint-4B32C3?logo=eslint&style=flat-square)](https://eslint.org/)
56
58
  [![XO code style](https://shields.io/badge/code_style-5ed9c7?logo=xo&labelColor=gray&style=flat-square)](https://github.com/xojs/xo)
57
59
  [![Code style](https://img.shields.io/badge/code_style-Prettier-ff69b4?logo=prettier&style=flat-square)](https://github.com/prettier/prettier)
58
60
 
@@ -0,0 +1,8 @@
1
+ import { type Options } from '../options.js';
2
+ import { File } from './file.js';
3
+ declare class EslintConfig extends File {
4
+ constructor(path: string, options: Options);
5
+ process(): this;
6
+ private sourceFile;
7
+ }
8
+ export { EslintConfig };
@@ -0,0 +1,21 @@
1
+ import ts from 'typescript';
2
+ import { File } from './file.js';
3
+ class EslintConfig extends File {
4
+ constructor(path, options) {
5
+ super(path, { ...options, format: true, read: false });
6
+ }
7
+ process() {
8
+ this._content = ts.createPrinter().printFile(this.sourceFile());
9
+ return this;
10
+ }
11
+ sourceFile() {
12
+ const statements = [
13
+ ts.factory.createExportDeclaration(undefined, false, ts.factory.createNamedExports([
14
+ ts.factory.createExportSpecifier(false, undefined, ts.factory.createIdentifier('default')),
15
+ ]), ts.factory.createStringLiteral('@vidavidorra/eslint-config')),
16
+ ];
17
+ return ts.factory.createSourceFile(statements, ts.factory.createToken(ts.SyntaxKind.EndOfFileToken), ts.NodeFlags.None);
18
+ }
19
+ }
20
+ export { EslintConfig };
21
+ //# sourceMappingURL=eslint-config.js.map
@@ -1,9 +1,11 @@
1
1
  import { CiCd } from './ci-cd.js';
2
+ import { EslintConfig } from './eslint-config.js';
2
3
  import { File } from './file.js';
3
4
  import { LintStaged } from './lint-staged.js';
4
5
  import { Npmrc } from './npmrc.js';
5
6
  import { Package } from './package.js';
6
7
  import { Readme } from './readme/index.js';
8
+ import { Renovate } from './renovate.js';
7
9
  import { TsConfig } from './ts-config.js';
8
10
  function files(options) {
9
11
  return [
@@ -11,10 +13,11 @@ function files(options) {
11
13
  new File('.github/husky/pre-commit', { ...options, mode: 0o755 }),
12
14
  new CiCd('.github/workflows/ci-cd.yml', options),
13
15
  new LintStaged('.github/lint-staged.js', options),
14
- new File('.github/renovate.json', options),
16
+ new Renovate('.github/renovate.json', options),
15
17
  new File('.editorconfig', options),
16
18
  new File('.gitignore', options),
17
19
  new Npmrc('.npmrc', options),
20
+ new EslintConfig('eslint.config.js', options),
18
21
  new File('LICENSE.md', options),
19
22
  new Package('package.json', options),
20
23
  new Readme('README.md', options),
@@ -3,7 +3,7 @@ import { File } from './file.js';
3
3
  declare class LintStaged extends File {
4
4
  constructor(path: string, options: Options);
5
5
  process(): this;
6
- private xo;
6
+ private eslint;
7
7
  private ava;
8
8
  private prettier;
9
9
  private config;
@@ -2,14 +2,14 @@ import ts from 'typescript';
2
2
  import { File } from './file.js';
3
3
  class LintStaged extends File {
4
4
  constructor(path, options) {
5
- super(path, { ...options, format: true });
5
+ super(path, { ...options, format: true, read: false });
6
6
  }
7
7
  process() {
8
8
  this._content = ts.createPrinter().printFile(this.sourceFile());
9
9
  return this;
10
10
  }
11
- xo() {
12
- return ts.factory.createStringLiteral('xo --fix');
11
+ eslint() {
12
+ return ts.factory.createStringLiteral('eslint --fix');
13
13
  }
14
14
  ava() {
15
15
  return ts.factory.createArrowFunction(undefined, undefined, [], undefined, undefined, ts.factory.createStringLiteral('ava'));
@@ -20,7 +20,7 @@ class LintStaged extends File {
20
20
  config() {
21
21
  return ts.factory.createObjectLiteralExpression([
22
22
  ts.factory.createPropertyAssignment(ts.factory.createStringLiteral('*.{ts,tsx,js,jsx}'), ts.factory.createArrayLiteralExpression([
23
- this.xo(),
23
+ this.eslint(),
24
24
  ...(this._options.testing ? [this.ava()] : []),
25
25
  ])),
26
26
  ts.factory.createPropertyAssignment(ts.factory.createStringLiteral('*.{vue,css,less,scss,html,htm,json,md,markdown,yml,yaml}'), this.prettier()),
@@ -25,14 +25,13 @@ declare const schema: z.ZodObject<{
25
25
  build: z.ZodString;
26
26
  format: z.ZodString;
27
27
  'format:check': z.ZodString;
28
- lint: z.ZodLiteral<"npm run format:check && xo">;
29
- 'lint:fix': z.ZodLiteral<"npm run format && xo --fix">;
28
+ lint: z.ZodLiteral<"npm run format:check && eslint">;
29
+ 'lint:fix': z.ZodLiteral<"npm run format && eslint --fix">;
30
30
  postinstall: z.ZodOptional<z.ZodString>;
31
31
  prepare: z.ZodLiteral<"husky .github/husky">;
32
32
  test: z.ZodString;
33
33
  }, z.core.$strict>;
34
34
  commitlint: z.ZodRecord<z.ZodString, z.ZodUnknown>;
35
- xo: z.ZodRecord<z.ZodString, z.ZodUnknown>;
36
35
  prettier: z.ZodLiteral<"@vidavidorra/prettier-config">;
37
36
  release: z.ZodRecord<z.ZodString, z.ZodUnknown>;
38
37
  ava: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -71,14 +70,13 @@ declare class Package extends File {
71
70
  build: string;
72
71
  format: string;
73
72
  'format:check': string;
74
- lint: "npm run format:check && xo";
75
- 'lint:fix': "npm run format && xo --fix";
73
+ lint: "npm run format:check && eslint";
74
+ 'lint:fix': "npm run format && eslint --fix";
76
75
  prepare: "husky .github/husky";
77
76
  test: string;
78
77
  postinstall?: string | undefined;
79
78
  };
80
79
  commitlint: Record<string, unknown>;
81
- xo: Record<string, unknown>;
82
80
  prettier: "@vidavidorra/prettier-config";
83
81
  release: Record<string, unknown>;
84
82
  devDependencies: Record<string, string>;
@@ -24,15 +24,14 @@ const schema = z.strictObject({
24
24
  format: z.string().startsWith('prettier'),
25
25
  // eslint-disable-next-line @typescript-eslint/naming-convention
26
26
  'format:check': z.string().startsWith('prettier'),
27
- lint: z.literal('npm run format:check && xo'),
27
+ lint: z.literal('npm run format:check && eslint'),
28
28
  // eslint-disable-next-line @typescript-eslint/naming-convention
29
- 'lint:fix': z.literal('npm run format && xo --fix'),
29
+ 'lint:fix': z.literal('npm run format && eslint --fix'),
30
30
  postinstall: z.string().optional(),
31
31
  prepare: z.literal('husky .github/husky'),
32
32
  test: z.string().min(1),
33
33
  }),
34
34
  commitlint: z.record(z.string(), z.unknown()),
35
- xo: z.record(z.string(), z.unknown()),
36
35
  prettier: z.literal('@vidavidorra/prettier-config'),
37
36
  release: z.record(z.string(), z.unknown()),
38
37
  ava: z.record(z.string(), z.unknown()).optional(),
@@ -84,12 +83,13 @@ class Package extends File {
84
83
  '@semantic-release/exec',
85
84
  '@semantic-release/git',
86
85
  '@vidavidorra/commitlint-config',
86
+ '@vidavidorra/eslint-config',
87
87
  '@vidavidorra/prettier-config',
88
+ 'eslint',
88
89
  'husky',
89
90
  'lint-staged',
90
91
  'prettier',
91
92
  'semantic-release',
92
- 'xo',
93
93
  ];
94
94
  if (this._options.typescript) {
95
95
  this._package.files = [this._fullPackage.files[0]];
@@ -1,5 +1,5 @@
1
1
  import { type Options } from '../../options.js';
2
- type Config = Record<'conventionalCommits' | 'xo' | 'prettier' | 'renovate' | 'semanticRelease' | 'codeCoverage' | 'license' | 'npmVersion' | 'npmDownloads' | 'nodeJsVersion', {
2
+ type Config = Record<'codeCoverage' | 'conventionalCommits' | 'eslint' | 'license' | 'nodeJsVersion' | 'npmDownloads' | 'npmVersion' | 'prettier' | 'renovate' | 'semanticRelease' | 'xo', {
3
3
  title: string;
4
4
  url: string;
5
5
  link: string;
@@ -14,15 +14,40 @@ class Badge {
14
14
  }
15
15
  get config() {
16
16
  return {
17
+ codeCoverage: {
18
+ title: 'Code coverage',
19
+ url: `https://img.shields.io/codecov/c/github/${this.gitHubRepository}?logo=codecov`,
20
+ link: `https://codecov.io/gh/${this.gitHubRepository}`,
21
+ },
17
22
  conventionalCommits: {
18
23
  title: 'Conventional Commits: 1.0.0',
19
24
  url: 'https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow',
20
25
  link: 'https://conventionalcommits.org',
21
26
  },
22
- xo: {
23
- title: 'XO code style',
24
- url: 'https://img.shields.io/badge/code_style-5ed9c7?logo=xo&labelColor=gray',
25
- link: 'https://github.com/xojs/xo',
27
+ eslint: {
28
+ title: 'Linter',
29
+ url: 'https://img.shields.io/badge/Linter-ESLint-4B32C3?logo=eslint&style=flat-square',
30
+ link: 'https://eslint.org/',
31
+ },
32
+ license: {
33
+ title: 'License',
34
+ url: `https://img.shields.io/github/license/${this.gitHubRepository}`,
35
+ link: `LICENSE.md`,
36
+ },
37
+ nodeJsVersion: {
38
+ title: 'Node.js version support',
39
+ url: `https://img.shields.io/node/v/${this._options.package}?logo=node.js`,
40
+ link: `https://nodejs.org/en/about/releases/`,
41
+ },
42
+ npmDownloads: {
43
+ title: 'npm downloads',
44
+ url: `https://img.shields.io/npm/dm/${this._options.package}?logo=npm`,
45
+ link: `https://www.npmjs.com/package/${this._options.package}`,
46
+ },
47
+ npmVersion: {
48
+ title: 'npm version',
49
+ url: `https://img.shields.io/npm/v/${this._options.package}?logo=npm`,
50
+ link: `https://www.npmjs.com/package/${this._options.package}`,
26
51
  },
27
52
  prettier: {
28
53
  title: 'Prettier code style',
@@ -39,30 +64,10 @@ class Badge {
39
64
  url: 'https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079',
40
65
  link: 'https://github.com/semantic-release/semantic-release',
41
66
  },
42
- codeCoverage: {
43
- title: 'Code coverage',
44
- url: `https://img.shields.io/codecov/c/github/${this.gitHubRepository}?logo=codecov`,
45
- link: `https://codecov.io/gh/${this.gitHubRepository}`,
46
- },
47
- license: {
48
- title: 'License',
49
- url: `https://img.shields.io/github/license/${this.gitHubRepository}`,
50
- link: `LICENSE.md`,
51
- },
52
- npmVersion: {
53
- title: 'npm version',
54
- url: `https://img.shields.io/npm/v/${this._options.package}?logo=npm`,
55
- link: `https://www.npmjs.com/package/${this._options.package}`,
56
- },
57
- npmDownloads: {
58
- title: 'npm downloads',
59
- url: `https://img.shields.io/npm/dm/${this._options.package}?logo=npm`,
60
- link: `https://www.npmjs.com/package/${this._options.package}`,
61
- },
62
- nodeJsVersion: {
63
- title: 'Node.js version support',
64
- url: `https://img.shields.io/node/v/${this._options.package}?logo=node.js`,
65
- link: `https://nodejs.org/en/about/releases/`,
67
+ xo: {
68
+ title: 'XO code style',
69
+ url: 'https://img.shields.io/badge/code_style-5ed9c7?logo=xo&labelColor=gray',
70
+ link: 'https://github.com/xojs/xo',
66
71
  },
67
72
  };
68
73
  }
@@ -70,6 +70,7 @@ class Readme extends File {
70
70
  ].join(' ')}
71
71
 
72
72
  ${this._badge.markdown('conventionalCommits')}
73
+ ${this._badge.markdown('eslint')}
73
74
  ${this._badge.markdown('xo')}
74
75
  ${this._badge.markdown('prettier')}`);
75
76
  }
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { type Options } from '../options.js';
3
+ import { File } from './file.js';
4
+ declare const schema: z.ZodObject<{
5
+ $schema: z.ZodLiteral<"https://docs.renovatebot.com/renovate-schema.json">;
6
+ extends: z.ZodTuple<[z.ZodLiteral<"github>vidavidorra/.github">], null>;
7
+ packageRules: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
8
+ }, z.core.$strict>;
9
+ type Config = z.infer<typeof schema>;
10
+ declare class Renovate extends File {
11
+ protected readonly _config: Config;
12
+ constructor(path: string, options: Options);
13
+ get config(): {
14
+ $schema: "https://docs.renovatebot.com/renovate-schema.json";
15
+ extends: ["github>vidavidorra/.github"];
16
+ packageRules?: Record<string, unknown>[] | undefined;
17
+ };
18
+ process(): this;
19
+ }
20
+ export { type Config, Renovate };
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import { File } from './file.js';
3
+ const schema = z.strictObject({
4
+ '$schema': z.literal('https://docs.renovatebot.com/renovate-schema.json'),
5
+ extends: z.tuple([z.literal('github>vidavidorra/.github')]),
6
+ packageRules: z.array(z.record(z.string(), z.unknown())).optional(),
7
+ });
8
+ class Renovate extends File {
9
+ _config;
10
+ constructor(path, options) {
11
+ super(path, { ...options, format: true });
12
+ this._config = schema.parse(JSON.parse(this._content));
13
+ }
14
+ get config() {
15
+ return structuredClone(this._config);
16
+ }
17
+ process() {
18
+ delete this._config.packageRules;
19
+ this._content = JSON.stringify(this._config, undefined, 2);
20
+ return this;
21
+ }
22
+ }
23
+ export { Renovate };
24
+ //# sourceMappingURL=renovate.js.map
@@ -7,11 +7,11 @@ declare const schema: z.ZodObject<{
7
7
  }, z.core.$loose>;
8
8
  include: z.ZodArray<z.ZodString>;
9
9
  }, z.core.$strict>;
10
- type TsConfigJson = z.infer<typeof schema>;
10
+ type Config = z.infer<typeof schema>;
11
11
  declare class TsConfig extends File {
12
- protected readonly _tsConfig: TsConfigJson;
12
+ protected readonly _config: Config;
13
13
  constructor(path: string, options: Options);
14
- get tsConfig(): {
14
+ get config(): {
15
15
  compilerOptions: {
16
16
  [x: string]: unknown;
17
17
  allowJs?: boolean | undefined;
@@ -20,4 +20,4 @@ declare class TsConfig extends File {
20
20
  };
21
21
  process(): this;
22
22
  }
23
- export { TsConfig, type TsConfigJson };
23
+ export { TsConfig, type Config };
@@ -5,17 +5,17 @@ const schema = z.strictObject({
5
5
  include: z.array(z.string()).min(1),
6
6
  });
7
7
  class TsConfig extends File {
8
- _tsConfig;
8
+ _config;
9
9
  constructor(path, options) {
10
10
  super(path, { ...options, format: true });
11
- this._tsConfig = schema.required().parse(JSON.parse(this._content));
11
+ this._config = schema.parse(JSON.parse(this._content));
12
12
  }
13
- get tsConfig() {
14
- return structuredClone(this._tsConfig);
13
+ get config() {
14
+ return structuredClone(this._config);
15
15
  }
16
16
  process() {
17
- delete this._tsConfig.compilerOptions.allowJs;
18
- this._content = JSON.stringify(this._tsConfig, undefined, 2);
17
+ delete this._config.compilerOptions.allowJs;
18
+ this._content = JSON.stringify(this._config, undefined, 2);
19
19
  return this;
20
20
  }
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vidavidorra/create-project",
3
- "version": "4.2.4",
3
+ "version": "4.4.0",
4
4
  "private": false,
5
5
  "description": "Interactively create a GitHub project",
6
6
  "keywords": [
@@ -37,8 +37,8 @@
37
37
  "format": "prettier --write \"**/*.{vue,css,less,scss,html,htm,json,md,markdown,yml,yaml}\" --log-level warn",
38
38
  "format:check": "prettier --check \"**/*.{vue,css,less,scss,html,htm,json,md,markdown,yml,yaml}\" --log-level warn",
39
39
  "postinstall": "node ./src/scripts/postinstall.js",
40
- "lint": "npm run format:check && xo",
41
- "lint:fix": "npm run format && xo --fix",
40
+ "lint": "npm run format:check && eslint",
41
+ "lint:fix": "npm run format && eslint --fix",
42
42
  "prepare": "husky .github/husky",
43
43
  "test": "c8 ava"
44
44
  },
@@ -47,10 +47,6 @@
47
47
  "@vidavidorra"
48
48
  ]
49
49
  },
50
- "xo": {
51
- "prettier": true,
52
- "space": true
53
- },
54
50
  "prettier": "@vidavidorra/prettier-config",
55
51
  "release": {
56
52
  "branches": [
@@ -216,13 +212,14 @@
216
212
  "@types/sinon": "21.0.0",
217
213
  "@types/validate-npm-package-name": "4.0.2",
218
214
  "@vidavidorra/commitlint-config": "7.1.6",
215
+ "@vidavidorra/eslint-config": "1.0.2",
219
216
  "ava": "6.4.1",
220
217
  "c8": "10.1.3",
218
+ "eslint": "9.39.2",
221
219
  "husky": "9.1.7",
222
220
  "lint-staged": "16.2.7",
223
221
  "semantic-release": "25.0.2",
224
- "sinon": "21.0.0",
225
- "xo": "1.2.3"
222
+ "sinon": "21.0.0"
226
223
  },
227
224
  "engines": {
228
225
  "node": ">=22"
@@ -27,7 +27,7 @@ function postinstall() {
27
27
 
28
28
  if (
29
29
  import.meta.url.startsWith('file:') &&
30
- fileURLToPath(import.meta.url) === argv.at(1)
30
+ fileURLToPath(import.meta.url) === argv.at(1)
31
31
  ) {
32
32
  postinstall();
33
33
  }