Skip to content

Commit 310927c

Browse files
committed
resolve merge conflicts with main
1 parent acdebb7 commit 310927c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2806
-717
lines changed

.circleci/config.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/scripts/publish-dev-build

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env bash
2+
set -eux
3+
4+
package-name() {
5+
node -e "
6+
const package = JSON.parse(fs.readFileSync('package.json'))
7+
console.log(package.name)
8+
"
9+
}
10+
11+
rewrite-package-json() {
12+
ARCHIVE_URL="https://github.com/${DEV_BUILD_REPO_NAME}/archive" \
13+
PACKAGE_LIST="$package_list" node -e "
14+
const url = process.env.ARCHIVE_URL
15+
const sha = process.env.GITHUB_SHA.slice(0, 7)
16+
const package = JSON.parse(fs.readFileSync('package.json'))
17+
if (package.dependencies) {
18+
const packageNames = JSON.parse(process.env.PACKAGE_LIST).map(_ => _.name)
19+
for (const name in package.dependencies)
20+
if (packageNames.indexOf(name) != -1)
21+
package.dependencies[name] = url + '/' + name + '/' + sha + '.tar.gz'
22+
fs.writeFileSync('package.json', JSON.stringify(package))
23+
}
24+
"
25+
}
26+
27+
DEV_BUILD_REPO_NAME="hotwired/dev-builds"
28+
DEV_BUILD_ORIGIN_URL="https://${1}@github.com/${DEV_BUILD_REPO_NAME}.git"
29+
BUILD_PATH="$HOME/publish-dev-build"
30+
31+
cd "$GITHUB_WORKSPACE"
32+
33+
_IFS="$IFS"
34+
IFS=$'\n'
35+
package_list="$(yarn -s lerna list --no-private --json 2>/dev/null)"
36+
package_paths=( $(yarn -s lerna exec --no-private pwd 2>/dev/null) )
37+
IFS="$_IFS"
38+
39+
name="$(git log -n 1 --format=format:%cn)"
40+
email="$(git log -n 1 --format=format:%ce)"
41+
subject="$(git log -n 1 --format=format:%s)"
42+
date="$(git log -n 1 --format=format:%ai)"
43+
url="https://github.com/${GITHUB_REPOSITORY}/tree/${GITHUB_SHA}"
44+
45+
for package_path in "${package_paths[@]}"; do
46+
pushd "$package_path"
47+
package_name="$(package-name)"
48+
tag="${package_name}/${GITHUB_SHA:0:7}"
49+
message="$tag $subject"$'\n'$'\n'"$url"
50+
popd
51+
52+
mkdir -p "$BUILD_PATH"
53+
54+
pushd "$BUILD_PATH"
55+
git init .
56+
git remote add origin "$DEV_BUILD_ORIGIN_URL"
57+
git symbolic-ref HEAD refs/heads/publish-dev-build
58+
59+
shopt -s nullglob
60+
cp -R "$package_path"/{*.json,*.js,dist} . || true
61+
shopt -u nullglob
62+
rewrite-package-json
63+
git add .
64+
65+
GIT_AUTHOR_DATE="$date" GIT_COMMITTER_DATE="$date" \
66+
GIT_AUTHOR_NAME="$name" GIT_COMMITTER_NAME="$name" \
67+
GIT_AUTHOR_EMAIL="$email" GIT_COMMITTER_EMAIL="$email" \
68+
git commit -m "$message"
69+
70+
git tag "$tag"
71+
[ "$GITHUB_REF" != "refs/heads/main" ] || git tag -f "${package_name}/latest"
72+
git push -f --tags
73+
popd
74+
75+
rm -fr "$BUILD_PATH"
76+
done
77+
78+
echo done

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: '12.4.0'
15+
- uses: actions/cache@v2
16+
with:
17+
path: |
18+
node_modules
19+
*/*/node_modules
20+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
21+
22+
- run: yarn install
23+
24+
- name: Test
25+
run: yarn test
26+
27+
- name: Publish dev build
28+
run: .github/scripts/publish-dev-build '${{ secrets.DEV_BUILD_GITHUB_TOKEN }}'
29+
if: ${{ github.event_name == 'push' }}

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.4.0
1+
16.2.0

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### A modest JavaScript framework for the HTML you already have
44

5-
Stimulus is a JavaScript framework with modest ambitions. It doesn't seek to take over your entire front-end—in fact, it's not concerned with rendering HTML at all. Instead, it's designed to augment your HTML with just enough behavior to make it shine. Stimulus pairs beautifully with [Turbolinks](https://github.com/turbolinks/turbolinks) to provide a complete solution for fast, compelling applications with a minimal amount of effort.
5+
Stimulus is a JavaScript framework with modest ambitions. It doesn't seek to take over your entire front-end—in fact, it's not concerned with rendering HTML at all. Instead, it's designed to augment your HTML with just enough behavior to make it shine. Stimulus pairs beautifully with [Turbo](https://turbo.hotwire.dev) to provide a complete solution for fast, compelling applications with a minimal amount of effort.
66

77
How does it work? Sprinkle your HTML with controller, target, and action attributes:
88

@@ -32,25 +32,25 @@ export default class extends Controller {
3232
}
3333
```
3434

35-
Stimulus continuously watches the page, kicking in as soon as attributes appear or disappear. It works with any update to the DOM, regardless of whether it comes from a full page load, a Turbolinks page change, or an Ajax request. Stimulus manages the whole lifecycle.
35+
Stimulus continuously watches the page, kicking in as soon as attributes appear or disappear. It works with any update to the DOM, regardless of whether it comes from a full page load, a [Turbo](https://turbo.hotwire.dev) page change, or an Ajax request. Stimulus manages the whole lifecycle.
3636

37-
You can write your first controller in five minutes by following along in the [Stimulus Handbook](https://stimulusjs.org/handbook/introduction).
37+
You can write your first controller in five minutes by following along in the [Stimulus Handbook](https://stimulus.hotwire.dev/handbook/introduction).
3838

39-
You can read more about why we created this new framework in [The Origin of Stimulus](https://stimulusjs.org/handbook/origin).
39+
You can read more about why we created this new framework in [The Origin of Stimulus](https://stimulus.hotwire.dev/handbook/origin).
4040

4141
## Installing Stimulus
4242

4343
Stimulus integrates with the [webpack](https://webpack.js.org/) asset packager to automatically load controller files from a folder in your app.
4444

4545
You can use Stimulus with other asset packaging systems, too. And if you prefer no build step at all, just drop a `<script>` tag on the page and get right down to business.
4646

47-
See the [Installation Guide](https://stimulusjs.org/handbook/installing) for detailed instructions.
47+
See the [Installation Guide](https://stimulus.hotwire.dev/handbook/installing) for detailed instructions.
4848

4949
## Getting Help & Contributing Back
5050

51-
Looking for the docs? Once you've read through the Handbook, consult the [Stimulus Reference](https://stimulusjs.org/reference/controllers) for API details.
51+
Looking for the docs? Once you've read through the Handbook, consult the [Stimulus Reference](https://stimulus.hotwire.dev/reference/controllers) for API details.
5252

53-
Have a question about Stimulus? Connect with other Stimulus developers on the [Stimulus Discourse](https://discourse.stimulusjs.org/) community forum.
53+
Have a question about Stimulus? Connect with other Stimulus developers on the [Hotwire Discourse](https://discuss.hotwire.dev/) community forum.
5454

5555
Find a bug? Head over to our [issue tracker](https://github.com/stimulusjs/stimulus/issues) and we'll do our best to help. We love pull requests, too!
5656

@@ -60,7 +60,7 @@ We expect all Stimulus contributors to abide by the terms of our [Code of Conduc
6060

6161
Stimulus is [MIT-licensed](LICENSE.md) open-source software from [Basecamp](https://basecamp.com/), the creators of [Ruby on Rails](http://rubyonrails.org).
6262

63-
Continuous integration is generously provided by open-source grants from [CircleCI](https://circleci.com) and [Sauce Labs](https://saucelabs.com/open-source).
63+
Continuous integration VMs generously provided by [Sauce Labs](https://saucelabs.com/open-source).
6464

6565
---
6666

docs/handbook/00_the_origin_of_stimulus.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ And it’s also not to say that the proliferation of single-page JavaScript appl
1717

1818
We wanted Basecamp to feel like that too. As though we had followed the herd and rewritten everything with client-side rendering or gone full-native on mobile.
1919

20-
This desire led us to a two-punch solution: [Turbolinks](https://github.com/turbolinks/turbolinks) and Stimulus.
20+
This desire led us to a two-punch solution: [Turbo](https://turbo.hotwire.dev) and Stimulus.
2121

22-
### Turbolinks up high, Stimulus down low
22+
### Turbo up high, Stimulus down low
2323

24-
Before I get to Stimulus, our new modest JavaScript framework, allow me to recap the proposition of Turbolinks.
24+
Before I get to Stimulus, our new modest JavaScript framework, allow me to recap the proposition of Turbo.
2525

26-
Turbolinks descends from an approach called [pjax](https://github.com/defunkt/jquery-pjax), developed at GitHub. The basic concept remains the same. The reason full-page refreshes often feel slow is not so much because the browser has to process a bunch of HTML sent from a server. Browsers are really good and really fast at that. And in most cases, the fact that an HTML payload tends to be larger than a JSON payload doesn’t matter either (especially with gzipping). No, the reason is that CSS and JavaScript has to be reinitialized and reapplied to the page again. Regardless of whether the files themselves are cached. This can be pretty slow if you have a fair amount of CSS and JavaScript.
26+
Turbo descends from an approach called [pjax](https://github.com/defunkt/jquery-pjax), developed at GitHub. The basic concept remains the same. The reason full-page refreshes often feel slow is not so much because the browser has to process a bunch of HTML sent from a server. Browsers are really good and really fast at that. And in most cases, the fact that an HTML payload tends to be larger than a JSON payload doesn’t matter either (especially with gzipping). No, the reason is that CSS and JavaScript has to be reinitialized and reapplied to the page again. Regardless of whether the files themselves are cached. This can be pretty slow if you have a fair amount of CSS and JavaScript.
2727

28-
To get around this reinitialization, Turbolinks maintains a persistent process, just like single-page applications do. But largely an invisible one. It intercepts links and loads new pages via Ajax. The server still returns fully-formed HTML documents.
28+
To get around this reinitialization, Turbo maintains a persistent process, just like single-page applications do. But largely an invisible one. It intercepts links and loads new pages via Ajax. The server still returns fully-formed HTML documents.
2929

3030
This strategy alone can make most actions in most applications feel really fast (if they’re able to return server responses in 100-200ms, which is eminently possible with caching). For Basecamp, it sped up the page-to-page transition by ~3x. It gives the application that feel of responsiveness and fluidity that was a massive part of the appeal for single-page applications.
3131

32-
But Turbolinks alone is only half the story. The coarsely grained one. Below the grade of a full page change lies all the fine-grained fidelity within a single page. The behavior that shows and hides elements, copies content to a clipboard, adds a new todo to a list, and all the other interactions we associate with a modern web application.
32+
But Turbo alone is only half the story. The coarsely grained one. Below the grade of a full page change lies all the fine-grained fidelity within a single page. The behavior that shows and hides elements, copies content to a clipboard, adds a new todo to a list, and all the other interactions we associate with a modern web application.
3333

3434
Prior to Stimulus, Basecamp used a smattering of different styles and patterns to apply these sprinkles. Some code was just a pinch of jQuery, some code was a similarly sized pinch of vanilla JavaScript, and some again was larger object-oriented subsystems. They all usually worked off explicit event handling hanging off a `data-behavior` attribute.
3535

@@ -50,7 +50,7 @@ It’s designed to read as a progressive enhancement when you look at the HTML i
5050

5151
You can read that and have a pretty good idea of what’s going on. Even without knowing anything about Stimulus or looking at the controller code itself. It’s almost like pseudocode. That’s very different from reading a slice of HTML that has an external JavaScript file apply event handlers to it. It also maintains the separation of concerns that has been lost in many contemporary JavaScript frameworks.
5252

53-
As you can see, Stimulus doesn’t bother itself with creating the HTML. Rather, it attaches itself to an existing HTML document. The HTML is, in the majority of cases, rendered on the server either on the page load (first hit or via Turbolinks) or via an Ajax request that changes the DOM.
53+
As you can see, Stimulus doesn’t bother itself with creating the HTML. Rather, it attaches itself to an existing HTML document. The HTML is, in the majority of cases, rendered on the server either on the page load (first hit or via Turbo) or via an Ajax request that changes the DOM.
5454

5555
Stimulus is concerned with manipulating this existing HTML document. Sometimes that means adding a CSS class that hides an element or animates it or highlights it. Sometimes it means rearranging elements in groupings. Sometimes it means manipulating the content of an element, like when we transform UTC times that can be cached into local times that can be displayed.
5656

@@ -63,7 +63,7 @@ This makes Stimulus very different from the majority of contemporary JavaScript
6363

6464
Stimulus also differs on the question of state. Most frameworks have ways of maintaining state within JavaScript objects, and then render HTML based on that state. Stimulus is the exact opposite. State is stored in the HTML, so that controllers can be discarded between page changes, but still reinitialize as they were when the cached HTML appears again.
6565

66-
It really is a remarkably different paradigm. One that I’m sure many veteran JavaScript developers who’ve been used to work with contemporary frameworks will scoff at. And hey, scoff away. If you’re happy with the complexity and effort it takes to maintain an application within the maelstrom of, say, React + Redux, then Turbolinks + Stimulus will not appeal to you.
66+
It really is a remarkably different paradigm. One that I’m sure many veteran JavaScript developers who’ve been used to work with contemporary frameworks will scoff at. And hey, scoff away. If you’re happy with the complexity and effort it takes to maintain an application within the maelstrom of, say, React + Redux, then Turbo + Stimulus will not appeal to you.
6767

6868
If, on the other hand, you have nagging sense that what you’re working on does not warrant the intense complexity and application separation such contemporary techniques imply, then you’re likely to find refuge in our approach.
6969

@@ -74,7 +74,7 @@ At Basecamp we’ve used this architecture across several different versions of
7474

7575
In fact, it feels like the same kind of secret sauce we had at Basecamp when we developed [Ruby on Rails](https://rubyonrails.org/). The sense that contemporary mainstream approaches are needlessly convoluted, and that we can do more, faster, with far less.
7676

77-
Furthermore, you don’t even have to choose. Stimulus and Turbolinks work great in conjunction with other, heavier approaches. If 80% of your application does not warrant the big rig, consider using our two-pack punch for that. Then roll out the heavy machinery for the part of your application that can really benefit from it.
77+
Furthermore, you don’t even have to choose. Stimulus and Turbo work great in conjunction with other, heavier approaches. If 80% of your application does not warrant the big rig, consider using our two-pack punch for that. Then roll out the heavy machinery for the part of your application that can really benefit from it.
7878

7979
At Basecamp, we have and do use several heavier-duty approaches when the occasion calls for it. Our calendars tend to use client-side rendering. Our text editor is [Trix](https://trix-editor.org/), a fully formed text processor that wouldn’t make sense as a set of Stimulus controllers.
8080

docs/handbook/02_hello_stimulus.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ The best way to learn how Stimulus works is to build a simple controller. This c
88

99
## Prerequisites
1010

11-
To follow along, you'll need a running copy of the [`stimulus-starter`](https://github.com/stimulusjs/stimulus-starter) project, which is a preconfigured blank slate for exploring Stimulus.
11+
To follow along, you'll need a running copy of the [`stimulus-starter`](https://github.com/hotwired/stimulus-starter) project, which is a preconfigured blank slate for exploring Stimulus.
1212

13-
We recommend [remixing `stimulus-starter` on Glitch](https://glitch.com/edit/#!/import/git?url=https://github.com/stimulusjs/stimulus-starter.git) so you can work entirely in your browser without installing anything:
13+
We recommend [remixing `stimulus-starter` on Glitch](https://glitch.com/edit/#!/import/git?url=https://github.com/hotwired/stimulus-starter.git) so you can work entirely in your browser without installing anything:
1414

15-
[![Remix on Glitch](https://cdn.glitch.com/2703baf2-b643-4da7-ab91-7ee2a2d00b5b%2Fremix-button.svg)](https://glitch.com/edit/#!/import/git?url=https://github.com/stimulusjs/stimulus-starter.git)
15+
[![Remix on Glitch](https://cdn.glitch.com/2703baf2-b643-4da7-ab91-7ee2a2d00b5b%2Fremix-button.svg)](https://glitch.com/edit/#!/import/git?url=https://github.com/hotwired/stimulus-starter.git)
1616

1717
Or, if you'd prefer to work from the comfort of your own text editor, you'll need to clone and set up `stimulus-starter`:
1818

1919
```
20-
$ git clone https://github.com/stimulusjs/stimulus-starter.git
20+
$ git clone https://github.com/hotwired/stimulus-starter.git
2121
$ cd stimulus-starter
2222
$ yarn install
2323
$ yarn start

docs/handbook/05_managing_state.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permalink: /handbook/managing-state
66

77
Most contemporary frameworks encourage you to keep state in JavaScript at all times. They treat the DOM as a write-only rendering target, reconciled by client-side templates consuming JSON from the server.
88

9-
Stimulus takes a different approach. A Stimulus application's state lives as attributes in the DOM; controllers themselves are largely stateless. This approach makes it possible to work with HTML from anywhere—the initial document, an Ajax request, a Turbolinks visit, or even another JavaScript library—and have associated controllers spring to life automatically without any explicit initialization step.
9+
Stimulus takes a different approach. A Stimulus application's state lives as attributes in the DOM; controllers themselves are largely stateless. This approach makes it possible to work with HTML from anywhere—the initial document, an Ajax request, a Turbo visit, or even another JavaScript library—and have associated controllers spring to life automatically without any explicit initialization step.
1010

1111
## Building a Slideshow
1212

0 commit comments

Comments
 (0)