@upleveled/preflight 2.0.0 → 2.0.1

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.
@@ -11,11 +11,11 @@ import userAgents from 'top-user-agents';
11
11
  import { URL, fileURLToPath } from 'node:url';
12
12
  import algoliasearch from 'algoliasearch';
13
13
  import pReduce from 'p-reduce';
14
- import path, { dirname } from 'node:path';
14
+ import path, { dirname, sep } from 'node:path';
15
15
  import os from 'node:os';
16
16
 
17
+ // https://www.compart.com/en/unicode/U+2800
17
18
  // eslint-disable-next-line security/detect-bidi-characters -- Intentional use of unusual character for formatting
18
-
19
19
  const emptyBrailleCharacter = '‎';
20
20
  function commandExample(command) {
21
21
  return `${emptyBrailleCharacter} ${chalk.dim('$')} ${command}`;
@@ -36,15 +36,12 @@ async function allChangesCommittedToGit() {
36
36
  stdout: replSlug
37
37
  } = await execaCommand('echo $REPL_SLUG');
38
38
  const isRunningInReplIt = replSlug !== '';
39
-
40
39
  if (isRunningInReplIt) {
41
40
  await promises.writeFile('.git/info/exclude', '.replit\n');
42
41
  }
43
-
44
42
  const {
45
43
  stdout
46
44
  } = await execaCommand('git status --porcelain');
47
-
48
45
  if (stdout !== '') {
49
46
  const onlyPnpmLockModifiedOnDrone = stdout.trim() === 'M pnpm-lock.yaml' && (await isDrone());
50
47
  throw new Error(`Some changes have not been committed to Git:
@@ -68,7 +65,6 @@ function normalizeNewline(input) {
68
65
  if (typeof input !== 'string') {
69
66
  throw new TypeError(`Expected a \`string\`, got \`${typeof input}\``);
70
67
  }
71
-
72
68
  return input.replace(new RegExp(CRLF, 'g'), '\n');
73
69
  }
74
70
 
@@ -80,25 +76,25 @@ async function eslintCheck() {
80
76
  const {
81
77
  stdout
82
78
  } = error;
83
- const lines = stdout.split('\n'); // If no ESLint problems detected, throw the error
84
-
79
+ const lines = stdout.split('\n');
80
+ // If no ESLint problems detected, throw the error
85
81
  if (!/^\d+ problems?$/.test(lines[lines.length - 2])) {
86
82
  throw error;
87
83
  }
88
-
89
84
  throw new Error(`ESLint problems found in the following files:
90
- ${normalizeNewline(stdout).split('\n') // Match lines starting with slashes (macOS, Linux) or drive letters (Windows)
91
- .filter(line => /^(\/|[A-Z]:\\)/.test(line)) // Strip out the filename
85
+ ${normalizeNewline(stdout).split('\n')
86
+ // Match lines starting with slashes (macOS, Linux) or drive letters (Windows)
87
+ .filter(line => /^(\/|[A-Z]:\\)/.test(line))
88
+ // Strip out the filename
92
89
  .map(line => {
93
90
  var _line$match;
94
-
95
91
  return (_line$match = line.match(/^(([A-Z]:)?[^:]+):/)) == null ? void 0 : _line$match[1];
96
- }) // Remove duplicate filenames
92
+ })
93
+ // Remove duplicate filenames
97
94
  .reduce((linesWithoutDuplicates, line) => {
98
95
  if (line && !linesWithoutDuplicates.includes(line)) {
99
96
  linesWithoutDuplicates.push(line);
100
97
  }
101
-
102
98
  return linesWithoutDuplicates;
103
99
  }, []).join('\n')}
104
100
 
@@ -114,32 +110,25 @@ var eslint = {
114
110
  };
115
111
 
116
112
  const require$1 = /*#__PURE__*/createRequire(`${/*#__PURE__*/process.cwd()}/`);
117
-
118
113
  const title$2 = 'ESLint config is latest version';
119
114
  async function eslintConfigIsValid() {
120
115
  const {
121
116
  stdout: remoteVersion
122
117
  } = await execaCommand('npm show eslint-config-upleveled version');
123
118
  let localVersion;
124
-
125
119
  try {
126
120
  const eslintConfigPackageJsonPath = require$1.resolve('eslint-config-upleveled/package.json');
127
-
128
121
  localVersion = JSON.parse(await promises.readFile(eslintConfigPackageJsonPath, 'utf-8')).version;
129
122
  } catch (err) {}
130
-
131
123
  if (typeof localVersion === 'undefined') {
132
124
  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
133
125
  `);
134
126
  }
135
-
136
127
  if (semver.gt(remoteVersion, localVersion)) {
137
128
  throw new Error(`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
138
129
  `);
139
130
  }
140
-
141
131
  let eslintConfigMatches;
142
-
143
132
  try {
144
133
  eslintConfigMatches = (await promises.readFile('./.eslintrc.cjs', 'utf-8')).trim() === `/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */
145
134
  const config = {
@@ -151,14 +140,11 @@ module.exports = config;`;
151
140
  throw new Error(`Error reading your .eslintrc.cjs file - please reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled
152
141
  `);
153
142
  }
154
-
155
143
  if (!eslintConfigMatches) {
156
144
  throw new Error(`Your ESLint config file .eslintrc.cjs does not match the configuration file template - please reinstall the config using the instructions on https://www.npmjs.com/package/eslint-config-upleveled
157
145
  `);
158
146
  }
159
-
160
147
  const eslintDisableOccurrences = [];
