oribuild-linux-arm64 0.0.0-pre-alpha.0

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/README.md ADDED
@@ -0,0 +1,203 @@
1
+ # ori
2
+
3
+ Tools and plugins to run innerloop builds of typescript monorepos using [esbuild](https://esbuild.github.io/).
4
+
5
+ ## Configuration & Usage
6
+ ```
7
+ ori -h
8
+
9
+ -blockFollowUp
10
+ Wait for an initial build before running non-build tasks (implied by -traceInitialBuild)
11
+ -cacheNodeModules
12
+ Forcefully cache node_modules in a plugion
13
+ -config string
14
+ Path to build.json (default "./build.json")
15
+ -cpuprofile string
16
+ Generate a cpu profile at the given path
17
+ -entry string
18
+ Use a given entry or entry group (specified in build.json)
19
+ -findWithLs
20
+ defer trace collection until the incremental rebuild
21
+ -gitRef string
22
+ initial set of changed files to use when starting the typescript process (default "HEAD")
23
+ -logLevel string
24
+ log level (error,info,debug) (default "info")
25
+ -noTui
26
+ Disable the tui and print everything to stdio
27
+ -port int
28
+ Port to run the http server on (default 3000)
29
+ -snoop
30
+ snoop on the import array
31
+ -split
32
+ Enable codesplitting (WARNING: Requires type='module' on the entrypoint script tag, will not work against prod owa-web-server)
33
+ -trace string
34
+ Generate an event trace at the given path
35
+ -traceIncrementalBuilds
36
+ Collect a pprof trace of incremental builds
37
+ -traceInitialBuild
38
+ Collect a pprof trace of the initial build
39
+ ```
40
+
41
+ ### build.json fields
42
+
43
+ ```json5
44
+ {
45
+ // Where to find a partial tsconfig with paths: entries
46
+ // mapping requires from lib directories to the corresponding
47
+ // source files
48
+ //
49
+ // should be deprecated by #3
50
+ "tsconfigPathsPath": "tsconfig.paths.json",
51
+ // The path that esbuild should output to
52
+ "outPath": "dist/esbuild",
53
+ // Where to find resource.json files
54
+ //
55
+ // TODO: document resource.json files
56
+ //
57
+ // Should be deprecated by #4
58
+ "resourceRoots": ["packages", "shared"],
59
+ // Where to find source files to watch
60
+ //
61
+ // Should be deprecated by #4
62
+ "watchSourceRoots": ["packages", "shared"],
63
+ // Directories the webserver should serve in addition to serving
64
+ // resources from resources.json and the built scripts + chunks
65
+ "directServeDirectories": ["resources"],
66
+ // constants to define, passed to esbuild's define property
67
+ // see https://esbuild.github.io/api/#define
68
+ "defineConstants": {
69
+ "global": "self",
70
+ "process.env.IS_WEBPACK": "false"
71
+ },
72
+ // A map of entry script names to the packages they are built from
73
+ // (packages are read from tsconfig.paths.json, should be replaced
74
+ // with packageNames in the workspaces we crawl)
75
+ "entry": {
76
+ "mailindex": "mail-index-package-name",
77
+ },
78
+ // Entrypoints to workers
79
+ //
80
+ // Workers are built separately, see WorkerLoader for details
81
+ //
82
+ // Worker entrypoints not in this map will be built inline in the main,
83
+ // build, at significant performance cost
84
+ "workerRawEntries": {
85
+ "pdfjsworker": "node_modules/pdfjs-dist/build/pdf.worker.js",
86
+ "pdfjsworkermin": "node_modules/pdfjs-dist/build/pdf.worker.min.js",
87
+ "owadataworker": "packages/libraries/worker/owa-data-worker-bootstrap/src/index.worker.ts"
88
+ },
89
+ // Human readable groups of entries from the above entries map
90
+ // as well as custom extensions to defineConstants
91
+ //
92
+ // For use on the cli for common entry goups.
93
+ "entryGroups": {
94
+ "OWA Mail": {
95
+ "entries": ["mailindex"],
96
+ "defineConstants": {
97
+ "OWA_BUILD_CONSTANTS.ENTRIES.mail": "true",
98
+ "OWA_BUILD_CONSTANTS.BUILD_ALL": "false"
99
+ }
100
+ }
101
+ }
102
+ }
103
+ ```
104
+
105
+ ## Working on `ori`
106
+ ### Getting Dependencies
107
+ - install go 1.17 https://go.dev/doc/install
108
+ - install mingw-gcc. I do this via https://www.mingw-w64.org/downloads/#mingw-builds (the sourceforge link at present)
109
+ - If the live installer fails, you can download the prebuilt binaries directly and add those to your path
110
+ https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/
111
+ - Prebuilt binaries require 7zip to extract https://www.7-zip.org/
112
+ - I installed x86_64-posix-seh
113
+ This is to support building libsass https://github.com/wellington/go-libsass/issues/37
114
+ - get the install path of mingw-gcc's bin and add it to your path (in my case /c/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin)
115
+ - Install the golang vscode plugin, and click "Install All" when it prompts you to install missing golang components (godef, gopkgs, gopls)
116
+
117
+ ### Catches
118
+
119
+ > Add more here as you hit unexpected situations
120
+
121
+ - in client-web: `yarn gulp gqlgen:generate` needs to be run manually after any graphql change.
122
+ - node_modules are not monitored and assumed to be always stable. If you edit node_modules, you
123
+ will need to save another file to refresh.
124
+ Once separate builds are implemented (#8), you will have to restart the whole build agent,
125
+ unless you specifically omit that node_module from the build cache
126
+ - ori exits with error `0xc0000139` on windows
127
+
128
+ ```sh
129
+ $ go run . -h
130
+ exit status 0xc0000139
131
+ ```
132
+
133
+ This translates to STATUS_ENTRYPOINT_NOT_FOUND
134
+ https://pkg.go.dev/golang.org/x/sys/windows
135
+
136
+ This might mean you have the wrong mingw install version and windows can't
137
+ find the entrypoint symbols for the libsass binary at runtime? not 100% sure
138
+ but changing the mingw version to the one specified above fixes the issue.
139
+
140
+ ### Useful Snippets
141
+ ```sh
142
+ # with mingw on your path
143
+
144
+ # Build entries
145
+ go run . -config=../build.json
146
+
147
+ # Build an entry named "OWA Mail" from the entrypoints map, with codesplitting
148
+ # Note that this has to be loaded with a script type="module" entrypoint,
149
+ # since esbuild codesplitting forces esm modules
150
+ go run . -config=../build.json -entry="OWA Mail" -split
151
+
152
+ # Generate a cpu profile for initial and incrmental builds (the traces directory must already exist)
153
+ go run . -config=../build.json -entry="OWA Mail" -traceInitialBuild -traceIncrementalBuilds -cpuprofile=traces/cpu.pprof
154
+
155
+ # Analyse cpu profiles (constains overview of CPU time)
156
+ go tool pprof -http=localhost:8080 traces/cpu.pprof.initial*
157
+ go tool pprof -http=localhost:8080 traces/cpu.pprof.incremental*
158
+
159
+ # Analyse traces
160
+ go tool trace traces/trace.out.*
161
+ ```
162
+
163
+ ## FAQs
164
+
165
+ - Why not use the esbuild node API?
166
+
167
+ In short, we tried it and it was slow. Initial build times were several minutes, compared to the 40-odd seconds we see with the go api because of all the time plugins spent waiting to run on the node main thread.
168
+
169
+ - Can I customize `ori` for my monorepo?
170
+
171
+ For now, `ori` will remain extremly opinionared on what the monorepo shape must look like. As much as possible, we want to prefer convention over configuration.
172
+
173
+ In the same vein, rather than implementing plugins or encouraging people to fork and make their own custom builds of `ori`, new functionality will be added to the same `ori` binaries as needed.
174
+
175
+ - Why is it called `ori`?
176
+
177
+ `ori` was started by the Outlook Web team, and is short for `OWA Rapid Innerloop`.
178
+
179
+ It can also be easily typed on a single row of a QWERTY keyboard without using your fifth fingers, which I value because I have ulnar neuropathy.
180
+
181
+ > TODO: Populate this section as people ask more questions
182
+
183
+ ## Contributing
184
+
185
+ This project welcomes contributions and suggestions. Most contributions require you to agree to a
186
+ Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
187
+ the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
188
+
189
+ When you submit a pull request, a CLA bot will automatically determine whether you need to provide
190
+ a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
191
+ provided by the bot. You will only need to do this once across all repos using our CLA.
192
+
193
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
194
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
195
+ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
196
+
197
+ ## Trademarks
198
+
199
+ This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
200
+ trademarks or logos is subject to and must follow
201
+ [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
202
+ Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
203
+ Any use of third-party trademarks or logos are subject to those third-party's policies.
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "oribuild-linux-arm64",
3
+ "version": "0.0.0-pre-alpha.0",
4
+ "repository": {
5
+ "url": "https://github.com/microsoft/ori"
6
+ },
7
+ "os": [
8
+ "x64"
9
+ ],
10
+ "cpu": [
11
+ "linux"
12
+ ],
13
+ "bin": {
14
+ "ori": "./platform-unimplemented.js"
15
+ }
16
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ console.error(`oribuild does not yet support target ${process.platform}-${process.arch}`)
3
+ process.exit(1)