scripts/check_license_headers: enforce license on ts/tsx files

Enforcing inclusion of our OSS license at the top of .ts and .tsx
files. Also updates any relevant files in the repo that were
previously missing the license comment. An additional `@license`
comment is added to client/web/src/index.tsx to preserve the
license in generated Javascript.

Updates #10261

Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
This commit is contained in:
Sonia Appasamy 2023-11-28 13:15:19 -05:00 committed by Sonia Appasamy
parent 09b4914916
commit 5f40b8a0bc
26 changed files with 83 additions and 1 deletions

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
let csrfToken: string let csrfToken: string
let synoToken: string | undefined // required for synology API requests let synoToken: string | undefined // required for synology API requests
let unraidCsrfToken: string | undefined // required for unraid POST requests (#8062) let unraidCsrfToken: string | undefined // required for unraid POST requests (#8062)

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import cx from "classnames" import cx from "classnames"
import React from "react" import React from "react"
import Badge from "src/ui/badge" import Badge from "src/ui/badge"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import cx from "classnames" import cx from "classnames"
import React, { useEffect } from "react" import React, { useEffect } from "react"
import { ReactComponent as TailscaleIcon } from "src/assets/icons/tailscale-icon.svg" import { ReactComponent as TailscaleIcon } from "src/assets/icons/tailscale-icon.svg"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import cx from "classnames" import cx from "classnames"
import React, { useCallback, useMemo, useRef, useState } from "react" import React, { useCallback, useMemo, useRef, useState } from "react"
import { ReactComponent as Check } from "src/assets/icons/check.svg" import { ReactComponent as Check } from "src/assets/icons/check.svg"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import cx from "classnames" import cx from "classnames"
import React, { useCallback, useEffect, useState } from "react" import React, { useCallback, useEffect, useState } from "react"
import { ReactComponent as ChevronDown } from "src/assets/icons/chevron-down.svg" import { ReactComponent as ChevronDown } from "src/assets/icons/chevron-down.svg"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import React from "react" import React from "react"
import { VersionInfo } from "src/hooks/self-update" import { VersionInfo } from "src/hooks/self-update"
import { Link } from "wouter" import { Link } from "wouter"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import cx from "classnames" import cx from "classnames"
import React from "react" import React from "react"
import { apiFetch } from "src/api" import { apiFetch } from "src/api"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import cx from "classnames" import cx from "classnames"
import React from "react" import React from "react"
import { ReactComponent as ArrowRight } from "src/assets/icons/arrow-right.svg" import { ReactComponent as ArrowRight } from "src/assets/icons/arrow-right.svg"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import React, { useCallback, useState } from "react" import React, { useCallback, useState } from "react"
import { apiFetch } from "src/api" import { apiFetch } from "src/api"
import { ReactComponent as TailscaleIcon } from "src/assets/icons/tailscale-icon.svg" import { ReactComponent as TailscaleIcon } from "src/assets/icons/tailscale-icon.svg"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import React from "react" import React from "react"
import { PrefsUpdate } from "src/hooks/node-data" import { PrefsUpdate } from "src/hooks/node-data"
import Toggle from "src/ui/toggle" import Toggle from "src/ui/toggle"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import React from "react" import React from "react"
import { ReactComponent as CheckCircleIcon } from "src/assets/icons/check-circle.svg" import { ReactComponent as CheckCircleIcon } from "src/assets/icons/check-circle.svg"
import { ReactComponent as XCircleIcon } from "src/assets/icons/x-circle.svg" import { ReactComponent as XCircleIcon } from "src/assets/icons/x-circle.svg"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import { useCallback, useEffect, useState } from "react" import { useCallback, useEffect, useState } from "react"
import { apiFetch, setSynoToken } from "src/api" import { apiFetch, setSynoToken } from "src/api"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import { useEffect, useMemo, useState } from "react" import { useEffect, useMemo, useState } from "react"
import { apiFetch } from "src/api" import { apiFetch } from "src/api"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import { useCallback, useEffect, useState } from "react" import { useCallback, useEffect, useState } from "react"
import { apiFetch, setUnraidCsrfToken } from "src/api" import { apiFetch, setUnraidCsrfToken } from "src/api"
import { ExitNode } from "src/hooks/exit-nodes" import { ExitNode } from "src/hooks/exit-nodes"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import { useCallback, useEffect, useState } from "react" import { useCallback, useEffect, useState } from "react"
import { apiFetch } from "src/api" import { apiFetch } from "src/api"

View File

@ -1,3 +1,13 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
// Preserved js license comment for web client app.
/**
* @license
* Copyright (c) Tailscale Inc & AUTHORS
* SPDX-License-Identifier: BSD-3-Clause
*/
import React from "react" import React from "react"
import { createRoot } from "react-dom/client" import { createRoot } from "react-dom/client"
import App from "src/components/app" import App from "src/components/app"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import cx from "classnames" import cx from "classnames"
import React, { HTMLAttributes } from "react" import React, { HTMLAttributes } from "react"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import * as Primitive from "@radix-ui/react-collapsible" import * as Primitive from "@radix-ui/react-collapsible"
import React, { useState } from "react" import React, { useState } from "react"
import { ReactComponent as ChevronDown } from "src/assets/icons/chevron-down.svg" import { ReactComponent as ChevronDown } from "src/assets/icons/chevron-down.svg"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import cx from "classnames" import cx from "classnames"
import React, { InputHTMLAttributes } from "react" import React, { InputHTMLAttributes } from "react"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import * as PopoverPrimitive from "@radix-ui/react-popover" import * as PopoverPrimitive from "@radix-ui/react-popover"
import cx from "classnames" import cx from "classnames"
import React, { ReactNode } from "react" import React, { ReactNode } from "react"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import cx from "classnames" import cx from "classnames"
import React from "react" import React from "react"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import cx from "classnames" import cx from "classnames"
import React, { forwardRef, InputHTMLAttributes } from "react" import React, { forwardRef, InputHTMLAttributes } from "react"
import { ReactComponent as Search } from "src/assets/icons/search.svg" import { ReactComponent as Search } from "src/assets/icons/search.svg"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import cx from "classnames" import cx from "classnames"
import React, { HTMLAttributes } from "react" import React, { HTMLAttributes } from "react"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import cx from "classnames" import cx from "classnames"
import React, { ChangeEvent } from "react" import React, { ChangeEvent } from "react"

View File

@ -1,3 +1,6 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
import { Terminal, ITerminalOptions } from "xterm" import { Terminal, ITerminalOptions } from "xterm"
import { FitAddon } from "xterm-addon-fit" import { FitAddon } from "xterm-addon-fit"
import { WebLinksAddon } from "xterm-addon-web-links" import { WebLinksAddon } from "xterm-addon-web-links"

View File

@ -26,7 +26,7 @@ if [ $# != 1 ]; then
fi fi
fail=0 fail=0
for file in $(find $1 -name '*.go' -not -path '*/.git/*'); do for file in $(find $1 \( -name '*.go' -or -name '*.tsx' -or -name '*.ts' -not -name '*.config.ts' \) -not -path '*/.git/*' -not -path '*/node_modules/*'); do
case $file in case $file in
$1/tempfork/*) $1/tempfork/*)
# Skip, tempfork of third-party code # Skip, tempfork of third-party code