@upleveled/preflight 7.0.4 → 7.0.6
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 +32 -20
- package/dist/preflight.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/checks/allChangesCommittedToGit.ts +3 -3
- package/src/checks/eslint.ts +6 -2
- package/src/checks/eslintConfigIsValid.ts +3 -4
- package/src/checks/linkOnGithubAbout.ts +2 -2
- package/src/checks/noDependencyProblems/noUnusedDependencies.ts +2 -4
- package/src/checks/noExtraneousFilesCommittedToGit.ts +3 -4
- package/src/checks/noSecretsCommittedToGit.ts +2 -2
- package/src/checks/nodeModulesIgnoredFromGit.ts +3 -3
- package/src/checks/preflightIsLatestVersion.ts +3 -4
- package/src/checks/prettier.ts +6 -4
- package/src/checks/stylelint.ts +8 -6
- package/src/checks/stylelintConfigIsValid.ts +3 -4
- package/src/checks/useSinglePackageManager.ts +2 -4
- package/src/util/drone.ts +3 -3
- package/src/util/preflightBinPath.ts +3 -3
package/dist/preflight.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Listr } from 'listr2';
|
|
2
2
|
import { promises, existsSync } from 'node:fs';
|
|
3
|
-
import {
|
|
3
|
+
import { execa } from 'execa';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import path, { sep, dirname } from 'node:path';
|
|
6
6
|
import { createRequire } from 'node:module';
|
|
@@ -24,9 +24,9 @@ function commandExample(command) {
|
|
|
24
24
|
async function isDrone() {
|
|
25
25
|
const {
|
|
26
26
|
stdout
|
|
27
|
-
} = await
|
|
27
|
+
} = await execa({
|
|
28
28
|
reject: false
|
|
29
|
-
})
|
|
29
|
+
})`cat /etc/os-release`;
|
|
30
30
|
return /Alpine Linux/.test(stdout);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -34,14 +34,14 @@ const title = 'All changes committed to Git';
|
|
|
34
34
|
async function allChangesCommittedToGit() {
|
|
35
35
|
const {
|
|
36
36
|
stdout: replSlug
|
|
37
|
-
} = await
|
|
37
|
+
} = await execa`echo $REPL_SLUG`;
|
|
38
38
|
const isRunningInReplIt = replSlug !== '';
|
|
39
39
|
if (isRunningInReplIt) {
|
|
40
40
|
await promises.writeFile('.git/info/exclude', '.replit\n');
|
|
41
41
|
}
|
|
42
42
|
const {
|
|
43
43
|
stdout
|
|
44
|
-
} = await
|
|
44
|
+
} = await execa`git status --porcelain`;
|
|
45
45
|
if (stdout !== '') {
|
|
46
46
|
const onlyPnpmLockModifiedOnDrone = stdout.trim() === 'M pnpm-lock.yaml' && (await isDrone());
|
|
47
47
|
throw new Error(`Some changes have not been committed to Git:
|
|
@@ -63,7 +63,11 @@ var allChangesCommittedToGit$1 = {
|
|
|
63
63
|
const title$1 = 'ESLint';
|
|
64
64
|
async function eslintCheck() {
|
|
65
65
|
try {
|
|
66
|
-
await
|
|
66
|
+
await execa({
|
|
67
|
+
// Execute binaries in ./node_modules/.bin to avoid pnpm overhead
|
|
68
|
+
// https://github.com/sindresorhus/execa/blob/main/docs/environment.md#local-binaries
|
|
69
|
+
preferLocal: true
|
|
70
|
+
})`eslint . --max-warnings 0 --format json`;
|
|
67
71
|
} catch (error) {
|
|
68
72
|
const {
|
|
69
73
|
stdout
|
|
@@ -115,7 +119,7 @@ const title$2 = 'ESLint config is latest version';
|
|
|
115
119
|
async function eslintConfigIsValid() {
|
|
116
120
|
const {
|
|
117
121
|
stdout: remoteVersion
|
|
118
|
-
} = await
|
|
122
|
+
} = await execa`npm show eslint-config-upleveled version`;
|
|
119
123
|
let localVersion;
|
|
120
124
|
try {
|
|
121
125
|
const eslintConfigPackageJsonPath = require$1.resolve('eslint-config-upleveled/package.json');
|
|
@@ -178,7 +182,7 @@ const title$3 = 'GitHub repo has deployed project link under About';
|
|
|
178
182
|
async function linkOnGithubAbout() {
|
|
179
183
|
const {
|
|
180
184
|
stdout
|
|
181
|
-
} = await
|
|
185
|
+
} = await execa`git remote get-url origin`;
|
|
182
186
|
const repoUrl = stdout.replace('git@github.com:', 'https://github.com/').replace('.git', '');
|
|
183
187
|
const html = await (await fetch(repoUrl)).text();
|
|
184
188
|
const $ = cheerio.load(html);
|
|
@@ -217,13 +221,13 @@ function normalizeNewlines(input) {
|
|
|
217
221
|
|
|
218
222
|
const title$4 = 'node_modules/ folder ignored in Git';
|
|
219
223
|
async function nodeModulesIgnoredFromGit() {
|
|
220
|
-
if ((await
|
|
224
|
+
if ((await execa`git ls-files node_modules/`).stdout !== '') {
|
|
221
225
|
throw new Error(`node_modules/ folder committed to Git. Remove it using:
|
|
222
226
|
|
|
223
227
|
${commandExample('git rm -r --cached node_modules')}
|
|
224
228
|
`);
|
|
225
229
|
}
|
|
226
|
-
if ((await
|
|
230
|
+
if ((await execa`git ls-files .gitignore`).stdout !== '.gitignore') {
|
|
227
231
|
throw new Error('.gitignore file not found');
|
|
228
232
|
}
|
|
229
233
|
const nodeModulesInGitignore = normalizeNewlines(await promises.readFile('./.gitignore', 'utf8')).split('\n').reduce((found, line) => found || /^\/?node_modules\/?$/.test(line), false);
|
|
@@ -314,9 +318,9 @@ async function noDependenciesWithoutTypes() {
|
|
|
314
318
|
|
|
315
319
|
const {
|
|
316
320
|
stdout: preflightBinPath
|
|
317
|
-
} = await /*#__PURE__*/
|
|
321
|
+
} = await /*#__PURE__*/execa({
|
|
318
322
|
cwd: /*#__PURE__*/dirname( /*#__PURE__*/fileURLToPath(import.meta.url))
|
|
319
|
-
})
|
|
323
|
+
})`pnpm bin`;
|
|
320
324
|
|
|
321
325
|
const title$6 = 'No unused dependencies';
|
|
322
326
|
async function noUnusedAndMissingDependencies() {
|
|
@@ -353,7 +357,7 @@ async function noUnusedAndMissingDependencies() {
|
|
|
353
357
|
// Next.js
|
|
354
358
|
'sharp'].join(',');
|
|
355
359
|
try {
|
|
356
|
-
await
|
|
360
|
+
await execa`${preflightBinPath}/depcheck --ignores="${ignoredPackagePatterns}"`;
|
|
357
361
|
} catch (error) {
|
|
358
362
|
const {
|
|
359
363
|
stdout
|
|
@@ -389,7 +393,7 @@ const title$7 = 'No extraneous files committed to Git';
|
|
|
389
393
|
async function noExtraneousFilesCommittedToGit() {
|
|
390
394
|
const {
|
|
391
395
|
stdout
|
|
392
|
-
} = await
|
|
396
|
+
} = await execa`git ls-files .DS_Store yarn-error.log npm-debug.log`;
|
|
393
397
|
if (stdout !== '') {
|
|
394
398
|
throw new Error(`Extraneous files committed to Git:
|
|
395
399
|
${stdout}
|
|
@@ -413,7 +417,7 @@ const title$8 = 'No secrets committed to Git';
|
|
|
413
417
|
async function noSecretsCommittedToGit() {
|
|
414
418
|
const {
|
|
415
419
|
stdout
|
|
416
|
-
} = await
|
|
420
|
+
} = await execa`git ls-files .env .env*.local`;
|
|
417
421
|
if (stdout !== '') {
|
|
418
422
|
throw new Error(`Secrets committed to Git 😱:
|
|
419
423
|
${stdout}
|
|
@@ -443,7 +447,7 @@ const title$9 = 'Preflight is latest version';
|
|
|
443
447
|
async function preflightIsLatestVersion() {
|
|
444
448
|
const {
|
|
445
449
|
stdout: remoteVersion
|
|
446
|
-
} = await
|
|
450
|
+
} = await execa`npm show @upleveled/preflight version`;
|
|
447
451
|
if (semver.gt(remoteVersion, preflightPackageJson.version)) {
|
|
448
452
|
throw new Error(`Your current version of Preflight (${preflightPackageJson.version}) is older than the latest version ${remoteVersion} - upgrade with:
|
|
449
453
|
|
|
@@ -461,7 +465,11 @@ var preflightIsLatestVersion$1 = {
|
|
|
461
465
|
const title$a = 'Prettier';
|
|
462
466
|
async function prettierCheck() {
|
|
463
467
|
try {
|
|
464
|
-
await
|
|
468
|
+
await execa({
|
|
469
|
+
// Execute binaries in ./node_modules/.bin to avoid pnpm overhead
|
|
470
|
+
// https://github.com/sindresorhus/execa/blob/main/docs/environment.md#local-binaries
|
|
471
|
+
preferLocal: true
|
|
472
|
+
})`prettier "**/*.{js,jsx,ts,tsx,css,scss,sql}" --list-different --end-of-line auto`;
|
|
465
473
|
} catch (error) {
|
|
466
474
|
const {
|
|
467
475
|
stdout,
|
|
@@ -513,7 +521,11 @@ const supportedStylelintFileExtensions = ['css', 'sass', 'scss', 'less', 'js', '
|
|
|
513
521
|
const title$c = 'Stylelint';
|
|
514
522
|
async function stylelintCheck() {
|
|
515
523
|
try {
|
|
516
|
-
await
|
|
524
|
+
await execa({
|
|
525
|
+
// Execute binaries in ./node_modules/.bin to avoid pnpm overhead
|
|
526
|
+
// https://github.com/sindresorhus/execa/blob/main/docs/environment.md#local-binaries
|
|
527
|
+
preferLocal: true
|
|
528
|
+
})`stylelint **/*.{${supportedStylelintFileExtensions.join(',')}} --max-warnings 0 --formatter json`;
|
|
517
529
|
} catch (error) {
|
|
518
530
|
const {
|
|
519
531
|
stdout
|
|
@@ -561,7 +573,7 @@ const title$d = 'Stylelint config is latest version';
|
|
|
561
573
|
async function stylelintConfigIsValid() {
|
|
562
574
|
const {
|
|
563
575
|
stdout: remoteVersion
|
|
564
|
-
} = await
|
|
576
|
+
} = await execa`npm show stylelint-config-upleveled version`;
|
|
565
577
|
let localVersion;
|
|
566
578
|
try {
|
|
567
579
|
const stylelintConfigPackageJsonPath = require$2.resolve('stylelint-config-upleveled/package.json');
|
|
@@ -625,7 +637,7 @@ const title$e = 'Use single package manager';
|
|
|
625
637
|
async function useSinglePackageManager() {
|
|
626
638
|
const {
|
|
627
639
|
stdout
|
|
628
|
-
} = await
|
|
640
|
+
} = await execa`git ls-files package-lock.json yarn.lock`;
|
|
629
641
|
if (stdout !== '') {
|
|
630
642
|
throw new Error(`package-lock.json or yarn.lock file committed to Git. Remove it with:
|
|
631
643
|
|
|
@@ -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/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,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,MAAMS,OAAK,GAAG,QAAQ;AAE7B,AAAe,eAAeS,WAAWA;EACvC,IAAI;IACF,MAAMZ,YAAY,CAAC,+CAA+C,CAAC;GACpE,CAAC,OA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AAM,GAAG,CAAC,EAAE;EAC3BM,OAAO,CAACsJ,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 { execa } from 'execa';\n\nexport async function isDrone() {\n const { stdout } = await execa({\n reject: false,\n })`cat /etc/os-release`;\n return /Alpine Linux/.test(stdout);\n}\n","import { promises as fs } from 'node:fs';\nimport { execa } 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 execa`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 execa`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 { execa } from 'execa';\n\nexport const title = 'ESLint';\n\nexport default async function eslintCheck() {\n try {\n await execa({\n // Execute binaries in ./node_modules/.bin to avoid pnpm overhead\n // https://github.com/sindresorhus/execa/blob/main/docs/environment.md#local-binaries\n preferLocal: true,\n })`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 { execa } 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 } =\n await execa`npm show eslint-config-upleveled version`;\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 { execa } 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 execa`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 { execa } 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 execa`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 execa`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 { execa } from 'execa';\n\nexport const { stdout: preflightBinPath } = await execa({\n cwd: dirname(fileURLToPath(import.meta.url)),\n})`pnpm bin`;\n","import { execa } 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 execa`${preflightBinPath}/depcheck --ignores=\"${ignoredPackagePatterns}\"`;\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 { execa } 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 } =\n await execa`git ls-files .DS_Store yarn-error.log npm-debug.log`;\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 { execa } 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 execa`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 { execa } 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 } =\n await execa`npm show @upleveled/preflight version`;\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 { execa } from 'execa';\nimport { normalizeNewlines } from '../util/crossPlatform';\n\nexport const title = 'Prettier';\n\nexport default async function prettierCheck() {\n try {\n await execa({\n // Execute binaries in ./node_modules/.bin to avoid pnpm overhead\n // https://github.com/sindresorhus/execa/blob/main/docs/environment.md#local-binaries\n preferLocal: true,\n })`prettier \"**/*.{js,jsx,ts,tsx,css,scss,sql}\" --list-different --end-of-line auto`;\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 { execa } 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 execa({\n // Execute binaries in ./node_modules/.bin to avoid pnpm overhead\n // https://github.com/sindresorhus/execa/blob/main/docs/environment.md#local-binaries\n preferLocal: true,\n })`stylelint **/*.{${supportedStylelintFileExtensions.join(\n ',',\n )}} --max-warnings 0 --formatter json`;\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 { execa } 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 } =\n await execa`npm show stylelint-config-upleveled version`;\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 { execa } 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 execa`git ls-files package-lock.json yarn.lock`;\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","execa","reject","test","title","allChangesCommittedToGit","replSlug","isRunningInReplIt","fs","writeFile","onlyPnpmLockModifiedOnDrone","trim","Error","eslintCheck","preferLocal","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,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,KAAK,CAAC;IAC7BC,MAAM,EAAE;GACT,sBAAsB;EACvB,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,sBAAsB;EAEzD,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,6BAA6B;EAEt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,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,CAAC3J,MAAM,GAAG,CAAC,EAAE;EAC3BM,OAAO,CAACsJ,IAAI,CAAC,CAAC,CAAC;AACjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upleveled/preflight",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.6",
|
|
4
4
|
"repository": "upleveled/preflight",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "UpLeveled (https://github.com/upleveled)",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"cheerio": "1.0.0-rc.12",
|
|
33
33
|
"depcheck": "1.4.7",
|
|
34
34
|
"domhandler": "5.0.3",
|
|
35
|
-
"execa": "
|
|
35
|
+
"execa": "9.1.0",
|
|
36
36
|
"listr2": "8.2.1",
|
|
37
37
|
"node-fetch": "3.3.2",
|
|
38
38
|
"p-reduce": "3.0.0",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
|
-
import {
|
|
2
|
+
import { execa } from 'execa';
|
|
3
3
|
import { commandExample } from '../util/commandExample';
|
|
4
4
|
import { isDrone } from '../util/drone';
|
|
5
5
|
|
|
6
6
|
export const title = 'All changes committed to Git';
|
|
7
7
|
|
|
8
8
|
export default async function allChangesCommittedToGit() {
|
|
9
|
-
const { stdout: replSlug } = await
|
|
9
|
+
const { stdout: replSlug } = await execa`echo $REPL_SLUG`;
|
|
10
10
|
|
|
11
11
|
const isRunningInReplIt = replSlug !== '';
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ export default async function allChangesCommittedToGit() {
|
|
|
14
14
|
await fs.writeFile('.git/info/exclude', '.replit\n');
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const { stdout } = await
|
|
17
|
+
const { stdout } = await execa`git status --porcelain`;
|
|
18
18
|
|
|
19
19
|
if (stdout !== '') {
|
|
20
20
|
const onlyPnpmLockModifiedOnDrone =
|
package/src/checks/eslint.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { sep } from 'node:path';
|
|
2
2
|
import { ESLint } from 'eslint';
|
|
3
|
-
import {
|
|
3
|
+
import { execa } from 'execa';
|
|
4
4
|
|
|
5
5
|
export const title = 'ESLint';
|
|
6
6
|
|
|
7
7
|
export default async function eslintCheck() {
|
|
8
8
|
try {
|
|
9
|
-
await
|
|
9
|
+
await execa({
|
|
10
|
+
// Execute binaries in ./node_modules/.bin to avoid pnpm overhead
|
|
11
|
+
// https://github.com/sindresorhus/execa/blob/main/docs/environment.md#local-binaries
|
|
12
|
+
preferLocal: true,
|
|
13
|
+
})`eslint . --max-warnings 0 --format json`;
|
|
10
14
|
} catch (error) {
|
|
11
15
|
const { stdout } = error as { stdout: string };
|
|
12
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import {
|
|
3
|
+
import { execa } from 'execa';
|
|
4
4
|
import readdirp from 'readdirp';
|
|
5
5
|
import semver from 'semver';
|
|
6
6
|
|
|
@@ -9,9 +9,8 @@ const require = createRequire(`${process.cwd()}/`);
|
|
|
9
9
|
export const title = 'ESLint config is latest version';
|
|
10
10
|
|
|
11
11
|
export default async function eslintConfigIsValid() {
|
|
12
|
-
const { stdout: remoteVersion } =
|
|
13
|
-
|
|
14
|
-
);
|
|
12
|
+
const { stdout: remoteVersion } =
|
|
13
|
+
await execa`npm show eslint-config-upleveled version`;
|
|
15
14
|
|
|
16
15
|
let localVersion: string | undefined;
|
|
17
16
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import cheerio from 'cheerio';
|
|
2
2
|
import type { Element } from 'domhandler';
|
|
3
|
-
import {
|
|
3
|
+
import { execa } from 'execa';
|
|
4
4
|
import fetch from 'node-fetch';
|
|
5
5
|
import { randomUserAgent } from '../util/randomUserAgent';
|
|
6
6
|
|
|
7
7
|
export const title = 'GitHub repo has deployed project link under About';
|
|
8
8
|
|
|
9
9
|
export default async function linkOnGithubAbout() {
|
|
10
|
-
const { stdout } = await
|
|
10
|
+
const { stdout } = await execa`git remote get-url origin`;
|
|
11
11
|
|
|
12
12
|
const repoUrl = stdout
|
|
13
13
|
.replace('git@github.com:', 'https://github.com/')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execa } from 'execa';
|
|
2
2
|
import { commandExample } from '../../util/commandExample';
|
|
3
3
|
import { preflightBinPath } from '../../util/preflightBinPath';
|
|
4
4
|
|
|
@@ -61,9 +61,7 @@ export default async function noUnusedAndMissingDependencies() {
|
|
|
61
61
|
].join(',');
|
|
62
62
|
|
|
63
63
|
try {
|
|
64
|
-
await
|
|
65
|
-
`${preflightBinPath}/depcheck --ignores="${ignoredPackagePatterns}"`,
|
|
66
|
-
);
|
|
64
|
+
await execa`${preflightBinPath}/depcheck --ignores="${ignoredPackagePatterns}"`;
|
|
67
65
|
} catch (error) {
|
|
68
66
|
const { stdout } = error as { stdout: string };
|
|
69
67
|
if (
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execa } from 'execa';
|
|
2
2
|
import { commandExample } from '../util/commandExample';
|
|
3
3
|
|
|
4
4
|
export const title = 'No extraneous files committed to Git';
|
|
5
5
|
|
|
6
6
|
export default async function noExtraneousFilesCommittedToGit() {
|
|
7
|
-
const { stdout } =
|
|
8
|
-
|
|
9
|
-
);
|
|
7
|
+
const { stdout } =
|
|
8
|
+
await execa`git ls-files .DS_Store yarn-error.log npm-debug.log`;
|
|
10
9
|
|
|
11
10
|
if (stdout !== '') {
|
|
12
11
|
throw new Error(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execa } from 'execa';
|
|
2
2
|
import { commandExample } from '../util/commandExample';
|
|
3
3
|
|
|
4
4
|
export const title = 'No secrets committed to Git';
|
|
5
5
|
|
|
6
6
|
export default async function noSecretsCommittedToGit() {
|
|
7
|
-
const { stdout } = await
|
|
7
|
+
const { stdout } = await execa`git ls-files .env .env*.local`;
|
|
8
8
|
|
|
9
9
|
if (stdout !== '') {
|
|
10
10
|
throw new Error(
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
|
-
import {
|
|
2
|
+
import { execa } from 'execa';
|
|
3
3
|
import { commandExample } from '../util/commandExample';
|
|
4
4
|
import { normalizeNewlines } from '../util/crossPlatform';
|
|
5
5
|
|
|
6
6
|
export const title = 'node_modules/ folder ignored in Git';
|
|
7
7
|
|
|
8
8
|
export default async function nodeModulesIgnoredFromGit() {
|
|
9
|
-
if ((await
|
|
9
|
+
if ((await execa`git ls-files node_modules/`).stdout !== '') {
|
|
10
10
|
throw new Error(
|
|
11
11
|
`node_modules/ folder committed to Git. Remove it using:
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ export default async function nodeModulesIgnoredFromGit() {
|
|
|
15
15
|
);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
if ((await
|
|
18
|
+
if ((await execa`git ls-files .gitignore`).stdout !== '.gitignore') {
|
|
19
19
|
throw new Error('.gitignore file not found');
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
|
-
import {
|
|
2
|
+
import { execa } from 'execa';
|
|
3
3
|
import semver from 'semver';
|
|
4
4
|
import { commandExample } from '../util/commandExample';
|
|
5
5
|
import { preflightPackageJson } from '../util/packageJson';
|
|
@@ -7,9 +7,8 @@ import { preflightPackageJson } from '../util/packageJson';
|
|
|
7
7
|
export const title = 'Preflight is latest version';
|
|
8
8
|
|
|
9
9
|
export default async function preflightIsLatestVersion() {
|
|
10
|
-
const { stdout: remoteVersion } =
|
|
11
|
-
|
|
12
|
-
);
|
|
10
|
+
const { stdout: remoteVersion } =
|
|
11
|
+
await execa`npm show @upleveled/preflight version`;
|
|
13
12
|
|
|
14
13
|
if (semver.gt(remoteVersion, preflightPackageJson.version)) {
|
|
15
14
|
throw new Error(
|
package/src/checks/prettier.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execa } from 'execa';
|
|
2
2
|
import { normalizeNewlines } from '../util/crossPlatform';
|
|
3
3
|
|
|
4
4
|
export const title = 'Prettier';
|
|
5
5
|
|
|
6
6
|
export default async function prettierCheck() {
|
|
7
7
|
try {
|
|
8
|
-
await
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
await execa({
|
|
9
|
+
// Execute binaries in ./node_modules/.bin to avoid pnpm overhead
|
|
10
|
+
// https://github.com/sindresorhus/execa/blob/main/docs/environment.md#local-binaries
|
|
11
|
+
preferLocal: true,
|
|
12
|
+
})`prettier "**/*.{js,jsx,ts,tsx,css,scss,sql}" --list-different --end-of-line auto`;
|
|
11
13
|
} catch (error) {
|
|
12
14
|
const { stdout, stderr } = error as { stdout: string; stderr: string };
|
|
13
15
|
|
package/src/checks/stylelint.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sep } from 'node:path';
|
|
2
|
-
import {
|
|
2
|
+
import { execa } from 'execa';
|
|
3
3
|
import { LintResult } from 'stylelint';
|
|
4
4
|
|
|
5
5
|
export const supportedStylelintFileExtensions = [
|
|
@@ -16,11 +16,13 @@ export const title = 'Stylelint';
|
|
|
16
16
|
|
|
17
17
|
export default async function stylelintCheck() {
|
|
18
18
|
try {
|
|
19
|
-
await
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
)
|
|
19
|
+
await execa({
|
|
20
|
+
// Execute binaries in ./node_modules/.bin to avoid pnpm overhead
|
|
21
|
+
// https://github.com/sindresorhus/execa/blob/main/docs/environment.md#local-binaries
|
|
22
|
+
preferLocal: true,
|
|
23
|
+
})`stylelint **/*.{${supportedStylelintFileExtensions.join(
|
|
24
|
+
',',
|
|
25
|
+
)}} --max-warnings 0 --formatter json`;
|
|
24
26
|
} catch (error) {
|
|
25
27
|
const { stdout } = error as { stdout: string };
|
|
26
28
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import {
|
|
3
|
+
import { execa } from 'execa';
|
|
4
4
|
import readdirp from 'readdirp';
|
|
5
5
|
import semver from 'semver';
|
|
6
6
|
import { supportedStylelintFileExtensions } from './stylelint';
|
|
@@ -10,9 +10,8 @@ const require = createRequire(`${process.cwd()}/`);
|
|
|
10
10
|
export const title = 'Stylelint config is latest version';
|
|
11
11
|
|
|
12
12
|
export default async function stylelintConfigIsValid() {
|
|
13
|
-
const { stdout: remoteVersion } =
|
|
14
|
-
|
|
15
|
-
);
|
|
13
|
+
const { stdout: remoteVersion } =
|
|
14
|
+
await execa`npm show stylelint-config-upleveled version`;
|
|
16
15
|
|
|
17
16
|
let localVersion: string | undefined;
|
|
18
17
|
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execa } from 'execa';
|
|
2
2
|
import { commandExample } from '../util/commandExample';
|
|
3
3
|
|
|
4
4
|
export const title = 'Use single package manager';
|
|
5
5
|
|
|
6
6
|
export default async function useSinglePackageManager() {
|
|
7
|
-
const { stdout } = await
|
|
8
|
-
'git ls-files package-lock.json yarn.lock',
|
|
9
|
-
);
|
|
7
|
+
const { stdout } = await execa`git ls-files package-lock.json yarn.lock`;
|
|
10
8
|
|
|
11
9
|
if (stdout !== '') {
|
|
12
10
|
throw new Error(
|
package/src/util/drone.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execa } from 'execa';
|
|
2
2
|
|
|
3
3
|
export async function isDrone() {
|
|
4
|
-
const { stdout } = await
|
|
4
|
+
const { stdout } = await execa({
|
|
5
5
|
reject: false,
|
|
6
|
-
})
|
|
6
|
+
})`cat /etc/os-release`;
|
|
7
7
|
return /Alpine Linux/.test(stdout);
|
|
8
8
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dirname } from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import {
|
|
3
|
+
import { execa } from 'execa';
|
|
4
4
|
|
|
5
|
-
export const { stdout: preflightBinPath } = await
|
|
5
|
+
export const { stdout: preflightBinPath } = await execa({
|
|
6
6
|
cwd: dirname(fileURLToPath(import.meta.url)),
|
|
7
|
-
})
|
|
7
|
+
})`pnpm bin`;
|