Skip to content

Commit e8a64bf

Browse files
RubenSandwichim2nguyen
authored andcommitted
Add copyright source headers and GHA check (#159)
* Add copyright source headers * Add check headers GHA * Use a trusted checkout action version * test by pushing up a file with no header * forgot the .js on the file * Remove test file
1 parent 537457f commit e8a64bf

File tree

87 files changed

+463
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+463
-0
lines changed

.copywrite.hcl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
schema_version = 1
2+
3+
project {
4+
license = "BUSL-1.1"
5+
copyright_year = 2024
6+
7+
header_ignore = [
8+
"public/**",
9+
"content/**",
10+
"docs/**",
11+
"__fixtures__/**",
12+
"__mocks__/**",
13+
"**/*.json",
14+
".next/**",
15+
".husky/**",
16+
"next-env.d.ts",
17+
]
18+
}

.github/actions/get-vercel-preview-data/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright (c) HashiCorp, Inc.
2+
# SPDX-License-Identifier: BUSL-1.1
3+
14
name: Get Vercel Preview Data
25
description: Fetches the latest Vercel preview, inspector URL, and created UTC for the specified project's deployment
36
runs:

.github/actions/get-vercel-preview-data/dist/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
/******/ (() => { // webpackBootstrap
27
/******/ var __webpack_modules__ = ({
38

.github/actions/get-vercel-preview-data/src/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import * as core from '@actions/core'
27
import fetch from 'node-fetch'
38

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'Check Copyright Headers'
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.js'
7+
- '**.jsx'
8+
- '**.ts'
9+
- '**.tsx'
10+
- '**.mjs'
11+
push:
12+
branches: ['main']
13+
14+
jobs:
15+
check-headers:
16+
name: 'Check Copyright Headers'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout Repo
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
22+
- name: Install copywrite
23+
uses: hashicorp/setup-copywrite@32638da2d4e81d56a0764aa1547882fc4d209636 # v1.1.3
24+
25+
- name: Validate Header Compliance
26+
run: copywrite headers --plan

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright (c) HashiCorp, Inc.
2+
# SPDX-License-Identifier: BUSL-1.1
3+
14
FROM node:20
25

36
WORKDIR /server

app/api/all-docs-paths/route.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { expect, test, vi, afterEach } from 'vitest'
27
import docsPathsMock from '../../../__fixtures__/docsPathsAllVersionsMock.json'
38
import { GET } from './route'

app/api/all-docs-paths/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { errorResultToString } from '@utils/result'
27
import { getDocsPaths } from '@utils/allDocsPaths'
38
import { PRODUCT_CONFIG } from '@utils/productConfig.mjs'

app/api/assets/[productSlug]/[version]/[...assetPath]/route.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { expect, test, vi } from 'vitest'
27
import { GET } from './route'
38
import { getAssetData } from '@utils/file'

app/api/assets/[productSlug]/[version]/[...assetPath]/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { getAssetData } from '@utils/file'
27
import { getProductVersion } from '@utils/contentVersions'
38
import { errorResultToString } from '@utils/result'

app/api/content-versions/route.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { expect, test, vi, beforeEach, afterEach } from 'vitest'
27
import { GET } from './route'
38

app/api/content-versions/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { findDocVersions } from '../../utils/findDocVersions'
27
import { PRODUCT_CONFIG } from '@utils/productConfig.mjs'
38

app/api/content/[productSlug]/doc/[version]/[...docsPath]/route.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import {
27
expect,
38
describe,

app/api/content/[productSlug]/doc/[version]/[...docsPath]/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { readFile, parseMarkdownFrontMatter } from '@utils/file'
27
import { getProductVersion } from '@utils/contentVersions'
38
import { errorResultToString } from '@utils/result'

app/api/content/[productSlug]/nav-data/[version]/[...section]/route.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import {
27
expect,
38
describe,

app/api/content/[productSlug]/nav-data/[version]/[...section]/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { readFile, parseJson } from '@utils/file'
27
import { getProductVersion } from '@utils/contentVersions'
38
import { errorResultToString } from '@utils/result'

app/api/content/[productSlug]/redirects/route.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { expect, test, vi } from 'vitest'
27
import { GET } from './route'
38

app/api/content/[productSlug]/redirects/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { getProductVersion } from '@utils/contentVersions'
27
import { readFile, parseJsonc } from '@utils/file'
38
import { errorResultToString } from '@utils/result'

app/api/content/[productSlug]/version-metadata/route.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import {
27
expect,
38
describe,

app/api/content/[productSlug]/version-metadata/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { getProductVersionMetadata } from '@utils/contentVersions'
27
import { errorResultToString } from '@utils/result'
38

app/layout.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import React from 'react'
27

38
// eslint-disable-next-line no-restricted-exports

app/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
/** Add your relevant code here for the issue to reproduce */
27
// eslint-disable-next-line no-restricted-exports
38
export default function Home() {

app/utils/allDocsPaths.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { expect, test, vi } from 'vitest'
27
import { getDocsPaths } from './allDocsPaths'
38
import docsPathsMock from '../../__fixtures__/docsPathsAllVersionsMock.json'

app/utils/allDocsPaths.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { Ok, Err, errorResultToString } from '@utils/result'
27
import docsPathsAllVersions from '@api/docsPathsAllVersions.json'
38
import { getProductVersion } from './contentVersions'

app/utils/contentVersions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import versionMetadata from '@api/versionMetadata.json'
27
import { Ok, Err } from '@utils/result'
38

app/utils/file.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import grayMatter from 'gray-matter'
27
import { parse as jsoncParse } from 'jsonc-parser'
38

app/utils/findDocVersions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import docsPathsAllVersions from '@api/docsPathsAllVersions.json'
27

38
/**

app/utils/productConfig.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import semver from 'semver'
27

38
/**

app/utils/result.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
// The result type is used to represent the result of an operation that can fail. It is a common pattern in Rust and other languages. This pattern is useful for handling errors in a more structured way and avoiding exceptions. Because any error state is wrapped in Err and any success state is wrapped in Ok. See "app/utils/file.ts" for an example of how this is used.
27

38
export type Result<T, E = undefined> =

app/utils/utils.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { expect, test, vi, afterEach, beforeEach } from 'vitest'
27
import { vol } from 'memfs'
38
import {

docker-compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright (c) HashiCorp, Inc.
2+
# SPDX-License-Identifier: BUSL-1.1
3+
14
services:
25
dev-portal:
36
image: 'hashicorp/dev-portal:latest'

eslint.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import globals from 'globals'
27
import pluginJs from '@eslint/js'
38
import tseslint from 'typescript-eslint'

next.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
/** @type {import("next").NextConfig} */
27
const nextConfig = {
38
reactStrictMode: true,

scripts/add-version-to-nav-data.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import fs from 'node:fs/promises'
27
import { PRODUCT_CONFIG } from '../app/utils/productConfig.mjs'
38
import semver from 'semver'

scripts/algolia/batch-post-records/batch-post-records-to-algolia.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import fs from 'fs'
27
import algoliasearch from 'algoliasearch'
38

scripts/algolia/batch-post-records/batch-post-records-to-algolia.test.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { describe, it, expect, vi, afterEach } from 'vitest'
27
import { batchPostRecords } from './batch-post-records-to-algolia.mjs'
38
import algoliasearch from 'algoliasearch'

scripts/algolia/batch-post-records/index.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { batchPostRecords } from './batch-post-records-to-algolia.mjs'
27
import path from 'path'
38

scripts/algolia/build-algolia-records.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import path from 'path'
27
import grayMatter from 'gray-matter'
38
import { createAlgoliaRecordObject } from './transform-mdx-to-algolia-record/create-records.mjs'

scripts/algolia/convert-mdx-to-json/index.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import path from 'path'
27
import { readdir } from 'node:fs/promises'
38
import { getLatestVersion } from '../../utils/file-path/latest-version/index.mjs'

scripts/algolia/convert-mdx-to-json/index.test.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { describe, test, expect, vi } from 'vitest'
27
import path from 'path'
38
import { readdir } from 'node:fs/promises'

scripts/algolia/transform-mdx-to-algolia-record/code-list-items/collect-code-list-items.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import remark from 'remark'
27
import visit from 'unist-util-visit'
38
import is from 'unist-util-is'

scripts/algolia/transform-mdx-to-algolia-record/code-list-items/collect-code-list-items.test.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: BUSL-1.1
4+
*/
5+
16
import { describe, test, expect } from 'vitest'
27
import { collectCodeListItems } from './collect-code-list-items.mjs'
38

0 commit comments

Comments
 (0)