Skip to content

Commit 632fa6e

Browse files
authored
build(libui): build using typescript (#5266)
1 parent 82dd117 commit 632fa6e

11 files changed

+15
-117
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ package.tgz
3434
# Those folders are meant to contain the prepack build artifacts; we don't commit them
3535
/packages/*/lib/*
3636

37-
# Those packages are built inline and the JS files must not be checked-in
37+
# Those packages are built inline and the artifacts must not be checked-in
3838
/packages/yarnpkg-libui/sources/**/*.js
39+
/packages/yarnpkg-libui/sources/**/*.d.ts
3940

4041
# Only contains the Webpack cache
4142
/packages/docusaurus/.yarn

.pnp.cjs

Lines changed: 0 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-14.4 KB
Binary file not shown.
Binary file not shown.
-29 KB
Binary file not shown.
Binary file not shown.

.yarn/versions/002f6fd6.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declined:
2+
- "@yarnpkg/libui"

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
],
88
"devDependencies": {
99
"@arcanis/sherlock": "^2.0.3",
10-
"@babel/cli": "^7.18.10",
1110
"@babel/core": "^7.18.10",
1211
"@babel/preset-env": "^7.18.10",
1312
"@babel/preset-react": "^7.18.6",
@@ -75,7 +74,6 @@
7574
"build:plugin-workspace-tools": "yarn node -r ./scripts/setup-ts-execution ./scripts/create-mock-plugin.ts workspace-tools",
7675
"build:plugin-commands": "node ./scripts/gen-plugin-commands.js > packages/yarnpkg-cli/sources/pluginCommands.ts",
7776
"build:compile": "rm -rf \"$0\"/lib && mkdir -p \"$0\"/lib && rsync -a --include '*.d.ts' --exclude '*.ts' --exclude '*.tsx' \"$0\"/sources/ \"$0\"/lib/ && node scripts/compile \"$@\"",
78-
"build:compile-inline": "find \"$0\"/sources -name '*.js' && babel \"$0\"/sources --out-dir \"$0\"/sources --extensions .ts,.tsx",
7977
"test:lint": "eslint --max-warnings 0 \"./**/*.@(tsx|ts|js)\"",
8078
"test:unit": "jest",
8179
"typecheck:all": "tsc --noEmit"

packages/yarnpkg-libui/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"stableVersion": "2.2.2",
55
"license": "BSD-2-Clause",
66
"sideEffects": false,
7+
"files": [
8+
"sources"
9+
],
710
"peerDependencies": {
811
"ink": "^3.0.8",
912
"react": "^16.8.4"
@@ -22,8 +25,8 @@
2225
"tslib": "^2.4.0"
2326
},
2427
"scripts": {
25-
"postpack": "find sources -name '*.js' -delete",
26-
"prepack": "yarn build:compile-inline \"$(pwd)\""
28+
"postpack": "find sources -name '*.js' -delete -or -name '*.d.ts' -delete",
29+
"prepack": "run build:compile \"$(pwd)\" --inline"
2730
},
2831
"engines": {
2932
"node": ">=14.15.0"

scripts/compile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ const ts = require(`typescript`);
1010
*/
1111
function compile(tsConfigPath, folder, ...opts) {
1212
const emitDeclarationOnly = opts.includes(`--emitDeclarationOnly`);
13+
const inline = opts.includes(`--inline`);
1314

1415
const parsedConfig = ts.parseJsonConfigFileContent({
1516
extends: tsConfigPath,
1617
compilerOptions: {
1718
rootDir: `sources`,
18-
outDir: `lib`,
19+
outDir: inline ? `sources` : `lib`,
1920
emitDeclarationOnly,
2021
},
2122
include: [`sources/**/*.ts`, `sources/**/*.tsx`],

0 commit comments

Comments
 (0)