-
Notifications
You must be signed in to change notification settings - Fork 40
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
chore: update script library #939
base: main
Are you sure you want to change the base?
Conversation
const path = 'src/lib-prefix.ts' | ||
if (!fs.existsSync(path)) { | ||
// Supported in rollup 4, we're currently rollup 2 | ||
// this.error(`File not found: ${path}`); |
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.
Minor, do we want to keep this logging comment?
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.
I'd like to keep it here so that when we migrate to rollup 4, we can just uncomment this line. wdyt?
} | ||
|
||
fs.writeFileSync(path, updatedContent, 'utf-8'); | ||
// this.info(`File updated: ${path}`); |
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.
Ditto
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.
the same as above #939 (comment)
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.
Nit: Should we also add the comment // Supported in rollup 4, we're currently rollup 2
here for clarity
@@ -63,6 +97,7 @@ export const iife = { | |||
sourcemap: true, | |||
}, | |||
plugins: [ | |||
updateLibPrefixPlugin(), |
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.
I think another possible solution is using https://www.npmjs.com/package/rollup-plugin-inject-process-env, so we can dynamically inject environment variable here, then read in the build process.
Manipulating the library file solution LGTM too.
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.
Great solution! I'll make it as a backup if the plugin solution doesn't work well.
} | ||
|
||
|
||
const updateLibPrefixPlugin = (isUndo) => { |
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.
Doesn't look like isUndo
is used here
} | ||
|
||
fs.writeFileSync(path, updatedContent, 'utf-8'); | ||
// this.info(`File updated: ${path}`); |
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.
Nit: Should we also add the comment // Supported in rollup 4, we're currently rollup 2
here for clarity
@@ -54,6 +55,39 @@ export const umd = { | |||
], | |||
}; | |||
|
|||
const updateLibPrefix = (isUndo) => { |
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.
Nit: Should function name give a bit more context? Not sure if I'm just unfamiliar with rollup/context of the PR. isUndo
makes a bit more sense with some context.
Summary
amplitude-ts-sdk-script
in amplitude-min.js which is renamed asanalytics-browser-x.x.x-min.js.gz
and uploaded to s3 atAmplitude-TypeScript/scripts/publish/upload-to-s3.js
Line 9 in cbb0afa
amplitude-ts
amplitude-ts
Checklist