Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

feat: expose wrapped (Fast) React components #300

Merged
merged 34 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
35a57ec
feat: add basic fast-react scaffolding
Nov 17, 2021
8af60b1
feat: use refs for storybook composition
Nov 17, 2021
6d62e2e
feat: add script to build react library
Nov 17, 2021
3571f9e
feat: change build strategy
Nov 18, 2021
a84e8f9
revert storybook modifications
Nov 19, 2021
b0cf95a
export remaining wrapped components
Nov 19, 2021
733a792
exclude react components from default tsconfig
Nov 19, 2021
4c019e2
fix: make React a peer dep
Dec 6, 2021
33044a4
fix: use provided design system API
Dec 6, 2021
6a7ce7c
fix: lint
Dec 6, 2021
bc4a8cf
fix: rename react tsconfig
Dec 6, 2021
f225fd6
fix: move script to dedicated dir
Dec 6, 2021
6b201e4
fix: remove unused script
Dec 6, 2021
42c4ecb
feat: add comments
Dec 7, 2021
b238013
bump FAST dependencies to latest
Jan 3, 2022
89ffc27
fix: manually register certain events
Jan 12, 2022
8c46506
feat: manually specify names
Jan 21, 2022
c85751d
feat: wrap copy script in try/catch
Jan 24, 2022
5e284e3
fix: add separate try/catch blocks
Jan 24, 2022
7ce6c9f
fix: alphabetize imports
Jan 24, 2022
320beca
fix: explicit import path
Jan 24, 2022
8ff23a3
fix: lint
Jan 24, 2022
fff41a6
wip: change up build strategy, modify React tsconfig
Jan 24, 2022
d0775e9
Add tsconfig.eslint.json to npm ignore file
hawkticehurst Jan 24, 2022
4a07d1d
Add prettier override for all JS files in the scripts directory
hawkticehurst Jan 24, 2022
eb16e13
Delete tsconfig.react.json
hawkticehurst Jan 25, 2022
99cfb32
Update outDir and declarationDir, as well as make it responsible for …
hawkticehurst Jan 25, 2022
916c0cf
Update api extractor config to reflect new TS declarationDir path
hawkticehurst Jan 25, 2022
2e39d49
Update various ignore config files to include the react build directory
hawkticehurst Jan 25, 2022
089d756
Update package.json build scripts, main field, and types field
hawkticehurst Jan 25, 2022
a25eb30
Create a file containing utility functions that are used across toolk…
hawkticehurst Jan 25, 2022
df516f9
Update setup webview test env script to use helper functions and copy…
hawkticehurst Jan 25, 2022
0f7fd87
Replace copy-pkg-json script with move-react-build-dir script
hawkticehurst Jan 25, 2022
444ef7e
Update developer note and fix formatting error in move-react-build-di…
hawkticehurst Jan 25, 2022
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ node_modules
dist
# don't lint build folder output
build
react
# don't lint coverage output
coverage
# don't lint storybook files
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules/

# Production
dist/
react/
storybook-static/

# Tests
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ storybook-static/
babel.config.js
tsconfig.json
tsconfig.build.json
tsconfig.eslint.json
webpack.config.js
rollup.config.js
policheck
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ node_modules/
# Production
build/
dist/
react/
storybook-static/

# Tests
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}
},
{
"files": "scripts/setup-webview-test-env.js",
"files": "scripts/*.js",
"options": {
"printWidth": 200
}
Expand Down
2 changes: 1 addition & 1 deletion api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "dist/dts/index.d.ts",
"mainEntryPointFilePath": "dist/index.d.ts",
"apiReport": {
"enabled": true,
"reportFolder": "docs",
Expand Down
79 changes: 46 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"type": "git",
"url": "git+https://github.com/microsoft/vscode-webview-ui-toolkit.git"
},
"main": "dist/esm/index.js",
"types": "dist/dts/index.d.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"sideEffects": false,
"scripts": {
"start": "start-storybook -p 6006",
"build": "rollup -c && tsc -p ./tsconfig.json && npm run doc",
"build": "rollup -c && tsc -p ./tsconfig.json && npm run doc && node ./scripts/move-react-build-dir.js",
"build:docs": "build-storybook",
"deploy:docs": "npm run build:docs && gh-pages -d storybook-static",
"doc": "api-extractor run --local",
Expand All @@ -30,8 +30,12 @@
"test:webview": "npm run build && node ./scripts/setup-webview-test-env.js"
},
"dependencies": {
"@microsoft/fast-element": "^1.6.0",
"@microsoft/fast-foundation": "^2.30.0"
"@microsoft/fast-element": "^1.6.2",
"@microsoft/fast-foundation": "^2.30.0",
"@microsoft/fast-react-wrapper": "^0.1.18"
},
"peerDependencies": {
"react": ">=16.9.0"
},
"devDependencies": {
"@babel/core": "^7.14.3",
Expand Down
76 changes: 76 additions & 0 deletions scripts/helpers.js
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,
};
Loading