@upleveled/preflight 7.0.3 → 7.0.4
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.
- package/dist/preflight.esm.js +38 -44
- package/dist/preflight.esm.js.map +1 -1
- package/package.json +11 -11
- package/src/checks/eslint.ts +1 -1
- package/src/checks/eslintConfigIsValid.ts +4 -2
- package/src/checks/noDependencyProblems/noDependenciesWithoutTypes.ts +6 -2
- package/src/checks/stylelint.ts +1 -1
- package/src/checks/stylelintConfigIsValid.ts +4 -2
- package/src/index.ts +0 -9
- package/dist/checks/noDependencyProblems/nextJsProjectHasSharpInstalled.d.ts +0 -2
- package/src/checks/noDependencyProblems/nextJsProjectHasSharpInstalled.ts +0 -21
package/dist/preflight.esm.js
CHANGED
|
@@ -9,9 +9,9 @@ import semver from 'semver';
|
|
|
9
9
|
import cheerio from 'cheerio';
|
|
10
10
|
import fetch from 'node-fetch';
|
|
11
11
|
import userAgents from 'top-user-agents';
|
|
12
|
-
import { URL, fileURLToPath } from 'node:url';
|
|
13
12
|
import algoliasearch from 'algoliasearch';
|
|
14
13
|
import pReduce from 'p-reduce';
|
|
14
|
+
import { URL, fileURLToPath } from 'node:url';
|
|
15
15
|
import os from 'node:os';
|
|
16
16
|
|
|
17
17
|
// https://www.compart.com/en/unicode/U+2800
|
|
@@ -76,7 +76,7 @@ async function eslintCheck() {
|
|
|
76
76
|
.filter(eslintResult => {
|
|
77
77
|
return eslintResult.errorCount > 0 || eslintResult.warningCount > 0;
|
|
78
78
|
});
|
|
79
|
-
} catch
|
|
79
|
+
} catch {
|
|
80
80
|
throw error;
|
|
81
81
|
}
|
|
82
82
|
if (eslintResults.length < 1 || !eslintResults.every(result => 'errorCount' in result && 'warningCount' in result)) {
|
|
@@ -120,7 +120,9 @@ async function eslintConfigIsValid() {
|
|
|
120
120
|
try {
|
|
121
121
|
const eslintConfigPackageJsonPath = require$1.resolve('eslint-config-upleveled/package.json');
|
|
122
122
|
localVersion = JSON.parse(await promises.readFile(eslintConfigPackageJsonPath, 'utf-8')).version;
|
|
123
|
-
} catch
|
|
123
|
+
} catch {
|
|
124
|
+
// Swallow error
|
|
125
|
+
}
|
|
124
126
|
if (typeof localVersion === 'undefined') {
|
|
125
127
|
throw new Error(`The UpLeveled ESLint Config has not been installed - please install using the instructions on https://www.npmjs.com/package/eslint-config-upleveled
|
|
126
128
|
`);
|
|
@@ -132,7 +134,7 @@ async function eslintConfigIsValid() {
|
|
|
132
134
|
let eslintConfigMatches;
|
|
133
135
|
try {
|
|
134
136
|
eslintConfigMatches = (await promises.readFile('./eslint.config.js', 'utf-8')).trim() === "export { default } from 'eslint-config-upleveled';";
|
|
135
|
-
} catch
|
|
137
|
+
} catch {
|
|
136
138
|
throw new Error(`Error reading your eslint.config.js file - please delete the file if it exists and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled
|
|
137
139
|
`);
|
|
138
140
|
}
|
|
@@ -239,17 +241,6 @@ var nodeModulesIgnoredFromGit$1 = {
|
|
|
239
241
|
const projectPackageJson = /*#__PURE__*/JSON.parse(await /*#__PURE__*/promises.readFile('package.json', 'utf-8'));
|
|
240
242
|
const preflightPackageJson = /*#__PURE__*/JSON.parse(await /*#__PURE__*/promises.readFile( /*#__PURE__*/new URL('../package.json', import.meta.url), 'utf-8'));
|
|
241
243
|
|
|
242
|
-
const title$5 = 'Next.js project has sharp installed';
|
|
243
|
-
function nextJsProjectHasSharpInstalled() {
|
|
244
|
-
const dependenciesPackageNames = Object.keys(projectPackageJson.dependencies || {});
|
|
245
|
-
if (dependenciesPackageNames.includes('next') && !dependenciesPackageNames.includes('sharp')) {
|
|
246
|
-
throw new Error(`Next.js projects should have sharp installed for better image optimization. Install it with:
|
|
247
|
-
|
|
248
|
-
${commandExample('pnpm add sharp')}
|
|
249
|
-
`);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
244
|
const client = /*#__PURE__*/algoliasearch(
|
|
254
245
|
// Application ID and API key specific to UpLeveled
|
|
255
246
|
// Preflight. Please don't use anywhere else without
|
|
@@ -258,7 +249,7 @@ const client = /*#__PURE__*/algoliasearch(
|
|
|
258
249
|
// Application ID
|
|
259
250
|
'ec73550aa8b2936dab436d4e02144784');
|
|
260
251
|
const index = /*#__PURE__*/client.initIndex('npm-search');
|
|
261
|
-
const title$
|
|
252
|
+
const title$5 = 'No dependencies without types';
|
|
262
253
|
// This is a naive check for matching @types/<pkg name> packages
|
|
263
254
|
// that the student hasn't yet installed. It is not intended to
|
|
264
255
|
// be an exhaustive check for any types for all packages.
|
|
@@ -277,11 +268,15 @@ async function noDependenciesWithoutTypes() {
|
|
|
277
268
|
if ('types' in modulePackageJson || 'typings' in modulePackageJson) {
|
|
278
269
|
return filteredDependencies;
|
|
279
270
|
}
|
|
280
|
-
} catch
|
|
271
|
+
} catch {
|
|
272
|
+
// Swallow error
|
|
273
|
+
}
|
|
281
274
|
let indexDTsPath;
|
|
282
275
|
try {
|
|
283
276
|
indexDTsPath = require.resolve(`${dependency}/index.d.ts`);
|
|
284
|
-
} catch
|
|
277
|
+
} catch {
|
|
278
|
+
// Swallow error
|
|
279
|
+
}
|
|
285
280
|
// If the index.d.ts file exists inside the module's directory, bail out
|
|
286
281
|
if (indexDTsPath && existsSync(indexDTsPath)) {
|
|
287
282
|
return filteredDependencies;
|
|
@@ -323,7 +318,7 @@ const {
|
|
|
323
318
|
cwd: /*#__PURE__*/dirname( /*#__PURE__*/fileURLToPath(import.meta.url))
|
|
324
319
|
});
|
|
325
320
|
|
|
326
|
-
const title$
|
|
321
|
+
const title$6 = 'No unused dependencies';
|
|
327
322
|
async function noUnusedAndMissingDependencies() {
|
|
328
323
|
const ignoredPackagePatterns = [
|
|
329
324
|
// Unused dependency detected in https://github.com/upleveled/next-portfolio-dev
|
|
@@ -390,7 +385,7 @@ async function noUnusedAndMissingDependencies() {
|
|
|
390
385
|
}
|
|
391
386
|
}
|
|
392
387
|
|
|
393
|
-
const title$
|
|
388
|
+
const title$7 = 'No extraneous files committed to Git';
|
|
394
389
|
async function noExtraneousFilesCommittedToGit() {
|
|
395
390
|
const {
|
|
396
391
|
stdout
|
|
@@ -410,11 +405,11 @@ async function noExtraneousFilesCommittedToGit() {
|
|
|
410
405
|
|
|
411
406
|
var noExtraneousFilesCommittedToGit$1 = {
|
|
412
407
|
__proto__: null,
|
|
413
|
-
title: title$
|
|
408
|
+
title: title$7,
|
|
414
409
|
'default': noExtraneousFilesCommittedToGit
|
|
415
410
|
};
|
|
416
411
|
|
|
417
|
-
const title$
|
|
412
|
+
const title$8 = 'No secrets committed to Git';
|
|
418
413
|
async function noSecretsCommittedToGit() {
|
|
419
414
|
const {
|
|
420
415
|
stdout
|
|
@@ -440,11 +435,11 @@ async function noSecretsCommittedToGit() {
|
|
|
440
435
|
|
|
441
436
|
var noSecretsCommittedToGit$1 = {
|
|
442
437
|
__proto__: null,
|
|
443
|
-
title: title$
|
|
438
|
+
title: title$8,
|
|
444
439
|
'default': noSecretsCommittedToGit
|
|
445
440
|
};
|
|
446
441
|
|
|
447
|
-
const title$
|
|
442
|
+
const title$9 = 'Preflight is latest version';
|
|
448
443
|
async function preflightIsLatestVersion() {
|
|
449
444
|
const {
|
|
450
445
|
stdout: remoteVersion
|
|
@@ -459,11 +454,11 @@ async function preflightIsLatestVersion() {
|
|
|
459
454
|
|
|
460
455
|
var preflightIsLatestVersion$1 = {
|
|
461
456
|
__proto__: null,
|
|
462
|
-
title: title$
|
|
457
|
+
title: title$9,
|
|
463
458
|
'default': preflightIsLatestVersion
|
|
464
459
|
};
|
|
465
460
|
|
|
466
|
-
const title$
|
|
461
|
+
const title$a = 'Prettier';
|
|
467
462
|
async function prettierCheck() {
|
|
468
463
|
try {
|
|
469
464
|
await execaCommand('pnpm prettier "**/*.{js,jsx,ts,tsx,css,scss,sql}" --list-different --end-of-line auto');
|
|
@@ -488,11 +483,11 @@ async function prettierCheck() {
|
|
|
488
483
|
|
|
489
484
|
var prettier = {
|
|
490
485
|
__proto__: null,
|
|
491
|
-
title: title$
|
|
486
|
+
title: title$a,
|
|
492
487
|
'default': prettierCheck
|
|
493
488
|
};
|
|
494
489
|
|
|
495
|
-
const title$
|
|
490
|
+
const title$b = 'Project folder name matches correct format';
|
|
496
491
|
function projectFolderNameMatchesCorrectFormat() {
|
|
497
492
|
const currentDirectoryName = path.basename(process.cwd());
|
|
498
493
|
const lowercaseHyphenedDirectoryName = currentDirectoryName.toLowerCase().replaceAll(' ', '-');
|
|
@@ -510,12 +505,12 @@ function projectFolderNameMatchesCorrectFormat() {
|
|
|
510
505
|
|
|
511
506
|
var projectFolderNameMatchesCorrectFormat$1 = {
|
|
512
507
|
__proto__: null,
|
|
513
|
-
title: title$
|
|
508
|
+
title: title$b,
|
|
514
509
|
'default': projectFolderNameMatchesCorrectFormat
|
|
515
510
|
};
|
|
516
511
|
|
|
517
512
|
const supportedStylelintFileExtensions = ['css', 'sass', 'scss', 'less', 'js', 'tsx', 'jsx'];
|
|
518
|
-
const title$
|
|
513
|
+
const title$c = 'Stylelint';
|
|
519
514
|
async function stylelintCheck() {
|
|
520
515
|
try {
|
|
521
516
|
await execaCommand(`pnpm stylelint **/*.{${supportedStylelintFileExtensions.join(',')}} --max-warnings 0 --formatter json`);
|
|
@@ -526,7 +521,7 @@ async function stylelintCheck() {
|
|
|
526
521
|
let stylelintResults;
|
|
527
522
|
try {
|
|
528
523
|
stylelintResults = JSON.parse(stdout).filter(stylelintResult => stylelintResult.errored === true);
|
|
529
|
-
} catch
|
|
524
|
+
} catch {
|
|
530
525
|
throw error;
|
|
531
526
|
}
|
|
532
527
|
if (stylelintResults.length < 1 || !stylelintResults.every(result => 'errored' in result)) {
|
|
@@ -557,12 +552,12 @@ async function stylelintCheck() {
|
|
|
557
552
|
var stylelint = {
|
|
558
553
|
__proto__: null,
|
|
559
554
|
supportedStylelintFileExtensions: supportedStylelintFileExtensions,
|
|
560
|
-
title: title$
|
|
555
|
+
title: title$c,
|
|
561
556
|
'default': stylelintCheck
|
|
562
557
|
};
|
|
563
558
|
|
|
564
559
|
const require$2 = /*#__PURE__*/createRequire(`${/*#__PURE__*/process.cwd()}/`);
|
|
565
|
-
const title$
|
|
560
|
+
const title$d = 'Stylelint config is latest version';
|
|
566
561
|
async function stylelintConfigIsValid() {
|
|
567
562
|
const {
|
|
568
563
|
stdout: remoteVersion
|
|
@@ -571,7 +566,9 @@ async function stylelintConfigIsValid() {
|
|
|
571
566
|
try {
|
|
572
567
|
const stylelintConfigPackageJsonPath = require$2.resolve('stylelint-config-upleveled/package.json');
|
|
573
568
|
localVersion = JSON.parse(await promises.readFile(stylelintConfigPackageJsonPath, 'utf-8')).version;
|
|
574
|
-
} catch
|
|
569
|
+
} catch {
|
|
570
|
+
// Swallow error
|
|
571
|
+
}
|
|
575
572
|
if (typeof localVersion === 'undefined') {
|
|
576
573
|
throw new Error(`The UpLeveled Stylelint Config has not been installed - please install using the instructions on https://www.npmjs.com/package/eslint-config-upleveled
|
|
577
574
|
`);
|
|
@@ -589,7 +586,7 @@ const config = {
|
|
|
589
586
|
};
|
|
590
587
|
|
|
591
588
|
export default config;`;
|
|
592
|
-
} catch
|
|
589
|
+
} catch {
|
|
593
590
|
throw new Error(`Error reading your stylelint.config.js file - please delete the file if it exists and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled
|
|
594
591
|
`);
|
|
595
592
|
}
|
|
@@ -620,11 +617,11 @@ export default config;`;
|
|
|
620
617
|
|
|
621
618
|
var stylelintConfigIsValid$1 = {
|
|
622
619
|
__proto__: null,
|
|
623
|
-
title: title$
|
|
620
|
+
title: title$d,
|
|
624
621
|
'default': stylelintConfigIsValid
|
|
625
622
|
};
|
|
626
623
|
|
|
627
|
-
const title$
|
|
624
|
+
const title$e = 'Use single package manager';
|
|
628
625
|
async function useSinglePackageManager() {
|
|
629
626
|
const {
|
|
630
627
|
stdout
|
|
@@ -647,7 +644,7 @@ async function useSinglePackageManager() {
|
|
|
647
644
|
|
|
648
645
|
var useSinglePackageManager$1 = {
|
|
649
646
|
__proto__: null,
|
|
650
|
-
title: title$
|
|
647
|
+
title: title$e,
|
|
651
648
|
'default': useSinglePackageManager
|
|
652
649
|
};
|
|
653
650
|
|
|
@@ -665,14 +662,11 @@ projectFolderNameMatchesCorrectFormat$1,
|
|
|
665
662
|
// Dependencies
|
|
666
663
|
{
|
|
667
664
|
title: 'No dependency problems',
|
|
668
|
-
task: (ctx, task) => task.newListr([
|
|
669
|
-
title: title$
|
|
670
|
-
task: nextJsProjectHasSharpInstalled
|
|
671
|
-
}]), {
|
|
672
|
-
title: title$7,
|
|
665
|
+
task: (ctx, task) => task.newListr([{
|
|
666
|
+
title: title$6,
|
|
673
667
|
task: noUnusedAndMissingDependencies
|
|
674
668
|
}, {
|
|
675
|
-
title: title$
|
|
669
|
+
title: title$5,
|
|
676
670
|
task: noDependenciesWithoutTypes
|
|
677
671
|
}])
|
|
678
672
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.esm.js","sources":["../src/util/commandExample.ts","../src/util/drone.ts","../src/checks/allChangesCommittedToGit.ts","../src/checks/eslint.ts","../src/checks/eslintConfigIsValid.ts","../src/util/randomUserAgent.ts","../src/checks/linkOnGithubAbout.ts","../src/util/crossPlatform.ts","../src/checks/nodeModulesIgnoredFromGit.ts","../src/util/packageJson.ts","../src/checks/noDependencyProblems/nextJsProjectHasSharpInstalled.ts","../src/checks/noDependencyProblems/noDependenciesWithoutTypes.ts","../src/util/preflightBinPath.ts","../src/checks/noDependencyProblems/noUnusedDependencies.ts","../src/checks/noExtraneousFilesCommittedToGit.ts","../src/checks/noSecretsCommittedToGit.ts","../src/checks/preflightIsLatestVersion.ts","../src/checks/prettier.ts","../src/checks/projectFolderNameMatchesCorrectFormat.ts","../src/checks/stylelint.ts","../src/checks/stylelintConfigIsValid.ts","../src/checks/useSinglePackageManager.ts","../src/index.ts"],"sourcesContent":["import chalk from 'chalk';\n\n// https://www.compart.com/en/unicode/U+2800\n// eslint-disable-next-line security/detect-bidi-characters -- Intentional use of unusual character for formatting\nconst emptyBrailleCharacter = '';\n\nexport function commandExample(command: string) {\n return `${emptyBrailleCharacter} ${chalk.dim('$')} ${command}`;\n}\n","import { execaCommand } from 'execa';\n\nexport async function isDrone() {\n const { stdout } = await execaCommand('cat /etc/os-release', {\n reject: false,\n });\n return /Alpine Linux/.test(stdout);\n}\n","import { promises as fs } from 'node:fs';\nimport { execaCommand } from 'execa';\nimport { commandExample } from '../util/commandExample';\nimport { isDrone } from '../util/drone';\n\nexport const title = 'All changes committed to Git';\n\nexport default async function allChangesCommittedToGit() {\n const { stdout: replSlug } = await execaCommand('echo $REPL_SLUG');\n\n const isRunningInReplIt = replSlug !== '';\n\n if (isRunningInReplIt) {\n await fs.writeFile('.git/info/exclude', '.replit\\n');\n }\n\n const { stdout } = await execaCommand('git status --porcelain');\n\n if (stdout !== '') {\n const onlyPnpmLockModifiedOnDrone =\n stdout.trim() === 'M pnpm-lock.yaml' && (await isDrone());\n throw new Error(\n `Some changes have not been committed to Git:\n ${stdout}${\n onlyPnpmLockModifiedOnDrone\n ? `\n\n The only file with changes is the pnpm-lock.yaml file, indicating that npm was incorrectly used in addition to pnpm (eg. an \"npm install\" command was run). To fix this, force regeneration of the pnpm-lock.yaml file locally with the following command and then commit the changes:\n\n ${commandExample('pnpm install --force')}`\n : ''\n }\n `,\n );\n }\n}\n","import { sep } from 'node:path';\nimport { ESLint } from 'eslint';\nimport { execaCommand } from 'execa';\n\nexport const title = 'ESLint';\n\nexport default async function eslintCheck() {\n try {\n await execaCommand('pnpm eslint . --max-warnings 0 --format json');\n } catch (error) {\n const { stdout } = error as { stdout: string };\n\n let eslintResults;\n\n try {\n eslintResults = (JSON.parse(stdout) as ESLint.LintResult[])\n // Filter out results with no problems, which the ESLint CLI\n // still reports with the `--format json` flag\n .filter((eslintResult) => {\n return eslintResult.errorCount > 0 || eslintResult.warningCount > 0;\n });\n } catch (parseError) {\n throw error;\n }\n\n if (\n eslintResults.length < 1 ||\n !eslintResults.every(\n (result) => 'errorCount' in result && 'warningCount' in result,\n )\n ) {\n throw new Error(\n `Unexpected shape of ESLint JSON related to .errorCount and .warningCount properties - please report this to the UpLeveled engineering team, including the following output:\n ${stdout}\n `,\n );\n }\n\n throw new Error(\n `ESLint problems found in the following files:\n ${eslintResults\n // Make paths relative to the project:\n //\n // Before:\n // macOS / Linux: /home/projects/next-student-project/app/api/hello/route.js\n // Windows: C:\\Users\\Lukas\\projects\\next-student-project\\app\\api\\hello\\route.js\n //\n // After:\n // macOS / Linux: app/api/hello/route.js\n // Windows: app\\api\\hello\\route.js\n .map(({ filePath }) => filePath.replace(`${process.cwd()}${sep}`, ''))\n .join('\\n')}\n\n Open these files in your editor - there should be problems to fix\n `,\n );\n }\n}\n","import { promises as fs } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { execaCommand } from 'execa';\nimport readdirp from 'readdirp';\nimport semver from 'semver';\n\nconst require = createRequire(`${process.cwd()}/`);\n\nexport const title = 'ESLint config is latest version';\n\nexport default async function eslintConfigIsValid() {\n const { stdout: remoteVersion } = await execaCommand(\n 'npm show eslint-config-upleveled version',\n );\n\n let localVersion: string | undefined;\n\n try {\n const eslintConfigPackageJsonPath = require.resolve(\n 'eslint-config-upleveled/package.json',\n );\n\n localVersion = JSON.parse(\n await fs.readFile(eslintConfigPackageJsonPath, 'utf-8'),\n ).version;\n } catch (error) {}\n\n if (typeof localVersion === 'undefined') {\n throw new Error(\n `The UpLeveled ESLint Config has not been installed - please install using the instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n if (semver.gt(remoteVersion, localVersion)) {\n throw new Error(\n `Your current version of the UpLeveled ESLint Config (${localVersion}) is older than the latest version ${remoteVersion} - upgrade by running all lines of the install instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n let eslintConfigMatches;\n\n try {\n eslintConfigMatches =\n (await fs.readFile('./eslint.config.js', 'utf-8')).trim() ===\n \"export { default } from 'eslint-config-upleveled';\";\n } catch (error) {\n throw new Error(\n `Error reading your eslint.config.js file - please delete the file if it exists and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n if (!eslintConfigMatches) {\n throw new Error(\n `Your eslint.config.js file does not match the configuration file template - please delete the file and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n const eslintDisableOccurrences = [];\n\n for await (const { path } of readdirp('.', {\n directoryFilter: ['!.git', '!.next', '!node_modules'],\n fileFilter: ['*.js', '*.jsx', '*.ts', '*.tsx'],\n })) {\n const fileContents = await fs.readFile(path, 'utf-8');\n if (/eslint-disable|eslint [a-z0-9@/-]+: (0|off)/.test(fileContents)) {\n eslintDisableOccurrences.push(path);\n }\n }\n\n if (eslintDisableOccurrences.length > 0) {\n throw new Error(\n `ESLint has been disabled in the following files:\n ${eslintDisableOccurrences.join('\\n')}\n\n Remove all comments disabling or modifying ESLint rule configuration (eg. eslint-disable and eslint-disable-next-line comments) and fix the problems\n `,\n );\n }\n}\n","import userAgents from 'top-user-agents';\n\nexport function randomUserAgent() {\n const randomIndex = Math.floor(Math.random() * (userAgents.length - 1));\n return userAgents[randomIndex]!;\n}\n","import cheerio from 'cheerio';\nimport type { Element } from 'domhandler';\nimport { execaCommand } from 'execa';\nimport fetch from 'node-fetch';\nimport { randomUserAgent } from '../util/randomUserAgent';\n\nexport const title = 'GitHub repo has deployed project link under About';\n\nexport default async function linkOnGithubAbout() {\n const { stdout } = await execaCommand('git remote get-url origin');\n\n const repoUrl = stdout\n .replace('git@github.com:', 'https://github.com/')\n .replace('.git', '');\n\n const html = await (await fetch(repoUrl)).text();\n\n const $ = cheerio.load(html);\n\n const urlInAboutSection = $('h2')\n .filter(function (this: Element) {\n return $(this).text().trim() === 'About';\n })\n .nextAll('div')\n .filter(function (this: Element) {\n return $(this).children('.octicon.octicon-link').length > 0;\n })\n .children('.octicon.octicon-link')\n .next()\n .children('a[href]')\n .attr('href');\n\n if (!urlInAboutSection) {\n throw new Error(\n `Deployed project link not found in About section on ${repoUrl}. Click on the cog symbol to the right of the About heading and paste the Repl.it / Netlify / Fly.io link in the Website box.`,\n );\n }\n\n const response = await fetch(urlInAboutSection, {\n headers: {\n // For repl.it\n 'user-agent': randomUserAgent(),\n },\n });\n\n if (!response.ok) {\n throw new Error(\n `Project link in About section on ${repoUrl} is not returning a proper status code: the link returns status code ${response.status} (${response.statusText}).`,\n );\n }\n}\n","const CRLF = '\\r\\n';\n\nexport function normalizeNewlines(input: string) {\n if (typeof input !== 'string') {\n throw new TypeError(`Expected a \\`string\\`, got \\`${typeof input}\\``);\n }\n\n return input.replace(new RegExp(CRLF, 'g'), '\\n');\n}\n","import { promises as fs } from 'node:fs';\nimport { execaCommand } from 'execa';\nimport { commandExample } from '../util/commandExample';\nimport { normalizeNewlines } from '../util/crossPlatform';\n\nexport const title = 'node_modules/ folder ignored in Git';\n\nexport default async function nodeModulesIgnoredFromGit() {\n if ((await execaCommand('git ls-files node_modules/')).stdout !== '') {\n throw new Error(\n `node_modules/ folder committed to Git. Remove it using:\n\n ${commandExample('git rm -r --cached node_modules')}\n `,\n );\n }\n\n if ((await execaCommand('git ls-files .gitignore')).stdout !== '.gitignore') {\n throw new Error('.gitignore file not found');\n }\n\n const nodeModulesInGitignore = normalizeNewlines(\n await fs.readFile('./.gitignore', 'utf8'),\n )\n .split('\\n')\n .reduce((found, line) => found || /^\\/?node_modules\\/?$/.test(line), false);\n\n if (!nodeModulesInGitignore) {\n throw new Error('node_modules not found in .gitignore');\n }\n}\n","import { promises as fs } from 'node:fs';\nimport { URL } from 'node:url';\n\ntype PackageJson = {\n name: string;\n version: string;\n description?: string;\n keywords?: string;\n homepage?: string;\n bugs?: {\n email?: string;\n url?: string;\n };\n license?: string;\n author?:\n | string\n | {\n name: string;\n email?: string;\n url?: string;\n };\n contributors?:\n | string[]\n | {\n name: string;\n email?: string;\n url?: string;\n }[];\n files?: string[];\n main?: string;\n browser?: string;\n bin?: Record<string, string>;\n man?: string;\n directories?: {\n lib?: string;\n bin?: string;\n man?: string;\n doc?: string;\n example?: string;\n test?: string;\n };\n repository?: {\n type?: 'git';\n url?: string;\n directory?: string;\n };\n scripts?: Record<string, string>;\n config?: Record<string, string>;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n bundledDependencies?: string[];\n engines?: Record<string, string>;\n os?: string[];\n cpu?: string[];\n};\n\nexport const projectPackageJson = JSON.parse(\n await fs.readFile('package.json', 'utf-8'),\n) as PackageJson;\n\nexport const preflightPackageJson = JSON.parse(\n await fs.readFile(new URL('../package.json', import.meta.url), 'utf-8'),\n) as PackageJson;\n","import { commandExample } from '../../util/commandExample';\nimport { projectPackageJson } from '../../util/packageJson';\n\nexport const title = 'Next.js project has sharp installed';\n\nexport default function nextJsProjectHasSharpInstalled() {\n const dependenciesPackageNames = Object.keys(\n projectPackageJson.dependencies || {},\n );\n if (\n dependenciesPackageNames.includes('next') &&\n !dependenciesPackageNames.includes('sharp')\n ) {\n throw new Error(\n `Next.js projects should have sharp installed for better image optimization. Install it with:\n\n ${commandExample('pnpm add sharp')}\n `,\n );\n }\n}\n","import { existsSync, promises as fs } from 'node:fs';\nimport algoliasearch from 'algoliasearch';\nimport pReduce from 'p-reduce';\nimport { commandExample } from '../../util/commandExample';\nimport { projectPackageJson } from '../../util/packageJson';\n\nconst client = algoliasearch(\n // Application ID and API key specific to UpLeveled\n // Preflight. Please don't use anywhere else without\n // asking Algolia's permission.\n 'OFCNCOG2CU', // Application ID\n 'ec73550aa8b2936dab436d4e02144784', // API Key\n);\nconst index = client.initIndex('npm-search');\n\ninterface AlgoliaObj {\n types?: {\n definitelyTyped?: string;\n };\n}\n\nexport const title = 'No dependencies without types';\n\n// This is a naive check for matching @types/<pkg name> packages\n// that the student hasn't yet installed. It is not intended to\n// be an exhaustive check for any types for all packages.\n//\n// It attempts to address scenarios such as this with\n// `styled-components`:\n//\n// https://learn.upleveled.io/courses/btcmp-l-webfs-gen-0/modules/122-cheatsheet-css-in-js/#eslint-errors-with-styled-components\nexport default async function noDependenciesWithoutTypes() {\n const dependenciesWithMissingTypes = await pReduce(\n Object.keys(projectPackageJson.dependencies || {}),\n async (filteredDependencies: [string, string][], dependency: string) => {\n try {\n const packageJsonPath = require.resolve(`${dependency}/package.json`);\n\n const modulePackageJson = JSON.parse(\n await fs.readFile(packageJsonPath, 'utf-8'),\n );\n\n // If the keys \"types\" or \"typings\" are in the module's `package.json`, bail out\n if ('types' in modulePackageJson || 'typings' in modulePackageJson) {\n return filteredDependencies;\n }\n } catch (error) {}\n\n let indexDTsPath;\n\n try {\n indexDTsPath = require.resolve(`${dependency}/index.d.ts`);\n } catch (error) {}\n\n // If the index.d.ts file exists inside the module's directory, bail out\n if (indexDTsPath && existsSync(indexDTsPath)) {\n return filteredDependencies;\n }\n\n let results: AlgoliaObj;\n\n try {\n results = await index.getObject<AlgoliaObj>(dependency, {\n attributesToRetrieve: ['types'],\n });\n } catch (error) {\n // Show dependency name if Algolia's `index.getObject()` throws with an\n // error message (such as the error message \"ObjectID does not exist\"\n // when a package cannot be found in the index)\n throw new Error(\n `Algolia error for \\`${dependency}\\`: ${(error as Error).message}`,\n );\n }\n\n const definitelyTypedPackageName = results.types?.definitelyTyped;\n\n if (definitelyTypedPackageName) {\n // If a matching `@types/<package name>` has been already installed in devDependencies, bail out\n if (\n Object.keys(projectPackageJson.devDependencies || {}).includes(\n definitelyTypedPackageName,\n )\n ) {\n return filteredDependencies;\n }\n\n filteredDependencies.push([dependency, definitelyTypedPackageName]);\n }\n\n return filteredDependencies;\n },\n [],\n );\n\n if (dependenciesWithMissingTypes.length > 0) {\n throw new Error(\n `Dependencies found without types. Add the missing types with:\n\n ${commandExample(\n `pnpm add --save-dev ${dependenciesWithMissingTypes\n .map(([, definitelyTypedPackageName]) => definitelyTypedPackageName)\n .join(' ')}`,\n )}\n\n If the dependencies above are already in your package.json, check that they have not been incorrectly installed as regular dependencies in the \"dependencies\" object - they should be installed inside \"devDependencies\" (using the --save-dev flag mentioned above). To fix this situation, remove the dependencies and run the command above exactly.\n `,\n );\n }\n}\n","import { dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { execaCommand } from 'execa';\n\nexport const { stdout: preflightBinPath } = await execaCommand(`pnpm bin`, {\n cwd: dirname(fileURLToPath(import.meta.url)),\n});\n","import { execaCommand } from 'execa';\nimport { commandExample } from '../../util/commandExample';\nimport { preflightBinPath } from '../../util/preflightBinPath';\n\nexport const title = 'No unused dependencies';\n\nexport default async function noUnusedAndMissingDependencies() {\n const ignoredPackagePatterns = [\n // Unused dependency detected in https://github.com/upleveled/next-portfolio-dev\n '@graphql-codegen/cli',\n\n // Tailwind CSS\n '@tailwindcss/jit',\n 'autoprefixer',\n 'postcss',\n 'tailwindcss',\n\n // Sass (eg. in Next.js)\n 'sass',\n\n // Prettier and plugins\n 'prettier',\n 'prettier-plugin-*',\n\n // ESLint configuration\n '@ts-safeql/eslint-plugin',\n 'libpg-query',\n\n // TODO: Remove this once depcheck issue is fixed:\n // PR: https://github.com/depcheck/depcheck/pull/790\n // Issue: https://github.com/depcheck/depcheck/issues/791\n //\n // Stylelint configuration\n 'stylelint',\n 'stylelint-config-upleveled',\n\n // Testing\n '@testing-library/user-event',\n 'jest',\n 'jest-environment-jsdom',\n 'playwright',\n\n // `expect` required for proper types with `@testing-library/jest-dom` with `@jest/globals` and pnpm\n // https://github.com/testing-library/jest-dom/issues/123#issuecomment-1536828385\n // TODO: Remove when we switch from Jest to Vitest\n 'expect',\n\n // `ts-node` required for jest.config.ts\n // https://jestjs.io/docs/29.6/configuration#:~:text=To%20read%20TypeScript%20configuration%20files%20Jest%20requires%20ts%2Dnode.%20Make%20sure%20it%20is%20installed%20in%20your%20project\n // TODO: Remove when usage of tsx is allowed\n // https://github.com/jestjs/jest/issues/11989\n 'ts-node',\n\n // TypeScript\n 'typescript',\n '@types/*',\n 'tsx',\n\n // Next.js\n 'sharp',\n ].join(',');\n\n try {\n await execaCommand(\n `${preflightBinPath}/depcheck --ignores=\"${ignoredPackagePatterns}\"`,\n );\n } catch (error) {\n const { stdout } = error as { stdout: string };\n if (\n !stdout.startsWith('Unused dependencies') &&\n !stdout.startsWith('Unused devDependencies') &&\n !stdout.startsWith('Missing dependencies')\n ) {\n throw error;\n }\n\n const [unusedDependenciesStdout, missingDependenciesStdout] = stdout.split(\n 'Missing dependencies',\n );\n\n const messages = [];\n\n if (unusedDependenciesStdout) {\n messages.push(`Unused dependencies found:\n ${unusedDependenciesStdout\n .split('\\n')\n .filter((str: string) => str.includes('* '))\n .join('\\n')}\n\n Remove these dependencies by running the following command for each dependency:\n\n ${commandExample('pnpm remove <dependency name here>')}\n `);\n }\n\n if (missingDependenciesStdout) {\n messages.push(`Missing dependencies found:\n ${missingDependenciesStdout\n .split('\\n')\n .filter((str: string) => str.includes('* '))\n .join('\\n')}\n\n Add these missing dependencies by running the following command for each dependency:\n\n ${commandExample('pnpm add <dependency name here>')}\n `);\n }\n\n if (messages.length > 0) throw new Error(messages.join('\\n\\n'));\n }\n}\n","import { execaCommand } from 'execa';\nimport { commandExample } from '../util/commandExample';\n\nexport const title = 'No extraneous files committed to Git';\n\nexport default async function noExtraneousFilesCommittedToGit() {\n const { stdout } = await execaCommand(\n 'git ls-files .DS_Store yarn-error.log npm-debug.log',\n );\n\n if (stdout !== '') {\n throw new Error(\n `Extraneous files committed to Git:\n ${stdout}\n\n Remove these files from your repo by running the following command for each file:\n\n ${commandExample('git rm --cached <filename here>')}\n\n Once you've removed all files, make sure that it doesn't happen again by adding the filenames above to your .gitignore file.\n `,\n );\n }\n}\n","import { execaCommand } from 'execa';\nimport { commandExample } from '../util/commandExample';\n\nexport const title = 'No secrets committed to Git';\n\nexport default async function noSecretsCommittedToGit() {\n const { stdout } = await execaCommand('git ls-files .env .env*.local');\n\n if (stdout !== '') {\n throw new Error(\n `Secrets committed to Git 😱:\n ${stdout}\n\n Remove these files from your repo by installing BFG from the System Setup Guide (see Optional Software at the bottom) and running it on each of your files like this:\n\n ${commandExample('bfg --delete-files <filename here>')}\n\n Once you've done this for every secret file, then force push to your repository:\n\n ${commandExample('git push --force')}\n\n More info: https://docs.github.com/en/github/authenticating-to-github/removing-sensitive-data-from-a-repository\n\n Finally, make sure that this doesn't happen again by adding the filenames above to your .gitignore file.\n `,\n );\n }\n}\n","import os from 'node:os';\nimport { execaCommand } from 'execa';\nimport semver from 'semver';\nimport { commandExample } from '../util/commandExample';\nimport { preflightPackageJson } from '../util/packageJson';\n\nexport const title = 'Preflight is latest version';\n\nexport default async function preflightIsLatestVersion() {\n const { stdout: remoteVersion } = await execaCommand(\n 'npm show @upleveled/preflight version',\n );\n\n if (semver.gt(remoteVersion, preflightPackageJson.version)) {\n throw new Error(\n `Your current version of Preflight (${\n preflightPackageJson.version\n }) is older than the latest version ${remoteVersion} - upgrade with:\n\n ${commandExample(\n `${\n os.platform() === 'linux' ? 'sudo ' : ''\n }pnpm add --global @upleveled/preflight`,\n )}\n `,\n );\n }\n}\n","import { execaCommand } from 'execa';\nimport { normalizeNewlines } from '../util/crossPlatform';\n\nexport const title = 'Prettier';\n\nexport default async function prettierCheck() {\n try {\n await execaCommand(\n 'pnpm prettier \"**/*.{js,jsx,ts,tsx,css,scss,sql}\" --list-different --end-of-line auto',\n );\n } catch (error) {\n const { stdout, stderr } = error as { stdout: string; stderr: string };\n\n if (!stdout || stderr) {\n throw error;\n }\n\n const unformattedFiles = normalizeNewlines(stdout).split('\\n');\n\n if (unformattedFiles.length > 0) {\n throw new Error(\n `Prettier has not been run in the following files:\n ${unformattedFiles.join('\\n')}\n\n For each of the files above, open the file in your editor and save the file. This will format the file with Prettier, which will cause changes to appear in Git.\n `,\n );\n }\n }\n}\n","import path from 'node:path';\nimport { commandExample } from '../util/commandExample';\n\nexport const title = 'Project folder name matches correct format';\n\nexport default function projectFolderNameMatchesCorrectFormat() {\n const currentDirectoryName = path.basename(process.cwd());\n const lowercaseHyphenedDirectoryName = currentDirectoryName\n .toLowerCase()\n .replaceAll(' ', '-');\n\n if (currentDirectoryName !== lowercaseHyphenedDirectoryName) {\n throw new Error(\n `Project directory name \"${currentDirectoryName}\" doesn't match the correct format (no spaces or uppercase letters).\n\n Rename the directory to the correct name \"${lowercaseHyphenedDirectoryName}\" with the following sequence of commands:\n\n ${commandExample('cd ..')}\n ${commandExample(\n `mv ${currentDirectoryName} ${lowercaseHyphenedDirectoryName}`,\n )}\n ${commandExample(`cd ${lowercaseHyphenedDirectoryName}`)}\n `,\n );\n }\n}\n","import { sep } from 'node:path';\nimport { execaCommand } from 'execa';\nimport { LintResult } from 'stylelint';\n\nexport const supportedStylelintFileExtensions = [\n 'css',\n 'sass',\n 'scss',\n 'less',\n 'js',\n 'tsx',\n 'jsx',\n];\n\nexport const title = 'Stylelint';\n\nexport default async function stylelintCheck() {\n try {\n await execaCommand(\n `pnpm stylelint **/*.{${supportedStylelintFileExtensions.join(\n ',',\n )}} --max-warnings 0 --formatter json`,\n );\n } catch (error) {\n const { stdout } = error as { stdout: string };\n\n let stylelintResults;\n\n try {\n stylelintResults = (JSON.parse(stdout) as LintResult[]).filter(\n (stylelintResult) => stylelintResult.errored === true,\n );\n } catch (parseError) {\n throw error;\n }\n\n if (\n stylelintResults.length < 1 ||\n !stylelintResults.every((result) => 'errored' in result)\n ) {\n throw new Error(\n `Unexpected shape of Stylelint JSON related to .errored properties - please report this to the UpLeveled engineering team, including the following output:\n ${stdout}\n `,\n );\n }\n\n throw new Error(\n `Stylelint problems found in the following files:\n ${stylelintResults\n // Make paths relative to the project:\n //\n // Before:\n // macOS / Linux: /home/projects/random-color-generator-react-app/src/index.css\n // Windows: C:\\Users\\Lukas\\projects\\random-color-generator-react-app\\src\\index.css\n //\n // After:\n // macOS / Linux: src/index.css\n // Windows: src\\index.css\n .map(({ source }) => source!.replace(`${process.cwd()}${sep}`, ''))\n .join('\\n')}\n\n Open these files in your editor - there should be problems to fix\n `,\n );\n }\n}\n","import { promises as fs } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { execaCommand } from 'execa';\nimport readdirp from 'readdirp';\nimport semver from 'semver';\nimport { supportedStylelintFileExtensions } from './stylelint';\n\nconst require = createRequire(`${process.cwd()}/`);\n\nexport const title = 'Stylelint config is latest version';\n\nexport default async function stylelintConfigIsValid() {\n const { stdout: remoteVersion } = await execaCommand(\n 'npm show stylelint-config-upleveled version',\n );\n\n let localVersion: string | undefined;\n\n try {\n const stylelintConfigPackageJsonPath = require.resolve(\n 'stylelint-config-upleveled/package.json',\n );\n\n localVersion = JSON.parse(\n await fs.readFile(stylelintConfigPackageJsonPath, 'utf-8'),\n ).version;\n } catch (error) {}\n\n if (typeof localVersion === 'undefined') {\n throw new Error(\n `The UpLeveled Stylelint Config has not been installed - please install using the instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n if (semver.gt(remoteVersion, localVersion)) {\n throw new Error(\n `Your current version of the UpLeveled Stylelint Config (${localVersion}) is older than the latest version ${remoteVersion} - upgrade by running:\n\n pnpm add stylelint-config-upleveled@${remoteVersion}`,\n );\n }\n\n let stylelintConfigMatches;\n\n try {\n stylelintConfigMatches =\n (await fs.readFile('./stylelint.config.js', 'utf-8')).trim() ===\n `/** @type {import('stylelint').Config} */\nconst config = {\n extends: ['stylelint-config-upleveled'],\n};\n\nexport default config;`;\n } catch (error) {\n throw new Error(\n `Error reading your stylelint.config.js file - please delete the file if it exists and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n if (!stylelintConfigMatches) {\n throw new Error(\n `Your stylelint.config.js file does not match the configuration file template - please delete the file and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n const stylelintDisableOccurrences = [];\n\n for await (const { path } of readdirp('.', {\n directoryFilter: ['!.git', '!.next', '!node_modules'],\n fileFilter: supportedStylelintFileExtensions.map(\n (fileExtension) => `*.${fileExtension}`,\n ),\n })) {\n const fileContents = await fs.readFile(path, 'utf-8');\n if (fileContents.includes('stylelint-disable')) {\n stylelintDisableOccurrences.push(path);\n }\n }\n\n if (stylelintDisableOccurrences.length > 0) {\n throw new Error(\n `Stylelint has been disabled in the following files:\n ${stylelintDisableOccurrences.join('\\n')}\n\n Remove all comments disabling or modifying Stylelint rule configuration (eg. stylelint-disable and stylelint-disable-next-line comments) and fix the problems\n `,\n );\n }\n}\n","import { execaCommand } from 'execa';\nimport { commandExample } from '../util/commandExample';\n\nexport const title = 'Use single package manager';\n\nexport default async function useSinglePackageManager() {\n const { stdout } = await execaCommand(\n 'git ls-files package-lock.json yarn.lock',\n );\n\n if (stdout !== '') {\n throw new Error(\n `package-lock.json or yarn.lock file committed to Git. Remove it with:\n\n ${commandExample('git rm --cached <filename>')}\n\n After you've removed it, you can delete the file with:\n\n ${commandExample('rm <filename>')}\n\n The presence of this file indicates that another package manager was used in addition to pnpm (eg. \"npm install\" or \"yarn add\" was run). In order to avoid issues with the state of the pnpm-lock.yaml file, we suggest also forcing regeneration this file with the following command:\n\n ${commandExample('pnpm install --force')}\n `,\n );\n }\n}\n","import { Listr, ListrTask } from 'listr2';\nimport * as allChangesCommittedToGit from './checks/allChangesCommittedToGit.js';\nimport * as eslint from './checks/eslint.js';\nimport * as eslintConfigIsValid from './checks/eslintConfigIsValid.js';\nimport * as linkOnGithubAbout from './checks/linkOnGithubAbout.js';\nimport * as nodeModulesIgnoredFromGit from './checks/nodeModulesIgnoredFromGit.js';\nimport * as nextJsProjectHasSharpInstalled from './checks/noDependencyProblems/nextJsProjectHasSharpInstalled.js';\nimport * as noDependenciesWithoutTypes from './checks/noDependencyProblems/noDependenciesWithoutTypes.js';\nimport * as noUnusedAndMissingDependencies from './checks/noDependencyProblems/noUnusedDependencies.js';\nimport * as noExtraneousFilesCommittedToGit from './checks/noExtraneousFilesCommittedToGit.js';\nimport * as noSecretsCommittedToGit from './checks/noSecretsCommittedToGit.js';\nimport * as preflightIsLatestVersion from './checks/preflightIsLatestVersion.js';\nimport * as prettier from './checks/prettier.js';\nimport * as projectFolderNameMatchesCorrectFormat from './checks/projectFolderNameMatchesCorrectFormat.js';\nimport * as stylelint from './checks/stylelint.js';\nimport * as stylelintConfigIsValid from './checks/stylelintConfigIsValid.js';\nimport * as useSinglePackageManager from './checks/useSinglePackageManager.js';\nimport { CtxParam } from './types/CtxParam.js';\nimport { TaskParam } from './types/TaskParam.js';\nimport {\n preflightPackageJson,\n projectPackageJson,\n} from './util/packageJson.js';\n\nconst projectDependencies = projectPackageJson.dependencies || {};\n\nconsole.log(`🚀 UpLeveled Preflight v${preflightPackageJson.version}`);\n\nconst listrTasks: ListrTask[] = [\n // ======= Sync Tasks =======\n // Git\n allChangesCommittedToGit,\n nodeModulesIgnoredFromGit,\n noExtraneousFilesCommittedToGit,\n noSecretsCommittedToGit,\n\n // Package managers\n useSinglePackageManager,\n\n // Project setup\n projectFolderNameMatchesCorrectFormat,\n\n // ======= Async Tasks =======\n // Dependencies\n {\n title: 'No dependency problems',\n task: (ctx: CtxParam, task: TaskParam): Listr =>\n task.newListr([\n ...(!Object.keys(projectDependencies).includes('next')\n ? []\n : [\n {\n title: nextJsProjectHasSharpInstalled.title,\n task: nextJsProjectHasSharpInstalled.default,\n },\n ]),\n {\n title: noUnusedAndMissingDependencies.title,\n task: noUnusedAndMissingDependencies.default,\n },\n {\n title: noDependenciesWithoutTypes.title,\n task: noDependenciesWithoutTypes.default,\n },\n ]),\n },\n\n // GitHub\n linkOnGithubAbout,\n\n // Linting\n eslint,\n ...(!(\n '@upleveled/react-scripts' in projectDependencies ||\n 'next' in projectDependencies\n )\n ? []\n : [stylelint]),\n prettier,\n\n // Version and configuration checks\n eslintConfigIsValid,\n ...(!(\n '@upleveled/react-scripts' in projectDependencies ||\n 'next' in projectDependencies\n )\n ? []\n : [stylelintConfigIsValid]),\n preflightIsLatestVersion,\n].map((module) => {\n if ('task' in module) return module;\n return {\n title: module.title,\n task: module.default,\n };\n});\n\nconst tasks = new Listr(listrTasks, {\n exitOnError: false,\n collectErrors: 'minimal',\n rendererOptions: {\n collapseErrors: false,\n removeEmptyLines: false,\n formatOutput: 'wrap',\n },\n fallbackRenderer: 'verbose',\n concurrent: 5,\n});\n\nawait tasks.run();\n\nif (tasks.errors.length > 0) {\n process.exit(1);\n}\n"],"names":["emptyBrailleCharacter","commandExample","command","chalk","dim","isDrone","stdout","execaCommand","reject","test","title","allChangesCommittedToGit","replSlug","isRunningInReplIt","fs","writeFile","onlyPnpmLockModifiedOnDrone","trim","Error","eslintCheck","error","eslintResults","JSON","parse","filter","eslintResult","errorCount","warningCount","parseError","length","every","result","map","filePath","replace","process","cwd","sep","join","require","createRequire","eslintConfigIsValid","remoteVersion","localVersion","eslintConfigPackageJsonPath","resolve","readFile","version","semver","gt","eslintConfigMatches","eslintDisableOccurrences","path","readdirp","directoryFilter","fileFilter","fileContents","push","randomUserAgent","randomIndex","Math","floor","random","userAgents","linkOnGithubAbout","repoUrl","html","fetch","text","$","cheerio","load","urlInAboutSection","nextAll","children","next","attr","response","headers","ok","status","statusText","CRLF","normalizeNewlines","input","TypeError","RegExp","nodeModulesIgnoredFromGit","nodeModulesInGitignore","split","reduce","found","line","projectPackageJson","preflightPackageJson","URL","import","meta","url","nextJsProjectHasSharpInstalled","dependenciesPackageNames","Object","keys","dependencies","includes","client","algoliasearch","index","initIndex","noDependenciesWithoutTypes","dependenciesWithMissingTypes","pReduce","filteredDependencies","dependency","packageJsonPath","modulePackageJson","indexDTsPath","existsSync","results","getObject","attributesToRetrieve","message","definitelyTypedPackageName","_results$types","types","definitelyTyped","devDependencies","preflightBinPath","dirname","fileURLToPath","noUnusedAndMissingDependencies","ignoredPackagePatterns","startsWith","unusedDependenciesStdout","missingDependenciesStdout","messages","str","noExtraneousFilesCommittedToGit","noSecretsCommittedToGit","preflightIsLatestVersion","os","platform","prettierCheck","stderr","unformattedFiles","projectFolderNameMatchesCorrectFormat","currentDirectoryName","basename","lowercaseHyphenedDirectoryName","toLowerCase","replaceAll","supportedStylelintFileExtensions","stylelintCheck","stylelintResults","stylelintResult","errored","source","stylelintConfigIsValid","stylelintConfigPackageJsonPath","stylelintConfigMatches","stylelintDisableOccurrences","fileExtension","useSinglePackageManager","projectDependencies","console","log","listrTasks","task","ctx","newListr","eslint","stylelint","prettier","module","default","tasks","Listr","exitOnError","collectErrors","rendererOptions","collapseErrors","removeEmptyLines","formatOutput","fallbackRenderer","concurrent","run","errors","exit"],"mappings":";;;;;;;;;;;;;;;;AAEA;AACA;AACA,MAAMA,qBAAqB,GAAG,GAAG;SAEjBC,cAAcA,CAACC,OAAe;EAC5C,UAAUF,0BAA0BG,KAAK,CAACC,GAAG,CAAC,GAAG,KAAKF,SAAS;AACjE;;ACNO,eAAeG,OAAOA;EAC3B,MAAM;IAAEC;GAAQ,GAAG,MAAMC,YAAY,CAAC,qBAAqB,EAAE;IAC3DC,MAAM,EAAE;GACT,CAAC;EACF,OAAO,cAAc,CAACC,IAAI,CAACH,MAAM,CAAC;AACpC;;ACFO,MAAMI,KAAK,GAAG,8BAA8B;AAEnD,AAAe,eAAeC,wBAAwBA;EACpD,MAAM;IAAEL,MAAM,EAAEM;GAAU,GAAG,MAAML,YAAY,CAAC,iBAAiB,CAAC;EAElE,MAAMM,iBAAiB,GAAGD,QAAQ,KAAK,EAAE;EAEzC,IAAIC,iBAAiB,EAAE;IACrB,MAAMC,QAAE,CAACC,SAAS,CAAC,mBAAmB,EAAE,WAAW,CAAC;;EAGtD,MAAM;IAAET;GAAQ,GAAG,MAAMC,YAAY,CAAC,wBAAwB,CAAC;EAE/D,IAAID,MAAM,KAAK,EAAE,EAAE;IACjB,MAAMU,2BAA2B,GAC/BV,MAAM,CAACW,IAAI,EAAE,KAAK,kBAAkB,KAAK,MAAMZ,OAAO,EAAE,CAAC;IAC3D,MAAM,IAAIa,KAAK;UAETZ,SACAU,2BAA2B;;;;UAK3Bf,cAAc,CAAC,sBAAsB,GAAG,GACpC;OAEP,CACF;;AAEL;;;;;;;;AC/BO,MAA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GACF,CAACQ,SAAS,CAAC,CAAC,EAChBC,QAAQ;AAER;AACAnI,qBAAmB,EACnB,IAAI,EACF,0BAA0B,IAAI0H,mBAAmB,IACjD,MAAM,IAAIA,mBAAmB,CAC9B,GACG,EAAE,GACF,CAACN,wBAAsB,CAAC,CAAC,EAC7BlB,0BAAwB,CACzB,CAAC3G,GAAG,CAAE6I,MAAM;EACX,IAAI,MAAM,IAAIA,MAAM,EAAE,OAAOA,MAAM;EACnC,OAAO;IACLnK,KAAK,EAAEmK,MAAM,CAACnK,KAAK;IACnB6J,IAAI,EAAEM,MAAM,CAACC;GACd;AACH,CAAC,CAAC;AAEF,MAAMC,KAAK,gBAAG,IAAIC,KAAK,CAACV,UAAU,EAAE;EAClCW,WAAW,EAAE,KAAK;EAClBC,aAAa,EAAE,SAAS;EACxBC,eAAe,EAAE;IACfC,cAAc,EAAE,KAAK;IACrBC,gBAAgB,EAAE,KAAK;IACvBC,YAAY,EAAE;GACf;EACDC,gBAAgB,EAAE,SAAS;EAC3BC,UAAU,EAAE;CACb,CAAC;AAEF,MAAMT,KAAK,CAACU,GAAG,EAAE;AAEjB,IAAIV,KAAK,CAACW,MAAM,CAAC7J,MAAM,GAAG,CAAC,EAAE;EAC3BM,OAAO,CAACwJ,IAAI,CAAC,CAAC,CAAC;AACjB"}
|
|
1
|
+
{"version":3,"file":"preflight.esm.js","sources":["../src/util/commandExample.ts","../src/util/drone.ts","../src/checks/allChangesCommittedToGit.ts","../src/checks/eslint.ts","../src/checks/eslintConfigIsValid.ts","../src/util/randomUserAgent.ts","../src/checks/linkOnGithubAbout.ts","../src/util/crossPlatform.ts","../src/checks/nodeModulesIgnoredFromGit.ts","../src/util/packageJson.ts","../src/checks/noDependencyProblems/noDependenciesWithoutTypes.ts","../src/util/preflightBinPath.ts","../src/checks/noDependencyProblems/noUnusedDependencies.ts","../src/checks/noExtraneousFilesCommittedToGit.ts","../src/checks/noSecretsCommittedToGit.ts","../src/checks/preflightIsLatestVersion.ts","../src/checks/prettier.ts","../src/checks/projectFolderNameMatchesCorrectFormat.ts","../src/checks/stylelint.ts","../src/checks/stylelintConfigIsValid.ts","../src/checks/useSinglePackageManager.ts","../src/index.ts"],"sourcesContent":["import chalk from 'chalk';\n\n// https://www.compart.com/en/unicode/U+2800\n// eslint-disable-next-line security/detect-bidi-characters -- Intentional use of unusual character for formatting\nconst emptyBrailleCharacter = '';\n\nexport function commandExample(command: string) {\n return `${emptyBrailleCharacter} ${chalk.dim('$')} ${command}`;\n}\n","import { execaCommand } from 'execa';\n\nexport async function isDrone() {\n const { stdout } = await execaCommand('cat /etc/os-release', {\n reject: false,\n });\n return /Alpine Linux/.test(stdout);\n}\n","import { promises as fs } from 'node:fs';\nimport { execaCommand } from 'execa';\nimport { commandExample } from '../util/commandExample';\nimport { isDrone } from '../util/drone';\n\nexport const title = 'All changes committed to Git';\n\nexport default async function allChangesCommittedToGit() {\n const { stdout: replSlug } = await execaCommand('echo $REPL_SLUG');\n\n const isRunningInReplIt = replSlug !== '';\n\n if (isRunningInReplIt) {\n await fs.writeFile('.git/info/exclude', '.replit\\n');\n }\n\n const { stdout } = await execaCommand('git status --porcelain');\n\n if (stdout !== '') {\n const onlyPnpmLockModifiedOnDrone =\n stdout.trim() === 'M pnpm-lock.yaml' && (await isDrone());\n throw new Error(\n `Some changes have not been committed to Git:\n ${stdout}${\n onlyPnpmLockModifiedOnDrone\n ? `\n\n The only file with changes is the pnpm-lock.yaml file, indicating that npm was incorrectly used in addition to pnpm (eg. an \"npm install\" command was run). To fix this, force regeneration of the pnpm-lock.yaml file locally with the following command and then commit the changes:\n\n ${commandExample('pnpm install --force')}`\n : ''\n }\n `,\n );\n }\n}\n","import { sep } from 'node:path';\nimport { ESLint } from 'eslint';\nimport { execaCommand } from 'execa';\n\nexport const title = 'ESLint';\n\nexport default async function eslintCheck() {\n try {\n await execaCommand('pnpm eslint . --max-warnings 0 --format json');\n } catch (error) {\n const { stdout } = error as { stdout: string };\n\n let eslintResults;\n\n try {\n eslintResults = (JSON.parse(stdout) as ESLint.LintResult[])\n // Filter out results with no problems, which the ESLint CLI\n // still reports with the `--format json` flag\n .filter((eslintResult) => {\n return eslintResult.errorCount > 0 || eslintResult.warningCount > 0;\n });\n } catch {\n throw error;\n }\n\n if (\n eslintResults.length < 1 ||\n !eslintResults.every(\n (result) => 'errorCount' in result && 'warningCount' in result,\n )\n ) {\n throw new Error(\n `Unexpected shape of ESLint JSON related to .errorCount and .warningCount properties - please report this to the UpLeveled engineering team, including the following output:\n ${stdout}\n `,\n );\n }\n\n throw new Error(\n `ESLint problems found in the following files:\n ${eslintResults\n // Make paths relative to the project:\n //\n // Before:\n // macOS / Linux: /home/projects/next-student-project/app/api/hello/route.js\n // Windows: C:\\Users\\Lukas\\projects\\next-student-project\\app\\api\\hello\\route.js\n //\n // After:\n // macOS / Linux: app/api/hello/route.js\n // Windows: app\\api\\hello\\route.js\n .map(({ filePath }) => filePath.replace(`${process.cwd()}${sep}`, ''))\n .join('\\n')}\n\n Open these files in your editor - there should be problems to fix\n `,\n );\n }\n}\n","import { promises as fs } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { execaCommand } from 'execa';\nimport readdirp from 'readdirp';\nimport semver from 'semver';\n\nconst require = createRequire(`${process.cwd()}/`);\n\nexport const title = 'ESLint config is latest version';\n\nexport default async function eslintConfigIsValid() {\n const { stdout: remoteVersion } = await execaCommand(\n 'npm show eslint-config-upleveled version',\n );\n\n let localVersion: string | undefined;\n\n try {\n const eslintConfigPackageJsonPath = require.resolve(\n 'eslint-config-upleveled/package.json',\n );\n\n localVersion = JSON.parse(\n await fs.readFile(eslintConfigPackageJsonPath, 'utf-8'),\n ).version;\n } catch {\n // Swallow error\n }\n\n if (typeof localVersion === 'undefined') {\n throw new Error(\n `The UpLeveled ESLint Config has not been installed - please install using the instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n if (semver.gt(remoteVersion, localVersion)) {\n throw new Error(\n `Your current version of the UpLeveled ESLint Config (${localVersion}) is older than the latest version ${remoteVersion} - upgrade by running all lines of the install instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n let eslintConfigMatches;\n\n try {\n eslintConfigMatches =\n (await fs.readFile('./eslint.config.js', 'utf-8')).trim() ===\n \"export { default } from 'eslint-config-upleveled';\";\n } catch {\n throw new Error(\n `Error reading your eslint.config.js file - please delete the file if it exists and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n if (!eslintConfigMatches) {\n throw new Error(\n `Your eslint.config.js file does not match the configuration file template - please delete the file and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n const eslintDisableOccurrences = [];\n\n for await (const { path } of readdirp('.', {\n directoryFilter: ['!.git', '!.next', '!node_modules'],\n fileFilter: ['*.js', '*.jsx', '*.ts', '*.tsx'],\n })) {\n const fileContents = await fs.readFile(path, 'utf-8');\n if (/eslint-disable|eslint [a-z0-9@/-]+: (0|off)/.test(fileContents)) {\n eslintDisableOccurrences.push(path);\n }\n }\n\n if (eslintDisableOccurrences.length > 0) {\n throw new Error(\n `ESLint has been disabled in the following files:\n ${eslintDisableOccurrences.join('\\n')}\n\n Remove all comments disabling or modifying ESLint rule configuration (eg. eslint-disable and eslint-disable-next-line comments) and fix the problems\n `,\n );\n }\n}\n","import userAgents from 'top-user-agents';\n\nexport function randomUserAgent() {\n const randomIndex = Math.floor(Math.random() * (userAgents.length - 1));\n return userAgents[randomIndex]!;\n}\n","import cheerio from 'cheerio';\nimport type { Element } from 'domhandler';\nimport { execaCommand } from 'execa';\nimport fetch from 'node-fetch';\nimport { randomUserAgent } from '../util/randomUserAgent';\n\nexport const title = 'GitHub repo has deployed project link under About';\n\nexport default async function linkOnGithubAbout() {\n const { stdout } = await execaCommand('git remote get-url origin');\n\n const repoUrl = stdout\n .replace('git@github.com:', 'https://github.com/')\n .replace('.git', '');\n\n const html = await (await fetch(repoUrl)).text();\n\n const $ = cheerio.load(html);\n\n const urlInAboutSection = $('h2')\n .filter(function (this: Element) {\n return $(this).text().trim() === 'About';\n })\n .nextAll('div')\n .filter(function (this: Element) {\n return $(this).children('.octicon.octicon-link').length > 0;\n })\n .children('.octicon.octicon-link')\n .next()\n .children('a[href]')\n .attr('href');\n\n if (!urlInAboutSection) {\n throw new Error(\n `Deployed project link not found in About section on ${repoUrl}. Click on the cog symbol to the right of the About heading and paste the Repl.it / Netlify / Fly.io link in the Website box.`,\n );\n }\n\n const response = await fetch(urlInAboutSection, {\n headers: {\n // For repl.it\n 'user-agent': randomUserAgent(),\n },\n });\n\n if (!response.ok) {\n throw new Error(\n `Project link in About section on ${repoUrl} is not returning a proper status code: the link returns status code ${response.status} (${response.statusText}).`,\n );\n }\n}\n","const CRLF = '\\r\\n';\n\nexport function normalizeNewlines(input: string) {\n if (typeof input !== 'string') {\n throw new TypeError(`Expected a \\`string\\`, got \\`${typeof input}\\``);\n }\n\n return input.replace(new RegExp(CRLF, 'g'), '\\n');\n}\n","import { promises as fs } from 'node:fs';\nimport { execaCommand } from 'execa';\nimport { commandExample } from '../util/commandExample';\nimport { normalizeNewlines } from '../util/crossPlatform';\n\nexport const title = 'node_modules/ folder ignored in Git';\n\nexport default async function nodeModulesIgnoredFromGit() {\n if ((await execaCommand('git ls-files node_modules/')).stdout !== '') {\n throw new Error(\n `node_modules/ folder committed to Git. Remove it using:\n\n ${commandExample('git rm -r --cached node_modules')}\n `,\n );\n }\n\n if ((await execaCommand('git ls-files .gitignore')).stdout !== '.gitignore') {\n throw new Error('.gitignore file not found');\n }\n\n const nodeModulesInGitignore = normalizeNewlines(\n await fs.readFile('./.gitignore', 'utf8'),\n )\n .split('\\n')\n .reduce((found, line) => found || /^\\/?node_modules\\/?$/.test(line), false);\n\n if (!nodeModulesInGitignore) {\n throw new Error('node_modules not found in .gitignore');\n }\n}\n","import { promises as fs } from 'node:fs';\nimport { URL } from 'node:url';\n\ntype PackageJson = {\n name: string;\n version: string;\n description?: string;\n keywords?: string;\n homepage?: string;\n bugs?: {\n email?: string;\n url?: string;\n };\n license?: string;\n author?:\n | string\n | {\n name: string;\n email?: string;\n url?: string;\n };\n contributors?:\n | string[]\n | {\n name: string;\n email?: string;\n url?: string;\n }[];\n files?: string[];\n main?: string;\n browser?: string;\n bin?: Record<string, string>;\n man?: string;\n directories?: {\n lib?: string;\n bin?: string;\n man?: string;\n doc?: string;\n example?: string;\n test?: string;\n };\n repository?: {\n type?: 'git';\n url?: string;\n directory?: string;\n };\n scripts?: Record<string, string>;\n config?: Record<string, string>;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n bundledDependencies?: string[];\n engines?: Record<string, string>;\n os?: string[];\n cpu?: string[];\n};\n\nexport const projectPackageJson = JSON.parse(\n await fs.readFile('package.json', 'utf-8'),\n) as PackageJson;\n\nexport const preflightPackageJson = JSON.parse(\n await fs.readFile(new URL('../package.json', import.meta.url), 'utf-8'),\n) as PackageJson;\n","import { existsSync, promises as fs } from 'node:fs';\nimport algoliasearch from 'algoliasearch';\nimport pReduce from 'p-reduce';\nimport { commandExample } from '../../util/commandExample';\nimport { projectPackageJson } from '../../util/packageJson';\n\nconst client = algoliasearch(\n // Application ID and API key specific to UpLeveled\n // Preflight. Please don't use anywhere else without\n // asking Algolia's permission.\n 'OFCNCOG2CU', // Application ID\n 'ec73550aa8b2936dab436d4e02144784', // API Key\n);\nconst index = client.initIndex('npm-search');\n\ninterface AlgoliaObj {\n types?: {\n definitelyTyped?: string;\n };\n}\n\nexport const title = 'No dependencies without types';\n\n// This is a naive check for matching @types/<pkg name> packages\n// that the student hasn't yet installed. It is not intended to\n// be an exhaustive check for any types for all packages.\n//\n// It attempts to address scenarios such as this with\n// `styled-components`:\n//\n// https://learn.upleveled.io/courses/btcmp-l-webfs-gen-0/modules/122-cheatsheet-css-in-js/#eslint-errors-with-styled-components\nexport default async function noDependenciesWithoutTypes() {\n const dependenciesWithMissingTypes = await pReduce(\n Object.keys(projectPackageJson.dependencies || {}),\n async (filteredDependencies: [string, string][], dependency: string) => {\n try {\n const packageJsonPath = require.resolve(`${dependency}/package.json`);\n\n const modulePackageJson = JSON.parse(\n await fs.readFile(packageJsonPath, 'utf-8'),\n );\n\n // If the keys \"types\" or \"typings\" are in the module's `package.json`, bail out\n if ('types' in modulePackageJson || 'typings' in modulePackageJson) {\n return filteredDependencies;\n }\n } catch {\n // Swallow error\n }\n\n let indexDTsPath;\n\n try {\n indexDTsPath = require.resolve(`${dependency}/index.d.ts`);\n } catch {\n // Swallow error\n }\n\n // If the index.d.ts file exists inside the module's directory, bail out\n if (indexDTsPath && existsSync(indexDTsPath)) {\n return filteredDependencies;\n }\n\n let results: AlgoliaObj;\n\n try {\n results = await index.getObject<AlgoliaObj>(dependency, {\n attributesToRetrieve: ['types'],\n });\n } catch (error) {\n // Show dependency name if Algolia's `index.getObject()` throws with an\n // error message (such as the error message \"ObjectID does not exist\"\n // when a package cannot be found in the index)\n throw new Error(\n `Algolia error for \\`${dependency}\\`: ${(error as Error).message}`,\n );\n }\n\n const definitelyTypedPackageName = results.types?.definitelyTyped;\n\n if (definitelyTypedPackageName) {\n // If a matching `@types/<package name>` has been already installed in devDependencies, bail out\n if (\n Object.keys(projectPackageJson.devDependencies || {}).includes(\n definitelyTypedPackageName,\n )\n ) {\n return filteredDependencies;\n }\n\n filteredDependencies.push([dependency, definitelyTypedPackageName]);\n }\n\n return filteredDependencies;\n },\n [],\n );\n\n if (dependenciesWithMissingTypes.length > 0) {\n throw new Error(\n `Dependencies found without types. Add the missing types with:\n\n ${commandExample(\n `pnpm add --save-dev ${dependenciesWithMissingTypes\n .map(([, definitelyTypedPackageName]) => definitelyTypedPackageName)\n .join(' ')}`,\n )}\n\n If the dependencies above are already in your package.json, check that they have not been incorrectly installed as regular dependencies in the \"dependencies\" object - they should be installed inside \"devDependencies\" (using the --save-dev flag mentioned above). To fix this situation, remove the dependencies and run the command above exactly.\n `,\n );\n }\n}\n","import { dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { execaCommand } from 'execa';\n\nexport const { stdout: preflightBinPath } = await execaCommand(`pnpm bin`, {\n cwd: dirname(fileURLToPath(import.meta.url)),\n});\n","import { execaCommand } from 'execa';\nimport { commandExample } from '../../util/commandExample';\nimport { preflightBinPath } from '../../util/preflightBinPath';\n\nexport const title = 'No unused dependencies';\n\nexport default async function noUnusedAndMissingDependencies() {\n const ignoredPackagePatterns = [\n // Unused dependency detected in https://github.com/upleveled/next-portfolio-dev\n '@graphql-codegen/cli',\n\n // Tailwind CSS\n '@tailwindcss/jit',\n 'autoprefixer',\n 'postcss',\n 'tailwindcss',\n\n // Sass (eg. in Next.js)\n 'sass',\n\n // Prettier and plugins\n 'prettier',\n 'prettier-plugin-*',\n\n // ESLint configuration\n '@ts-safeql/eslint-plugin',\n 'libpg-query',\n\n // TODO: Remove this once depcheck issue is fixed:\n // PR: https://github.com/depcheck/depcheck/pull/790\n // Issue: https://github.com/depcheck/depcheck/issues/791\n //\n // Stylelint configuration\n 'stylelint',\n 'stylelint-config-upleveled',\n\n // Testing\n '@testing-library/user-event',\n 'jest',\n 'jest-environment-jsdom',\n 'playwright',\n\n // `expect` required for proper types with `@testing-library/jest-dom` with `@jest/globals` and pnpm\n // https://github.com/testing-library/jest-dom/issues/123#issuecomment-1536828385\n // TODO: Remove when we switch from Jest to Vitest\n 'expect',\n\n // `ts-node` required for jest.config.ts\n // https://jestjs.io/docs/29.6/configuration#:~:text=To%20read%20TypeScript%20configuration%20files%20Jest%20requires%20ts%2Dnode.%20Make%20sure%20it%20is%20installed%20in%20your%20project\n // TODO: Remove when usage of tsx is allowed\n // https://github.com/jestjs/jest/issues/11989\n 'ts-node',\n\n // TypeScript\n 'typescript',\n '@types/*',\n 'tsx',\n\n // Next.js\n 'sharp',\n ].join(',');\n\n try {\n await execaCommand(\n `${preflightBinPath}/depcheck --ignores=\"${ignoredPackagePatterns}\"`,\n );\n } catch (error) {\n const { stdout } = error as { stdout: string };\n if (\n !stdout.startsWith('Unused dependencies') &&\n !stdout.startsWith('Unused devDependencies') &&\n !stdout.startsWith('Missing dependencies')\n ) {\n throw error;\n }\n\n const [unusedDependenciesStdout, missingDependenciesStdout] = stdout.split(\n 'Missing dependencies',\n );\n\n const messages = [];\n\n if (unusedDependenciesStdout) {\n messages.push(`Unused dependencies found:\n ${unusedDependenciesStdout\n .split('\\n')\n .filter((str: string) => str.includes('* '))\n .join('\\n')}\n\n Remove these dependencies by running the following command for each dependency:\n\n ${commandExample('pnpm remove <dependency name here>')}\n `);\n }\n\n if (missingDependenciesStdout) {\n messages.push(`Missing dependencies found:\n ${missingDependenciesStdout\n .split('\\n')\n .filter((str: string) => str.includes('* '))\n .join('\\n')}\n\n Add these missing dependencies by running the following command for each dependency:\n\n ${commandExample('pnpm add <dependency name here>')}\n `);\n }\n\n if (messages.length > 0) throw new Error(messages.join('\\n\\n'));\n }\n}\n","import { execaCommand } from 'execa';\nimport { commandExample } from '../util/commandExample';\n\nexport const title = 'No extraneous files committed to Git';\n\nexport default async function noExtraneousFilesCommittedToGit() {\n const { stdout } = await execaCommand(\n 'git ls-files .DS_Store yarn-error.log npm-debug.log',\n );\n\n if (stdout !== '') {\n throw new Error(\n `Extraneous files committed to Git:\n ${stdout}\n\n Remove these files from your repo by running the following command for each file:\n\n ${commandExample('git rm --cached <filename here>')}\n\n Once you've removed all files, make sure that it doesn't happen again by adding the filenames above to your .gitignore file.\n `,\n );\n }\n}\n","import { execaCommand } from 'execa';\nimport { commandExample } from '../util/commandExample';\n\nexport const title = 'No secrets committed to Git';\n\nexport default async function noSecretsCommittedToGit() {\n const { stdout } = await execaCommand('git ls-files .env .env*.local');\n\n if (stdout !== '') {\n throw new Error(\n `Secrets committed to Git 😱:\n ${stdout}\n\n Remove these files from your repo by installing BFG from the System Setup Guide (see Optional Software at the bottom) and running it on each of your files like this:\n\n ${commandExample('bfg --delete-files <filename here>')}\n\n Once you've done this for every secret file, then force push to your repository:\n\n ${commandExample('git push --force')}\n\n More info: https://docs.github.com/en/github/authenticating-to-github/removing-sensitive-data-from-a-repository\n\n Finally, make sure that this doesn't happen again by adding the filenames above to your .gitignore file.\n `,\n );\n }\n}\n","import os from 'node:os';\nimport { execaCommand } from 'execa';\nimport semver from 'semver';\nimport { commandExample } from '../util/commandExample';\nimport { preflightPackageJson } from '../util/packageJson';\n\nexport const title = 'Preflight is latest version';\n\nexport default async function preflightIsLatestVersion() {\n const { stdout: remoteVersion } = await execaCommand(\n 'npm show @upleveled/preflight version',\n );\n\n if (semver.gt(remoteVersion, preflightPackageJson.version)) {\n throw new Error(\n `Your current version of Preflight (${\n preflightPackageJson.version\n }) is older than the latest version ${remoteVersion} - upgrade with:\n\n ${commandExample(\n `${\n os.platform() === 'linux' ? 'sudo ' : ''\n }pnpm add --global @upleveled/preflight`,\n )}\n `,\n );\n }\n}\n","import { execaCommand } from 'execa';\nimport { normalizeNewlines } from '../util/crossPlatform';\n\nexport const title = 'Prettier';\n\nexport default async function prettierCheck() {\n try {\n await execaCommand(\n 'pnpm prettier \"**/*.{js,jsx,ts,tsx,css,scss,sql}\" --list-different --end-of-line auto',\n );\n } catch (error) {\n const { stdout, stderr } = error as { stdout: string; stderr: string };\n\n if (!stdout || stderr) {\n throw error;\n }\n\n const unformattedFiles = normalizeNewlines(stdout).split('\\n');\n\n if (unformattedFiles.length > 0) {\n throw new Error(\n `Prettier has not been run in the following files:\n ${unformattedFiles.join('\\n')}\n\n For each of the files above, open the file in your editor and save the file. This will format the file with Prettier, which will cause changes to appear in Git.\n `,\n );\n }\n }\n}\n","import path from 'node:path';\nimport { commandExample } from '../util/commandExample';\n\nexport const title = 'Project folder name matches correct format';\n\nexport default function projectFolderNameMatchesCorrectFormat() {\n const currentDirectoryName = path.basename(process.cwd());\n const lowercaseHyphenedDirectoryName = currentDirectoryName\n .toLowerCase()\n .replaceAll(' ', '-');\n\n if (currentDirectoryName !== lowercaseHyphenedDirectoryName) {\n throw new Error(\n `Project directory name \"${currentDirectoryName}\" doesn't match the correct format (no spaces or uppercase letters).\n\n Rename the directory to the correct name \"${lowercaseHyphenedDirectoryName}\" with the following sequence of commands:\n\n ${commandExample('cd ..')}\n ${commandExample(\n `mv ${currentDirectoryName} ${lowercaseHyphenedDirectoryName}`,\n )}\n ${commandExample(`cd ${lowercaseHyphenedDirectoryName}`)}\n `,\n );\n }\n}\n","import { sep } from 'node:path';\nimport { execaCommand } from 'execa';\nimport { LintResult } from 'stylelint';\n\nexport const supportedStylelintFileExtensions = [\n 'css',\n 'sass',\n 'scss',\n 'less',\n 'js',\n 'tsx',\n 'jsx',\n];\n\nexport const title = 'Stylelint';\n\nexport default async function stylelintCheck() {\n try {\n await execaCommand(\n `pnpm stylelint **/*.{${supportedStylelintFileExtensions.join(\n ',',\n )}} --max-warnings 0 --formatter json`,\n );\n } catch (error) {\n const { stdout } = error as { stdout: string };\n\n let stylelintResults;\n\n try {\n stylelintResults = (JSON.parse(stdout) as LintResult[]).filter(\n (stylelintResult) => stylelintResult.errored === true,\n );\n } catch {\n throw error;\n }\n\n if (\n stylelintResults.length < 1 ||\n !stylelintResults.every((result) => 'errored' in result)\n ) {\n throw new Error(\n `Unexpected shape of Stylelint JSON related to .errored properties - please report this to the UpLeveled engineering team, including the following output:\n ${stdout}\n `,\n );\n }\n\n throw new Error(\n `Stylelint problems found in the following files:\n ${stylelintResults\n // Make paths relative to the project:\n //\n // Before:\n // macOS / Linux: /home/projects/random-color-generator-react-app/src/index.css\n // Windows: C:\\Users\\Lukas\\projects\\random-color-generator-react-app\\src\\index.css\n //\n // After:\n // macOS / Linux: src/index.css\n // Windows: src\\index.css\n .map(({ source }) => source!.replace(`${process.cwd()}${sep}`, ''))\n .join('\\n')}\n\n Open these files in your editor - there should be problems to fix\n `,\n );\n }\n}\n","import { promises as fs } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { execaCommand } from 'execa';\nimport readdirp from 'readdirp';\nimport semver from 'semver';\nimport { supportedStylelintFileExtensions } from './stylelint';\n\nconst require = createRequire(`${process.cwd()}/`);\n\nexport const title = 'Stylelint config is latest version';\n\nexport default async function stylelintConfigIsValid() {\n const { stdout: remoteVersion } = await execaCommand(\n 'npm show stylelint-config-upleveled version',\n );\n\n let localVersion: string | undefined;\n\n try {\n const stylelintConfigPackageJsonPath = require.resolve(\n 'stylelint-config-upleveled/package.json',\n );\n\n localVersion = JSON.parse(\n await fs.readFile(stylelintConfigPackageJsonPath, 'utf-8'),\n ).version;\n } catch {\n // Swallow error\n }\n\n if (typeof localVersion === 'undefined') {\n throw new Error(\n `The UpLeveled Stylelint Config has not been installed - please install using the instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n if (semver.gt(remoteVersion, localVersion)) {\n throw new Error(\n `Your current version of the UpLeveled Stylelint Config (${localVersion}) is older than the latest version ${remoteVersion} - upgrade by running:\n\n pnpm add stylelint-config-upleveled@${remoteVersion}`,\n );\n }\n\n let stylelintConfigMatches;\n\n try {\n stylelintConfigMatches =\n (await fs.readFile('./stylelint.config.js', 'utf-8')).trim() ===\n `/** @type {import('stylelint').Config} */\nconst config = {\n extends: ['stylelint-config-upleveled'],\n};\n\nexport default config;`;\n } catch {\n throw new Error(\n `Error reading your stylelint.config.js file - please delete the file if it exists and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n if (!stylelintConfigMatches) {\n throw new Error(\n `Your stylelint.config.js file does not match the configuration file template - please delete the file and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled\n `,\n );\n }\n\n const stylelintDisableOccurrences = [];\n\n for await (const { path } of readdirp('.', {\n directoryFilter: ['!.git', '!.next', '!node_modules'],\n fileFilter: supportedStylelintFileExtensions.map(\n (fileExtension) => `*.${fileExtension}`,\n ),\n })) {\n const fileContents = await fs.readFile(path, 'utf-8');\n if (fileContents.includes('stylelint-disable')) {\n stylelintDisableOccurrences.push(path);\n }\n }\n\n if (stylelintDisableOccurrences.length > 0) {\n throw new Error(\n `Stylelint has been disabled in the following files:\n ${stylelintDisableOccurrences.join('\\n')}\n\n Remove all comments disabling or modifying Stylelint rule configuration (eg. stylelint-disable and stylelint-disable-next-line comments) and fix the problems\n `,\n );\n }\n}\n","import { execaCommand } from 'execa';\nimport { commandExample } from '../util/commandExample';\n\nexport const title = 'Use single package manager';\n\nexport default async function useSinglePackageManager() {\n const { stdout } = await execaCommand(\n 'git ls-files package-lock.json yarn.lock',\n );\n\n if (stdout !== '') {\n throw new Error(\n `package-lock.json or yarn.lock file committed to Git. Remove it with:\n\n ${commandExample('git rm --cached <filename>')}\n\n After you've removed it, you can delete the file with:\n\n ${commandExample('rm <filename>')}\n\n The presence of this file indicates that another package manager was used in addition to pnpm (eg. \"npm install\" or \"yarn add\" was run). In order to avoid issues with the state of the pnpm-lock.yaml file, we suggest also forcing regeneration this file with the following command:\n\n ${commandExample('pnpm install --force')}\n `,\n );\n }\n}\n","import { Listr, ListrTask } from 'listr2';\nimport * as allChangesCommittedToGit from './checks/allChangesCommittedToGit.js';\nimport * as eslint from './checks/eslint.js';\nimport * as eslintConfigIsValid from './checks/eslintConfigIsValid.js';\nimport * as linkOnGithubAbout from './checks/linkOnGithubAbout.js';\nimport * as nodeModulesIgnoredFromGit from './checks/nodeModulesIgnoredFromGit.js';\nimport * as noDependenciesWithoutTypes from './checks/noDependencyProblems/noDependenciesWithoutTypes.js';\nimport * as noUnusedAndMissingDependencies from './checks/noDependencyProblems/noUnusedDependencies.js';\nimport * as noExtraneousFilesCommittedToGit from './checks/noExtraneousFilesCommittedToGit.js';\nimport * as noSecretsCommittedToGit from './checks/noSecretsCommittedToGit.js';\nimport * as preflightIsLatestVersion from './checks/preflightIsLatestVersion.js';\nimport * as prettier from './checks/prettier.js';\nimport * as projectFolderNameMatchesCorrectFormat from './checks/projectFolderNameMatchesCorrectFormat.js';\nimport * as stylelint from './checks/stylelint.js';\nimport * as stylelintConfigIsValid from './checks/stylelintConfigIsValid.js';\nimport * as useSinglePackageManager from './checks/useSinglePackageManager.js';\nimport { CtxParam } from './types/CtxParam.js';\nimport { TaskParam } from './types/TaskParam.js';\nimport {\n preflightPackageJson,\n projectPackageJson,\n} from './util/packageJson.js';\n\nconst projectDependencies = projectPackageJson.dependencies || {};\n\nconsole.log(`🚀 UpLeveled Preflight v${preflightPackageJson.version}`);\n\nconst listrTasks: ListrTask[] = [\n // ======= Sync Tasks =======\n // Git\n allChangesCommittedToGit,\n nodeModulesIgnoredFromGit,\n noExtraneousFilesCommittedToGit,\n noSecretsCommittedToGit,\n\n // Package managers\n useSinglePackageManager,\n\n // Project setup\n projectFolderNameMatchesCorrectFormat,\n\n // ======= Async Tasks =======\n // Dependencies\n {\n title: 'No dependency problems',\n task: (ctx: CtxParam, task: TaskParam): Listr =>\n task.newListr([\n {\n title: noUnusedAndMissingDependencies.title,\n task: noUnusedAndMissingDependencies.default,\n },\n {\n title: noDependenciesWithoutTypes.title,\n task: noDependenciesWithoutTypes.default,\n },\n ]),\n },\n\n // GitHub\n linkOnGithubAbout,\n\n // Linting\n eslint,\n ...(!(\n '@upleveled/react-scripts' in projectDependencies ||\n 'next' in projectDependencies\n )\n ? []\n : [stylelint]),\n prettier,\n\n // Version and configuration checks\n eslintConfigIsValid,\n ...(!(\n '@upleveled/react-scripts' in projectDependencies ||\n 'next' in projectDependencies\n )\n ? []\n : [stylelintConfigIsValid]),\n preflightIsLatestVersion,\n].map((module) => {\n if ('task' in module) return module;\n return {\n title: module.title,\n task: module.default,\n };\n});\n\nconst tasks = new Listr(listrTasks, {\n exitOnError: false,\n collectErrors: 'minimal',\n rendererOptions: {\n collapseErrors: false,\n removeEmptyLines: false,\n formatOutput: 'wrap',\n },\n fallbackRenderer: 'verbose',\n concurrent: 5,\n});\n\nawait tasks.run();\n\nif (tasks.errors.length > 0) {\n process.exit(1);\n}\n"],"names":["emptyBrailleCharacter","commandExample","command","chalk","dim","isDrone","stdout","execaCommand","reject","test","title","allChangesCommittedToGit","replSlug","isRunningInReplIt","fs","writeFile","onlyPnpmLockModifiedOnDrone","trim","Error","eslintCheck","error","eslintResults","JSON","parse","filter","eslintResult","errorCount","warningCount","length","every","result","map","filePath","replace","process","cwd","sep","join","require","createRequire","eslintConfigIsValid","remoteVersion","localVersion","eslintConfigPackageJsonPath","resolve","readFile","version","semver","gt","eslintConfigMatches","eslintDisableOccurrences","path","readdirp","directoryFilter","fileFilter","fileContents","push","randomUserAgent","randomIndex","Math","floor","random","userAgents","linkOnGithubAbout","repoUrl","html","fetch","text","$","cheerio","load","urlInAboutSection","nextAll","children","next","attr","response","headers","ok","status","statusText","CRLF","normalizeNewlines","input","TypeError","RegExp","nodeModulesIgnoredFromGit","nodeModulesInGitignore","split","reduce","found","line","projectPackageJson","preflightPackageJson","URL","import","meta","url","client","algoliasearch","index","initIndex","noDependenciesWithoutTypes","dependenciesWithMissingTypes","pReduce","Object","keys","dependencies","filteredDependencies","dependency","packageJsonPath","modulePackageJson","indexDTsPath","existsSync","results","getObject","attributesToRetrieve","message","definitelyTypedPackageName","_results$types","types","definitelyTyped","devDependencies","includes","preflightBinPath","dirname","fileURLToPath","noUnusedAndMissingDependencies","ignoredPackagePatterns","startsWith","unusedDependenciesStdout","missingDependenciesStdout","messages","str","noExtraneousFilesCommittedToGit","noSecretsCommittedToGit","preflightIsLatestVersion","os","platform","prettierCheck","stderr","unformattedFiles","projectFolderNameMatchesCorrectFormat","currentDirectoryName","basename","lowercaseHyphenedDirectoryName","toLowerCase","replaceAll","supportedStylelintFileExtensions","stylelintCheck","stylelintResults","stylelintResult","errored","source","stylelintConfigIsValid","stylelintConfigPackageJsonPath","stylelintConfigMatches","stylelintDisableOccurrences","fileExtension","useSinglePackageManager","projectDependencies","console","log","listrTasks","task","ctx","newListr","eslint","stylelint","prettier","module","default","tasks","Listr","exitOnError","collectErrors","rendererOptions","collapseErrors","removeEmptyLines","formatOutput","fallbackRenderer","concurrent","run","errors","exit"],"mappings":";;;;;;;;;;;;;;;;AAEA;AACA;AACA,MAA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
"version": "7.0.4",
|
|
4
4
|
"repository": "upleveled/preflight",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "UpLeveled (https://github.com/upleveled)",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
]
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@types/eslint": "8.56.
|
|
29
|
+
"@types/eslint": "8.56.10",
|
|
30
30
|
"algoliasearch": "4.23.3",
|
|
31
31
|
"chalk": "5.3.0",
|
|
32
32
|
"cheerio": "1.0.0-rc.12",
|
|
@@ -38,26 +38,26 @@
|
|
|
38
38
|
"p-reduce": "3.0.0",
|
|
39
39
|
"patch-package": "8.0.0",
|
|
40
40
|
"readdirp": "3.6.0",
|
|
41
|
-
"semver": "7.6.
|
|
42
|
-
"top-user-agents": "2.1.
|
|
41
|
+
"semver": "7.6.2",
|
|
42
|
+
"top-user-agents": "2.1.22"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@babel/plugin-transform-modules-commonjs": "7.24.
|
|
45
|
+
"@babel/plugin-transform-modules-commonjs": "7.24.6",
|
|
46
46
|
"@jest/globals": "29.7.0",
|
|
47
|
-
"@size-limit/file": "11.1.
|
|
47
|
+
"@size-limit/file": "11.1.4",
|
|
48
48
|
"@types/babel__core": "7.20.5",
|
|
49
49
|
"@types/jest": "29.5.12",
|
|
50
|
-
"@types/node": "20.12.
|
|
50
|
+
"@types/node": "20.12.13",
|
|
51
51
|
"@types/p-map": "2.0.0",
|
|
52
52
|
"@types/semver": "7.5.8",
|
|
53
53
|
"babel-jest": "29.7.0",
|
|
54
|
-
"eslint": "9.
|
|
55
|
-
"eslint-config-upleveled": "8.
|
|
54
|
+
"eslint": "9.3.0",
|
|
55
|
+
"eslint-config-upleveled": "8.1.9",
|
|
56
56
|
"p-map": "7.0.2",
|
|
57
57
|
"postinstall-postinstall": "2.1.0",
|
|
58
58
|
"prettier": "3.2.5",
|
|
59
|
-
"size-limit": "11.1.
|
|
60
|
-
"stylelint": "16.
|
|
59
|
+
"size-limit": "11.1.4",
|
|
60
|
+
"stylelint": "16.6.1",
|
|
61
61
|
"tsdx": "0.14.1",
|
|
62
62
|
"tslib": "2.6.2",
|
|
63
63
|
"typescript": "5.4.5"
|
package/src/checks/eslint.ts
CHANGED
|
@@ -23,7 +23,9 @@ export default async function eslintConfigIsValid() {
|
|
|
23
23
|
localVersion = JSON.parse(
|
|
24
24
|
await fs.readFile(eslintConfigPackageJsonPath, 'utf-8'),
|
|
25
25
|
).version;
|
|
26
|
-
} catch
|
|
26
|
+
} catch {
|
|
27
|
+
// Swallow error
|
|
28
|
+
}
|
|
27
29
|
|
|
28
30
|
if (typeof localVersion === 'undefined') {
|
|
29
31
|
throw new Error(
|
|
@@ -45,7 +47,7 @@ export default async function eslintConfigIsValid() {
|
|
|
45
47
|
eslintConfigMatches =
|
|
46
48
|
(await fs.readFile('./eslint.config.js', 'utf-8')).trim() ===
|
|
47
49
|
"export { default } from 'eslint-config-upleveled';";
|
|
48
|
-
} catch
|
|
50
|
+
} catch {
|
|
49
51
|
throw new Error(
|
|
50
52
|
`Error reading your eslint.config.js file - please delete the file if it exists and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled
|
|
51
53
|
`,
|
|
@@ -44,13 +44,17 @@ export default async function noDependenciesWithoutTypes() {
|
|
|
44
44
|
if ('types' in modulePackageJson || 'typings' in modulePackageJson) {
|
|
45
45
|
return filteredDependencies;
|
|
46
46
|
}
|
|
47
|
-
} catch
|
|
47
|
+
} catch {
|
|
48
|
+
// Swallow error
|
|
49
|
+
}
|
|
48
50
|
|
|
49
51
|
let indexDTsPath;
|
|
50
52
|
|
|
51
53
|
try {
|
|
52
54
|
indexDTsPath = require.resolve(`${dependency}/index.d.ts`);
|
|
53
|
-
} catch
|
|
55
|
+
} catch {
|
|
56
|
+
// Swallow error
|
|
57
|
+
}
|
|
54
58
|
|
|
55
59
|
// If the index.d.ts file exists inside the module's directory, bail out
|
|
56
60
|
if (indexDTsPath && existsSync(indexDTsPath)) {
|
package/src/checks/stylelint.ts
CHANGED
|
@@ -24,7 +24,9 @@ export default async function stylelintConfigIsValid() {
|
|
|
24
24
|
localVersion = JSON.parse(
|
|
25
25
|
await fs.readFile(stylelintConfigPackageJsonPath, 'utf-8'),
|
|
26
26
|
).version;
|
|
27
|
-
} catch
|
|
27
|
+
} catch {
|
|
28
|
+
// Swallow error
|
|
29
|
+
}
|
|
28
30
|
|
|
29
31
|
if (typeof localVersion === 'undefined') {
|
|
30
32
|
throw new Error(
|
|
@@ -52,7 +54,7 @@ const config = {
|
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
export default config;`;
|
|
55
|
-
} catch
|
|
57
|
+
} catch {
|
|
56
58
|
throw new Error(
|
|
57
59
|
`Error reading your stylelint.config.js file - please delete the file if it exists and reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled
|
|
58
60
|
`,
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,6 @@ import * as eslint from './checks/eslint.js';
|
|
|
4
4
|
import * as eslintConfigIsValid from './checks/eslintConfigIsValid.js';
|
|
5
5
|
import * as linkOnGithubAbout from './checks/linkOnGithubAbout.js';
|
|
6
6
|
import * as nodeModulesIgnoredFromGit from './checks/nodeModulesIgnoredFromGit.js';
|
|
7
|
-
import * as nextJsProjectHasSharpInstalled from './checks/noDependencyProblems/nextJsProjectHasSharpInstalled.js';
|
|
8
7
|
import * as noDependenciesWithoutTypes from './checks/noDependencyProblems/noDependenciesWithoutTypes.js';
|
|
9
8
|
import * as noUnusedAndMissingDependencies from './checks/noDependencyProblems/noUnusedDependencies.js';
|
|
10
9
|
import * as noExtraneousFilesCommittedToGit from './checks/noExtraneousFilesCommittedToGit.js';
|
|
@@ -46,14 +45,6 @@ const listrTasks: ListrTask[] = [
|
|
|
46
45
|
title: 'No dependency problems',
|
|
47
46
|
task: (ctx: CtxParam, task: TaskParam): Listr =>
|
|
48
47
|
task.newListr([
|
|
49
|
-
...(!Object.keys(projectDependencies).includes('next')
|
|
50
|
-
? []
|
|
51
|
-
: [
|
|
52
|
-
{
|
|
53
|
-
title: nextJsProjectHasSharpInstalled.title,
|
|
54
|
-
task: nextJsProjectHasSharpInstalled.default,
|
|
55
|
-
},
|
|
56
|
-
]),
|
|
57
48
|
{
|
|
58
49
|
title: noUnusedAndMissingDependencies.title,
|
|
59
50
|
task: noUnusedAndMissingDependencies.default,
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { commandExample } from '../../util/commandExample';
|
|
2
|
-
import { projectPackageJson } from '../../util/packageJson';
|
|
3
|
-
|
|
4
|
-
export const title = 'Next.js project has sharp installed';
|
|
5
|
-
|
|
6
|
-
export default function nextJsProjectHasSharpInstalled() {
|
|
7
|
-
const dependenciesPackageNames = Object.keys(
|
|
8
|
-
projectPackageJson.dependencies || {},
|
|
9
|
-
);
|
|
10
|
-
if (
|
|
11
|
-
dependenciesPackageNames.includes('next') &&
|
|
12
|
-
!dependenciesPackageNames.includes('sharp')
|
|
13
|
-
) {
|
|
14
|
-
throw new Error(
|
|
15
|
-
`Next.js projects should have sharp installed for better image optimization. Install it with:
|
|
16
|
-
|
|
17
|
-
${commandExample('pnpm add sharp')}
|
|
18
|
-
`,
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
}
|