This repository has been archived by the owner on Jan 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Export toolkit components as wrapped React components (#300)
Description of changes Uses the `fast-react-wrapper` to wrap all toolkit components as React components and then exports them under the following syntax: `import { ComponentName } from '@vscode/webview-ui-toolkit/react';`
- Loading branch information
1 parent
b333e29
commit cc58b83
Showing
13 changed files
with
463 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ node_modules/ | |
|
||
# Production | ||
dist/ | ||
react/ | ||
storybook-static/ | ||
|
||
# Tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ node_modules/ | |
# Production | ||
build/ | ||
dist/ | ||
react/ | ||
storybook-static/ | ||
|
||
# Tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
function createDir(dir) { | ||
if (!fs.existsSync(dir)) { | ||
fs.mkdirSync(dir); | ||
} | ||
} | ||
|
||
function copyDir(source, target) { | ||
let files = []; | ||
const targetFolder = path.join(target, path.basename(source)); | ||
if (!fs.existsSync(targetFolder)) { | ||
fs.mkdirSync(targetFolder); | ||
} | ||
if (fs.lstatSync(source).isDirectory()) { | ||
files = fs.readdirSync(source); | ||
files.forEach(function (file) { | ||
const curSource = path.join(source, file); | ||
if (fs.lstatSync(curSource).isDirectory()) { | ||
copyDir(curSource, targetFolder); | ||
} else { | ||
copyFile(curSource, targetFolder); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
function copyFile(source, target) { | ||
let targetFile = target; | ||
if (fs.existsSync(target)) { | ||
if (fs.lstatSync(target).isDirectory()) { | ||
targetFile = path.join(target, path.basename(source)); | ||
} | ||
} | ||
fs.writeFileSync(targetFile, fs.readFileSync(source)); | ||
} | ||
|
||
const colors = { | ||
reset: '\x1b[0m', | ||
bold: '\x1b[1m', | ||
dim: '\x1b[2m', | ||
red: '\x1b[31m', | ||
green: '\x1b[32m', | ||
cyan: '\x1b[36m', | ||
}; | ||
|
||
function color(opts, text) { | ||
let colorString = ''; | ||
for (const opt of opts) { | ||
colorString += colors[opt]; | ||
} | ||
return `${colorString}${text}${colors.reset}`; | ||
} | ||
|
||
function delDir(path) { | ||
if (fs.existsSync(path) && fs.lstatSync(path).isDirectory()) { | ||
fs.readdirSync(path).forEach(function (file, index) { | ||
const currPath = path + '/' + file; | ||
if (fs.lstatSync(currPath).isDirectory()) { | ||
delDir(currPath); | ||
} else { | ||
fs.unlinkSync(currPath); | ||
} | ||
}); | ||
fs.rmdirSync(path); | ||
} | ||
} | ||
|
||
module.exports = { | ||
createDir, | ||
copyDir, | ||
copyFile, | ||
color, | ||
delDir, | ||
}; |
Oops, something went wrong.