From c73c9c843f73bb935279b844d59619d9a6b4b560 Mon Sep 17 00:00:00 2001 From: Pascal Laliberte Date: Fri, 29 Mar 2024 13:27:09 -0400 Subject: [PATCH] Remove global `window.$` jQuery definition (#1319) * BT setup * Add a box partial showing the NP issue * Update all Bundler dependencies (2024-03-24) (#1378) * remove duplicate electron import * remove jquery global definition --------- Co-authored-by: Adam Pallozzi Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> --- .circleci/config.yml | 6 +- .github/FUNDING.yml | 1 - .redocly.yaml | 2 +- README.example.md | 30 ------ README.md | 139 ++++++-------------------- app.json | 2 +- app/javascript/application.js | 3 - app/javascript/electron/index.js | 5 - app/javascript/support/jquery.js | 3 - app/views/account/teams/show.html.erb | 4 +- config/application.rb | 2 +- config/cable.yml | 2 +- config/database.yml | 12 +-- config/environments/production.rb | 2 +- config/initializers/session_store.rb | 2 +- config/locales/en/application.en.yml | 6 +- config/locales/en/user_mailer.en.yml | 10 +- package.json | 1 - yarn.lock | 2 +- zapier/package.json | 4 +- 20 files changed, 59 insertions(+), 179 deletions(-) delete mode 100644 .github/FUNDING.yml delete mode 100644 README.example.md delete mode 100644 app/javascript/electron/index.js delete mode 100644 app/javascript/support/jquery.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 8fd201a0f..b25cd8a39 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,14 +29,14 @@ aliases: - image: cimg/ruby:3.3.0-browsers environment: PGHOST: localhost - PGUSER: untitled_application + PGUSER: np_tester RAILS_ENV: test - &postgres_docker_image - image: cimg/postgres:14.2 environment: POSTGRES_HOST_AUTH_METHOD: trust - POSTGRES_DB: untitled_application_test - POSTGRES_USER: untitled_application + POSTGRES_DB: np_tester_test + POSTGRES_USER: np_tester - &wait_for_docker # We run this because the DB might not be available for a while due to a race condition. run: dockerize -wait tcp://localhost:5432 -timeout 1m diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index a2fb285a8..000000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -custom: ["https://buy.stripe.com/4gw7vc5hFan959uaEN"] diff --git a/.redocly.yaml b/.redocly.yaml index 32f1ef217..3762fbbbb 100644 --- a/.redocly.yaml +++ b/.redocly.yaml @@ -1,4 +1,4 @@ -organization: untitled_application +organization: np_tester extends: - recommended diff --git a/README.example.md b/README.example.md deleted file mode 100644 index 7ff18ff7a..000000000 --- a/README.example.md +++ /dev/null @@ -1,30 +0,0 @@ -# Untitled Application - -## Getting Started - -1. You must have the following dependencies installed: - - - Ruby 3 - - See [`.ruby-version`](.ruby-version) for the specific version. - - Node 19 - - See [`.nvmrc`](.nvmrc) for the specific version. - - PostgreSQL 14 - - Redis 6.2 - - [Chrome](https://www.google.com/search?q=chrome) (for headless browser tests) - - If you don't have these installed, you can use [rails.new](https://rails.new) to help with the process. - -2. Run the `bin/setup` script. -3. Start the application with `bin/dev`. -4. Visit http://localhost:3000. - -## Information about Bullet Train -If this is your first time working on a Bullet Train application, be sure to review the [Bullet Train Basic Techniques](https://bullettrain.co/docs/getting-started) and the [Bullet Train Developer Documentation](https://bullettrain.co/docs). - -### Render - -[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/bullet-train-co/bullet_train) - -Clicking this button will take you to the first step of a process that, when completed, will provision production-grade infrastructure for your Bullet Train application which will cost about **$30/month**. - -When you're done deploying to Render, you need to go into "Dashboard" > "web", copy the server URL, and then go into "Env Groups" > "settings" and paste the URL into the value for `BASE_URL`. diff --git a/README.md b/README.md index d29b8e550..57a070373 100644 --- a/README.md +++ b/README.md @@ -1,109 +1,30 @@ -# Bullet Train Application Template -If you're new to Bullet Train, start with the [Bullet Train Developer Documentation](https://bullettrain.co/docs) and the [Getting Started](https://bullettrain.co/docs/getting-started) guide. You should also [join the community Discord server](https://discord.gg/bullettrain)! - -## Building a New Application with Bullet Train -If you're building a new application with Bullet Train, you don't want to "Fork" the template repository on GitHub. Instead, you should: - -1. Clone the template repository: - - ``` - git clone git@github.com:bullet-train-co/bullet_train.git your_new_project_name - ``` - -2. Enter the project directory: - - ``` - cd your_new_project_name - ``` - -3. Run the configuration and setup scripts: - - ``` - bin/configure - bin/setup - ``` - -4. Boot your application: - - ``` - bin/dev - ``` - -5. Visit `http://localhost:3000`. - -## Cloud Development with Gitpod - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/bullet-train-co/bullet_train) - -Clicking this button will set up a new Bullet Train project for development on [Gitpod](https://gitpod.io). - -
-
- -

-Open-source development sponsored by: -

- -

- -

- -
-
- -## Provisioning a Production Environment -You can use this public repository to provision a new application and then push your private application code there later. - -### Render - -[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/bullet-train-co/bullet_train) - -Clicking this button will take you to the first step of a process that, when completed, will provision production-grade infrastructure for your Bullet Train application which will cost about **$30/month**. - -When you're done deploying to Render, you need to go into "Dashboard" > "web", copy the server URL, and then go into "Env Groups" > "settings" and paste the URL into the value for `BASE_URL`. - -### Heroku - -[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=http://github.com/bullet-train-co/bullet_train) - -Clicking this button will take you to the first step of a process that, when completed, will provision production-grade infrastructure and services for your Bullet Train application which will cost about **$140/month**. - -Once that process has completed, be sure to complete the other steps from the [Deploying to Heroku](https://bullettrain.co/docs/heroku) documentation. - -## Contribute to Bullet Train -If you're looking contribute to Bullet Train, you should "Fork" this template repository on GitHub, like so: - -1. Visit https://github.com/bullet-train-co/bullet_train. -2. Click "Fork" in the top-right corner. -3. Select the account where you want to fork the repository. -4. Click the "Code" button on the new repository and copy the SSH path. -5. Clone your forked repository using the SSH path you copied, like so: - - ``` - git clone git@github.com:your-account/bullet_train.git - cd bullet_train - ``` - -6. Run the setup script: - - ``` - bin/setup - ``` - -7. Start the application: - - ``` - bin/dev - ``` - - > [!NOTE] - > Optional: If you have [ngrok](https://ngrok.com/) installed, uncomment `ngrok: ngrok http 3000` from `Procfile.dev` and run - > `bin/set-ngrok-url` to set `BASE_URL` to a publically accessible domain. - > Run `bin/set-ngrok-url` after restarting `ngrok` to update `BASE_URL` to - > the current public url. - -8. Visit http://localhost:3000. - ---- - -This `README.md` file will be replaced with [`README.example.md`](./README.example.md) after running `bin/configure`. +# NP Tester + +## Getting Started + +1. You must have the following dependencies installed: + + - Ruby 3 + - See [`.ruby-version`](.ruby-version) for the specific version. + - Node 19 + - See [`.nvmrc`](.nvmrc) for the specific version. + - PostgreSQL 14 + - Redis 6.2 + - [Chrome](https://www.google.com/search?q=chrome) (for headless browser tests) + + If you don't have these installed, you can use [rails.new](https://rails.new) to help with the process. + +2. Run the `bin/setup` script. +3. Start the application with `bin/dev`. +4. Visit http://localhost:3000. + +## Information about Bullet Train +If this is your first time working on a Bullet Train application, be sure to review the [Bullet Train Basic Techniques](https://bullettrain.co/docs/getting-started) and the [Bullet Train Developer Documentation](https://bullettrain.co/docs). + +### Render + +[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/bullet-train-co/bullet_train) + +Clicking this button will take you to the first step of a process that, when completed, will provision production-grade infrastructure for your Bullet Train application which will cost about **$30/month**. + +When you're done deploying to Render, you need to go into "Dashboard" > "web", copy the server URL, and then go into "Env Groups" > "settings" and paste the URL into the value for `BASE_URL`. diff --git a/app.json b/app.json index 462d8e7b8..034b1d4de 100644 --- a/app.json +++ b/app.json @@ -1,5 +1,5 @@ { - "name": "Untitled Application", + "name": "NP Tester", "description": "The Ruby on Rails SaaS-in-a-Box", "repository": "https://github.com/bullet-train-co/bullet_train", "logo": "https://bullettrain.co/heroku-logo.png", diff --git a/app/javascript/application.js b/app/javascript/application.js index efc4eda12..427c02642 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -3,7 +3,6 @@ // includes should be specified at the end of the file, not in this section. This helps avoid merge conflicts in the // future should the framework defaults change. -import "./support/jquery"; import Rails from "@rails/ujs" import * as ActiveStorage from "@rails/activestorage" import "@hotwired/turbo-rails" @@ -27,8 +26,6 @@ require("@icon/themify-icons/themify-icons.css") import { trixEditor } from "@bullet-train/fields" trixEditor() -import "./electron" - // ✅ YOUR APPLICATION'S INCLUDES // If you need to customize your application's includes, this is the place to do it. This helps avoid merge // conflicts in the future when Rails or Bullet Train update their own default includes. diff --git a/app/javascript/electron/index.js b/app/javascript/electron/index.js deleted file mode 100644 index 5b2e3bb9e..000000000 --- a/app/javascript/electron/index.js +++ /dev/null @@ -1,5 +0,0 @@ -$(document).on('turbo:load', function() { - if (navigator.userAgent.toLocaleLowerCase().includes('electron')) { - $('body').addClass('electron') - } -}) \ No newline at end of file diff --git a/app/javascript/support/jquery.js b/app/javascript/support/jquery.js deleted file mode 100644 index efa5f9f72..000000000 --- a/app/javascript/support/jquery.js +++ /dev/null @@ -1,3 +0,0 @@ -import jquery from "jquery"; -window.jQuery = jquery; -window.$ = jquery; diff --git a/app/views/account/teams/show.html.erb b/app/views/account/teams/show.html.erb index f6522cb1c..743c66e55 100644 --- a/app/views/account/teams/show.html.erb +++ b/app/views/account/teams/show.html.erb @@ -3,7 +3,9 @@ <% p.content_for :body do %> <%# 🚅 super scaffolding will insert new children above this line. %> - + + <%= render 'shared/box', title: "Test title" %> + <%= render 'shared/box', title: "Test title" do end %> <%= render 'account/scaffolding/absolutely_abstract/creative_concepts/index', creative_concepts: @team.scaffolding_absolutely_abstract_creative_concepts, hide_back: true unless scaffolding_things_disabled? %> <% end %> <% end %> diff --git a/config/application.rb b/config/application.rb index fb3bf8c32..9a372dfd8 100644 --- a/config/application.rb +++ b/config/application.rb @@ -9,7 +9,7 @@ require_relative "../lib/bullet_train_oauth_scaffolder_support" -module UntitledApplication +module NpTester class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 7.0 diff --git a/config/cable.yml b/config/cable.yml index 3bda4695f..86a681389 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -7,7 +7,7 @@ test: production: adapter: redis url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> - channel_prefix: untitled_application_production + channel_prefix: np_tester_production driver: :ruby ssl_params: verify_mode: <%= OpenSSL::SSL::VERIFY_NONE %> diff --git a/config/database.yml b/config/database.yml index 3d9650661..00abbf370 100644 --- a/config/database.yml +++ b/config/database.yml @@ -23,13 +23,13 @@ default: &default development: <<: *default - database: untitled_application_development + database: np_tester_development # The specified database role being used to connect to postgres. # To create additional roles in postgres see `$ createuser --help`. # When left blank, postgres will use the default role. This is # the same name as the operating system user that initialized the database. - #username: untitled_application-app + #username: np_tester-app # The password associated with the postgres role (username). #password: @@ -57,7 +57,7 @@ development: # Do not set this db to the same as development or production. test: <<: *default - database: untitled_application_test + database: np_tester_test # As with config/secrets.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is @@ -80,7 +80,7 @@ test: # production: <<: *default - database: untitled_application_production - username: untitled_application - password: <%= ENV['UNTITLED_APPLICATION_DATABASE_PASSWORD'] %> + database: np_tester_production + username: np_tester + password: <%= ENV['NP_TESTER_DATABASE_PASSWORD'] %> url: <%= ENV['DATABASE_URL'] %> diff --git a/config/environments/production.rb b/config/environments/production.rb index 02a07c71c..4486c72c3 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -68,7 +68,7 @@ # Use a real queuing backend for Active Job (and separate queues per environment). # config.active_job.queue_adapter = :resque - # config.active_job.queue_name_prefix = "untitled_application_production" + # config.active_job.queue_name_prefix = "np_tester_production" config.action_mailer.perform_caching = false diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 978db93d7..0d3ef5957 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.session_store :cookie_store, key: "_untitled_application_session" +Rails.application.config.session_store :cookie_store, key: "_np_tester_session" diff --git a/config/locales/en/application.en.yml b/config/locales/en/application.en.yml index e855a1bbd..f94f111e9 100644 --- a/config/locales/en/application.en.yml +++ b/config/locales/en/application.en.yml @@ -1,11 +1,11 @@ en: application: - name: Untitled Application + name: NP Tester owner: Unidentified Developer description: "You can update this description in `config/locales/en/application.en.yml`." - keywords: untitled application seo keywords + keywords: np tester seo keywords support_email: change.me@localhost - key: untitled_application + key: np_tester webhooks/outgoing/endpoints: fields: api_version: diff --git a/config/locales/en/user_mailer.en.yml b/config/locales/en/user_mailer.en.yml index 258ec7309..520264939 100644 --- a/config/locales/en/user_mailer.en.yml +++ b/config/locales/en/user_mailer.en.yml @@ -3,15 +3,15 @@ en: signature: &SIGNATURE html:

If you have any questions, please don't hesitate to send us an email.

-

Thanks,
The Untitled Application Team

+

Thanks,
The NP Tester Team

invited: - subject: Invitation to join %{team_name} on Untitled Application! + subject: Invitation to join %{team_name} on NP Tester! preview: '%{inviter_name} has sent you this invitation.' heading: You're invited! body: html:

- %{inviter_name} has invited you to join %{team_name} on Untitled Application. + %{inviter_name} has invited you to join %{team_name} on NP Tester. You can join %{team_name} by clicking the button below.

cta: @@ -19,9 +19,9 @@ en: signature: <<: *SIGNATURE welcome: - subject: Welcome to Untitled Application! + subject: Welcome to NP Tester! preview: This email contains details on how to get started using your account. - heading: Welcome to Untitled Application! + heading: Welcome to NP Tester! body: html:

This is the default welcome email! The content of this welcome email can be updated in `config/locales/en/user_mailer.en.yml`.

diff --git a/package.json b/package.json index 919c69180..7dc4620b7 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "dragula": "^3.7.3", "esbuild": "^0.20.2", "glob": "^10.3.10", - "jquery": "^3.7.0", "jstz": "^2.1.1", "postcss": "^8.4.38", "postcss-css-variables": "^0.19.0", diff --git a/yarn.lock b/yarn.lock index edcda4fd7..ae009aecc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2276,7 +2276,7 @@ jiti@^1.19.1: resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.20.0.tgz#2d823b5852ee8963585c8dd8b7992ffc1ae83b42" integrity sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA== -jquery@>=1.10, jquery@^3.7.0: +jquery@>=1.10: version "3.7.1" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.7.1.tgz#083ef98927c9a6a74d05a6af02806566d16274de" integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg== diff --git a/zapier/package.json b/zapier/package.json index 8e5161511..da56f7f62 100644 --- a/zapier/package.json +++ b/zapier/package.json @@ -1,7 +1,7 @@ { - "name": "untitled-application", + "name": "np-tester", "version": "1.0.0", - "description": "Integrate Zapier with Untitled Application", + "description": "Integrate Zapier with NP Tester", "main": "index.js", "scripts": { "test": "mocha --recursive -t 10000"