@tamagui/build 1.0.1-beta.138 → 1.0.1-beta.141
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 +32 -12
package/package.json
CHANGED
package/tamagui-build.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
2
3
|
|
|
3
4
|
const exec = require('execa')
|
|
4
5
|
const fs = require('fs-extra')
|
|
@@ -7,7 +8,6 @@ const fg = require('fast-glob')
|
|
|
7
8
|
const createExternalPlugin = require('./externalNodePlugin')
|
|
8
9
|
const debounce = require('lodash.debounce')
|
|
9
10
|
const { dirname, join } = require('path')
|
|
10
|
-
const { tmpdir } = require('os')
|
|
11
11
|
|
|
12
12
|
const jsOnly = !!process.env.JS_ONLY
|
|
13
13
|
const skipJS = !!(process.env.SKIP_JS || false)
|
|
@@ -33,14 +33,18 @@ async function clean() {
|
|
|
33
33
|
fs.remove('types'),
|
|
34
34
|
fs.remove('dist'),
|
|
35
35
|
])
|
|
36
|
-
} catch {
|
|
36
|
+
} catch {
|
|
37
|
+
// ok
|
|
38
|
+
}
|
|
37
39
|
if (shouldCleanBuildOnly) {
|
|
38
40
|
console.log('🔹 cleaned', pkg.name)
|
|
39
41
|
process.exit(0)
|
|
40
42
|
}
|
|
41
43
|
try {
|
|
42
44
|
await Promise.allSettled([fs.remove('node_modules')])
|
|
43
|
-
} catch {
|
|
45
|
+
} catch {
|
|
46
|
+
// ok
|
|
47
|
+
}
|
|
44
48
|
console.log('🔹 cleaned', pkg.name)
|
|
45
49
|
process.exit(0)
|
|
46
50
|
}
|
|
@@ -88,6 +92,19 @@ async function build() {
|
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
|
|
95
|
+
// const targetDir = `.types${Math.floor(Math.random() * 1_000_000)}`
|
|
96
|
+
// const cleanup = () => {
|
|
97
|
+
// try {
|
|
98
|
+
// fs.removeSync(targetDir)
|
|
99
|
+
// } catch {
|
|
100
|
+
// // ok
|
|
101
|
+
// }
|
|
102
|
+
// }
|
|
103
|
+
|
|
104
|
+
// process.once('beforeExit', cleanup)
|
|
105
|
+
// process.once('SIGINT', cleanup)
|
|
106
|
+
// process.once('SIGTERM', cleanup)
|
|
107
|
+
|
|
91
108
|
async function buildTsc() {
|
|
92
109
|
if (jsOnly || shouldSkipTypes) return
|
|
93
110
|
if (shouldSkipInitialTypes) {
|
|
@@ -99,14 +116,17 @@ async function buildTsc() {
|
|
|
99
116
|
if (!(await fs.pathExists(`tsconfig.json`))) {
|
|
100
117
|
throw new Error(`No tsconfig.json found`)
|
|
101
118
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
119
|
+
const targetDir = 'types'
|
|
120
|
+
try {
|
|
121
|
+
// typescripts build cache messes up when doing declarationOnly
|
|
122
|
+
await fs.remove('tsconfig.tsbuildinfo')
|
|
123
|
+
await fs.ensureDir(targetDir)
|
|
124
|
+
const cmd = `tsc --baseUrl . --outDir ${targetDir} --rootDir src --emitDeclarationOnly --declarationMap`
|
|
125
|
+
// console.log('\x1b[2m$', `npx ${cmd}`)
|
|
126
|
+
await exec('npx', cmd.split(' '))
|
|
127
|
+
} finally {
|
|
128
|
+
await fs.remove('tsconfig.tsbuildinfo')
|
|
129
|
+
}
|
|
110
130
|
}
|
|
111
131
|
|
|
112
132
|
// NOTE:
|
|
@@ -171,7 +191,7 @@ async function buildJs() {
|
|
|
171
191
|
outdir: flatOut ? 'dist' : 'dist/jsx',
|
|
172
192
|
entryPoints: files,
|
|
173
193
|
sourcemap: true,
|
|
174
|
-
target: '
|
|
194
|
+
target: 'es2020',
|
|
175
195
|
keepNames: false,
|
|
176
196
|
format: 'esm',
|
|
177
197
|
color: true,
|