@tamagui/build 1.0.1-beta.133 → 1.0.1-beta.136
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 +1 -1
- package/tamagui-build.js +19 -25
- package/tsconfig.json +0 -9
package/package.json
CHANGED
package/tamagui-build.js
CHANGED
|
@@ -6,7 +6,8 @@ const esbuild = require('esbuild')
|
|
|
6
6
|
const fg = require('fast-glob')
|
|
7
7
|
const createExternalPlugin = require('./externalNodePlugin')
|
|
8
8
|
const debounce = require('lodash.debounce')
|
|
9
|
-
const { dirname } = require('path')
|
|
9
|
+
const { dirname, join } = require('path')
|
|
10
|
+
const { tmpdir } = require('os')
|
|
10
11
|
|
|
11
12
|
const jsOnly = !!process.env.JS_ONLY
|
|
12
13
|
const skipJS = !!(process.env.SKIP_JS || false)
|
|
@@ -94,20 +95,18 @@ async function buildTsc() {
|
|
|
94
95
|
return
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
function
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
)
|
|
110
|
-
)
|
|
98
|
+
async function buildThenCopy() {
|
|
99
|
+
if (!(await fs.pathExists(`tsconfig.json`))) {
|
|
100
|
+
throw new Error(`No tsconfig.json found`)
|
|
101
|
+
}
|
|
102
|
+
// nest it one extra so permissions of .tsbuildinfo thats written to parent folder arent off
|
|
103
|
+
const targetDir = join(tmpdir(), `tamagui-${Math.random() * 100000000}`.replace('.', ''), 'out')
|
|
104
|
+
await fs.ensureDir(targetDir)
|
|
105
|
+
const cmd = `tsc --baseUrl . --outDir ${targetDir} --rootDir src --declaration --emitDeclarationOnly --declarationMap`
|
|
106
|
+
// console.log('\x1b[2m$', `npx ${cmd}`)
|
|
107
|
+
await exec('npx', cmd.split(' '))
|
|
108
|
+
await fs.remove('types')
|
|
109
|
+
await fs.copy(targetDir, 'types')
|
|
111
110
|
}
|
|
112
111
|
|
|
113
112
|
// NOTE:
|
|
@@ -115,16 +114,11 @@ async function buildTsc() {
|
|
|
115
114
|
// but to build things nicely we need here to reset a few things:
|
|
116
115
|
// baseUrl: ., outDir: types, rootDir: src
|
|
117
116
|
// for best of both worlds
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
console.warn('BUG re-run without declaration first fixes no output bug...')
|
|
124
|
-
await buildNoMap()
|
|
125
|
-
await buildWithMap()
|
|
126
|
-
}
|
|
127
|
-
}
|
|
117
|
+
|
|
118
|
+
// there's a bug with typescript where outputting within the same dir just doesn't output for whatever reason
|
|
119
|
+
// i have a hunch it's some cache thing, because if i give a new outDir it works
|
|
120
|
+
// so fixing by always giving a random tmp outdir, and then copying
|
|
121
|
+
await buildThenCopy()
|
|
128
122
|
}
|
|
129
123
|
|
|
130
124
|
async function buildJs() {
|