-
-
Couldn't load subscription status.
- Fork 1.9k
build: Add build step before generating the schema #7589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
fd910a1
dbe27df
8c44130
c8818ec
0ff3ebb
9b651a9
b61a0b8
570640c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { build } from 'esbuild'; | ||
| import { localDevConfig } from '../../esbuild-config.js'; | ||
|
|
||
| // Build plotly.js to be used locally, such as when generating the schema. | ||
| // This is the same process used in the test dashboard server script, but | ||
| // run only once. | ||
| build(localDevConfig); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,59 @@ | ||
| var glsl = require('esbuild-plugin-glsl').glsl; | ||
| var environmentPlugin = require('esbuild-plugin-environment').environmentPlugin; | ||
| const { environmentPlugin } = require('esbuild-plugin-environment'); | ||
| const { glsl } = require('esbuild-plugin-glsl'); | ||
| const InlineCSSPlugin = require('esbuild-plugin-inline-css'); | ||
| const path = require('path'); | ||
| const constants = require('./tasks/util/constants.js'); | ||
|
|
||
| module.exports = { | ||
| // Default config used when building library | ||
| const esbuildConfig = { | ||
| entryPoints: ['./lib/index.js'], | ||
| format: 'iife', | ||
| globalName: 'Plotly', | ||
| bundle: true, | ||
| minify: false, | ||
| sourcemap: false, | ||
| plugins: [ | ||
| InlineCSSPlugin(), | ||
| glsl({ | ||
| minify: true, | ||
| }), | ||
| environmentPlugin({ | ||
| NODE_DEBUG: false, | ||
| }), | ||
| ], | ||
| plugins: [InlineCSSPlugin(), glsl({ minify: true }), environmentPlugin({ NODE_DEBUG: false })], | ||
| alias: { | ||
| stream: 'stream-browserify', | ||
| stream: 'stream-browserify' | ||
| }, | ||
| define: { | ||
| global: 'window', | ||
| 'define.amd': 'false', | ||
| 'define.amd': 'false' | ||
| }, | ||
| target: 'es2016', | ||
| logLevel: 'info', | ||
| logLevel: 'info' | ||
| }; | ||
|
|
||
| const devtoolsConfig = { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @camdecoster Could you add a comment above each of these configs explaining what it's used for (to the extent that you know)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll come up with something, but the variable names were my attempt at a description. |
||
| entryPoints: [path.join(constants.pathToRoot, 'devtools', 'test_dashboard', 'devtools.js')], | ||
| outfile: path.join(constants.pathToRoot, 'build', 'test_dashboard-bundle.js'), | ||
| format: 'cjs', | ||
| globalName: 'Tabs', | ||
| bundle: true, | ||
| minify: false, | ||
| sourcemap: false, | ||
| plugins: [glsl({ minify: true })], | ||
| define: { global: 'window' }, | ||
| target: 'es2016', | ||
| logLevel: 'info' | ||
| }; | ||
|
|
||
| const localDevConfig = { | ||
| ...esbuildConfig, | ||
| outfile: './build/plotly.js' | ||
| }; | ||
|
|
||
| const localDevReglCodegenConfig = { | ||
| ...esbuildConfig, | ||
| entryPoints: [path.join(constants.pathToRoot, 'devtools/regl_codegen', 'devtools.js')], | ||
| outfile: './build/regl_codegen-bundle.js', | ||
| sourcemap: false, | ||
| minify: false | ||
| }; | ||
|
|
||
| module.exports = { | ||
| devtoolsConfig, | ||
| esbuildConfig, | ||
| localDevConfig, | ||
| localDevReglCodegenConfig, | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@camdecoster After the cleanup you've done, does this step really need a separate file? Couldn't you just now add
build(localDevConfig);to the beginning of themakeSchema()function inschema.mjs?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a fair question. I envisioned this script as being one that could be called elsewhere, but that seems like it violates the YAGNI principle. I'll do as you suggest. We can always add it back.