refactor: remove copyright comment from swizzled components (#7017)

* refactor: remove copyright comment from swizzled components

* Update packages/docusaurus/src/commands/swizzle/actions.ts

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
Alexey Pyltsyn 2022-03-26 12:51:54 +03:00 committed by GitHub
parent 3683f25637
commit 45b7a1b7c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 2 deletions

View file

@ -1,3 +1,11 @@
.testClass {
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.testClass {
background: black;
}

View file

@ -1,3 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
export default function ComponentInFolder() {

View file

@ -1,3 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.testClass {
background: black;
}

View file

@ -1,3 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
export default function FirstLevelComponent() {

View file

@ -81,7 +81,11 @@ export async function eject({
const fileName = path.basename(sourceFile);
const targetFile = path.join(toPath, fileName);
try {
await fs.copy(sourceFile, targetFile, {overwrite: true});
const fileContents = await fs.readFile(sourceFile, 'utf-8');
await fs.outputFile(
targetFile,
fileContents.trimStart().replace(/^\/\*.+?\*\/\s*/ms, ''),
);
} catch (err) {
throw new Error(
logger.interpolate`Could not copy file from ${sourceFile} to ${targetFile}`,