sewing_kit 0.122.1 → 0.123.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -1
- data/lib/generators/sewing_kit/USAGE +5 -0
- data/lib/generators/sewing_kit/install_generator.rb +34 -0
- data/lib/generators/sewing_kit/templates/editorconfig +15 -0
- data/lib/generators/sewing_kit/templates/eslintignore +2 -0
- data/lib/generators/sewing_kit/templates/package.json +31 -0
- data/lib/generators/sewing_kit/templates/prettierignore +7 -0
- data/lib/generators/sewing_kit/templates/sewing-kit.config.ts +11 -0
- data/lib/sewing_kit/railtie.rb +1 -9
- data/lib/sewing_kit/version.rb +1 -1
- data/lib/tasks/sewing_kit.rake +4 -2
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad8a311afdf9ea5efa60527866ac02247e3c91189a636aa78c9dde602f304e0f
|
4
|
+
data.tar.gz: 65e3897e31a73ae2ec5b3756672a35ccfda44df1d3cffa22a7473193aaf40b3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c0706c23cb462eb4240def360fcfc0d2afd158f3b3db2846290ddcbea176ea94b00ec3a9cbf2471c372ea8cef7668a625bb55fca2f0e8429c8514ee59cc2d65
|
7
|
+
data.tar.gz: d255523fbb50e830708ac1dfaec86aede73ab3b815e0653627cf51488c16f25a234effceea37b177dd9cb28d46a30fa4bff5c7c4160820c7d610eff2796d1ea4
|
data/README.md
CHANGED
@@ -19,6 +19,12 @@ yarn
|
|
19
19
|
dev up
|
20
20
|
```
|
21
21
|
|
22
|
+
### Run generator
|
23
|
+
|
24
|
+
`rails generate sewing_kit:install`
|
25
|
+
|
26
|
+
will generate a package.json file with common sewing-kit script tasks, default lint, format configuration; a sewing-kit configuration file, and other project default configurations.
|
27
|
+
|
22
28
|
### Add JavaScript
|
23
29
|
|
24
30
|
sewing_kit looks for JavaScript in `app/ui/index.js`. The code in `index.js` (and any imported JS/CSS) will be built into a `main` bundle.
|
@@ -146,7 +152,7 @@ If sewing-kit makes a breaking change, this gem's minor version will be bumped t
|
|
146
152
|
|
147
153
|
By moving everything into `package.json#dependencies`. This is necessary because Rails 5.2 prunes `devDependencies` during asset compilation.
|
148
154
|
|
149
|
-
### How can I test a production
|
155
|
+
### How can I test a production version of my changes?
|
150
156
|
|
151
157
|
Ideally, by deploying to a `staging` environment. If that is not possible, a production-like local development experience is available via:
|
152
158
|
|
@@ -176,3 +182,15 @@ SewingKit.configure do |config|
|
|
176
182
|
config.log_level = :warn # may be `:inherit`, `:debug`, `:info`, `:warn`, or `:error`
|
177
183
|
end
|
178
184
|
```
|
185
|
+
|
186
|
+
### How do I run sewing-kit in debug mode?
|
187
|
+
|
188
|
+
You can launch sewing-kit in debug mode by setting the `SK_DEBUG` environment flag.
|
189
|
+
|
190
|
+
```bash
|
191
|
+
$ SK_DEBUG=1 dev run
|
192
|
+
```
|
193
|
+
|
194
|
+
This runs your rails app with the sewing-kit development server in debug mode. This is useful for when you want to debug sewing-kit from a rails app.
|
195
|
+
|
196
|
+
Tip: Install the [Node.js V8 --inspector Manager (NiM)](https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj?hl=en) Chrome extension. This will launch a chrome debugger automatically for you.
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SewingKit
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('templates', __dir__)
|
6
|
+
|
7
|
+
desc "This generator creates a sewing-kit config file."
|
8
|
+
|
9
|
+
def initialize(args, *options)
|
10
|
+
@application_name = Rails.application.class.module_parent.to_s.underscore
|
11
|
+
super(args, *options)
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_package_json
|
15
|
+
package_json_path = "package.json"
|
16
|
+
|
17
|
+
copy_file(package_json_path)
|
18
|
+
gsub_file(package_json_path, "\${application_name}", @application_name)
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_sk_config
|
22
|
+
sk_config_path = "config/sewing-kit.config.ts"
|
23
|
+
|
24
|
+
copy_file("sewing-kit.config.ts", sk_config_path)
|
25
|
+
gsub_file(sk_config_path, "\${application_name}", @application_name)
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_config_files
|
29
|
+
copy_file("editorconfig", ".editorconfig")
|
30
|
+
copy_file("eslintignore", ".eslintignore")
|
31
|
+
copy_file("prettierignore", ".prettierignore")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# editorconfig.org
|
2
|
+
root = true
|
3
|
+
|
4
|
+
[*]
|
5
|
+
charset = utf-8
|
6
|
+
indent_size = 2
|
7
|
+
indent_style = space
|
8
|
+
insert_final_newline = true
|
9
|
+
trim_trailing_whitespace = true
|
10
|
+
|
11
|
+
# Markdown syntax specifies that trailing whitespaces can be meaningful,
|
12
|
+
# so let’s not trim those. e.g. 2 trailing spaces = linebreak (<br />)
|
13
|
+
# See https://daringfireball.net/projects/markdown/syntax#p
|
14
|
+
[*.md]
|
15
|
+
trim_trailing_whitespace = false
|
@@ -0,0 +1,31 @@
|
|
1
|
+
{
|
2
|
+
"name": "${application_name}",
|
3
|
+
"private": true,
|
4
|
+
"sideEffects": false,
|
5
|
+
"scripts": {
|
6
|
+
"dev": "sewing-kit dev",
|
7
|
+
"check": "sewing-kit check",
|
8
|
+
"lint": "sewing-kit lint",
|
9
|
+
"type-check": "sewing-kit type-check",
|
10
|
+
"nuke": "sewing-kit nuke",
|
11
|
+
"test": "sewing-kit test"
|
12
|
+
},
|
13
|
+
"eslintConfig": {
|
14
|
+
"extends": [
|
15
|
+
"plugin:@shopify/typescript",
|
16
|
+
"plugin:@shopify/react",
|
17
|
+
"plugin:@shopify/prettier",
|
18
|
+
"plugin:@shopify/jest",
|
19
|
+
"plugin:@shopify/polaris"
|
20
|
+
]
|
21
|
+
},
|
22
|
+
"prettier": "@shopify/prettier-config",
|
23
|
+
"stylelint": {
|
24
|
+
"extends": [
|
25
|
+
"@shopify/stylelint-plugin/prettier"
|
26
|
+
]
|
27
|
+
},
|
28
|
+
"resolutions": {
|
29
|
+
"babel-plugin-dynamic-import-node": "2.3.0"
|
30
|
+
}
|
31
|
+
}
|
data/lib/sewing_kit/railtie.rb
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'rails'
|
3
3
|
require 'rails/railtie'
|
4
|
-
|
5
|
-
# Force assets:precompile to be defined before sewing_kit's railtie tries to
|
6
|
-
# extend it.
|
7
|
-
require "sprockets/railtie" if defined? Rails
|
8
|
-
# rubocop:disable Lint/HandleExceptions
|
9
|
-
rescue
|
10
|
-
#
|
11
|
-
end
|
12
|
-
# rubocop:enable Lint/HandleExceptions
|
4
|
+
|
13
5
|
require 'sewing_kit/webpack/compiler'
|
14
6
|
require 'sewing_kit/webpack/helper'
|
15
7
|
require 'sewing_kit/webpack/dev'
|
data/lib/sewing_kit/version.rb
CHANGED
data/lib/tasks/sewing_kit.rake
CHANGED
@@ -14,8 +14,10 @@ namespace :sewing_kit do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
if Rake::Task.task_defined?(
|
18
|
-
Rake::Task[
|
17
|
+
if Rake::Task.task_defined?("assets:precompile")
|
18
|
+
Rake::Task["assets:precompile"].enhance do
|
19
19
|
Rake::Task['sewing_kit:build'].invoke
|
20
20
|
end
|
21
|
+
else
|
22
|
+
Rake::Task.define_task("assets:precompile" => %w(sewing_kit:build))
|
21
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sewing_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.123.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Sauve
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -102,6 +102,13 @@ extensions: []
|
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
104
|
- README.md
|
105
|
+
- lib/generators/sewing_kit/USAGE
|
106
|
+
- lib/generators/sewing_kit/install_generator.rb
|
107
|
+
- lib/generators/sewing_kit/templates/editorconfig
|
108
|
+
- lib/generators/sewing_kit/templates/eslintignore
|
109
|
+
- lib/generators/sewing_kit/templates/package.json
|
110
|
+
- lib/generators/sewing_kit/templates/prettierignore
|
111
|
+
- lib/generators/sewing_kit/templates/sewing-kit.config.ts
|
105
112
|
- lib/hacks/user_agent_parser.rb
|
106
113
|
- lib/sewing_kit.rb
|
107
114
|
- lib/sewing_kit/configuration.rb
|