161
-
162
148
  for await (const {
163
149
  path
164
150
  } of readdirp('.', {
@@ -166,12 +152,10 @@ module.exports = config;`;
166
152
  fileFilter: ['*.js', '*.jsx', '*.ts', '*.tsx']
167
153
  })) {
168
154
  const fileContents = await promises.readFile(path, 'utf-8');
169
-
170
155
  if (/eslint-disable|eslint [a-z0-9@/-]+: (0|off)/.test(fileContents)) {
171
156
  eslintDisableOccurrences.push(path);
172
157
  }
173
158
  }
174
-
175
159
  if (eslintDisableOccurrences.length > 0) {
176
160
  throw new Error(`ESLint has been disabled in the following files:
177
161
  ${eslintDisableOccurrences.join('\n')}
@@ -205,18 +189,15 @@ async function linkOnGithubAbout() {
205
189
  }).nextAll('div').filter(function () {
206
190
  return $(this).children('.octicon.octicon-link').length > 0;
207
191
  }).children('.octicon.octicon-link').next().children('a[href]').attr('href');
208
-
209
192
  if (!urlInAboutSection) {
210
193
  throw new Error(`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.`);
211
194
  }
212
-
213
195
  const response = await fetch(urlInAboutSection, {
214
196
  headers: {
215
197
  // For repl.it
216
198
  'user-agent': randomUserAgent()
217
199
  }
218
200
  });
219
-
220
201
  if (!response.ok) {
221
202
  throw new Error(`Project link in About section on ${repoUrl} is not returning a proper status code: the link returns status code ${response.status} (${response.statusText}).`);
222
203
  }
@@ -236,13 +217,10 @@ async function nodeModulesIgnoredFromGit() {
236
217
  ${commandExample('git rm -r --cached node_modules')}
237
218
  `);
238
219
  }
239
-
240
220
  if ((await execaCommand('git ls-files .gitignore')).stdout !== '.gitignore') {
241
221
  throw new Error('.gitignore file not found');
242
222
  }
243
-
244
223
  const nodeModulesInGitignore = normalizeNewline(await promises.readFile('./.gitignore', 'utf8')).split('\n').reduce((found, line) => found || /^\/?node_modules\/?$/.test(line), false);
245
-
246
224
  if (!nodeModulesInGitignore) {
247
225
  throw new Error('node_modules not found in .gitignore');
248
226
  }
@@ -260,7 +238,6 @@ const preflightPackageJson = /*#__PURE__*/JSON.parse(await /*#__PURE__*/promises
260
238
  const title$5 = 'Next.js project has sharp installed';
261
239
  function nextJsProjectHasSharpInstalled() {
262
240
  const dependenciesPackageNames = Object.keys(projectPackageJson.dependencies);
263
-
264
241
  if (dependenciesPackageNames.includes('next') && !dependenciesPackageNames.includes('sharp')) {
265
242
  throw new Error(`Next.js projects should have sharp installed for better image optimization. Install it with:
266
243
 
@@ -269,13 +246,16 @@ function nextJsProjectHasSharpInstalled() {
269
246
  }
270
247
  }
271
248
 
272
- const client = /*#__PURE__*/algoliasearch( // Application ID and API key specific to UpLeveled
249
+ const client = /*#__PURE__*/algoliasearch(
250
+ // Application ID and API key specific to UpLeveled
273
251
  // Preflight. Please don't use anywhere else without
274
252
  // asking Algolia's permission.
275
- 'OFCNCOG2CU', // Application ID
253
+ 'OFCNCOG2CU',
254
+ // Application ID
276
255
  'ec73550aa8b2936dab436d4e02144784');
277
256
  const index = /*#__PURE__*/client.initIndex('npm-search');
278
- const title$6 = 'No dependencies without types'; // This is a naive check for matching @types/<pkg name> packages
257
+ const title$6 = 'No dependencies without types';
258
+ // This is a naive check for matching @types/<pkg name> packages
279
259
  // that the student hasn't yet installed. It is not intended to
280
260
  // be an exhaustive check for any types for all packages.
281
261
  //
@@ -283,7 +263,6 @@ const title$6 = 'No dependencies without types'; // This is a naive check for ma
283
263
  // `styled-components`:
284
264
  //
285
265
  // https://learn.upleveled.io/courses/btcmp-l-webfs-gen-0/modules/122-cheatsheet-css-in-js/#eslint-errors-with-styled-components
286
-
287
266
  async function noDependenciesWithoutTypes() {
288
267
  const {
289
268
  devDependencies = {},
@@ -291,45 +270,39 @@ async function noDependenciesWithoutTypes() {
291
270
  } = projectPackageJson;
292
271
  const dependenciesWithMissingTypes = await pReduce(Object.keys(dependencies), async (filteredDependencies, dependency) => {
293
272
  var _results$types;
294
-
273
+ // It is not necessary check algolia for '@upleveled/react-scripts'
274
+ if (dependency === '@upleveled/react-scripts') {
275
+ return filteredDependencies;
276
+ }
295
277
  try {
296
278
  const packageJsonPath = require.resolve(`${dependency}/package.json`);
297
-
298
- const modulePackageJson = JSON.parse(await promises.readFile(packageJsonPath, 'utf-8')); // If the keys "types" or "typings" are in the module's `package.json`, bail out
299
-
279
+ const modulePackageJson = JSON.parse(await promises.readFile(packageJsonPath, 'utf-8'));
280
+ // If the keys "types" or "typings" are in the module's `package.json`, bail out
300
281
  if ('types' in modulePackageJson || 'typings' in modulePackageJson) {
301
282
  return filteredDependencies;
302
283
  }
303
284
  } catch (err) {}
304
-
305
285
  let indexDTsPath;
306
-
307
286
  try {
308
287
  indexDTsPath = require.resolve(`${dependency}/index.d.ts`);
309
- } catch (err) {} // If the index.d.ts file exists inside the module's directory, bail out
310
-
311
-
288
+ } catch (err) {}
289
+ // If the index.d.ts file exists inside the module's directory, bail out
312
290
  if (indexDTsPath && existsSync(indexDTsPath)) {
313
291
  return filteredDependencies;
314
292
  }
315
-
316
293
  const results = await index.getObject(dependency, {
317
294
  attributesToRetrieve: ['types']
318
295
  });
319
296
  const definitelyTypedPackageName = (_results$types = results.types) == null ? void 0 : _results$types.definitelyTyped;
320
-
321
297
  if (definitelyTypedPackageName) {
322
298
  // If a matching `@types/<package name>` has been already installed in devDependencies, bail out
323
299
  if (Object.keys(devDependencies).includes(definitelyTypedPackageName)) {
324
300
  return filteredDependencies;
325
301
  }
326
-
327
302
  filteredDependencies.push([dependency, definitelyTypedPackageName]);
328
303
  }
329
-
330
304
  return filteredDependencies;
331
305
  }, []);
332
-
333
306
  if (dependenciesWithMissingTypes.length > 0) {
334
307
  throw new Error(`Dependencies found without types. Add the missing types with:
335
308
 
@@ -348,35 +321,40 @@ const {
348
321
 
349
322
  const title$7 = 'No unused dependencies';
350
323
  async function noUnusedAndMissingDependencies() {
351
- const ignoredPackagePatterns = [// Unused dependency detected in https://github.com/upleveled/next-portfolio-dev
352
- '@graphql-codegen/cli', // Unused dependency detected in create-react-app
353
- '@testing-library/user-event', // Tailwind CSS
354
- '@tailwindcss/jit', 'autoprefixer', 'postcss', 'tailwindcss', // Sass (eg. in create-react-app)
355
- 'sass', // ESLint configuration
356
- 'babel-eslint', 'eslint-config-next', // TODO: Remove this once depcheck issue is fixed:
324
+ const ignoredPackagePatterns = [
325
+ // Unused dependency detected in https://github.com/upleveled/next-portfolio-dev
326
+ '@graphql-codegen/cli',
327
+ // Unused dependency detected in create-react-app
328
+ '@testing-library/user-event',
329
+ // Tailwind CSS
330
+ '@tailwindcss/jit', 'autoprefixer', 'postcss', 'tailwindcss',
331
+ // Sass (eg. in create-react-app)
332
+ 'sass',
333
+ // ESLint configuration
334
+ 'babel-eslint', 'eslint-config-next',
335
+ // TODO: Remove this once depcheck issue is fixed:
357
336
  // PR: https://github.com/depcheck/depcheck/pull/790
358
337
  // Issue: https://github.com/depcheck/depcheck/issues/791
359
338
  //
360
339
  // Stylelint configuration
361
- 'stylelint', 'stylelint-config-upleveled', // Testing
362
- 'babel-jest', 'cypress', 'jest', 'jest-environment-jsdom', 'jest-puppeteer', 'playwright', 'puppeteer', // TypeScript
363
- 'typescript', '@types/*', // Next.js
340
+ 'stylelint', 'stylelint-config-upleveled',
341
+ // Testing
342
+ 'babel-jest', 'cypress', 'jest', 'jest-environment-jsdom', 'jest-puppeteer', 'playwright', 'puppeteer',
343
+ // TypeScript
344
+ 'typescript', '@types/*',
345
+ // Next.js
364
346
  'sharp'].join(',');
365
-
366
347
  try {
367
348
  await execaCommand(`${preflightBinPath}/depcheck --ignores="${ignoredPackagePatterns}"`);
368
349
  } catch (error) {
369
350
  const {
370
351
  stdout
371
352
  } = error;
372
-
373
353
  if (!stdout.startsWith('Unused dependencies') && !stdout.startsWith('Unused devDependencies') && !stdout.startsWith('Missing dependencies')) {
374
354
  throw error;
375
355
  }
376
-
377
356
  const [unusedDependenciesStdout, missingDependenciesStdout] = stdout.split('Missing dependencies');
378
357
  const messages = [];
379
-
380
358
  if (unusedDependenciesStdout) {
381
359
  messages.push(`Unused dependencies found:
382
360
  ${unusedDependenciesStdout.split('\n').filter(str => str.includes('* ')).join('\n')}
@@ -386,7 +364,6 @@ async function noUnusedAndMissingDependencies() {
386
364
  ${commandExample('pnpm remove <dependency name here>')}
387
365
  `);
388
366
  }
389
-
390
367
  if (missingDependenciesStdout) {
391
368
  /**
392
369
  * Temporary workaround to filter out eslint-config-upleveled peer dependencies
@@ -396,9 +373,8 @@ async function noUnusedAndMissingDependencies() {
396
373
  * https://github.com/depcheck/depcheck/issues/789
397
374
  */
398
375
  const missingDependenciesStdoutFiltered = missingDependenciesStdout.split('\n').filter(missingDependency => {
399
- return !(missingDependency.includes('./.eslintrc.cjs') && ['@next/eslint-plugin-next', '@typescript-eslint/eslint-plugin', '@typescript-eslint/parser', 'eslint-plugin-upleveled', 'eslint-config-react-app', 'eslint-import-resolver-typescript', 'eslint-plugin-import', 'eslint-plugin-jsx-a11y', 'eslint-plugin-jsx-expressions', 'eslint-plugin-react-hooks', 'eslint-plugin-react', 'eslint-plugin-security', 'eslint-plugin-sonarjs', 'eslint-plugin-unicorn'].some(excludedDependency => missingDependency.includes(excludedDependency)));
376
+ return !(missingDependency.includes(`.${sep}.eslintrc.cjs`) && ['@next/eslint-plugin-next', '@typescript-eslint/eslint-plugin', '@typescript-eslint/parser', 'eslint-plugin-upleveled', 'eslint-config-react-app', 'eslint-import-resolver-typescript', 'eslint-plugin-import', 'eslint-plugin-jsx-a11y', 'eslint-plugin-jsx-expressions', 'eslint-plugin-react-hooks', 'eslint-plugin-react', 'eslint-plugin-security', 'eslint-plugin-sonarjs', 'eslint-plugin-unicorn'].some(excludedDependency => missingDependency.includes(excludedDependency)));
400
377
  }).join('\n');
401
-
402
378
  if (missingDependenciesStdoutFiltered) {
403
379
  messages.push(`Missing dependencies found:
404
380
  ${missingDependenciesStdoutFiltered.split('\n').filter(str => str.includes('* ')).join('\n')}
@@ -409,7 +385,6 @@ async function noUnusedAndMissingDependencies() {
409
385
  `);
410
386
  }
411
387
  }
412
-
413
388
  if (messages.length > 0) throw new Error(messages.join('\n\n'));
414
389
  }
415
390
  }
@@ -419,7 +394,6 @@ async function noExtraneousFilesCommittedToGit() {
419
394
  const {
420
395
  stdout
421
396
  } = await execaCommand('git ls-files .DS_Store yarn-error.log npm-debug.log');
422
-
423
397
  if (stdout !== '') {
424
398
  throw new Error(`Extraneous files committed to Git:
425
399
  ${stdout}
@@ -444,7 +418,6 @@ async function noSecretsCommittedToGit() {
444
418
  const {
445
419
  stdout
446
420
  } = await execaCommand('git ls-files .env .env*.local');
447
-
448
421
  if (stdout !== '') {
449
422
  throw new Error(`Secrets committed to Git 😱:
450
423
  ${stdout}
@@ -475,7 +448,6 @@ async function preflightIsLatestVersion() {
475
448
  const {
476
449
  stdout: remoteVersion
477
450
  } = await execaCommand('npm show @upleveled/preflight version');
478
-
479
451
  if (semver.gt(remoteVersion, preflightPackageJson.version)) {
480
452
  throw new Error(`Your current version of Preflight (${preflightPackageJson.version}) is older than the latest version ${remoteVersion} - upgrade with:
481
453
 
@@ -502,22 +474,23 @@ async function prettierCheck() {
502
474
  stderr
503
475
  } = error;
504
476
  const stderrWithoutPackageJsonWarning = stderr.replace(/warning [/.\\]*package\.json: No license field[\r\n]*/g, '');
505
-
506
477
  if (!stdout || stderrWithoutPackageJsonWarning) {
507
478
  throw error;
508
479
  }
509
-
510
- const ignoredFilePatterns = [// File from create-react-app not matching our formatting
480
+ const ignoredFilePatterns = [
481
+ // File from create-react-app not matching our formatting
511
482
  // https://github.com/facebook/create-react-app/blob/fdbde1f3c256b43d5386b5ae3a75083dbd8f0aff/packages/cra-template/template/src/reportWebVitals.js
512
- /src[/\\]reportWebVitals\.js$/, // Files from create-next-app not matching our formatting
483
+ /src[/\\]reportWebVitals\.js$/,
484
+ // Files from create-next-app not matching our formatting
513
485
  // https://github.com/vercel/next.js/blob/5a73859fe8d3659d52e169f97188ae422e0d2ace/packages/create-next-app/templates/default/pages/api/hello.js
514
- /pages[/\\]api[/\\]hello\.js$/, // https://github.com/vercel/next.js/blob/aacfa79ddf88e4e1488b63ac253af27110f0a151/packages/create-next-app/templates/default/pages/_app.js
486
+ /pages[/\\]api[/\\]hello\.js$/,
487
+ // https://github.com/vercel/next.js/blob/aacfa79ddf88e4e1488b63ac253af27110f0a151/packages/create-next-app/templates/default/pages/_app.js
515
488
  /pages[/\\]_app\.js$/];
516
- const unformattedFiles = normalizeNewline(stdout).split('\n').map(file => // Make paths relative to the project instead of Preflight, eg:
489
+ const unformattedFiles = normalizeNewline(stdout).split('\n').map(file =>
490
+ // Make paths relative to the project instead of Preflight, eg:
517
491
  // before: ../../../../../../projects/random-color-generator-react-app/src/reportWebVitals.js
518
492
  // after: random-color-generator-react-app/src/reportWebVitals.js
519
493
  file.replace(/^([A-Z]:|\.\.[/\\])[a-zA-Z0-9-_/.\\ ]*projects[/\\]/, '')).filter(file => !ignoredFilePatterns.some(ignoredFilePattern => ignoredFilePattern.test(file)));
520
-
521
494
  if (unformattedFiles.length > 0) {
522
495
  throw new Error(`Prettier has not been run in the following files:
523
496
  ${unformattedFiles.join('\n')}
@@ -540,7 +513,6 @@ const title$c = 'Project folder name matches correct format';
540
513
  function projectFolderNameMatchesCorrectFormat() {
541
514
  const currentDirectoryName = path.basename(process.cwd());
542
515
  const lowercaseHyphenedDirectoryName = currentDirectoryName.toLowerCase().replaceAll(' ', '-');
543
-
544
516
  if (currentDirectoryName !== lowercaseHyphenedDirectoryName) {
545
517
  throw new Error(`Project directory name "${currentDirectoryName}" doesn't match the correct format (no spaces or uppercase letters).
546
518
 
@@ -564,7 +536,6 @@ async function useSinglePackageManager() {
564
536
  const {
565
537
  stdout
566
538
  } = await execaCommand('git ls-files package-lock.json yarn.lock');
567
-
568
539
  if (stdout !== '') {
569
540
  throw new Error(`package-lock.json or yarn.lock file committed to Git. Remove it with:
570
541
 
@@ -588,11 +559,15 @@ var useSinglePackageManager$1 = {
588
559
  };
589
560
 
590
561
  console.log(`🚀 UpLeveled Preflight v${preflightPackageJson.version}`);
591
- const listrTasks = /*#__PURE__*/[// ======= Sync Tasks =======
562
+ const listrTasks = /*#__PURE__*/[
563
+ // ======= Sync Tasks =======
592
564
  // Git
593
- allChangesCommittedToGit$1, nodeModulesIgnoredFromGit$1, noExtraneousFilesCommittedToGit$1, noSecretsCommittedToGit$1, // Package managers
594
- useSinglePackageManager$1, // Project setup
595
- projectFolderNameMatchesCorrectFormat$1, // ======= Async Tasks =======
565
+ allChangesCommittedToGit$1, nodeModulesIgnoredFromGit$1, noExtraneousFilesCommittedToGit$1, noSecretsCommittedToGit$1,
566
+ // Package managers
567
+ useSinglePackageManager$1,
568
+ // Project setup
569
+ projectFolderNameMatchesCorrectFormat$1,
570
+ // ======= Async Tasks =======
596
571
  // Dependencies
597
572
  {
598
573
  title: 'No dependency problems',
@@ -606,9 +581,12 @@ projectFolderNameMatchesCorrectFormat$1, // ======= Async Tasks =======
606
581
  title: title$6,
607
582
  task: noDependenciesWithoutTypes
608
583
  }])
609
- }, // GitHub
610
- linkOnGithubAbout$1, // Linting
611
- eslint, prettier, // Version and configuration checks
584
+ },
585
+ // GitHub
586
+ linkOnGithubAbout$1,
587
+ // Linting
588
+ eslint, prettier,
589
+ // Version and configuration checks
612
590
  eslintConfigIsValid$1, preflightIsLatestVersion$1].map(module => {
613
591
  if ('task' in module) return module;
614
592
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"preflight.esm.js","sources":["../src/util/commandExample.ts","../src/util/isDrone.ts","../src/checks/allChangesCommittedToGit.ts","../src/util/normalizeNewline.ts","../src/checks/eslint.ts","../src/checks/eslintConfigIsValid.ts","../src/util/randomUserAgent.ts","../src/checks/linkOnGithubAbout.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/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 default 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/isDrone';\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","const CRLF = '\\r\\n';\n\nexport default function normalizeNewline(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 { execaCommand } from 'execa';\nimport normalizeNewline from '../util/normalizeNewline';\n\nexport const title = 'ESLint';\n\nexport default async function eslintCheck() {\n try {\n await execaCommand('pnpm eslint . --max-warnings 0 --format compact');\n } catch (error) {\n const { stdout } = error as { stdout: string };\n const lines = stdout.split('\\n');\n\n // If no ESLint problems detected, throw the error\n if (!/^\\d+ problems?$/.test(lines[lines.length - 2]!)) {\n throw error;\n }\n\n throw new Error(\n `ESLint problems found in the following files:\n ${normalizeNewline(stdout)\n .split('\\n')\n // Match lines starting with slashes (macOS, Linux) or drive letters (Windows)\n .filter((line) => /^(\\/|[A-Z]:\\\\)/.test(line))\n // Strip out the filename\n .map((line) => line.match(/^(([A-Z]:)?[^:]+):/)?.[1])\n // Remove duplicate filenames\n .reduce((linesWithoutDuplicates: string[], line) => {\n if (line && !linesWithoutDuplicates.includes(line)) {\n linesWithoutDuplicates.push(line);\n }\n return linesWithoutDuplicates;\n }, [])\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;\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 (err) {}\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('./.eslintrc.cjs', 'utf-8')).trim() ===\n `/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */\nconst config = {\n extends: ['upleveled'],\n};\n\nmodule.exports = config;`;\n } catch (err) {\n throw new Error(\n `Error reading your .eslintrc.cjs file - please 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 file .eslintrc.cjs does not match the configuration file template - please 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 default 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","import { promises as fs } from 'node:fs';\nimport { execaCommand } from 'execa';\nimport commandExample from '../util/commandExample';\nimport normalizeNewline from '../util/normalizeNewline';\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 = normalizeNewline(\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 { devDependencies = {}, dependencies = {} } = projectPackageJson;\n\n const dependenciesWithMissingTypes = await pReduce(\n Object.keys(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 (err) {}\n\n let indexDTsPath;\n\n try {\n indexDTsPath = require.resolve(`${dependency}/index.d.ts`);\n } catch (err) {}\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 const results = await index.getObject<AlgoliaObj>(dependency, {\n attributesToRetrieve: ['types'],\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 (Object.keys(devDependencies).includes(definitelyTypedPackageName)) {\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\nconst { stdout: preflightBinPath } = await execaCommand(`pnpm bin`, {\n cwd: dirname(fileURLToPath(import.meta.url)),\n});\n\nexport default preflightBinPath;\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 // Unused dependency detected in create-react-app\n '@testing-library/user-event',\n\n // Tailwind CSS\n '@tailwindcss/jit',\n 'autoprefixer',\n 'postcss',\n 'tailwindcss',\n\n // Sass (eg. in create-react-app)\n 'sass',\n\n // ESLint configuration\n 'babel-eslint',\n 'eslint-config-next',\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 'babel-jest',\n 'cypress',\n 'jest',\n 'jest-environment-jsdom',\n 'jest-puppeteer',\n 'playwright',\n 'puppeteer',\n\n // TypeScript\n 'typescript',\n '@types/*',\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 /**\n * Temporary workaround to filter out eslint-config-upleveled peer dependencies\n * not listed in `package.json`, which are flagged as missing dependencies by depcheck\n *\n * TODO: Remove this variable once this depcheck issue is fixed:\n * https://github.com/depcheck/depcheck/issues/789\n */\n const missingDependenciesStdoutFiltered = missingDependenciesStdout\n .split('\\n')\n .filter((missingDependency) => {\n return !(\n missingDependency.includes('./.eslintrc.cjs') &&\n [\n '@next/eslint-plugin-next',\n '@typescript-eslint/eslint-plugin',\n '@typescript-eslint/parser',\n 'eslint-plugin-upleveled',\n 'eslint-config-react-app',\n 'eslint-import-resolver-typescript',\n 'eslint-plugin-import',\n 'eslint-plugin-jsx-a11y',\n 'eslint-plugin-jsx-expressions',\n 'eslint-plugin-react-hooks',\n 'eslint-plugin-react',\n 'eslint-plugin-security',\n 'eslint-plugin-sonarjs',\n 'eslint-plugin-unicorn',\n ].some((excludedDependency) =>\n missingDependency.includes(excludedDependency),\n )\n );\n })\n .join('\\n');\n\n if (missingDependenciesStdoutFiltered) {\n messages.push(`Missing dependencies found:\n ${missingDependenciesStdoutFiltered\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\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 { dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { execaCommand } from 'execa';\nimport normalizeNewline from '../util/normalizeNewline';\n\nexport const title = 'Prettier';\n\nexport default async function prettierCheck() {\n try {\n await execaCommand(\n `../node_modules/.bin/prettier --list-different ${process.cwd()}/**/*.{js,jsx,ts,jsx} --ignore-path ${process.cwd()}/.eslintignore --config ${process.cwd()}/prettier.config.cjs --end-of-line auto`,\n { cwd: dirname(fileURLToPath(import.meta.url)) },\n );\n } catch (error) {\n const { stdout, stderr } = error as { stdout: string; stderr: string };\n\n const stderrWithoutPackageJsonWarning = stderr.replace(\n /warning [/.\\\\]*package\\.json: No license field[\\r\\n]*/g,\n '',\n );\n\n if (!stdout || stderrWithoutPackageJsonWarning) {\n throw error;\n }\n\n const ignoredFilePatterns = [\n // File from create-react-app not matching our formatting\n // https://github.com/facebook/create-react-app/blob/fdbde1f3c256b43d5386b5ae3a75083dbd8f0aff/packages/cra-template/template/src/reportWebVitals.js\n /src[/\\\\]reportWebVitals\\.js$/,\n\n // Files from create-next-app not matching our formatting\n // https://github.com/vercel/next.js/blob/5a73859fe8d3659d52e169f97188ae422e0d2ace/packages/create-next-app/templates/default/pages/api/hello.js\n /pages[/\\\\]api[/\\\\]hello\\.js$/,\n // https://github.com/vercel/next.js/blob/aacfa79ddf88e4e1488b63ac253af27110f0a151/packages/create-next-app/templates/default/pages/_app.js\n /pages[/\\\\]_app\\.js$/,\n ];\n\n const unformattedFiles = normalizeNewline(stdout)\n .split('\\n')\n .map((file) =>\n // Make paths relative to the project instead of Preflight, eg:\n // before: ../../../../../../projects/random-color-generator-react-app/src/reportWebVitals.js\n // after: random-color-generator-react-app/src/reportWebVitals.js\n file.replace(/^([A-Z]:|\\.\\.[/\\\\])[a-zA-Z0-9-_/.\\\\ ]*projects[/\\\\]/, ''),\n )\n .filter(\n (file) =>\n !ignoredFilePatterns.some((ignoredFilePattern) =>\n ignoredFilePattern.test(file),\n ),\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 In some very uncommon cases (this probably doesn't apply to you), the mismatch may come from inconsistent end of line characters. Read more here: https://github.com/upleveled/answers/issues/31\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 { 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 } 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 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\nconsole.log(`🚀 UpLeveled Preflight v${preflightPackageJson.version}`);\n\nconst listrTasks = [\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 ...(!projectPackageJson.dependencies ||\n !Object.keys(projectPackageJson.dependencies).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 prettier,\n\n // Version and configuration checks\n eslintConfigIsValid,\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\nawait new Listr(listrTasks, {\n exitOnError: false,\n rendererOptions: {\n collapseErrors: false,\n removeEmptyLines: false,\n formatOutput: 'wrap',\n },\n fallbackRenderer: 'verbose',\n concurrent: 5,\n}).run();\n"],"names":["emptyBrailleCharacter","commandExample","command","chalk","dim","isDrone","stdout","execaCommand","reject","test","title","allChangesCommittedToGit","replSlug","isRunningInReplIt","fs","writeFile","onlyPnpmLockModifiedOnDrone","trim","Error","CRLF","normalizeNewline","input","TypeError","replace","RegExp","eslintCheck","error","lines","split","length","filter","line","map","match","reduce","linesWithoutDuplicates","includes","push","join","require","createRequire","process","cwd","eslintConfigIsValid","remoteVersion","localVersion","eslintConfigPackageJsonPath","resolve","JSON","parse","readFile","version","err","semver","gt","eslintConfigMatches","eslintDisableOccurrences","path","readdirp","directoryFilter","fileFilter","fileContents","randomUserAgent","randomIndex","Math","floor","random","userAgents","linkOnGithubAbout","repoUrl","html","fetch","text","$","cheerio","load","urlInAboutSection","nextAll","children","next","attr","response","headers","ok","status","statusText","nodeModulesIgnoredFromGit","nodeModulesInGitignore","found","projectPackageJson","preflightPackageJson","URL","import","meta","url","nextJsProjectHasSharpInstalled","dependenciesPackageNames","Object","keys","dependencies","client","algoliasearch","index","initIndex","noDependenciesWithoutTypes","devDependencies","dependenciesWithMissingTypes","pReduce","filteredDependencies","dependency","packageJsonPath","modulePackageJson","indexDTsPath","existsSync","results","getObject","attributesToRetrieve","definitelyTypedPackageName","types","definitelyTyped","preflightBinPath","dirname","fileURLToPath","noUnusedAndMissingDependencies","ignoredPackagePatterns","startsWith","unusedDependenciesStdout","missingDependenciesStdout","messages","str","missingDependenciesStdoutFiltered","missingDependency","some","excludedDependency","noExtraneousFilesCommittedToGit","noSecretsCommittedToGit","preflightIsLatestVersion","os","platform","prettierCheck","stderr","stderrWithoutPackageJsonWarning","ignoredFilePatterns","unformattedFiles","file","ignoredFilePattern","projectFolderNameMatchesCorrectFormat","currentDirectoryName","basename","lowercaseHyphenedDirectoryName","toLowerCase","replaceAll","useSinglePackageManager","console","log","listrTasks","task","ctx","newListr","eslint","prettier","module","default","Listr","exitOnError","rendererOptions","collapseErrors","removeEmptyLines","formatOutput","fallbackRenderer","concurrent","run"],"mappings":";;;;;;;;;;;;;;;;AAGA;;AACA,MAAMA,qBAAqB,GAAG,GAA9B;SAEwBC,eAAeC;AACrC,YAAUF,0BAA0BG,KAAK,CAACC,GAAN,CAAU,GAAV,KAAkBF,SAAtD;AACD;;ACNM,eAAeG,OAAf;AACL,QAAM;AAAEC,IAAAA;AAAF,MAAa,MAAMC,YAAY,CAAC,qBAAD,EAAwB;AAC3DC,IAAAA,MAAM,EAAE;AADmD,GAAxB,CAArC;AAGA,SAAO,eAAeC,IAAf,CAAoBH,MAApB,CAAP;AACD;;ACFM,MAAMI,KAAK,GAAG,8BAAd;AAEP,AAAe,eAAeC,wBAAf;AACb,QAAM;AAAEL,IAAAA,MAAM,EAAEM;AAAV,MAAuB,MAAML,YAAY,CAAC,iBAAD,CAA/C;AAEA,QAAMM,iBAAiB,GAAGD,QAAQ,KAAK,EAAvC;;AAEA,MAAIC,iBAAJ,EAAuB;AACrB,UAAMC,QAAE,CAACC,SAAH,CAAa,mBAAb,EAAkC,WAAlC,CAAN;AACD;;AAED,QAAM;AAAET,IAAAA;AAAF,MAAa,MAAMC,YAAY,CAAC,wBAAD,CAArC;;AAEA,MAAID,MAAM,KAAK,EAAf,EAAmB;AACjB,UAAMU,2BAA2B,GAC/BV,MAAM,CAACW,IAAP,OAAkB,kBAAlB,KAAyC,MAAMZ,OAAO,EAAtD,CADF;AAEA,UAAM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HJ,CADY,EAUZ;AACErF,IAAAA,KAAK,EAAEiH,OADT;AAEEiC,IAAAA,IAAI,EAAEjC;AAFR,GAVY,EAcZ;AACEjH,IAAAA,KAAK,EAAE8F,OADT;AAEEoD,IAAAA,IAAI,EAAEpD;AAFR,GAdY,CAAd;AAHJ,CAhBiB;AAyCjBpC,mBAzCiB;AA4CjB2F,MA5CiB,EA6CjBC,QA7CiB;AAgDjBrH,qBAhDiB,EAiDjB6F,0BAjDiB,EAkDjBxG,GAlDiB,CAkDZiI,MAAD;AACJ,MAAI,UAAUA,MAAd,EAAsB,OAAOA,MAAP;AACtB,SAAO;AACLvJ,IAAAA,KAAK,EAAEuJ,MAAM,CAACvJ,KADT;AAELkJ,IAAAA,IAAI,EAAEK,MAAM,CAACC;AAFR,GAAP;AAID,CAxDkB,CAAnB;AA0DA,MAAM,IAAIC,KAAJ,CAAUR,UAAV,EAAsB;AAC1BS,EAAAA,WAAW,EAAE,KADa;AAE1BC,EAAAA,eAAe,EAAE;AACfC,IAAAA,cAAc,EAAE,KADD;AAEfC,IAAAA,gBAAgB,EAAE,KAFH;AAGfC,IAAAA,YAAY,EAAE;AAHC,GAFS;AAO1BC,EAAAA,gBAAgB,EAAE,SAPQ;AAQ1BC,EAAAA,UAAU,EAAE;AARc,CAAtB,EASHC,GATG,EAAN"}
1
+ {"version":3,"file":"preflight.esm.js","sources":["../src/util/commandExample.ts","../src/util/isDrone.ts","../src/checks/allChangesCommittedToGit.ts","../src/util/normalizeNewline.ts","../src/checks/eslint.ts","../src/checks/eslintConfigIsValid.ts","../src/util/randomUserAgent.ts","../src/checks/linkOnGithubAbout.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/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 default 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/isDrone';\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","const CRLF = '\\r\\n';\n\nexport default function normalizeNewline(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 { execaCommand } from 'execa';\nimport normalizeNewline from '../util/normalizeNewline';\n\nexport const title = 'ESLint';\n\nexport default async function eslintCheck() {\n try {\n await execaCommand('pnpm eslint . --max-warnings 0 --format compact');\n } catch (error) {\n const { stdout } = error as { stdout: string };\n const lines = stdout.split('\\n');\n\n // If no ESLint problems detected, throw the error\n if (!/^\\d+ problems?$/.test(lines[lines.length - 2]!)) {\n throw error;\n }\n\n throw new Error(\n `ESLint problems found in the following files:\n ${normalizeNewline(stdout)\n .split('\\n')\n // Match lines starting with slashes (macOS, Linux) or drive letters (Windows)\n .filter((line) => /^(\\/|[A-Z]:\\\\)/.test(line))\n // Strip out the filename\n .map((line) => line.match(/^(([A-Z]:)?[^:]+):/)?.[1])\n // Remove duplicate filenames\n .reduce((linesWithoutDuplicates: string[], line) => {\n if (line && !linesWithoutDuplicates.includes(line)) {\n linesWithoutDuplicates.push(line);\n }\n return linesWithoutDuplicates;\n }, [])\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;\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 (err) {}\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('./.eslintrc.cjs', 'utf-8')).trim() ===\n `/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */\nconst config = {\n extends: ['upleveled'],\n};\n\nmodule.exports = config;`;\n } catch (err) {\n throw new Error(\n `Error reading your .eslintrc.cjs file - please 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 file .eslintrc.cjs does not match the configuration file template - please 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 default 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","import { promises as fs } from 'node:fs';\nimport { execaCommand } from 'execa';\nimport commandExample from '../util/commandExample';\nimport normalizeNewline from '../util/normalizeNewline';\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 = normalizeNewline(\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 { devDependencies = {}, dependencies = {} } = projectPackageJson;\n\n const dependenciesWithMissingTypes = await pReduce(\n Object.keys(dependencies),\n async (filteredDependencies: [string, string][], dependency: string) => {\n // It is not necessary check algolia for '@upleveled/react-scripts'\n if (dependency === '@upleveled/react-scripts') {\n return filteredDependencies;\n }\n\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 (err) {}\n\n let indexDTsPath;\n\n try {\n indexDTsPath = require.resolve(`${dependency}/index.d.ts`);\n } catch (err) {}\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 const results = await index.getObject<AlgoliaObj>(dependency, {\n attributesToRetrieve: ['types'],\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 (Object.keys(devDependencies).includes(definitelyTypedPackageName)) {\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\nconst { stdout: preflightBinPath } = await execaCommand(`pnpm bin`, {\n cwd: dirname(fileURLToPath(import.meta.url)),\n});\n\nexport default preflightBinPath;\n","import { sep } from 'node:path';\nimport { 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 // Unused dependency detected in create-react-app\n '@testing-library/user-event',\n\n // Tailwind CSS\n '@tailwindcss/jit',\n 'autoprefixer',\n 'postcss',\n 'tailwindcss',\n\n // Sass (eg. in create-react-app)\n 'sass',\n\n // ESLint configuration\n 'babel-eslint',\n 'eslint-config-next',\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 'babel-jest',\n 'cypress',\n 'jest',\n 'jest-environment-jsdom',\n 'jest-puppeteer',\n 'playwright',\n 'puppeteer',\n\n // TypeScript\n 'typescript',\n '@types/*',\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 /**\n * Temporary workaround to filter out eslint-config-upleveled peer dependencies\n * not listed in `package.json`, which are flagged as missing dependencies by depcheck\n *\n * TODO: Remove this variable once this depcheck issue is fixed:\n * https://github.com/depcheck/depcheck/issues/789\n */\n const missingDependenciesStdoutFiltered = missingDependenciesStdout\n .split('\\n')\n .filter((missingDependency) => {\n return !(\n missingDependency.includes(`.${sep}.eslintrc.cjs`) &&\n [\n '@next/eslint-plugin-next',\n '@typescript-eslint/eslint-plugin',\n '@typescript-eslint/parser',\n 'eslint-plugin-upleveled',\n 'eslint-config-react-app',\n 'eslint-import-resolver-typescript',\n 'eslint-plugin-import',\n 'eslint-plugin-jsx-a11y',\n 'eslint-plugin-jsx-expressions',\n 'eslint-plugin-react-hooks',\n 'eslint-plugin-react',\n 'eslint-plugin-security',\n 'eslint-plugin-sonarjs',\n 'eslint-plugin-unicorn',\n ].some((excludedDependency) =>\n missingDependency.includes(excludedDependency),\n )\n );\n })\n .join('\\n');\n\n if (missingDependenciesStdoutFiltered) {\n messages.push(`Missing dependencies found:\n ${missingDependenciesStdoutFiltered\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\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 { dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { execaCommand } from 'execa';\nimport normalizeNewline from '../util/normalizeNewline';\n\nexport const title = 'Prettier';\n\nexport default async function prettierCheck() {\n try {\n await execaCommand(\n `../node_modules/.bin/prettier --list-different ${process.cwd()}/**/*.{js,jsx,ts,jsx} --ignore-path ${process.cwd()}/.eslintignore --config ${process.cwd()}/prettier.config.cjs --end-of-line auto`,\n { cwd: dirname(fileURLToPath(import.meta.url)) },\n );\n } catch (error) {\n const { stdout, stderr } = error as { stdout: string; stderr: string };\n\n const stderrWithoutPackageJsonWarning = stderr.replace(\n /warning [/.\\\\]*package\\.json: No license field[\\r\\n]*/g,\n '',\n );\n\n if (!stdout || stderrWithoutPackageJsonWarning) {\n throw error;\n }\n\n const ignoredFilePatterns = [\n // File from create-react-app not matching our formatting\n // https://github.com/facebook/create-react-app/blob/fdbde1f3c256b43d5386b5ae3a75083dbd8f0aff/packages/cra-template/template/src/reportWebVitals.js\n /src[/\\\\]reportWebVitals\\.js$/,\n\n // Files from create-next-app not matching our formatting\n // https://github.com/vercel/next.js/blob/5a73859fe8d3659d52e169f97188ae422e0d2ace/packages/create-next-app/templates/default/pages/api/hello.js\n /pages[/\\\\]api[/\\\\]hello\\.js$/,\n // https://github.com/vercel/next.js/blob/aacfa79ddf88e4e1488b63ac253af27110f0a151/packages/create-next-app/templates/default/pages/_app.js\n /pages[/\\\\]_app\\.js$/,\n ];\n\n const unformattedFiles = normalizeNewline(stdout)\n .split('\\n')\n .map((file) =>\n // Make paths relative to the project instead of Preflight, eg:\n // before: ../../../../../../projects/random-color-generator-react-app/src/reportWebVitals.js\n // after: random-color-generator-react-app/src/reportWebVitals.js\n file.replace(/^([A-Z]:|\\.\\.[/\\\\])[a-zA-Z0-9-_/.\\\\ ]*projects[/\\\\]/, ''),\n )\n .filter(\n (file) =>\n !ignoredFilePatterns.some((ignoredFilePattern) =>\n ignoredFilePattern.test(file),\n ),\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 In some very uncommon cases (this probably doesn't apply to you), the mismatch may come from inconsistent end of line characters. Read more here: https://github.com/upleveled/answers/issues/31\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 { 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 } 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 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\nconsole.log(`🚀 UpLeveled Preflight v${preflightPackageJson.version}`);\n\nconst listrTasks = [\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 ...(!projectPackageJson.dependencies ||\n !Object.keys(projectPackageJson.dependencies).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 prettier,\n\n // Version and configuration checks\n eslintConfigIsValid,\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\nawait new Listr(listrTasks, {\n exitOnError: false,\n rendererOptions: {\n collapseErrors: false,\n removeEmptyLines: false,\n formatOutput: 'wrap',\n },\n fallbackRenderer: 'verbose',\n concurrent: 5,\n}).run();\n"],"names":["emptyBrailleCharacter","commandExample","command","chalk","dim","isDrone","stdout","execaCommand","reject","test","title","allChangesCommittedToGit","replSlug","isRunningInReplIt","fs","writeFile","onlyPnpmLockModifiedOnDrone","trim","Error","CRLF","normalizeNewline","input","TypeError","replace","RegExp","eslintCheck","error","lines","split","length","filter","line","map","_line$match","match","reduce","linesWithoutDuplicates","includes","push","join","require","createRequire","process","cwd","eslintConfigIsValid","remoteVersion","localVersion","eslintConfigPackageJsonPath","resolve","JSON","parse","readFile","version","err","semver","gt","eslintConfigMatches","eslintDisableOccurrences","path","readdirp","directoryFilter","fileFilter","fileContents","randomUserAgent","randomIndex","Math","floor","random","userAgents","linkOnGithubAbout","repoUrl","html","fetch","text","$","cheerio","load","urlInAboutSection","nextAll","children","next","attr","response","headers","ok","status","statusText","nodeModulesIgnoredFromGit","nodeModulesInGitignore","found","projectPackageJson","preflightPackageJson","URL","import","meta","url","nextJsProjectHasSharpInstalled","dependenciesPackageNames","Object","keys","dependencies","client","algoliasearch","index","initIndex","noDependenciesWithoutTypes","devDependencies","dependenciesWithMissingTypes","pReduce","filteredDependencies","dependency","packageJsonPath","modulePackageJson","indexDTsPath","existsSync","results","getObject","attributesToRetrieve","definitelyTypedPackageName","_results$types","types","definitelyTyped","preflightBinPath","dirname","fileURLToPath","noUnusedAndMissingDependencies","ignoredPackagePatterns","startsWith","unusedDependenciesStdout","missingDependenciesStdout","messages","str","missingDependenciesStdoutFiltered","missingDependency","sep","some","excludedDependency","noExtraneousFilesCommittedToGit","noSecretsCommittedToGit","preflightIsLatestVersion","os","platform","prettierCheck","stderr","stderrWithoutPackageJsonWarning","ignoredFilePatterns","unformattedFiles","file","ignoredFilePattern","projectFolderNameMatchesCorrectFormat","currentDirectoryName","basename","lowercaseHyphenedDirectoryName","toLowerCase","replaceAll","useSinglePackageManager","console","log","listrTasks","task","ctx","newListr","eslint","prettier","module","default","Listr","exitOnError","rendererOptions","collapseErrors","removeEmptyLines","formatOutput","fallbackRenderer","concurrent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+ "version": "2.0.1",
4
4
  "repository": "upleveled/preflight",
5
5
  "license": "MIT",
6
6
  "author": "UpLeveled (https://github.com/upleveled)",
@@ -43,13 +43,13 @@
43
43
  "cheerio": "1.0.0-rc.12",
44
44
  "depcheck": "1.4.3",
45
45
  "execa": "7.1.1",
46
- "listr2": "6.2.0",
46
+ "listr2": "6.3.1",
47
47
  "node-fetch": "3.3.1",
48
48
  "p-reduce": "3.0.0",
49
49
  "patch-package": "6.5.1",
50
50
  "prettier": "2.8.7",
51
51
  "readdirp": "3.6.0",
52
- "semver": "7.4.0",
52
+ "semver": "7.5.0",
53
53
  "top-user-agents": "1.0.52"
54
54
  },
55
55
  "devDependencies": {
@@ -58,18 +58,18 @@
58
58
  "@next/eslint-plugin-next": "13.3.0",
59
59
  "@size-limit/file": "8.2.4",
60
60
  "@types/domhandler": "2.4.2",
61
- "@types/jest": "29.5.0",
62
- "@types/node": "18.15.11",
61
+ "@types/jest": "29.5.1",
62
+ "@types/node": "18.15.12",
63
63
  "@types/p-map": "2.0.0",
64
- "@types/react": "18.0.35",
64
+ "@types/react": "18.0.37",
65
65
  "@types/react-dom": "18.0.11",
66
66
  "@types/semver": "7.3.13",
67
- "@typescript-eslint/eslint-plugin": "5.58.0",
68
- "@typescript-eslint/parser": "5.58.0",
67
+ "@typescript-eslint/eslint-plugin": "5.59.0",
68
+ "@typescript-eslint/parser": "5.59.0",
69
69
  "babel-jest": "29.5.0",
70
70
  "eslint": "8.38.0",
71
71
  "eslint-config-react-app": "7.0.1",
72
- "eslint-config-upleveled": "4.1.0",
72
+ "eslint-config-upleveled": "4.1.3",
73
73
  "eslint-import-resolver-typescript": "3.5.5",
74
74
  "eslint-plugin-cypress": "2.13.2",
75
75
  "eslint-plugin-flowtype": "8.0.3",
@@ -35,6 +35,11 @@ export default async function noDependenciesWithoutTypes() {
35
35
  const dependenciesWithMissingTypes = await pReduce(
36
36
  Object.keys(dependencies),
37
37
  async (filteredDependencies: [string, string][], dependency: string) => {
38
+ // It is not necessary check algolia for '@upleveled/react-scripts'
39
+ if (dependency === '@upleveled/react-scripts') {
40
+ return filteredDependencies;
41
+ }
42
+
38
43
  try {
39
44
  const packageJsonPath = require.resolve(`${dependency}/package.json`);
40
45
 
@@ -1,3 +1,4 @@
1
+ import { sep } from 'node:path';
1
2
  import { execaCommand } from 'execa';
2
3
  import commandExample from '../../util/commandExample';
3
4
  import preflightBinPath from '../../util/preflightBinPath';
@@ -95,7 +96,7 @@ export default async function noUnusedAndMissingDependencies() {
95
96
  .split('\n')
96
97
  .filter((missingDependency) => {
97
98
  return !(
98
- missingDependency.includes('./.eslintrc.cjs') &&
99
+ missingDependency.includes(`.${sep}.eslintrc.cjs`) &&
99
100
  [
100
101
  '@next/eslint-plugin-next',
101
102
  '@typescript-eslint/eslint-plugin',