Skip to content
Merged
50 changes: 25 additions & 25 deletions .github/actions/meteor-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,31 +165,31 @@ runs:

yarn build:ci

declare -a meter_modules_to_remove=(
"meteor/babel-compiler/node_modules/@meteorjs/swc-core/.swc/node_modules/@swc/core-darwin-arm64" # Removes 35M
"meteor/babel-compiler/node_modules/@meteorjs/swc-core/.swc/node_modules/@swc/core-linux-x64-musl" # Removes 58M
"meteor/babel-compiler/node_modules/@meteorjs/swc-core/.swc/node_modules/@swc/core-linux-arm64-musl" # Removes 44M
"meteor/babel-compiler/node_modules/typescript" # Removes 31M
Comment thread
nazabucciarelli marked this conversation as resolved.
"meteor/babel-compiler/node_modules/@babel" # Removes 14M

"@rocket.chat/i18n/src" # Removes 16M
"typescript" # Removes 19M
# "@babel" # Removes 34M - Needed by Minimongo
)

du -s /tmp/dist/bundle

for dir_path in "${meter_modules_to_remove[@]}"; do
path=/tmp/dist/bundle/programs/server/npm/node_modules/${dir_path}

if [ -d "$path" ]; then
rm -rf "$path"

echo "Removed directory: $path"
else
echo "Path is not a directory or does not exist: $path"
fi
done
# declare -a meter_modules_to_remove=(
# "meteor/babel-compiler/node_modules/@meteorjs/swc-core/.swc/node_modules/@swc/core-darwin-arm64" # Removes 35M
# "meteor/babel-compiler/node_modules/@meteorjs/swc-core/.swc/node_modules/@swc/core-linux-x64-musl" # Removes 58M
# "meteor/babel-compiler/node_modules/@meteorjs/swc-core/.swc/node_modules/@swc/core-linux-arm64-musl" # Removes 44M
# "meteor/babel-compiler/node_modules/typescript" # Removes 31M
# "meteor/babel-compiler/node_modules/@babel" # Removes 14M
#
# "@rocket.chat/i18n/src" # Removes 16M
# "typescript" # Removes 19M
# # "@babel" # Removes 34M - Needed by Minimongo
# )
#
# du -s /tmp/dist/bundle
#
# for dir_path in "${meter_modules_to_remove[@]}"; do
# path=/tmp/dist/bundle/programs/server/npm/node_modules/${dir_path}
#
# if [ -d "$path" ]; then
# rm -rf "$path"
#
# echo "Removed directory: $path"
# else
# echo "Path is not a directory or does not exist: $path"
# fi
# done

# Remove all .d.ts files from node_modules to reduce size
# Removes 184M
Expand Down
36 changes: 36 additions & 0 deletions apps/meteor/tests/end-to-end/api/incoming-integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,42 @@ describe('[Incoming Integrations]', () => {

await removeIntegration(withScript._id, 'incoming');
});

it('should return a response with scriptCompiled and without scriptError when the script is valid', async () => {
Comment thread
nazabucciarelli marked this conversation as resolved.
Outdated
const res = await request
.post(api('integrations.create'))
.set(credentials)
.send({
type: 'webhook-incoming',
name: 'Incoming test',
enabled: true,
alias: 'test',
username: 'rocket.cat',
scriptEnabled: true,
scriptEngine: 'isolated-vm',
channel: '#general',
script: `
class Script {
process_incoming_request({ request }) {
return {
content:{
text: request.content.text
}
};
}
}
`,
})
.expect('Content-Type', 'application/json')
.expect(200);

expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('integration').and.to.be.an('object');
expect(res.body.integration).to.not.have.property('scriptError');
expect(res.body.integration).to.have.property('scriptCompiled');
const integrationId = res.body.integration._id;
await removeIntegration(integrationId, 'incoming');
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
});

describe('[/integrations.history]', () => {
Expand Down
Loading