Skip to content
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

Usability improvements #36

Merged
merged 4 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 16.13.1
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ This repository contains a set of frontend apps to test with.

## Setup

Make sure you have have a working local Node.js install.
Install geckodriver and install the bundle:
Make sure you have have a working local Node.js install. The
Node.js version should match the one in the `.tool-versions` file.

The `yarn` package manager should be globally installed:

```
npm i -g yarn
```

Install the dependencies with bundle:

```
brew install geckodriver
bundle install
```

Expand Down Expand Up @@ -54,7 +61,17 @@ Then navigate to http://localhost:5001 to trigger an error.

## Running tests

Run `bundle exec rspec` to run an integration test on all test setups.
To run the tests, you must have `geckodriver` installed:

```
brew install geckodriver
```

To run an integration test on all test setups:

```
bundle exec rspec
```

## Adding a new app

Expand Down
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ namespace :app do
# Check if we have all input
@frontend_key = @keys["frontend_key"] or raise "No frontend key set in keys.yml"
@push_key = @keys["push_key"] or raise "No push key set in keys.yml"
@revision = ENV["revision"] or raise "No revision set in env"
@revision = ENV["revision"]
if @revision.nil?
@revision = demo_revision
puts "No revision set in env; using demo revision #{@revision.inspect}"
end
# Use uris from keys.yml, or the default production ones
@uri = @keys["uri"] || "https://appsignal-endpoint.net/collect"
@sourcemap_uri = @keys["sourcemaps_uri"] || "https://appsignal.com/api/sourcemaps"
Expand Down
3 changes: 3 additions & 0 deletions frameworks/angular/14/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,8 @@
}
}
}
},
"cli": {
"analytics": false
}
}
6 changes: 5 additions & 1 deletion support/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ def get_keys
YAML.load_file("keys.yml")
end

def demo_revision
"0123456789abcdef".chars.sample(7).join + "-demo"
end

def render_erb(file, binding)
ERB.new(File.read(file)).result(binding)
end
Expand All @@ -73,7 +77,7 @@ def write_appsignal_config(app, frontend_key, revision, uri)
end
File.write(
"frameworks/#{app}/src/#{filename}",
render_erb("support/templates/appsignal.js.erb", binding)
render_erb("support/templates/#{filename}.erb", binding)
)
end

Expand Down
6 changes: 5 additions & 1 deletion support/templates/appsignal.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

import Appsignal from "@appsignal/javascript";

export default new Appsignal({
const appsignal = new Appsignal({
key: "<%= @frontend_key %>",
revision: "<%= @revision %>",
uri: "<%= @uri %>"
});

export default appsignal;

globalThis.appsignal = appsignal;
unflxw marked this conversation as resolved.
Show resolved Hide resolved
17 changes: 17 additions & 0 deletions support/templates/appsignal.ts.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This file is autogenerated when running rake app:run

import Appsignal from "@appsignal/javascript";

const appsignal = new Appsignal({
key: "<%= @frontend_key %>",
revision: "<%= @revision %>",
uri: "<%= @uri %>"
});

export default appsignal;

declare global {
var appsignal: Appsignal
}

globalThis.appsignal = appsignal;