-
Notifications
You must be signed in to change notification settings - Fork 14
[CDX-468] Add modern ESM build #455
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 all commits
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,29 @@ | ||
| name: Run tests - Bundled ESM | ||
| on: | ||
| pull_request: | ||
| branches: | ||
| - "**" | ||
| concurrency: | ||
| group: run-tests-bundled-esm-${{ github.head_ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| node: ["22.18.0"] | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v2 | ||
|
constructor-claude-bedrock[bot] marked this conversation as resolved.
esezen marked this conversation as resolved.
constructor-claude-bedrock[bot] marked this conversation as resolved.
esezen marked this conversation as resolved.
|
||
| - name: Set up node | ||
| uses: actions/setup-node@v2 | ||
| with: | ||
| node-version: ${{ matrix.node }} | ||
| - name: Install dependencies | ||
| run: npm install | ||
| - name: Run tests | ||
| run: npm run test:bundled:esm:parallel | ||
| env: | ||
| TEST_REQUEST_API_KEY: ${{ secrets.TEST_REQUEST_API_KEY }} | ||
| TEST_MEDIA_REQUEST_API_KEY: ${{ secrets.TEST_MEDIA_REQUEST_API_KEY }} | ||
| SKIP_NETWORK_TIMEOUT_TESTS: true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| require('esbuild').build({ | ||
|
constructor-claude-bedrock[bot] marked this conversation as resolved.
|
||
| entryPoints: ['./src/constructorio.js'], | ||
| bundle: true, | ||
| format: 'esm', | ||
| target: 'es2017', | ||
| platform: 'browser', | ||
|
esezen marked this conversation as resolved.
|
||
| sourcemap: true, | ||
|
esezen marked this conversation as resolved.
|
||
| define: { | ||
| global: 'window', | ||
| }, | ||
| external: ['@constructor-io/constructorio-id', 'crc-32'], | ||
|
esezen marked this conversation as resolved.
constructor-claude-bedrock[bot] marked this conversation as resolved.
esezen marked this conversation as resolved.
|
||
| outfile: './lib/esm/constructorio.js', | ||
| }).catch(() => process.exit(1)); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| const packageJSON = require('../package.json'); | ||
|
constructor-claude-bedrock[bot] marked this conversation as resolved.
|
||
|
|
||
| require('esbuild').build({ | ||
| entryPoints: ['./src/constructorio.js'], | ||
| bundle: true, | ||
| minify: true, | ||
| format: 'iife', | ||
| globalName: 'ConstructorioClient', | ||
|
esezen marked this conversation as resolved.
constructor-claude-bedrock[bot] marked this conversation as resolved.
|
||
| target: 'es2017', | ||
| platform: 'browser', | ||
| define: { | ||
| global: 'window', | ||
| process: '{"env":{"BUNDLED":"true"}}', | ||
|
esezen marked this conversation as resolved.
|
||
| }, | ||
| outfile: `./dist/test-only/constructorio-client-javascript-${packageJSON.version}.iife.js`, | ||
|
esezen marked this conversation as resolved.
|
||
| }).catch(() => process.exit(1)); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| const packageJSON = require('../package.json'); | ||
|
Contributor
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. Should this live in
Contributor
Author
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. Good catch, I think it makes sense to move the other one down 26d402c |
||
|
|
||
| const banner = `/*! | ||
| * | ||
| * Constructor.io JavaScript Client, version ${packageJSON.version} | ||
| * (c) 2015-${new Date().getFullYear()} Constructor.io | ||
| * --- | ||
| * Constructor Search uses artificial intelligence to provide AI-first search, browse, and recommendations results that increase conversions and revenue. | ||
| * - https://constructor.io | ||
| * - https://github.com/Constructor-io/constructorio-client-javascript | ||
| * --- | ||
| * Includes code from the 'browserify/events' library, licensed under the MIT License. | ||
| * For full license details, see the library documentation. | ||
| * | ||
| */`; | ||
|
|
||
| require('esbuild').build({ | ||
| entryPoints: ['./src/constructorio.js'], | ||
|
esezen marked this conversation as resolved.
esezen marked this conversation as resolved.
|
||
| bundle: true, | ||
| minify: true, | ||
| format: 'esm', | ||
| target: 'es2017', | ||
| platform: 'browser', | ||
| define: { | ||
|
constructor-claude-bedrock[bot] marked this conversation as resolved.
|
||
| global: 'window', | ||
| process: '{"env":{"BUNDLED":"true"}}', | ||
|
esezen marked this conversation as resolved.
constructor-claude-bedrock[bot] marked this conversation as resolved.
|
||
| }, | ||
| banner: { js: banner }, | ||
| outfile: `./dist/esm/constructorio-client-javascript-${packageJSON.version}.esm.js`, | ||
| }).catch(() => process.exit(1)); | ||
Uh oh!
There was an error while loading. Please reload this page.