@upleveled/preflight 7.0.9 → 8.0.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.
Files changed (44) hide show
  1. package/bin/preflight.ts +3 -0
  2. package/package.json +21 -40
  3. package/src/checks/allChangesCommittedToGit.ts +2 -2
  4. package/src/checks/eslint.ts +1 -1
  5. package/src/checks/eslintConfigIsValid.ts +3 -2
  6. package/src/checks/linkOnGithubAbout.ts +1 -1
  7. package/src/checks/noDependencyProblems/noDependenciesWithoutTypes.ts +2 -2
  8. package/src/checks/noDependencyProblems/noUnusedDependencies.ts +2 -2
  9. package/src/checks/noExtraneousFilesCommittedToGit.ts +1 -1
  10. package/src/checks/noSecretsCommittedToGit.ts +1 -1
  11. package/src/checks/nodeModulesIgnoredFromGit.ts +2 -2
  12. package/src/checks/preflightIsLatestVersion.ts +2 -2
  13. package/src/checks/prettier.ts +1 -1
  14. package/src/checks/projectFolderNameMatchesCorrectFormat.ts +1 -1
  15. package/src/checks/stylelint.ts +1 -1
  16. package/src/checks/stylelintConfigIsValid.ts +7 -5
  17. package/src/checks/useSinglePackageManager.ts +1 -1
  18. package/src/index.ts +19 -19
  19. package/src/util/packageJson.ts +1 -1
  20. package/bin/preflight.js +0 -3
  21. package/dist/checks/allChangesCommittedToGit.d.ts +0 -2
  22. package/dist/checks/eslint.d.ts +0 -2
  23. package/dist/checks/eslintConfigIsValid.d.ts +0 -2
  24. package/dist/checks/linkOnGithubAbout.d.ts +0 -2
  25. package/dist/checks/noDependencyProblems/noDependenciesWithoutTypes.d.ts +0 -2
  26. package/dist/checks/noDependencyProblems/noUnusedDependencies.d.ts +0 -2
  27. package/dist/checks/noExtraneousFilesCommittedToGit.d.ts +0 -2
  28. package/dist/checks/noSecretsCommittedToGit.d.ts +0 -2
  29. package/dist/checks/nodeModulesIgnoredFromGit.d.ts +0 -2
  30. package/dist/checks/preflightIsLatestVersion.d.ts +0 -2
  31. package/dist/checks/prettier.d.ts +0 -2
  32. package/dist/checks/projectFolderNameMatchesCorrectFormat.d.ts +0 -2
  33. package/dist/checks/stylelint.d.ts +0 -3
  34. package/dist/checks/stylelintConfigIsValid.d.ts +0 -2
  35. package/dist/checks/useSinglePackageManager.d.ts +0 -2
  36. package/dist/index.d.ts +0 -1
  37. package/dist/preflight.esm.js +0 -722
  38. package/dist/preflight.esm.js.map +0 -1
  39. package/dist/util/commandExample.d.ts +0 -1
  40. package/dist/util/crossPlatform.d.ts +0 -1
  41. package/dist/util/drone.d.ts +0 -1
  42. package/dist/util/packageJson.d.ts +0 -53
  43. package/dist/util/preflightBinPath.d.ts +0 -1
  44. package/dist/util/randomUserAgent.d.ts +0 -1
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env -S pnpm exec tsx
2
+
3
+ import '../src/index.ts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upleveled/preflight",
3
- "version": "7.0.9",
3
+ "version": "8.0.0",
4
4
  "repository": "upleveled/preflight",
5
5
  "license": "MIT",
6
6
  "author": "UpLeveled (https://github.com/upleveled)",
@@ -9,72 +9,53 @@
9
9
  "Karl Horky <karl.horky@gmail.com>"
10
10
  ],
11
11
  "type": "module",
12
- "main": "dist/preflight.esm.js",
13
- "module": "dist/preflight.esm.js",
14
- "typings": "dist/index.d.ts",
12
+ "module": "./src/index.ts",
13
+ "types": "./src/index.ts",
15
14
  "bin": {
16
- "preflight": "bin/preflight.js"
15
+ "preflight": "./bin/preflight.ts"
17
16
  },
