提交 86b489e3 编写于 作者: J Javan Makhmali

Move all npm packages to @rails scope

Fixes #33083
上级 7aaf9b80
......@@ -109,13 +109,14 @@ browser.
This will stop you from looking silly when you push an RC to rubygems.org and
then realize it is broken.
### Release to RubyGems and NPM.
IMPORTANT: The Action Cable client and Action View's UJS adapter are released
as NPM packages, so you must have Node.js installed, have an NPM account
(npmjs.com), and be a package owner for `actioncable` and `rails-ujs` (you can
check this via `npm owner ls actioncable` and `npm owner ls rails-ujs`) in
order to do a full release. Do not release until you're set up with NPM!
### Release to RubyGems and npm.
IMPORTANT: Several gems have JavaScript components that are released as npm
packages, so you must have Node.js installed, have an npm account (npmjs.com),
and be a package owner for `@rails/actioncable`, `@rails/actiontext`,
`@rails/activestorage`, and `@rails/ujs`. You can check this by making sure your
npm user (`npm whoami`) is listed as an owner (`npm owner ls <pkg>`) of each
package. Do not release until you're set up with npm!
The release task will sign the release tag. If you haven't got commit signing
set up, use https://git-scm.com/book/tr/v2/Git-Tools-Signing-Your-Work as a
......
......@@ -504,7 +504,7 @@ WebSocket functionality.
### Installation
```
npm install actioncable --save
npm install @rails/actioncable --save
```
### Usage
......@@ -516,7 +516,7 @@ provided.
In JavaScript...
```javascript
ActionCable = require('actioncable')
ActionCable = require('@rails/actioncable')
var cable = ActionCable.createConsumer('wss://RAILS-API-PATH.com/cable')
......@@ -528,7 +528,7 @@ cable.subscriptions.create('AppearanceChannel', {
and in CoffeeScript...
```coffeescript
ActionCable = require('actioncable')
ActionCable = require('@rails/actioncable')
cable = ActionCable.createConsumer('wss://RAILS-API-PATH.com/cable')
......
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
import ActionCable from "actioncable"
import ActionCable from "@rails/actioncable"
export default ActionCable.createConsumer()
{
"name": "actioncable",
"name": "@rails/actioncable",
"version": "6.0.0-alpha",
"description": "WebSocket framework for Ruby on Rails.",
"main": "app/assets/javascripts/action_cable.js",
......
import { DirectUpload } from "activestorage"
import { DirectUpload } from "@rails/activestorage"
export class AttachmentUpload {
constructor(attachment, element) {
......
......@@ -8,15 +8,14 @@
copy_file "#{__dir__}/../../app/views/active_storage/blobs/_blob.html.erb",
"app/views/active_storage/blobs/_blob.html.erb"
# FIXME: Replace with release version on release
say "Installing JavaScript dependency"
run "yarn add https://github.com/rails/actiontext"
run "yarn add @rails/actiontext"
APPLICATION_PACK_PATH = "app/javascript/packs/application.js"
if File.exist?(APPLICATION_PACK_PATH) && File.read(APPLICATION_PACK_PATH) !~ /import "actiontext"/
if File.exist?(APPLICATION_PACK_PATH) && File.read(APPLICATION_PACK_PATH) !~ /import "@rails\/actiontext"/
say "Adding import to default JavaScript pack"
append_to_file APPLICATION_PACK_PATH, <<-EOS
import "actiontext"
import "@rails/actiontext"
EOS
end
{
"name": "actiontext",
"name": "@rails/actiontext",
"version": "6.0.0-alpha",
"description": "Edit and display rich text in Rails applications",
"main": "app/javascript/actiontext/index.js",
......@@ -21,7 +21,7 @@
],
"license": "MIT",
"dependencies": {
"trix": ">=1.0.0",
"activestorage": "6.0.0-alpha"
"trix": "^1.0.0",
"@rails/activestorage": "^6.0.0-alpha"
}
}
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"activestorage@>= 5.2.0-rc1":
version "5.2.0-rc1"
resolved "https://registry.yarnpkg.com/activestorage/-/activestorage-5.2.0-rc1.tgz#79898996eceb0f13575eff41fb109051fbfa49b0"
trix@^0.11.1:
version "0.11.1"
resolved "https://registry.yarnpkg.com/trix/-/trix-0.11.1.tgz#ffe54f2757c2c2385b8424fd5c5d2ab712a09acc"
......@@ -17,11 +17,11 @@ Note that the `data` attributes this library adds are a feature of HTML5. If you
### NPM
npm install rails-ujs --save
npm install @rails/ujs --save
### Yarn
yarn add rails-ujs
yarn add @rails/ujs
Ensure that `.yarnclean` does not include `assets` if you use [yarn autoclean](https://yarnpkg.com/lang/en/docs/cli/autoclean/).
......@@ -40,7 +40,7 @@ In a conventional Rails application that uses the asset pipeline, require `rails
If you're using the Webpacker gem or some other JavaScript bundler, add the following to your main JS file:
```javascript
import Rails from 'rails-ujs';
import Rails from "@rails/ujs"
Rails.start()
```
......
{
"name": "rails-ujs",
"name": "@rails/ujs",
"version": "6.0.0-alpha",
"description": "Ruby on Rails unobtrusive scripting adapter",
"main": "lib/assets/compiled/rails-ujs.js",
......
......@@ -118,7 +118,7 @@ Active Storage, with its included JavaScript library, supports uploading directl
```
Using the npm package:
```js
import * as ActiveStorage from "activestorage"
import * as ActiveStorage from "@rails/activestorage"
ActiveStorage.start()
```
2. Annotate file inputs with the direct upload URL.
......
{
"name": "activestorage",
"name": "@rails/activestorage",
"version": "6.0.0-alpha",
"description": "Attach cloud and local files in Rails applications",
"main": "app/assets/javascripts/activestorage.js",
......
......@@ -151,7 +151,7 @@ established using the following JavaScript, which is generated by default by Rai
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
import ActionCable from "actioncable"
import ActionCable from "@rails/actioncable"
export default ActionCable.createConsumer()
```
......
......@@ -489,7 +489,7 @@ directly from the client to the cloud.
Using the npm package:
```js
import * as ActiveStorage from "activestorage"
import * as ActiveStorage from "@rails/activestorage"
ActiveStorage.start()
```
......@@ -616,7 +616,7 @@ of choice, instantiate a DirectUpload and call its create method. Create takes
a callback to invoke when the upload completes.
```js
import { DirectUpload } from "activestorage"
import { DirectUpload } from "@rails/activestorage"
const input = document.querySelector('input[type=file]')
......@@ -664,7 +664,7 @@ will call the object's `directUploadWillStoreFileWithXHR` method. You can then
bind your own progress handler on the XHR.
```js
import { DirectUpload } from "activestorage"
import { DirectUpload } from "@rails/activestorage"
class Uploader {
constructor(file, url) {
......
......@@ -2,6 +2,7 @@
"private": true,
"workspaces": [
"actioncable",
"actiontext",
"activestorage",
"actionview",
"tmp/templates/app_template",
......
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
import ActionCable from "actioncable"
import ActionCable from "@rails/actioncable"
export default ActionCable.createConsumer()
......@@ -3,7 +3,7 @@
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
import Rails from "rails-ujs"
import Rails from "@rails/ujs"
Rails.start()
<%- unless options[:skip_turbolinks] -%>
......@@ -12,7 +12,7 @@ Turbolinks.start()
<%- end -%>
<%- unless skip_active_storage? -%>
import * as ActiveStorage from "activestorage"
import * as ActiveStorage from "@rails/activestorage"
ActiveStorage.start()
<%- end -%>
<%- unless options[:skip_action_cable] -%>
......
......@@ -2,10 +2,10 @@
"name": "<%= app_name %>",
"private": true,
"dependencies": {
"rails-ujs": ">=5.2.1"<% unless options[:skip_turbolinks] %>,
"turbolinks": "5.1.1"<% end -%><% unless skip_active_storage? %>,
"activestorage": ">=5.2.1"<% end -%><% unless options[:skip_action_cable] %>,
"actioncable": ">=5.2.1"<% end %>
"@rails/ujs": "^6.0.0-alpha"<% unless options[:skip_turbolinks] %>,
"turbolinks": "^5.2.0"<% end -%><% unless skip_active_storage? %>,
"@rails/activestorage": "^6.0.0-alpha"<% end -%><% unless options[:skip_action_cable] %>,
"@rails/actioncable": "^6.0.0-alpha"<% end %>
},
"version": "0.1.0"
}
......@@ -206,7 +206,7 @@ def test_generator_for_active_storage
unless generator_class.name == "Rails::Generators::PluginGenerator"
assert_file "#{application_path}/app/javascript/packs/application.js" do |content|
assert_match(/^import \* as ActiveStorage from "activestorage"\nActiveStorage.start\(\)/, content)
assert_match(/^import \* as ActiveStorage from "@rails\/activestorage"\nActiveStorage.start\(\)/, content)
end
end
......@@ -267,7 +267,7 @@ def test_generator_does_not_generate_active_storage_contents_if_skip_active_reco
assert_file "#{application_path}/config/application.rb", /#\s+require\s+["']active_storage\/engine["']/
assert_file "#{application_path}/app/javascript/packs/application.js" do |content|
assert_no_match(/^import * as ActiveStorage from "activestorage"\nActiveStorage.start\(\)/, content)
assert_no_match(/^import * as ActiveStorage from "@rails\/activestorage"\nActiveStorage.start\(\)/, content)
end
assert_file "#{application_path}/config/environments/development.rb" do |content|
......
......@@ -5692,6 +5692,11 @@ trim-right@^1.0.1:
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=
trix@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/trix/-/trix-1.0.0.tgz#e9cc98cf6030c908f8d54e317b5b072f927b0c6b"
integrity sha512-feli9QVXe6gzZOCUfpPGpNDURW9jMciIRVQ5gkDudOctcA1oMtI5K/qEbsL2rFCoGl1rSoeRt+HPhIFGyQscKg==
tslib@^1.9.0:
version "1.9.3"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册