Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions colors.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
7 changes: 7 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/// <reference types="next" />
/// <reference types="next/image-types/global" />

Expand Down
7 changes: 7 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"postinstall": "is-ci || husky install .husky",
"check-all": "npm-run-all prettier lint:fix tsc rss",
"rss": "node scripts/generateRss.js",
"deadlinks": "node scripts/deadLinkChecker.js"
"deadlinks": "node scripts/deadLinkChecker.js",
"copyright": "node scripts/copyright.js"
},
"dependencies": {
"@codesandbox/sandpack-react": "2.13.5",
Expand Down
7 changes: 7 additions & 0 deletions plugins/markdownToHtml.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const remark = require('remark');
const externalLinks = require('remark-external-links'); // Add _target and rel to external links
const customHeaders = require('./remark-header-custom-ids'); // Custom header id's for i18n
Expand Down
5 changes: 4 additions & 1 deletion plugins/remark-header-custom-ids.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*!
Expand Down
7 changes: 7 additions & 0 deletions plugins/remark-smartypants.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*!
* Based on 'silvenon/remark-smartypants'
* https://github.com/silvenon/remark-smartypants/pull/80
Expand Down
7 changes: 7 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
5 changes: 4 additions & 1 deletion public/js/jsfiddle-integration-babel.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

// Do not delete or move this file.
Expand Down
5 changes: 4 additions & 1 deletion public/js/jsfiddle-integration.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

// Do not delete or move this file.
Expand Down
84 changes: 84 additions & 0 deletions scripts/copyright.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

const fs = require('fs');
const glob = require('glob');

const META_COPYRIGHT_COMMENT_BLOCK =
`/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/`.trim() + '\n\n';

const files = glob.sync('**/*.{js,ts,tsx,jsx,rs}', {
ignore: [
'**/dist/**',
'**/node_modules/**',
'**/tests/fixtures/**',
'**/__tests__/fixtures/**',
],
});

const updatedFiles = new Map();
let hasErrors = false;
files.forEach((file) => {
try {
const result = processFile(file);
if (result != null) {
updatedFiles.set(file, result);
}
} catch (e) {
console.error(e);
hasErrors = true;
}
});
if (hasErrors) {
console.error('Update failed');
process.exit(1);
} else {
for (const [file, source] of updatedFiles) {
fs.writeFileSync(file, source, 'utf8');
}
console.log('Update complete');
}

function processFile(file) {
if (fs.lstatSync(file).isDirectory()) {
return;
}
let source = fs.readFileSync(file, 'utf8');
let shebang = '';

if (source.startsWith('#!')) {
const newlineIndex = source.indexOf('\n');
if (newlineIndex === -1) {
shebang = `${source}\n`;
source = '';
} else {
shebang = source.slice(0, newlineIndex + 1);
source = source.slice(newlineIndex + 1);
}
}

if (source.indexOf(META_COPYRIGHT_COMMENT_BLOCK) === 0) {
return null;
}
if (/^\/\*\*/.test(source)) {
source = source.replace(/\/\*\*[^\/]+\/\s+/, META_COPYRIGHT_COMMENT_BLOCK);
} else {
source = `${META_COPYRIGHT_COMMENT_BLOCK}${source}`;
}

if (shebang) {
return `${shebang}${source}`;
}
return source;
}
6 changes: 6 additions & 0 deletions scripts/deadLinkChecker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/usr/bin/env node
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const fs = require('fs');
const path = require('path');
Expand Down
7 changes: 7 additions & 0 deletions scripts/generateRss.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
5 changes: 4 additions & 1 deletion scripts/headingIDHelpers/generateHeadingIDs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

// To do: Make this ESM.
Expand Down
6 changes: 5 additions & 1 deletion scripts/headingIDHelpers/validateHeadingIDs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const fs = require('fs');
const walk = require('./walk');

Expand Down
7 changes: 7 additions & 0 deletions scripts/headingIDHelpers/walk.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const fs = require('fs');

module.exports = function walk(dir) {
Expand Down
7 changes: 7 additions & 0 deletions scripts/headingIdLinter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const validateHeaderIds = require('./headingIDHelpers/validateHeadingIDs');
const generateHeadingIds = require('./headingIDHelpers/generateHeadingIDs');

Expand Down
7 changes: 7 additions & 0 deletions src/components/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/components/ButtonLink.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/components/DocsFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/components/ErrorDecoderContext.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

// Error Decoder requires reading pregenerated error message from getStaticProps,
// but MDX component doesn't support props. So we use React Context to populate
// the value without prop-drilling.
Expand Down
7 changes: 7 additions & 0 deletions src/components/ExternalLink.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/components/Icon/IconArrow.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/components/Icon/IconArrowSmall.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/components/Icon/IconBsky.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/components/Icon/IconCanary.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/components/Icon/IconChevron.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/components/Icon/IconClose.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/components/Icon/IconCodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
Expand Down
Loading