18
17
  "files": [
19
- "bin/preflight.js",
20
- "dist",
18
+ "./bin/preflight.js",
21
19
  "src"
22
20
  ],
23
- "jest": {
24
- "transformIgnorePatterns": [
25
- "node_modules/(?!execa)/"
26
- ]
27
- },
28
21
  "dependencies": {
29
- "@types/eslint": "9.6.0",
30
- "algoliasearch": "5.0.0",
22
+ "@types/eslint": "9.6.1",
23
+ "algoliasearch": "5.8.1",
31
24
  "chalk": "5.3.0",
32
25
  "cheerio": "1.0.0",
33
26
  "depcheck": "1.4.7",
34
27
  "domhandler": "5.0.3",
35
- "execa": "9.3.1",
36
- "listr2": "8.2.4",
28
+ "execa": "9.4.0",
29
+ "listr2": "8.2.5",
37
30
  "node-fetch": "3.3.2",
38
31
  "p-reduce": "3.0.0",
39
- "readdirp": "3.6.0",
32
+ "readdirp": "4.0.2",
40
33
  "semver": "7.6.3",
41
- "top-user-agents": "2.1.22"
34
+ "top-user-agents": "2.1.24",
35
+ "tsx": "4.19.1"
42
36
  },
43
37
  "devDependencies": {
44
- "@babel/plugin-transform-modules-commonjs": "7.24.8",
45
- "@jest/globals": "29.7.0",
46
- "@size-limit/file": "11.1.4",
47
- "@types/babel__core": "7.20.5",
48
- "@types/jest": "29.5.12",
49
- "@types/node": "22.3.0",
38
+ "@types/node": "22.7.5",
50
39
  "@types/p-map": "2.0.0",
51
40
  "@types/semver": "7.5.8",
52
- "babel-jest": "29.7.0",
53
- "eslint": "9.9.0",
54
- "eslint-config-upleveled": "8.6.14",
41
+ "eslint": "9.12.0",
42
+ "eslint-config-upleveled": "8.8.0",
55
43
  "p-map": "7.0.2",
56
- "postinstall-postinstall": "2.1.0",
57
44
  "prettier": "3.3.3",
58
- "size-limit": "11.1.4",
59
- "stylelint": "16.8.2",
60
- "tsdx": "0.14.1",
61
- "tslib": "2.6.3",
62
- "typescript": "5.5.4"
45
+ "stylelint": "16.9.0",
46
+ "typescript": "5.6.3",
47
+ "vitest": "2.1.2"
63
48
  },
64
49
  "engines": {
65
50
  "node": ">=18"
66
51
  },
67
52
  "scripts": {
68
- "analyze": "size-limit --why",
69
- "build": "tsdx build --format esm --target node --tsconfig tsconfig.src.json",
70
53
  "docker-build": "docker build --tag preflight .",
71
- "docker-build-run": "pnpm docker-build-ts && pnpm docker-build && pnpm docker-run",
72
- "docker-build-ts": "tsc --project docker/tsconfig.build.json",
54
+ "docker-build-run": "pnpm docker-build && pnpm docker-run",
73
55
  "docker-run": "docker run preflight",
74
56
  "lint": "eslint . --max-warnings 0",
75
- "size": "size-limit",
76
- "start": "tsdx watch --format esm --target node",
77
- "test": "tsdx test",
57
+ "start": "tsx watch ./src/index.ts",
58
+ "test": "vitest run",
78
59
  "test-local": "rm -rf ./__tests__/fixtures/__temp && pnpm test"
79
60
  }
80
61
  }
@@ -1,7 +1,7 @@
1
1
  import { promises as fs } from 'node:fs';
2
2
  import { execa } from 'execa';
3
- import { commandExample } from '../util/commandExample';
4
- import { isDrone } from '../util/drone';
3
+ import { commandExample } from '../util/commandExample.ts';
4
+ import { isDrone } from '../util/drone.ts';
5
5
 
