Skip to content

Commit a89d5c7

Browse files
JacksonGLfacebook-github-bot
authored andcommitted
chore(lens): integrate memlens package to the memlab build script
Summary: This diff integrates the MemLens build into MemLab’s build script, so when OSS users run `npm run build && npm run test` in the MemLab OSS project, it will also build and test the Lens project. Also updated next.js dependency to avoid potential vulnerabilities. Reviewed By: tulga1970 Differential Revision: D72186995 fbshipit-source-id: 26a903379d3f14fdd55b90cc205022c05f8d56bc
1 parent fb9ad97 commit a89d5c7

File tree

4 files changed

+73
-1
lines changed

4 files changed

+73
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ package-oss.json
1717
packages/**/dist
1818
yarn-error.log
1919
yarn.lock
20+
21+
# But do not ignore these files
22+
!packages/lens/dist/*.bundle.*.(js|ts)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"./packages/heap-analysis",
5151
"./packages/api",
5252
"./packages/cli",
53+
"./packages/lens",
5354
"./packages/memlab"
5455
]
5556
}

packages/e2e/static/example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"next": "14.2.15",
12+
"next": "14.2.21",
1313
"react": "18.2.0",
1414
"react-dom": "18.2.0"
1515
},

packages/lens/webpack.config.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @format
8+
* @oncall memory_lab
9+
*/
10+
const path = require('path');
11+
12+
const createConfig = ({entry, filename, minimize}) => ({
13+
entry,
14+
output: {
15+
filename,
16+
path: path.resolve(__dirname, 'dist'),
17+
library: entry.lib
18+
? {
19+
name: 'MemLens',
20+
type: 'umd',
21+
}
22+
: undefined,
23+
},
24+
resolve: {
25+
extensions: ['.ts', '.js'],
26+
},
27+
module: {
28+
rules: [
29+
{
30+
test: /\.ts$/,
31+
use: 'ts-loader',
32+
exclude: /node_modules/,
33+
},
34+
],
35+
},
36+
mode: 'production',
37+
optimization: {
38+
minimize,
39+
},
40+
});
41+
42+
/** Export 4 builds: lib (min/non-min), run (min/non-min) */
43+
module.exports = [
44+
createConfig({
45+
entry: {lib: './src/memlens.lib.ts'},
46+
filename: 'memlens.lib.bundle.js', // non-minified
47+
mode: 'production',
48+
minimize: false,
49+
}),
50+
createConfig({
51+
entry: {lib: './src/memlens.lib.ts'},
52+
filename: 'memlens.lib.bundle.min.js', // minified
53+
mode: 'production',
54+
minimize: true,
55+
}),
56+
createConfig({
57+
entry: {run: './src/memlens.run.ts'},
58+
filename: 'memlens.run.bundle.js', // non-minified
59+
mode: 'production',
60+
minimize: false,
61+
}),
62+
createConfig({
63+
entry: {run: './src/memlens.run.ts'},
64+
filename: 'memlens.run.bundle.min.js', // minified
65+
mode: 'production',
66+
minimize: true,
67+
}),
68+
];

0 commit comments

Comments
 (0)