fastlane-plugin-yarn 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f12b9cacbde76c69ad57c4618c2c5939b966ccbab6b696bbff3476ff06d67a76
|
4
|
+
data.tar.gz: 87110064759967fc957c1d689d8c6a16d4654ab90693a0f0e8a6ab020e14748b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6341970a340238ae18c831abef8198f8da7697957031ffe8bc36d4694610e82b4403146e98e740a756d7d7325f77e0b850219fd3973d7535bf2d2da3c5a95a5
|
7
|
+
data.tar.gz: 841e1d372d8e0d59c5884d10402ad20aab2721ead9e79e2d006506a286412923d980f1369774cfbfc9e5df1ec61815ee7ed9479b575527d93487edcc98dd8e3d
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# yarn plugin
|
2
2
|
|
3
3
|
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-yarn)
|
4
|
+
[![Gem](https://img.shields.io/gem/v/fastlane-plugin-yarn.svg)](https://rubygems.org/gems/fastlane-plugin-yarn/versions/1.1)
|
4
5
|
|
5
6
|
## Getting Started
|
6
7
|
|
@@ -18,10 +19,34 @@ When using the yarn action in your fastfile, it will install any dependencies th
|
|
18
19
|
It will by default look for your package.json file in the root directory, or you can choose a different location.
|
19
20
|
```ruby
|
20
21
|
yarn(
|
21
|
-
|
22
|
+
command: "test",
|
22
23
|
package_path: "../package.json"
|
23
24
|
)
|
24
25
|
```
|
26
|
+
|
27
|
+
Yarn Options
|
28
|
+
|
29
|
+
```
|
30
|
+
+---------------------------+---------------------------+---------------------------+---------+
|
31
|
+
| yarn Options |
|
32
|
+
+---------------------------+---------------------------+---------------------------+---------+
|
33
|
+
| Key | Description | Env Var | Default |
|
34
|
+
+---------------------------+---------------------------+---------------------------+---------+
|
35
|
+
| flags | Flags you want Yarn to | YARN_FLAGS | |
|
36
|
+
| | perform as listed in | | |
|
37
|
+
| | package.json file | | |
|
38
|
+
| command | Command you want Yarn to | YARN_COMMAND | |
|
39
|
+
| | perform, e.g. 'add' or | | |
|
40
|
+
| | 'upgrade' | | |
|
41
|
+
| package_path | Path to package.json file | PACKAGE_PATH | |
|
42
|
+
| project_root | package.json folder | PROJECT_ROOT | |
|
43
|
+
| options | Options to pass to Yarn | YARN_OPTIONS | |
|
44
|
+
| auto_install_dependencies | Runs yarn install before | AUTO_INSTALL_DEPENDENCIES | false |
|
45
|
+
| | executing any yarn | | |
|
46
|
+
| | command | | |
|
47
|
+
+---------------------------+---------------------------+---------------------------+---------+
|
48
|
+
```
|
49
|
+
|
25
50
|
## Example
|
26
51
|
|
27
52
|
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
@@ -6,15 +6,16 @@ module Fastlane
|
|
6
6
|
command = params[:command]
|
7
7
|
options = params[:options]
|
8
8
|
package_path = params[:package_path]
|
9
|
+
project_root = params[:project_root]
|
9
10
|
|
10
11
|
# create a new object from yarn helper
|
11
|
-
yarn = Helper::YarnHelper.new(package_path: package_path)
|
12
|
+
yarn = Helper::YarnHelper.new(package_path: package_path, project_root: project_root)
|
12
13
|
|
13
14
|
# Check if yarn is installed
|
14
15
|
yarn.check_install
|
15
16
|
|
16
17
|
if params[:auto_install_dependencies]
|
17
|
-
UI.message("
|
18
|
+
UI.message("Installing dependecies")
|
18
19
|
yarn.install_dependencies
|
19
20
|
end
|
20
21
|
|
@@ -55,22 +56,34 @@ module Fastlane
|
|
55
56
|
env_name: "PACKAGE_PATH",
|
56
57
|
description: "Path to package.json file",
|
57
58
|
optional: true,
|
58
|
-
type: String
|
59
|
+
type: String,
|
60
|
+
conflicting_options: [:project_root]),
|
61
|
+
FastlaneCore::ConfigItem.new(key: :project_root,
|
62
|
+
env_name: "PROJECT_ROOT",
|
63
|
+
description: "Folder hosting the package.json",
|
64
|
+
optional: true,
|
65
|
+
type: String,
|
66
|
+
conflicting_options: [:package_path]),
|
59
67
|
FastlaneCore::ConfigItem.new(key: :options,
|
60
68
|
env_name: "YARN_OPTIONS",
|
61
69
|
description: "Options to pass to Yarn",
|
62
70
|
optional: true,
|
63
|
-
|
71
|
+
is_string: false,
|
72
|
+
verify_block: ->(value) {
|
73
|
+
case value when String; when Array;
|
74
|
+
else UI.user_error! "Invalid option: #{value.inspect}, must be an Array or String"
|
75
|
+
end
|
76
|
+
}),
|
64
77
|
FastlaneCore::ConfigItem.new(key: :auto_install_dependencies,
|
65
78
|
env_name: "AUTO_INSTALL_DEPENDENCIES",
|
66
79
|
description: "Runs yarn install before executing any yarn command",
|
67
80
|
optional: true,
|
68
81
|
default_value: false,
|
69
82
|
is_string: false)
|
70
|
-
|
71
83
|
]
|
72
84
|
end
|
73
85
|
|
86
|
+
|
74
87
|
def self.is_supported?(platform)
|
75
88
|
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
76
89
|
# See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
|
@@ -8,13 +8,17 @@ module Fastlane
|
|
8
8
|
attr_accessor :commands
|
9
9
|
attr_accessor :options
|
10
10
|
attr_accessor :package_path
|
11
|
+
attr_accessor :project_root
|
11
12
|
attr_accessor :yarn
|
12
13
|
|
13
|
-
def initialize(package_path: nil)
|
14
|
+
def initialize(package_path: nil, project_root: nil)
|
14
15
|
self.package_path = package_path
|
16
|
+
self.project_root = project_root
|
15
17
|
|
16
18
|
if self.package_path
|
17
19
|
self.yarn = "cd #{File.dirname(self.package_path)} && yarn"
|
20
|
+
elsif self.project_root
|
21
|
+
self.yarn = "cd #{self.project_root} && yarn"
|
18
22
|
else
|
19
23
|
self.yarn = "yarn"
|
20
24
|
end
|
@@ -22,7 +26,10 @@ module Fastlane
|
|
22
26
|
|
23
27
|
# Run a certain action
|
24
28
|
def trigger(command: nil, flags: nil, options: nil, print_command: true, print_command_output: true)
|
25
|
-
|
29
|
+
unless options == "" || options == [] || options == nil then
|
30
|
+
option_string = options.respond_to?(:join) ? "-- #{options.join(" ")}" : "-- #{options}"
|
31
|
+
end
|
32
|
+
command = [self.yarn, flags, command, option_string].compact.join(" ")
|
26
33
|
Action.sh(command, print_command: print_command, print_command_output: print_command_output)
|
27
34
|
end
|
28
35
|
|
@@ -43,15 +50,16 @@ module Fastlane
|
|
43
50
|
end
|
44
51
|
|
45
52
|
def check_package
|
46
|
-
if self.package_path
|
47
|
-
package_path = 'package.json'
|
48
|
-
else
|
53
|
+
if self.package_path
|
49
54
|
package_path = self.package_path
|
55
|
+
elsif self.project_root
|
56
|
+
package_path = File.join(self.project_root, 'package.json')
|
57
|
+
else
|
58
|
+
package_path = 'package.json'
|
50
59
|
end
|
51
60
|
|
52
61
|
unless File.exist?(package_path)
|
53
|
-
UI.
|
54
|
-
raise Errno::ENOENT
|
62
|
+
UI.crash!("Could not find package.json: (#{package_path})")
|
55
63
|
end
|
56
64
|
end
|
57
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-yarn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Lesch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.7.6
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Execute Yarn commands from your Fastfile
|