@tamagui/build 1.0.0-alpha.22 → 1.0.0-alpha.31
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/.ultra.cache.json +1 -1
- package/package.json +2 -2
- package/tamagui-build.js +25 -69
package/.ultra.cache.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"files":{"node_modules":"1637314740088.0405","externalNodePlugin.js":"fa1cd57f4fb8bc9a8c7ea03adaabc309b322ae0b","package.json":"
|
|
1
|
+
{"files":{"node_modules":"1637314740088.0405","externalNodePlugin.js":"fa1cd57f4fb8bc9a8c7ea03adaabc309b322ae0b","package.json":"1a540bebd6c1b0404e01511a8af29cd532436279","tamagui-build.js":"06b3a361913d9bd875ce4eeb7f3cdad6b443ece3.1638416111368.626","tsconfig.json":"9862a02e4684884dd8a070c3b58132d338d0ca79"},"deps":{}}
|
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.31",
|
|
4
4
|
"bin": {
|
|
5
5
|
"tamagui-build": "tamagui-build.js"
|
|
6
6
|
},
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/fs-extra": "^9.0.13"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "3593d13742ae284776db7fbe0486d622312c7c15"
|
|
27
27
|
}
|
package/tamagui-build.js
CHANGED
|
@@ -8,12 +8,14 @@ const fg = require('fast-glob')
|
|
|
8
8
|
const createExternalPlugin = require('./externalNodePlugin')
|
|
9
9
|
const path = require('path')
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const jsOnly = !!process.env.JS_ONLY
|
|
12
|
+
const skipJS = !!(process.env.SKIP_JS || false)
|
|
13
|
+
const shouldSkipTypes = !!(process.argv.includes('skip-types') || process.env.SKIP_TYPES)
|
|
13
14
|
const shouldWatch = process.argv.includes('--watch')
|
|
14
15
|
|
|
16
|
+
let shouldSkipInitialTypes = !!process.env.SKIP_TYPES_INITIAL
|
|
17
|
+
|
|
15
18
|
const pkg = fs.readJSONSync('./package.json')
|
|
16
|
-
const pkgSource = pkg.source || 'src/index.ts'
|
|
17
19
|
const pkgMain = pkg.main
|
|
18
20
|
const pkgModule = pkg.module
|
|
19
21
|
|
|
@@ -29,7 +31,12 @@ async function build() {
|
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
async function buildTsc() {
|
|
32
|
-
if (
|
|
34
|
+
if (jsOnly || shouldSkipTypes) return
|
|
35
|
+
if (shouldSkipInitialTypes) {
|
|
36
|
+
shouldSkipInitialTypes = false
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
// NOTE:
|
|
34
41
|
// for Intellisense to work in monorepo you need baseUrl: "../.."
|
|
35
42
|
// but to build things nicely we need here to reset a few things:
|
|
@@ -148,72 +155,21 @@ if (shouldWatch) {
|
|
|
148
155
|
const path = require('path')
|
|
149
156
|
process.env.IS_WATCHING = true
|
|
150
157
|
process.env.DISABLE_AUTORUN = true
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
...new Set([...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.devDependencies || {})]),
|
|
155
|
-
]
|
|
156
|
-
.filter(Boolean)
|
|
157
|
-
.filter((x) => x.includes(`tamagui`))
|
|
158
|
-
|
|
159
|
-
const watchDirs = [
|
|
160
|
-
'src',
|
|
161
|
-
...deps.flatMap((d) => {
|
|
162
|
-
try {
|
|
163
|
-
return path.dirname(require.resolve(d))
|
|
164
|
-
} catch {
|
|
165
|
-
const potentialDir = path.join('..', d.replace('@tamagui/', '') + '/dist')
|
|
166
|
-
if (fs.existsSync(potentialDir)) {
|
|
167
|
-
return potentialDir
|
|
168
|
-
}
|
|
169
|
-
return []
|
|
170
|
-
}
|
|
171
|
-
}),
|
|
172
|
-
]
|
|
173
|
-
|
|
174
|
-
for (const dir of watchDirs) {
|
|
175
|
-
if (dir === 'src') {
|
|
176
|
-
build().then(() => doWatch())
|
|
177
|
-
} else {
|
|
178
|
-
doWatch()
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const watchSize = {}
|
|
182
|
-
function doWatch() {
|
|
183
|
-
const finish = (event, path, stats) => {
|
|
184
|
-
if (dir === 'src' || (stats && stats.size != watchSize[path])) {
|
|
185
|
-
if (stats) watchSize[path] = stats.size
|
|
186
|
-
console.log('watch build', dir)
|
|
187
|
-
build()
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const chokidar = require('chokidar')
|
|
192
|
-
chokidar
|
|
193
|
-
// prevent infinite loop but cause race condition if you just build directly
|
|
194
|
-
.watch(dir, {
|
|
195
|
-
persistent: true,
|
|
196
|
-
alwaysStat: true,
|
|
197
|
-
ignoreInitial: true,
|
|
198
|
-
})
|
|
199
|
-
.on('change', finish)
|
|
200
|
-
.on('add', finish)
|
|
158
|
+
build().then(() => {
|
|
159
|
+
const finish = (_, path, stats) => {
|
|
160
|
+
build()
|
|
201
161
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
162
|
+
const chokidar = require('chokidar')
|
|
163
|
+
chokidar
|
|
164
|
+
// prevent infinite loop but cause race condition if you just build directly
|
|
165
|
+
.watch('src', {
|
|
166
|
+
persistent: true,
|
|
167
|
+
alwaysStat: true,
|
|
168
|
+
ignoreInitial: true,
|
|
169
|
+
})
|
|
170
|
+
.on('change', finish)
|
|
171
|
+
.on('add', finish)
|
|
172
|
+
})
|
|
207
173
|
} else {
|
|
208
|
-
process.on('uncaughtException', console.log.bind(console))
|
|
209
|
-
process.on('unhandledRejection', console.log.bind(console))
|
|
210
174
|
build()
|
|
211
175
|
}
|
|
212
|
-
|
|
213
|
-
function debounce(callback, wait) {
|
|
214
|
-
let timer
|
|
215
|
-
return (...args) => {
|
|
216
|
-
clearTimeout(timer)
|
|
217
|
-
timer = setTimeout(() => callback(...args), wait)
|
|
218
|
-
}
|
|
219
|
-
}
|