@tamagui/build 1.0.0-alpha.64 → 1.0.0-beta.149
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/.turbo/turbo-build.log +1 -1
- package/package.json +3 -3
- package/tamagui-build.js +165 -147
- package/tsconfig.json +2 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[
|
|
1
|
+
[33m@tamagui/build:build: [0mcache hit, replaying output [2m2c474553072de320[0m
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/build",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta.149+a95e53bb",
|
|
4
4
|
"bin": {
|
|
5
5
|
"tamagui-build": "tamagui-build.js"
|
|
6
6
|
},
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"chokidar": "^3.5.2",
|
|
16
|
-
"esbuild": "^0.
|
|
16
|
+
"esbuild": "^0.14.36",
|
|
17
17
|
"execa": "^5.0.0",
|
|
18
18
|
"fast-glob": "^3.2.7",
|
|
19
19
|
"fs-extra": "^9.1.0",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/fs-extra": "^9.0.13"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "a95e53bb6c4678962ef84a59bf5bac74e7f4f32f"
|
|
27
27
|
}
|
package/tamagui-build.js
CHANGED
|
@@ -6,172 +6,190 @@ const json5 = require('json5')
|
|
|
6
6
|
const esbuild = require('esbuild')
|
|
7
7
|
const fg = require('fast-glob')
|
|
8
8
|
const createExternalPlugin = require('./externalNodePlugin')
|
|
9
|
-
const path = require('path')
|
|
10
9
|
|
|
11
10
|
const jsOnly = !!process.env.JS_ONLY
|
|
12
11
|
const skipJS = !!(process.env.SKIP_JS || false)
|
|
13
12
|
const shouldSkipTypes = !!(process.argv.includes('skip-types') || process.env.SKIP_TYPES)
|
|
13
|
+
const shouldClean = !!process.argv.includes('clean')
|
|
14
|
+
const shouldCleanBuildOnly = !!process.argv.includes('clean:build')
|
|
14
15
|
const shouldWatch = process.argv.includes('--watch')
|
|
15
16
|
|
|
16
|
-
let shouldSkipInitialTypes = !!process.env.SKIP_TYPES_INITIAL
|
|
17
|
-
|
|
18
17
|
const pkg = fs.readJSONSync('./package.json')
|
|
19
|
-
const pkgMain = pkg.main
|
|
20
|
-
const pkgModule = pkg.module
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
if (shouldClean || shouldCleanBuildOnly) {
|
|
20
|
+
;(async () => {
|
|
21
|
+
try {
|
|
22
|
+
await Promise.allSettled([fs.remove('.turbo'), fs.remove('types'), fs.remove('dist')])
|
|
23
|
+
} catch {}
|
|
24
|
+
if (shouldCleanBuildOnly) {
|
|
25
|
+
console.log('» cleaned', pkg.name)
|
|
26
|
+
process.exit(0)
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
await Promise.allSettled([fs.remove('node_modules')])
|
|
30
|
+
} catch {}
|
|
31
|
+
console.log('» cleaned', pkg.name)
|
|
32
|
+
process.exit(0)
|
|
33
|
+
})()
|
|
34
|
+
} else {
|
|
35
|
+
let shouldSkipInitialTypes = !!process.env.SKIP_TYPES_INITIAL
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} else {
|
|
32
|
-
fs.existsSync('tsconfig.tsbuildinfo') && fs.rmSync('tsconfig.tsbuildinfo')
|
|
33
|
-
}
|
|
37
|
+
const pkgMain = pkg.main
|
|
38
|
+
const pkgModule = pkg.module
|
|
34
39
|
|
|
35
|
-
async function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
async function build() {
|
|
41
|
+
console.log('»', pkg.name)
|
|
42
|
+
const x = Date.now()
|
|
43
|
+
let files = (await fg(['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.css'])).filter(
|
|
44
|
+
(x) => !x.includes('.d.ts')
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
if (process.env.NO_CLEAN) {
|
|
48
|
+
console.log('skip typecheck')
|
|
49
|
+
} else {
|
|
50
|
+
fs.existsSync('tsconfig.tsbuildinfo') && fs.rmSync('tsconfig.tsbuildinfo')
|
|
40
51
|
}
|
|
41
52
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
async function buildTsc() {
|
|
54
|
+
if (jsOnly || shouldSkipTypes) return
|
|
55
|
+
if (shouldSkipInitialTypes) {
|
|
56
|
+
shouldSkipInitialTypes = false
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// NOTE:
|
|
61
|
+
// for Intellisense to work in monorepo you need baseUrl: "../.."
|
|
62
|
+
// but to build things nicely we need here to reset a few things:
|
|
63
|
+
// baseUrl: ., outDir: types, rootDir: src
|
|
64
|
+
// now we can have the best of both worlds
|
|
48
65
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
// NOTE: to get intellisense to *not* suggest importing from the index file when it re-exports another package...
|
|
67
|
+
// (like tamagui does with @tamagui/core...)
|
|
68
|
+
// we add `exclude: ['src/index.ts']` to the tsconfig.json which fixes that
|
|
69
|
+
// but then it causes it to not export the types out from index... so....
|
|
70
|
+
// we do a stupid, stupid thing to re-write it temporarily without it before build. then restore it after
|
|
71
|
+
// honestly hate typescript config all around but this seems to work so fuck it
|
|
72
|
+
const tsConfOg = await fs.readFile('tsconfig.json')
|
|
73
|
+
const tsConfJSON = json5.parse(tsConfOg)
|
|
74
|
+
if (tsConfJSON.exclude && tsConfJSON.exclude.includes('src/index.ts')) {
|
|
75
|
+
tsConfJSON.exclude = tsConfJSON.exclude.filter((x) => x !== 'src/index.ts')
|
|
76
|
+
await fs.writeJSON('tsconfig.json', tsConfJSON)
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
await exec('npx', [
|
|
80
|
+
'tsc',
|
|
81
|
+
'--baseUrl',
|
|
82
|
+
'.',
|
|
83
|
+
'--outDir',
|
|
84
|
+
'types',
|
|
85
|
+
'--rootDir',
|
|
86
|
+
'src',
|
|
87
|
+
'--declaration',
|
|
88
|
+
'--emitDeclarationOnly',
|
|
89
|
+
'--declarationMap',
|
|
90
|
+
])
|
|
91
|
+
} finally {
|
|
92
|
+
// restore
|
|
93
|
+
await fs.writeFile('tsconfig.json', tsConfOg)
|
|
94
|
+
}
|
|
60
95
|
}
|
|
96
|
+
|
|
97
|
+
const externalPlugin = createExternalPlugin({
|
|
98
|
+
skipNodeModulesBundle: true,
|
|
99
|
+
})
|
|
100
|
+
|
|
61
101
|
try {
|
|
62
|
-
await
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
102
|
+
await Promise.all([
|
|
103
|
+
buildTsc(),
|
|
104
|
+
...(skipJS
|
|
105
|
+
? []
|
|
106
|
+
: [
|
|
107
|
+
pkgMain
|
|
108
|
+
? esbuild
|
|
109
|
+
.build({
|
|
110
|
+
entryPoints: files,
|
|
111
|
+
outdir: 'dist/cjs',
|
|
112
|
+
bundle: false,
|
|
113
|
+
sourcemap: true,
|
|
114
|
+
target: 'node14',
|
|
115
|
+
keepNames: true,
|
|
116
|
+
format: 'cjs',
|
|
117
|
+
color: true,
|
|
118
|
+
logLevel: 'error',
|
|
119
|
+
plugins: [externalPlugin],
|
|
120
|
+
minify: false,
|
|
121
|
+
platform: 'neutral',
|
|
122
|
+
})
|
|
123
|
+
.then(() => {
|
|
124
|
+
console.log(' >-> commonjs')
|
|
125
|
+
})
|
|
126
|
+
: null,
|
|
127
|
+
// dont bundle for tree shaking
|
|
128
|
+
pkgModule
|
|
129
|
+
? esbuild
|
|
130
|
+
.build({
|
|
131
|
+
entryPoints: files,
|
|
132
|
+
outdir: 'dist/esm',
|
|
133
|
+
sourcemap: true,
|
|
134
|
+
target: 'es2019',
|
|
135
|
+
keepNames: true,
|
|
136
|
+
format: 'esm',
|
|
137
|
+
color: true,
|
|
138
|
+
logLevel: 'error',
|
|
139
|
+
minify: false,
|
|
140
|
+
platform: 'neutral',
|
|
141
|
+
})
|
|
142
|
+
.then(() => {
|
|
143
|
+
console.log(' >-> esm')
|
|
144
|
+
})
|
|
145
|
+
: null,
|
|
146
|
+
esbuild
|
|
147
|
+
.build({
|
|
148
|
+
// only diff is jsx preserve and outdir
|
|
149
|
+
jsx: 'preserve',
|
|
150
|
+
outdir: 'dist/jsx',
|
|
151
|
+
entryPoints: files,
|
|
152
|
+
sourcemap: false,
|
|
153
|
+
target: 'es2019',
|
|
154
|
+
keepNames: true,
|
|
155
|
+
format: 'esm',
|
|
156
|
+
color: true,
|
|
157
|
+
logLevel: 'error',
|
|
158
|
+
minify: false,
|
|
159
|
+
platform: 'neutral',
|
|
160
|
+
})
|
|
161
|
+
.then(() => {
|
|
162
|
+
console.log(' >-> jsx')
|
|
163
|
+
}),
|
|
164
|
+
]),
|
|
73
165
|
])
|
|
166
|
+
} catch (error) {
|
|
167
|
+
console.log('error', error)
|
|
74
168
|
} finally {
|
|
75
|
-
|
|
76
|
-
await fs.writeFile('tsconfig.json', tsConfOg)
|
|
169
|
+
console.log('built in', `${(Date.now() - x) / 1000}s`)
|
|
77
170
|
}
|
|
78
171
|
}
|
|
79
172
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
logLevel: 'error',
|
|
102
|
-
plugins: [externalPlugin],
|
|
103
|
-
minify: false,
|
|
104
|
-
platform: 'neutral',
|
|
105
|
-
})
|
|
106
|
-
.then(() => {
|
|
107
|
-
console.log(' >-> commonjs')
|
|
108
|
-
})
|
|
109
|
-
: null,
|
|
110
|
-
// dont bundle for tree shaking
|
|
111
|
-
pkgModule
|
|
112
|
-
? esbuild
|
|
113
|
-
.build({
|
|
114
|
-
entryPoints: files,
|
|
115
|
-
outdir: 'dist/esm',
|
|
116
|
-
sourcemap: true,
|
|
117
|
-
target: 'es2019',
|
|
118
|
-
keepNames: true,
|
|
119
|
-
format: 'esm',
|
|
120
|
-
color: true,
|
|
121
|
-
logLevel: 'error',
|
|
122
|
-
minify: false,
|
|
123
|
-
platform: 'neutral',
|
|
124
|
-
})
|
|
125
|
-
.then(() => {
|
|
126
|
-
console.log(' >-> esm')
|
|
127
|
-
})
|
|
128
|
-
: null,
|
|
129
|
-
esbuild
|
|
130
|
-
.build({
|
|
131
|
-
// only diff is jsx preserve and outdir
|
|
132
|
-
jsx: 'preserve',
|
|
133
|
-
outdir: 'dist/jsx',
|
|
134
|
-
entryPoints: files,
|
|
135
|
-
sourcemap: false,
|
|
136
|
-
target: 'es2019',
|
|
137
|
-
keepNames: true,
|
|
138
|
-
format: 'esm',
|
|
139
|
-
color: true,
|
|
140
|
-
logLevel: 'error',
|
|
141
|
-
minify: false,
|
|
142
|
-
platform: 'neutral',
|
|
143
|
-
})
|
|
144
|
-
.then(() => {
|
|
145
|
-
console.log(' >-> jsx')
|
|
146
|
-
}),
|
|
147
|
-
]),
|
|
148
|
-
])
|
|
149
|
-
} catch (error) {
|
|
150
|
-
console.log('error', error)
|
|
151
|
-
} finally {
|
|
152
|
-
console.log('built in', `${(Date.now() - x) / 1000}s`)
|
|
173
|
+
if (shouldWatch) {
|
|
174
|
+
const path = require('path')
|
|
175
|
+
process.env.IS_WATCHING = true
|
|
176
|
+
process.env.DISABLE_AUTORUN = true
|
|
177
|
+
build().then(() => {
|
|
178
|
+
const finish = (_, path, stats) => {
|
|
179
|
+
build()
|
|
180
|
+
}
|
|
181
|
+
const chokidar = require('chokidar')
|
|
182
|
+
chokidar
|
|
183
|
+
// prevent infinite loop but cause race condition if you just build directly
|
|
184
|
+
.watch('src', {
|
|
185
|
+
persistent: true,
|
|
186
|
+
alwaysStat: true,
|
|
187
|
+
ignoreInitial: true,
|
|
188
|
+
})
|
|
189
|
+
.on('change', finish)
|
|
190
|
+
.on('add', finish)
|
|
191
|
+
})
|
|
192
|
+
} else {
|
|
193
|
+
build()
|
|
153
194
|
}
|
|
154
195
|
}
|
|
155
|
-
|
|
156
|
-
if (shouldWatch) {
|
|
157
|
-
const path = require('path')
|
|
158
|
-
process.env.IS_WATCHING = true
|
|
159
|
-
process.env.DISABLE_AUTORUN = true
|
|
160
|
-
build().then(() => {
|
|
161
|
-
const finish = (_, path, stats) => {
|
|
162
|
-
build()
|
|
163
|
-
}
|
|
164
|
-
const chokidar = require('chokidar')
|
|
165
|
-
chokidar
|
|
166
|
-
// prevent infinite loop but cause race condition if you just build directly
|
|
167
|
-
.watch('src', {
|
|
168
|
-
persistent: true,
|
|
169
|
-
alwaysStat: true,
|
|
170
|
-
ignoreInitial: true,
|
|
171
|
-
})
|
|
172
|
-
.on('change', finish)
|
|
173
|
-
.on('add', finish)
|
|
174
|
-
})
|
|
175
|
-
} else {
|
|
176
|
-
build()
|
|
177
|
-
}
|