Skip to content

Commit

Permalink
Add fixtures for all kinds of Rails app setups
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoroth committed Feb 15, 2024
1 parent 6057c8e commit 334046c
Show file tree
Hide file tree
Showing 67 changed files with 12,656 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
types/**/* linguist-vendored
test/fixtures/**/* linguist-vendored
17 changes: 17 additions & 0 deletions test/fixtures/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "app",
"private": true,
"dependencies": {
"@hotwired/stimulus": "^3.2.2",
"@stimulus-library/controllers": "^1.0.6",
"@vytant/stimulus-decorators": "^1.1.0",
"stimulus-checkbox": "^2.0.0",
"stimulus-clipboard": "^4.0.1",
"stimulus-datepicker": "^1.0.6",
"stimulus-dropdown": "^2.1.0",
"stimulus-hotkeys": "^2.3.0",
"stimulus-inline-input-validations": "^1.2.0",
"stimulus-use": "^0.52.2",
"tailwindcss-stimulus-components": "^4.0.4"
}
}
2 changes: 2 additions & 0 deletions test/fixtures/bun/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# See https://bun.sh/docs/install/lockfile
*.lockb diff=lockb
2 changes: 2 additions & 0 deletions test/fixtures/bun/Procfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
web: env RUBY_DEBUG_OPEN=true bin/rails server
js: bun run build --watch
2 changes: 2 additions & 0 deletions test/fixtures/bun/app/javascript/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Entry point for the build script in your package.json
import "./controllers"
9 changes: 9 additions & 0 deletions test/fixtures/bun/app/javascript/controllers/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Application } from "@hotwired/stimulus"

const application = Application.start()

// Configure Stimulus development experience
application.debug = false
window.Stimulus = application

export { application }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
connect() {

}
}
8 changes: 8 additions & 0 deletions test/fixtures/bun/app/javascript/controllers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This file is auto-generated by ./bin/rails stimulus:manifest:update
// Run that command whenever you add a new controller or create them with
// ./bin/rails generate stimulus controllerName

import { application } from "./application"

import HelloController from "./hello_controller"
application.register("hello", HelloController)
37 changes: 37 additions & 0 deletions test/fixtures/bun/bun.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import path from "path";
import fs from "fs";

const config = {
sourcemap: "external",
entrypoints: ["app/javascript/application.js"],
outdir: path.join(process.cwd(), "app/assets/builds"),
};

const build = async (config) => {
const result = await Bun.build(config);

if (!result.success) {
if (process.argv.includes("--watch")) {
console.error("Build failed");
for (const message of result.logs) {
console.error(message);
}
return;
} else {
throw new AggregateError(result.logs, "Build failed");
}
}
};

(async () => {
await build(config);

if (process.argv.includes("--watch")) {
fs.watch(path.join(process.cwd(), "app/javascript"), { recursive: true }, (eventType, filename) => {
console.log(`File changed: ${filename}. Rebuilding...`);
build(config);
});
} else {
process.exit(0);
}
})();
Binary file added test/fixtures/bun/bun.lockb
Binary file not shown.
10 changes: 10 additions & 0 deletions test/fixtures/bun/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "bun",
"private": true,
"dependencies": {
"@hotwired/stimulus": "^3.2.2"
},
"scripts": {
"build": "bun bun.config.js"
}
}
8 changes: 8 additions & 0 deletions test/fixtures/bun/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"@hotwired/stimulus@^3.2.2":
version "3.2.2"
resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.2.2.tgz#071aab59c600fed95b97939e605ff261a4251608"
integrity sha512-eGeIqNOQpXoPAIP7tC1+1Yc1yl1xnwYqg+3mzqxyrbE5pg5YFBZcA6YoTiByJB6DKAEsiWtl6tjTJS4IYtbB7A==
2 changes: 2 additions & 0 deletions test/fixtures/esbuild-rails/app/javascript/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Entry point for the build script in your package.json
import "./controllers"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Application } from "@hotwired/stimulus"

const application = Application.start()

// Configure Stimulus development experience
application.debug = false
window.Stimulus = application

export { application }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
connect() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { application } from "./application"
import controllers from "./**/*_controller.js"

controllers.forEach((controller) => {
application.register(controller.name, controller.module.default)
})
9 changes: 9 additions & 0 deletions test/fixtures/esbuild-rails/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "esbuild-rails",
"private": true,
"dependencies": {
"@hotwired/stimulus": "^3.2.2",
"esbuild": "^0.20.0",
"esbuild-rails": "^1.0.7"
}
}
Loading

0 comments on commit 334046c

Please sign in to comment.