Skip to content

Commit cbc0905

Browse files
committed
build(libui): build using typescript (#5266)
(cherry picked from commit 632fa6e)
1 parent 32c84c3 commit cbc0905

11 files changed

+13
-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
# Used by /scripts/stable-versions-store.js
4142
/scripts/stable-versions-store.json

.pnp.cjs

Lines changed: 0 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-14.3 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.17.6",
1110
"@babel/core": "^7.17.8",
1211
"@babel/preset-env": "^7.16.11",
1312
"@babel/preset-react": "^7.16.7",
@@ -64,7 +63,6 @@
6463
"scripts": {
6564
"build:plugin-commands": "node ./scripts/gen-plugin-commands.js > packages/yarnpkg-cli/sources/pluginCommands.ts",
6665
"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 \"$@\"",
67-
"build:compile-inline": "find \"$0\"/sources -name '*.js' && babel \"$0\"/sources --out-dir \"$0\"/sources --extensions .ts,.tsx",
6866
"test:lint": "eslint --max-warnings 0 \"./**/*.@(tsx|ts|js)\"",
6967
"test:unit": "jest",
7068
"typecheck:all": "tsc --noEmit"

packages/yarnpkg-libui/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"version": "2.2.2",
44
"license": "BSD-2-Clause",
55
"sideEffects": false,
6+
"files": [
7+
"sources"
8+
],
69
"peerDependencies": {
710
"ink": "^2.3.0",
811
"react": "^16.8.4"
@@ -21,8 +24,8 @@
2124
"tslib": "^1.13.0"
2225
},
2326
"scripts": {
24-
"postpack": "find sources -name '*.js' -delete",
25-
"prepack": "yarn build:compile-inline \"$(pwd)\""
27+
"postpack": "find sources -name '*.js' -delete -or -name '*.d.ts' -delete",
28+
"prepack": "run build:compile \"$(pwd)\" --inline"
2629
},
2730
"engines": {
2831
"node": ">=12 <14 || 14.2 - 14.9 || >14.10.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)