@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/build",
3
- "version": "1.0.0-alpha.12",
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.14",
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
- "typescript": "^4.2.4"
22
+ "json5": "^2.2.0",
23
+ "typescript": "^4.4.4"
22
24
  },
23
- "gitHead": "d50261a4e08d2212395af4f2d8f49555fc780c3e"
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
- await exec('npx', [
39
- 'tsc',
40
- '--baseUrl',
41
- '.',
42
- '--outDir',
43
- 'types',
44
- '--rootDir',
45
- 'src',
46
- '--declaration',
47
- '--emitDeclarationOnly',
48
- '--declarationMap',
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({
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "composite": true,
5
+ "jsx": "preserve"
6
+ },
7
+ }