6
6
  export const title = 'All changes committed to Git';
7
7
 
@@ -1,5 +1,5 @@
1
1
  import { sep } from 'node:path';
2
- import { ESLint } from 'eslint';
2
+ import type { ESLint } from 'eslint';
3
3
  import { execa } from 'execa';
4
4
 
5
5
  export const title = 'ESLint';
@@ -68,8 +68,9 @@ export default async function eslintConfigIsValid() {
68
68
  const eslintDisableOccurrences = [];
69
69
 
70
70
  for await (const { path } of readdirp('.', {
71
- directoryFilter: ['!.git', '!.next', '!node_modules'],
72
- fileFilter: ['*.js', '*.jsx', '*.ts', '*.tsx'],
71
+ directoryFilter: (dir) =>
72
+ !['.git', '.next', 'node_modules'].includes(dir.basename),
73
+ fileFilter: (file) => /\.(?:js|jsx|ts|tsx)$/.test(file.basename),
73
74
  })) {
74
75
  const fileContents = await fs.readFile(path, 'utf-8');
75
76
  if (/eslint-disable|eslint [a-z0-9@/-]+: (0|off)/.test(fileContents)) {
@@ -2,7 +2,7 @@ import { load } from 'cheerio';
2
2
  import type { Element } from 'domhandler';
3
3
  import { execa } from 'execa';
4
4
  import fetch from 'node-fetch';
5
- import { randomUserAgent } from '../util/randomUserAgent';
5
+ import { randomUserAgent } from '../util/randomUserAgent.ts';
6
6
 
7
7
  export const title = 'GitHub repo has deployed project link under About';
8
8
 
@@ -1,8 +1,8 @@
1
1
  import { existsSync, promises as fs } from 'node:fs';
2
2
  import { algoliasearch } from 'algoliasearch';
3
3
  import pReduce from 'p-reduce';
4
- import { commandExample } from '../../util/commandExample';
5
- import { projectPackageJson } from '../../util/packageJson';
4
+ import { commandExample } from '../../util/commandExample.ts';
5
+ import { projectPackageJson } from '../../util/packageJson.ts';
6
6
 
7
7
  const client = algoliasearch(
8
8
  // Application ID and API key specific to UpLeveled
@@ -1,6 +1,6 @@
1
1
  import { execa } from 'execa';
2
- import { commandExample } from '../../util/commandExample';
3
- import { preflightBinPath } from '../../util/preflightBinPath';
2
+ import { commandExample } from '../../util/commandExample.ts';
3
+ import { preflightBinPath } from '../../util/preflightBinPath.ts';
4
4
 
5
5
  export const title = 'No unused dependencies';
6
6
 
@@ -1,5 +1,5 @@
1
1
  import { execa } from 'execa';
2
- import { commandExample } from '../util/commandExample';
2
+ import { commandExample } from '../util/commandExample.ts';
3
3
 
4
4
  export const title = 'No extraneous files committed to Git';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { execa } from 'execa';
2
- import { commandExample } from '../util/commandExample';
2
+ import { commandExample } from '../util/commandExample.ts';
3
3
 
4
4
  export const title = 'No secrets committed to Git';
5
5
 
@@ -1,7 +1,7 @@
1
1
  import { promises as fs } from 'node:fs';
2
2
  import { execa } from 'execa';
3
- import { commandExample } from '../util/commandExample';
4
- import { normalizeNewlines } from '../util/crossPlatform';
3
+ import { commandExample } from '../util/commandExample.ts';
4
+ import { normalizeNewlines } from '../util/crossPlatform.ts';
5
5
 
6
6
  export const title = 'node_modules/ folder ignored in Git';
7
7
 
@@ -1,8 +1,8 @@
1
1
  import os from 'node:os';
2
2
  import { execa } from 'execa';
3
3
  import semver from 'semver';
4
- import { commandExample } from '../util/commandExample';
5
- import { preflightPackageJson } from '../util/packageJson';
4
+ import { commandExample } from '../util/commandExample.ts';
5
+ import { preflightPackageJson } from '../util/packageJson.ts';
6
6
 
7
7
  export const title = 'Preflight is latest version';
8
8
 
@@ -1,5 +1,5 @@
1
1
  import { execa } from 'execa';
2
- import { normalizeNewlines } from '../util/crossPlatform';
2
+ import { normalizeNewlines } from '../util/crossPlatform.ts';
3
3
 
4
4
  export const title = 'Prettier';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path';
2
- import { commandExample } from '../util/commandExample';
2
+ import { commandExample } from '../util/commandExample.ts';
3
3
 
4
4
  export const title = 'Project folder name matches correct format';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { sep } from 'node:path';
2
2
  import { execa } from 'execa';
3
- import { LintResult } from 'stylelint';
3
+ import type { LintResult } from 'stylelint';
4
4
 
5
5
  export const supportedStylelintFileExtensions = [
6
6
  'css',
@@ -3,7 +3,7 @@ import { createRequire } from 'node:module';
3
3
  import { execa } from 'execa';
4
4
  import readdirp from 'readdirp';
5
5
  import semver from 'semver';
6
- import { supportedStylelintFileExtensions } from './stylelint';
6
+ import { supportedStylelintFileExtensions } from './stylelint.ts';
7
7
 
8
8
  const require = createRequire(`${process.cwd()}/`);
9
9
 
@@ -77,10 +77,12 @@ export default config;`;
77
77
  const stylelintDisableOccurrences = [];
78
78
 
79
79
  for await (const { path } of readdirp('.', {
80
- directoryFilter: ['!.git', '!.next', '!node_modules'],
81
- fileFilter: supportedStylelintFileExtensions.map(
82
- (fileExtension) => `*.${fileExtension}`,
83
- ),
80
+ directoryFilter: (dir) =>
81
+ !['.git', '.next', 'node_modules'].includes(dir.basename),
82
+ fileFilter: (file) =>
83
+ new RegExp(`\\.(?:${supportedStylelintFileExtensions.join('|')})$`).test(
84
+ file.basename,
85
+ ),
84
86
  })) {
85
87
  const fileContents = await fs.readFile(path, 'utf-8');
86
88
  if (fileContents.includes('stylelint-disable')) {
@@ -1,5 +1,5 @@
1
1
  import { execa } from 'execa';
2
- import { commandExample } from '../util/commandExample';
2
+ import { commandExample } from '../util/commandExample.ts';
3
3
 
4
4
  export const title = 'Use single package manager';
5
5
 
package/src/index.ts CHANGED
@@ -1,29 +1,29 @@
1
1
  import {
2
2
  Listr,
3
- ListrContext,
4
- ListrDefaultRenderer,
5
- ListrTask,
3
+ type ListrContext,
4
+ type ListrDefaultRenderer,
5
+ type ListrTask,
6
6
  ListrTaskWrapper,
7
7
  } from 'listr2';
8
- import * as allChangesCommittedToGit from './checks/allChangesCommittedToGit.js';
9
- import * as eslint from './checks/eslint.js';
10
- import * as eslintConfigIsValid from './checks/eslintConfigIsValid.js';
11
- import * as linkOnGithubAbout from './checks/linkOnGithubAbout.js';
12
- import * as nodeModulesIgnoredFromGit from './checks/nodeModulesIgnoredFromGit.js';
13
- import * as noDependenciesWithoutTypes from './checks/noDependencyProblems/noDependenciesWithoutTypes.js';
14
- import * as noUnusedAndMissingDependencies from './checks/noDependencyProblems/noUnusedDependencies.js';
15
- import * as noExtraneousFilesCommittedToGit from './checks/noExtraneousFilesCommittedToGit.js';
16
- import * as noSecretsCommittedToGit from './checks/noSecretsCommittedToGit.js';
17
- import * as preflightIsLatestVersion from './checks/preflightIsLatestVersion.js';
18
- import * as prettier from './checks/prettier.js';
19
- import * as projectFolderNameMatchesCorrectFormat from './checks/projectFolderNameMatchesCorrectFormat.js';
20
- import * as stylelint from './checks/stylelint.js';
21
- import * as stylelintConfigIsValid from './checks/stylelintConfigIsValid.js';
22
- import * as useSinglePackageManager from './checks/useSinglePackageManager.js';
8
+ import * as allChangesCommittedToGit from './checks/allChangesCommittedToGit.ts';
9
+ import * as eslint from './checks/eslint.ts';
10
+ import * as eslintConfigIsValid from './checks/eslintConfigIsValid.ts';
11
+ import * as linkOnGithubAbout from './checks/linkOnGithubAbout.ts';
12
+ import * as nodeModulesIgnoredFromGit from './checks/nodeModulesIgnoredFromGit.ts';
13
+ import * as noDependenciesWithoutTypes from './checks/noDependencyProblems/noDependenciesWithoutTypes.ts';
14
+ import * as noUnusedAndMissingDependencies from './checks/noDependencyProblems/noUnusedDependencies.ts';
15
+ import * as noExtraneousFilesCommittedToGit from './checks/noExtraneousFilesCommittedToGit.ts';
16
+ import * as noSecretsCommittedToGit from './checks/noSecretsCommittedToGit.ts';
17
+ import * as preflightIsLatestVersion from './checks/preflightIsLatestVersion.ts';
18
+ import * as prettier from './checks/prettier.ts';
19
+ import * as projectFolderNameMatchesCorrectFormat from './checks/projectFolderNameMatchesCorrectFormat.ts';
20
+ import * as stylelint from './checks/stylelint.ts';
21
+ import * as stylelintConfigIsValid from './checks/stylelintConfigIsValid.ts';
22
+ import * as useSinglePackageManager from './checks/useSinglePackageManager.ts';
23
23
  import {
24
24
  preflightPackageJson,
25
25
  projectPackageJson,
26
- } from './util/packageJson.js';
26
+ } from './util/packageJson.ts';
27
27
 
28
28
  const projectDependencies = projectPackageJson.dependencies || {};
29
29
 
@@ -61,5 +61,5 @@ export const projectPackageJson = JSON.parse(
61
61
  ) as PackageJson;
62
62
 
63
63
  export const preflightPackageJson = JSON.parse(
64
- await fs.readFile(new URL('../package.json', import.meta.url), 'utf-8'),
64
+ await fs.readFile(new URL('../../package.json', import.meta.url), 'utf-8'),
65
65
  ) as PackageJson;
package/bin/preflight.js DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import '../dist/preflight.esm.js';
@@ -1,2 +0,0 @@
1
- export declare const title = "All changes committed to Git";
2
- export default function allChangesCommittedToGit(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "ESLint";
2
- export default function eslintCheck(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "ESLint config is latest version";
2
- export default function eslintConfigIsValid(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "GitHub repo has deployed project link under About";
2
- export default function linkOnGithubAbout(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "No dependencies without types";
2
- export default function noDependenciesWithoutTypes(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "No unused dependencies";
2
- export default function noUnusedAndMissingDependencies(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "No extraneous files committed to Git";
2
- export default function noExtraneousFilesCommittedToGit(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "No secrets committed to Git";
2
- export default function noSecretsCommittedToGit(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "node_modules/ folder ignored in Git";
2
- export default function nodeModulesIgnoredFromGit(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "Preflight is latest version";
2
- export default function preflightIsLatestVersion(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "Prettier";
2
- export default function prettierCheck(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "Project folder name matches correct format";
2
- export default function projectFolderNameMatchesCorrectFormat(): void;
@@ -1,3 +0,0 @@
1
- export declare const supportedStylelintFileExtensions: string[];
2
- export declare const title = "Stylelint";
3
- export default function stylelintCheck(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "Stylelint config is latest version";
2
- export default function stylelintConfigIsValid(): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const title = "Use single package manager";
2
- export default function useSinglePackageManager(): Promise<void>;
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};