Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
deps: target Yarn 3.6.3, Node 18 (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahnu authored Sep 26, 2023
1 parent 1c7079e commit 4646205
Show file tree
Hide file tree
Showing 26 changed files with 3,984 additions and 3,952 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
module.exports = {
root: true,
extends: ['@tophat/eslint-config/base', '@tophat/eslint-config/jest'],
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
rules: {
'prettier/prettier': [
'error',
Expand Down Expand Up @@ -32,5 +36,5 @@ module.exports = {
},
],
},
ignorePatterns: ['**/.*'],
ignorePatterns: ['**/.*', 'bundles'],
}
3 changes: 0 additions & 3 deletions .github/actions/detect-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ runs:
- name: Determine Node Version
run: echo NODE_VERSION=$(cat .nvmrc | tr -d '\n') >> $GITHUB_ENV
shell: bash
- name: Determine Yarn Version
run: echo YARN_VERSION=$(cat .yvmrc | tr -d '\n') >> $GITHUB_ENV
shell: bash
3 changes: 3 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["github>tophat/new-project-kit//.github/renovate"]
}
8 changes: 8 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
- name: Enable Corepack
run: corepack enable
- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}
- name: Run Commit Watch
Expand Down Expand Up @@ -54,6 +56,8 @@ jobs:
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
- name: Enable Corepack
run: corepack enable
- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}
- name: Restore yarn cache
Expand All @@ -68,6 +72,8 @@ jobs:
run: yarn install --immutable
- name: Linting
run: yarn lint:ci
- name: Type Check
run: yarn types
- name: Set GitHub user for tests
run: |
git config --global user.email "[email protected]"
Expand Down Expand Up @@ -95,6 +101,8 @@ jobs:
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
- name: Enable Corepack
run: corepack enable
- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}
- name: Restore yarn cache
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/gallium
lts/hydrogen
9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

Large diffs are not rendered by default.

873 changes: 0 additions & 873 deletions .yarn/releases/yarn-3.5.0.cjs

This file was deleted.

4 changes: 2 additions & 2 deletions .yarn/sdks/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
Expand Down
2 changes: 1 addition & 1 deletion .yarn/sdks/eslint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint",
"version": "8.18.0-sdk",
"version": "8.50.0-sdk",
"main": "./lib/api.js",
"type": "commonjs"
}
10 changes: 5 additions & 5 deletions .yarn/sdks/prettier/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier/index.js
// Setup the environment to be able to require prettier
require(absPnpApiPath).setup();
}
}

// Defer to the real prettier/index.js your application uses
module.exports = absRequire(`prettier/index.js`);
// Defer to the real prettier your application uses
module.exports = absRequire(`prettier`);
2 changes: 1 addition & 1 deletion .yarn/sdks/prettier/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "2.2.1-sdk",
"version": "3.0.3-sdk",
"main": "./index.js",
"type": "commonjs"
}
4 changes: 2 additions & 2 deletions .yarn/sdks/typescript/bin/tsc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
Expand Down
4 changes: 2 additions & 2 deletions .yarn/sdks/typescript/bin/tsserver
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
Expand Down
2 changes: 1 addition & 1 deletion .yarn/sdks/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript",
"version": "4.7.3-sdk",
"version": "5.2.2-sdk",
"main": "./lib/typescript.js",
"type": "commonjs"
}
11 changes: 10 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
---
npmRegistries:
//registry.npmjs.org/:
npmAuthToken: "${NPM_PUBLISH_TOKEN:-invalid}"

yarnPath: .yarn/releases/yarn-3.5.0.cjs
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"

logFilters:
- code: YN0060 # INCOMPATIBLE_PEER_DEPENDENCY
level: error
- code: YN0002 # MISSING_PEER_DEPENDENCY
level: error
2 changes: 0 additions & 2 deletions .yvmrc

This file was deleted.

42 changes: 21 additions & 21 deletions bundles/@yarnpkg/plugin-licenses-audit.js

Large diffs are not rendered by default.

