sewing_kit 0.127.0 → 0.128.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/generators/sewing_kit/install_generator.rb +39 -20
- data/lib/generators/sewing_kit/templates/{package.json → package.json.erb} +1 -1
- data/lib/generators/sewing_kit/templates/sewing-kit.config.ts.erb +47 -0
- data/lib/generators/sewing_kit/templates/tsconfig.json.erb +11 -0
- data/lib/sewing_kit/version.rb +1 -1
- data/lib/tasks/sewing_kit.rake +1 -1
- metadata +5 -4
- data/lib/generators/sewing_kit/templates/sewing-kit.config.ts +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a461122bbd1f59afece53f1695188abeb57f7a70bf397c9871a1389a5c3dace0
|
4
|
+
data.tar.gz: 606ece89a71cf2748dd13bf2a1884e428d41365cbdabb9fe98dbbe2c7184e143
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9725a50c0872da10cb36d7882d446d9606177af40055bd309c7874f78de953768c201aacaf02853ce9b83f8ed6c80462e3df81552a225d5c1727e66a64e2df5a
|
7
|
+
data.tar.gz: 14f2b69ef3a1afc0b2cc99275933dd219767dcf9784026fd79d01d3b33c52f2a6adc36fcc2d3b88fc97dad481293f34cc9959e0400c59cf3ee71590721f468a4
|
@@ -3,40 +3,59 @@
|
|
3
3
|
module SewingKit
|
4
4
|
class InstallGenerator < Rails::Generators::Base
|
5
5
|
source_root File.expand_path('templates', __dir__)
|
6
|
+
|
7
|
+
desc "Adds the configuration files for a sewing-kit powered front-end."
|
8
|
+
|
6
9
|
class_option :skip_yarn, type: :boolean, default: false
|
10
|
+
class_option :javascript_path, type: :string, default: 'app/ui'
|
7
11
|
|
8
|
-
|
12
|
+
# We don't specify a default here because we want to fallback dynamically
|
13
|
+
class_option :uses_dev, type: :boolean
|
9
14
|
|
10
|
-
def initialize(args, *
|
11
|
-
|
12
|
-
super(args, *options)
|
13
|
-
end
|
15
|
+
def initialize(args, *opts)
|
16
|
+
super(args, *opts)
|
14
17
|
|
15
|
-
|
16
|
-
|
18
|
+
@application_name = Project.app_name
|
19
|
+
@javascript_path = options[:javascript_path]
|
17
20
|
|
18
|
-
|
19
|
-
|
21
|
+
if Project.uses_webpacker?
|
22
|
+
warn "
|
23
|
+
WARNING: We've detected you currently have webpacker config at config/webpacker.yml.
|
24
|
+
You may experience conflicts between sewing-kit and webpacker's behaviour as build tools.
|
25
|
+
If your app was made with `rails new`, try rerunning it with `--skip-webpack-install --skip-javascript`
|
26
|
+
"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_config_files
|
31
|
+
say "Creating JS tooling config files"
|
32
|
+
copy_file("editorconfig", ".editorconfig")
|
33
|
+
copy_file("eslintignore", ".eslintignore")
|
34
|
+
copy_file("prettierignore", ".prettierignore")
|
35
|
+
template("package.json.erb", "package.json")
|
36
|
+
template("tsconfig.json.erb", "tsconfig.json")
|
37
|
+
template("sewing-kit.config.ts.erb", "config/sewing-kit.config.ts")
|
20
38
|
end
|
21
39
|
|
22
40
|
def install_js_dependencies
|
23
41
|
return if options.skip_yarn?
|
24
|
-
|
25
|
-
say "Installing react and types dependencies"
|
42
|
+
say "Installing javascript dependencies"
|
26
43
|
system("yarn add @shopify/sewing-kit")
|
44
|
+
system("yarn add typescript")
|
27
45
|
end
|
28
46
|
|
29
|
-
|
30
|
-
|
47
|
+
class Project
|
48
|
+
def self.app_name
|
49
|
+
Rails.application.class.module_parent.to_s.underscore
|
50
|
+
end
|
31
51
|
|
32
|
-
|
33
|
-
|
34
|
-
|
52
|
+
def self.uses_dev?
|
53
|
+
File.exist?('dev.yml')
|
54
|
+
end
|
35
55
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
copy_file("prettierignore", ".prettierignore")
|
56
|
+
def self.uses_webpacker?
|
57
|
+
File.exist?('config/webpacker.yml')
|
58
|
+
end
|
40
59
|
end
|
41
60
|
end
|
42
61
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/* eslint-env node */
|
2
|
+
import {resolve} from 'path';
|
3
|
+
|
4
|
+
import {Plugins, Env} from '@shopify/sewing-kit';
|
5
|
+
|
6
|
+
const ROOT_PATH = resolve(__dirname, '..');
|
7
|
+
|
8
|
+
export default function sewingKitConfig(plugins: Plugins, env: Env) {
|
9
|
+
return {
|
10
|
+
name: '<%= @application_name %>',
|
11
|
+
plugins: [
|
12
|
+
plugins.paths({
|
13
|
+
// Determines where the root directory for front-end code is
|
14
|
+
app: resolve(ROOT_PATH, '<%= @javascript_path %>'),
|
15
|
+
// Determines where test setup should go for front-end code
|
16
|
+
tests: resolve(ROOT_PATH, '<%= @javascript_path %>', 'tests'),
|
17
|
+
}),
|
18
|
+
|
19
|
+
<% unless @uses_dev %>
|
20
|
+
// Sets up the app to get its assets from the default webpack endpoint in development.
|
21
|
+
// You will need to change this to use your actual production cdn to get it working in production.
|
22
|
+
// NOTE: If you are using dev and shopify-cloud gem you can delete this.
|
23
|
+
plugins.cdn(
|
24
|
+
env.isDevelopment ? 'http://localhost:8080/webpack/assets/' : undefined,
|
25
|
+
),
|
26
|
+
<% end %>
|
27
|
+
// Sets up sewing-kit to generate type definitions for GraphQL using the given schema(s)
|
28
|
+
// Uncomment the following if you are using GraphQL and make sure the path points to your generated schema
|
29
|
+
// plugins.graphql({
|
30
|
+
// schema: resolve(__dirname, '..', 'app', 'graphql', 'schema.graphql'),
|
31
|
+
// }),
|
32
|
+
|
33
|
+
// Sets up sass mixins to be automatically imported.
|
34
|
+
// Uncomment if you are using Polaris and want access to the sass mixins in your custom SCSS
|
35
|
+
// plugins.sass({
|
36
|
+
// autoInclude: [
|
37
|
+
// path.join(
|
38
|
+
// __dirname,
|
39
|
+
// 'node_modules/@shopify/polaris/dist/styles/_public-api.scss',
|
40
|
+
// ),
|
41
|
+
// ],
|
42
|
+
// }),
|
43
|
+
|
44
|
+
// configure additional sewing-kit plugins here
|
45
|
+
],
|
46
|
+
};
|
47
|
+
}
|
data/lib/sewing_kit/version.rb
CHANGED
data/lib/tasks/sewing_kit.rake
CHANGED
@@ -4,7 +4,7 @@ TEMPLATE_PATH = File.expand_path("../install/template.rb", File.dirname(__FILE__
|
|
4
4
|
namespace :sewing_kit do
|
5
5
|
desc "Install all of Shopify’s modern FED tooling"
|
6
6
|
task :install do
|
7
|
-
exec "
|
7
|
+
exec "bundle exec rails generate sewing_kit:install"
|
8
8
|
end
|
9
9
|
|
10
10
|
desc "Build webpack asset bundles"
|
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.128.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-07-
|
11
|
+
date: 2020-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -106,9 +106,10 @@ files:
|
|
106
106
|
- lib/generators/sewing_kit/install_generator.rb
|
107
107
|
- lib/generators/sewing_kit/templates/editorconfig
|
108
108
|
- lib/generators/sewing_kit/templates/eslintignore
|
109
|
-
- lib/generators/sewing_kit/templates/package.json
|
109
|
+
- lib/generators/sewing_kit/templates/package.json.erb
|
110
110
|
- lib/generators/sewing_kit/templates/prettierignore
|
111
|
-
- lib/generators/sewing_kit/templates/sewing-kit.config.ts
|
111
|
+
- lib/generators/sewing_kit/templates/sewing-kit.config.ts.erb
|
112
|
+
- lib/generators/sewing_kit/templates/tsconfig.json.erb
|
112
113
|
- lib/hacks/user_agent_parser.rb
|
113
114
|
- lib/sewing_kit.rb
|
114
115
|
- lib/sewing_kit/configuration.rb
|
@@ -1,11 +0,0 @@
|
|
1
|
-
/* eslint-env node */
|
2
|
-
|
3
|
-
import {Plugins, Env} from '@shopify/sewing-kit';
|
4
|
-
|
5
|
-
export default function sewingKitConfig(plugins: Plugins, env: Env) {
|
6
|
-
return {
|
7
|
-
name: '${application_name}',
|
8
|
-
// remove cdn plugin when using dev
|
9
|
-
plugins: [plugins.cdn(env.isDevelopment ? 'http://localhost:8080/webpack/assets/' : undefined)],
|
10
|
-
};
|
11
|
-
}
|