@tamagui/build 1.0.0-alpha.12 → 1.0.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -4
- package/tamagui-build.js +31 -12
- package/tsconfig.json +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/build",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.17",
|
|
4
4
|
"bin": {
|
|
5
5
|
"tamagui-build": "tamagui-build.js"
|
|
6
6
|
},
|
|
@@ -12,13 +12,15 @@
|
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
+
"@types/fs-extra": "^9.0.13",
|
|
15
16
|
"chokidar": "^3.5.2",
|
|
16
17
|
"chokidar-cli": "^2.1.0",
|
|
17
|
-
"esbuild": "^0.13.
|
|
18
|
+
"esbuild": "^0.13.12",
|
|
18
19
|
"execa": "^5.0.0",
|
|
19
20
|
"fast-glob": "^3.2.7",
|
|
20
21
|
"fs-extra": "^9.1.0",
|
|
21
|
-
"
|
|
22
|
+
"json5": "^2.2.0",
|
|
23
|
+
"typescript": "^4.4.4"
|
|
22
24
|
},
|
|
23
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "af7a3c3e6d1da0e4a6f8636915fed3117448dffb"
|
|
24
26
|
}
|
package/tamagui-build.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const exec = require('execa')
|
|
4
4
|
const fs = require('fs-extra')
|
|
5
|
+
const json5 = require('json5')
|
|
5
6
|
const esbuild = require('esbuild')
|
|
6
7
|
const fg = require('fast-glob')
|
|
7
8
|
const createExternalPlugin = require('./externalNodePlugin')
|
|
@@ -35,18 +36,36 @@ async function build() {
|
|
|
35
36
|
// baseUrl: ., outDir: types, rootDir: src
|
|
36
37
|
// now we can have the best of both worlds
|
|
37
38
|
await fs.remove('types')
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
'
|
|
49
|
-
|
|
39
|
+
|
|
40
|
+
// NOTE: to get intellisense to *not* suggest importing from the index file when it re-exports another package...
|
|
41
|
+
// (like tamagui does with @tamagui/core...)
|
|
42
|
+
// we add `exclude: ['src/index.ts']` to the tsconfig.json which fixes that
|
|
43
|
+
// but then it causes it to not export the types out from index... so....
|
|
44
|
+
// we do a stupid, stupid thing to re-write it temporarily without it before build. then restore it after
|
|
45
|
+
// honestly hate typescript config all around but this seems to work so fuck it
|
|
46
|
+
const tsConfOg = await fs.readFile('tsconfig.json')
|
|
47
|
+
const tsConfJSON = json5.parse(tsConfOg)
|
|
48
|
+
if (tsConfJSON.exclude && tsConfJSON.exclude.includes('src/index.ts')) {
|
|
49
|
+
tsConfJSON.exclude = tsConfJSON.exclude.filter((x) => x !== 'src/index.ts')
|
|
50
|
+
await fs.writeJSON('tsconfig.json', tsConfJSON)
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
await exec('npx', [
|
|
54
|
+
'tsc',
|
|
55
|
+
'--baseUrl',
|
|
56
|
+
'.',
|
|
57
|
+
'--outDir',
|
|
58
|
+
'types',
|
|
59
|
+
'--rootDir',
|
|
60
|
+
'src',
|
|
61
|
+
'--declaration',
|
|
62
|
+
'--emitDeclarationOnly',
|
|
63
|
+
'--declarationMap',
|
|
64
|
+
])
|
|
65
|
+
} finally {
|
|
66
|
+
// restore
|
|
67
|
+
await fs.writeFile('tsconfig.json', tsConfOg)
|
|
68
|
+
}
|
|
50
69
|
}
|
|
51
70
|
|
|
52
71
|
const externalPlugin = createExternalPlugin({
|