83 changes: 42 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,56 +18,57 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint:ci": "eslint . --format junit --output-file ${ARTIFACT_DIR:-artifacts}/test_results/eslint/eslint.junit.xml",
"types": "tsc -p tsconfig.json --noEmit",
"build": "builder build plugin",
"prepack": "yarn build",
"contrib:add": "all-contributors add",
"contrib:generate": "all-contributors generate",
"contrib:check": "all-contributors check"
},
"devDependencies": {
"@babel/cli": "^7.17.10",
"@babel/core": "^7.18.5",
"@babel/plugin-transform-runtime": "^7.18.5",
"@babel/preset-env": "^7.18.2",
"@babel/preset-typescript": "^7.17.12",
"@commitlint/cli": "^11.0.0",
"@tophat/commitlint-config": "^0.3.7",
"@tophat/conventional-changelog-config": "^0.6.2",
"@tophat/eslint-config": "^3.1.0",
"@tophat/eslint-import-resolver-require": "^0.1.3",
"@types/jest": "^28.1.2",
"@types/node": "^16.0.0",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
"@yarnpkg/builder": "^3.2.2",
"@yarnpkg/cli": "^3.2.1",
"@yarnpkg/core": "^3.2.2",
"@yarnpkg/fslib": "^2.6.2",
"@yarnpkg/libzip": "^2.2.4",
"@babel/cli": "^7.23.0",
"@babel/core": "^7.23.0",
"@babel/plugin-transform-runtime": "^7.22.15",
"@babel/preset-env": "^7.22.20",
"@babel/preset-typescript": "^7.23.0",
"@commitlint/cli": "^17.7.1",
"@tophat/commitlint-config": "^1.0.2",
"@tophat/conventional-changelog-config": "^1.0.1",
"@tophat/eslint-config": "^8.0.1",
"@tophat/eslint-import-resolver-require": "^0.1.5",
"@types/jest": "^29.5.5",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5",
"@typescript-eslint/parser": "^5",
"@yarnpkg/builder": "^3",
"@yarnpkg/cli": "^3",
"@yarnpkg/core": "^3",
"@yarnpkg/fslib": "^2",
"@yarnpkg/libzip": "^2",
"@yarnpkg/plugin-essentials": "^3.2.1",
"@yarnpkg/plugin-git": "^2.6.1",
"@yarnpkg/plugin-npm": "^2.7.1",
"@yarnpkg/plugin-pack": "^3.1.2",
"@yarnpkg/sdks": "^3.0.0-rc.9",
"all-contributors-cli": "^6.20.0",
"babel-jest": "^28.1.1",
"commitizen": "^4.2.4",
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^2.7.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.5.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.30.0",
"@yarnpkg/sdks": "^3.0.0-rc.51",
"all-contributors-cli": "^6.26.1",
"babel-jest": "^29.7.0",
"commitizen": "^4.3.0",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jest": "^27.4.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^6.0.0",
"jest": "^28.1.1",
"jest-junit": "^13.2.0",
"lint-staged": "^11.0.0",
"prettier": "^2.2.1",
"typescript": "4.7.3",
"yaml-validator": "^3.0.1"
"husky": "^8.0.3",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"lint-staged": "^14.0.1",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"yaml-validator": "^5.1.0"
},
"lint-staged": {
"yarn.lock": [
Expand All @@ -82,8 +83,8 @@
]
},
"dependencies": {
"clipanion": "^3.2.0-rc.11",
"junit-report-builder": "^3.0.0"
"clipanion": "^3.2.1",
"junit-report-builder": "^3.0.1"
},
"packageManager": "yarn@3.5.0"
"packageManager": "yarn@3.6.3"
}
13 changes: 9 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@ import { PassThrough } from 'stream'

import {
Cache,
CommandContext,
type CommandContext,
Configuration,
Manifest,
Plugin,
type Plugin,
Project,
StreamReport,
miscUtils,
structUtils,
} from '@yarnpkg/core'
import { npath, ppath } from '@yarnpkg/fslib'
import { Command, Option, Usage } from 'clipanion'
import { Command, Option, type Usage } from 'clipanion'

import { isAllowableLicense, parseLicense } from './parsers'
import { buildJUnitReport, printSummary, writeCsvReport } from './reporter'
import { LicensePredicate, LicenseResults, PackageNamePredicate, Result } from './types'
import {
type LicensePredicate,
type LicenseResults,
type PackageNamePredicate,
type Result,
} from './types'
import { ResultMap, prettifyLocator } from './utils'

class AuditLicensesCommand extends Command<
Expand Down
6 changes: 3 additions & 3 deletions src/parsers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Manifest } from '@yarnpkg/core'
import { FakeFS, PortablePath, npath, ppath } from '@yarnpkg/fslib'
import { type Manifest } from '@yarnpkg/core'
import { type FakeFS, type PortablePath, npath, ppath } from '@yarnpkg/fslib'

import { LicenseCheckResult, LicensePredicate } from './types'
import { type LicenseCheckResult, type LicensePredicate } from './types'

const LICENSE_FILES = ['./LICENSE', './LICENCE']
function coerceToString(field: unknown): string | null {
Expand Down
6 changes: 3 additions & 3 deletions src/reporter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { writeFileSync } from 'fs'
import { Writable } from 'stream'
import { type Writable } from 'stream'

import junitBuilder from 'junit-report-builder'

import { LICENSE_FAILURE_TYPE, LicenseResults, Result } from './types'
import { type LICENSE_FAILURE_TYPE, type LicenseResults, type Result } from './types'
import { printTable } from './utils'

const PRINTABLE_REASON: { [k in LICENSE_FAILURE_TYPE]: string } = {
Expand Down Expand Up @@ -111,7 +111,7 @@ export async function writeCsvReport({

if (outputFile === '-') {
stdout.write(csvData)
} else {
} else if (outputFile) {
writeFileSync(outputFile, csvData, { encoding: 'utf8' })
}
}
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResultMap } from './utils'
import { type ResultMap } from './utils'

export type LICENSE_FAILURE_TYPE = 'missing' | 'incompatible'

Expand Down
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Writable } from 'stream'
import { type Writable } from 'stream'

import { Package, structUtils } from '@yarnpkg/core'
import { type Package, structUtils } from '@yarnpkg/core'

export const prettifyLocator = (pkg: Package): string => {
const name = structUtils.stringifyLocator(pkg)
if (name.indexOf('::') >= 0) {
if (name.includes('::')) {
return name.substring(0, name.indexOf('::'))
}
return name
Expand Down
4 changes: 2 additions & 2 deletions tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs'
import os from 'os'
import path from 'path'

import { PortablePath, npath } from '@yarnpkg/fslib'
import { type PortablePath, npath } from '@yarnpkg/fslib'

const trackedTmpDirs = new Set<string>()

Expand All @@ -26,7 +26,7 @@ export async function setupProject(): Promise<Project> {
const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'licenses-'))
trackedTmpDirs.add(tmpDir)

async function writeFile(filename, data) {
async function writeFile(filename: string, data: unknown) {
const fullpath = path.resolve(tmpDir, filename)
await fs.promises.writeFile(
fullpath,
Expand Down
Loading

0 comments on commit 4646205

Please sign in to comment.