zapier-platform-cli 17.7.1 → 17.8.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.
- package/oclif.manifest.json +190 -179
- package/package.json +1 -2
- package/src/oclif/commands/delete/version.js +0 -1
- package/src/oclif/commands/migrate.js +2 -2
- package/src/oclif/commands/push.js +19 -0
- package/src/oclif/commands/validate.js +12 -4
- package/src/utils/api.js +4 -3
- package/src/utils/build.js +2 -1
- package/src/utils/credentials.js +0 -1
- package/src/utils/npm.js +0 -2
- package/src/utils/example-apps.js +0 -89
- package/src/utils/xdg.js +0 -59
package/oclif.manifest.json
CHANGED
|
@@ -1051,14 +1051,14 @@
|
|
|
1051
1051
|
],
|
|
1052
1052
|
"flags": {
|
|
1053
1053
|
"user": {
|
|
1054
|
-
"description": "Migrates
|
|
1054
|
+
"description": "Migrates a user's private Zaps under the user's individual account, excluding organization accounts",
|
|
1055
1055
|
"name": "user",
|
|
1056
1056
|
"hasDynamicHelp": false,
|
|
1057
1057
|
"multiple": false,
|
|
1058
1058
|
"type": "option"
|
|
1059
1059
|
},
|
|
1060
1060
|
"account": {
|
|
1061
|
-
"description": "Migrates
|
|
1061
|
+
"description": "Migrates a user's private and shared Zaps under the user's individual and organization accounts",
|
|
1062
1062
|
"name": "account",
|
|
1063
1063
|
"hasDynamicHelp": false,
|
|
1064
1064
|
"multiple": false,
|
|
@@ -1194,6 +1194,10 @@
|
|
|
1194
1194
|
"aliases": [],
|
|
1195
1195
|
"args": {},
|
|
1196
1196
|
"description": "Build and upload the current integration.\n\nThis command is the same as running `zapier build` and `zapier upload` in sequence. See those for more info.",
|
|
1197
|
+
"examples": [
|
|
1198
|
+
"zapier push",
|
|
1199
|
+
"zapier push --snapshot MY-LABEL"
|
|
1200
|
+
],
|
|
1197
1201
|
"flags": {
|
|
1198
1202
|
"disable-dependency-detection": {
|
|
1199
1203
|
"description": "Disable \"smart\" file inclusion. By default, Zapier only includes files that are required by your entry point (`index.js` by default). If you (or your dependencies) require files dynamically (such as with `require(someVar)`), then you may see \"Cannot find module\" errors. Disabling this may make your `build.zip` too large. If that's the case, try using the `includeInBuild` option in your `.zapierapprc`. See the docs about `includeInBuild` for more info.",
|
|
@@ -1233,6 +1237,13 @@
|
|
|
1233
1237
|
"name": "overwrite-partner-changes",
|
|
1234
1238
|
"allowNo": false,
|
|
1235
1239
|
"type": "boolean"
|
|
1240
|
+
},
|
|
1241
|
+
"snapshot": {
|
|
1242
|
+
"description": "Pass in a label to create a snapshot version of this integration for development and testing purposes. The version will be created as: 0.0.0-MY-LABEL",
|
|
1243
|
+
"name": "snapshot",
|
|
1244
|
+
"hasDynamicHelp": false,
|
|
1245
|
+
"multiple": false,
|
|
1246
|
+
"type": "option"
|
|
1236
1247
|
}
|
|
1237
1248
|
},
|
|
1238
1249
|
"hasDynamicHelp": false,
|
|
@@ -1719,6 +1730,182 @@
|
|
|
1719
1730
|
"clear.js"
|
|
1720
1731
|
]
|
|
1721
1732
|
},
|
|
1733
|
+
"env:get": {
|
|
1734
|
+
"aliases": [],
|
|
1735
|
+
"args": {
|
|
1736
|
+
"version": {
|
|
1737
|
+
"description": "The version to get the environment for.",
|
|
1738
|
+
"name": "version",
|
|
1739
|
+
"required": true
|
|
1740
|
+
}
|
|
1741
|
+
},
|
|
1742
|
+
"description": "Get environment variables for a version.",
|
|
1743
|
+
"examples": [
|
|
1744
|
+
"zapier env:get 1.2.3"
|
|
1745
|
+
],
|
|
1746
|
+
"flags": {
|
|
1747
|
+
"debug": {
|
|
1748
|
+
"char": "d",
|
|
1749
|
+
"description": "Show extra debugging output.",
|
|
1750
|
+
"name": "debug",
|
|
1751
|
+
"allowNo": false,
|
|
1752
|
+
"type": "boolean"
|
|
1753
|
+
},
|
|
1754
|
+
"format": {
|
|
1755
|
+
"char": "f",
|
|
1756
|
+
"description": "Change the way structured data is presented. If \"json\" or \"raw\", you can pipe the output of the command into other tools, such as jq.",
|
|
1757
|
+
"name": "format",
|
|
1758
|
+
"default": "table",
|
|
1759
|
+
"hasDynamicHelp": false,
|
|
1760
|
+
"multiple": false,
|
|
1761
|
+
"options": [
|
|
1762
|
+
"plain",
|
|
1763
|
+
"json",
|
|
1764
|
+
"raw",
|
|
1765
|
+
"row",
|
|
1766
|
+
"table"
|
|
1767
|
+
],
|
|
1768
|
+
"type": "option"
|
|
1769
|
+
},
|
|
1770
|
+
"invokedFromAnotherCommand": {
|
|
1771
|
+
"hidden": true,
|
|
1772
|
+
"name": "invokedFromAnotherCommand",
|
|
1773
|
+
"allowNo": false,
|
|
1774
|
+
"type": "boolean"
|
|
1775
|
+
}
|
|
1776
|
+
},
|
|
1777
|
+
"hasDynamicHelp": false,
|
|
1778
|
+
"hiddenAliases": [],
|
|
1779
|
+
"id": "env:get",
|
|
1780
|
+
"pluginAlias": "zapier-platform-cli",
|
|
1781
|
+
"pluginName": "zapier-platform-cli",
|
|
1782
|
+
"pluginType": "core",
|
|
1783
|
+
"strict": true,
|
|
1784
|
+
"enableJsonFlag": false,
|
|
1785
|
+
"skipValidInstallCheck": true,
|
|
1786
|
+
"isESM": false,
|
|
1787
|
+
"relativePath": [
|
|
1788
|
+
"src",
|
|
1789
|
+
"oclif",
|
|
1790
|
+
"commands",
|
|
1791
|
+
"env",
|
|
1792
|
+
"get.js"
|
|
1793
|
+
]
|
|
1794
|
+
},
|
|
1795
|
+
"env:set": {
|
|
1796
|
+
"aliases": [],
|
|
1797
|
+
"args": {
|
|
1798
|
+
"version": {
|
|
1799
|
+
"description": "The version to set the environment for. Values are copied forward when a new version is created, but this command will only ever affect the specified version.",
|
|
1800
|
+
"name": "version",
|
|
1801
|
+
"required": true
|
|
1802
|
+
},
|
|
1803
|
+
"key-value pairs...": {
|
|
1804
|
+
"description": "The key-value pairs to set. Keys are case-insensitive. Each pair should be space separated and pairs should be separated by an `=`. For example: `A=123 B=456`",
|
|
1805
|
+
"name": "key-value pairs..."
|
|
1806
|
+
}
|
|
1807
|
+
},
|
|
1808
|
+
"description": "Set environment variables for a version.",
|
|
1809
|
+
"examples": [
|
|
1810
|
+
"zapier env:set 1.2.3 SECRET=12345 OTHER=4321"
|
|
1811
|
+
],
|
|
1812
|
+
"flags": {
|
|
1813
|
+
"force": {
|
|
1814
|
+
"char": "f",
|
|
1815
|
+
"description": "Force the update of environment variables regardless if the app version is production or not. Use with caution.",
|
|
1816
|
+
"name": "force",
|
|
1817
|
+
"allowNo": false,
|
|
1818
|
+
"type": "boolean"
|
|
1819
|
+
},
|
|
1820
|
+
"debug": {
|
|
1821
|
+
"char": "d",
|
|
1822
|
+
"description": "Show extra debugging output.",
|
|
1823
|
+
"name": "debug",
|
|
1824
|
+
"allowNo": false,
|
|
1825
|
+
"type": "boolean"
|
|
1826
|
+
},
|
|
1827
|
+
"invokedFromAnotherCommand": {
|
|
1828
|
+
"hidden": true,
|
|
1829
|
+
"name": "invokedFromAnotherCommand",
|
|
1830
|
+
"allowNo": false,
|
|
1831
|
+
"type": "boolean"
|
|
1832
|
+
}
|
|
1833
|
+
},
|
|
1834
|
+
"hasDynamicHelp": false,
|
|
1835
|
+
"hiddenAliases": [],
|
|
1836
|
+
"id": "env:set",
|
|
1837
|
+
"pluginAlias": "zapier-platform-cli",
|
|
1838
|
+
"pluginName": "zapier-platform-cli",
|
|
1839
|
+
"pluginType": "core",
|
|
1840
|
+
"strict": false,
|
|
1841
|
+
"enableJsonFlag": false,
|
|
1842
|
+
"skipValidInstallCheck": true,
|
|
1843
|
+
"isESM": false,
|
|
1844
|
+
"relativePath": [
|
|
1845
|
+
"src",
|
|
1846
|
+
"oclif",
|
|
1847
|
+
"commands",
|
|
1848
|
+
"env",
|
|
1849
|
+
"set.js"
|
|
1850
|
+
]
|
|
1851
|
+
},
|
|
1852
|
+
"env:unset": {
|
|
1853
|
+
"aliases": [],
|
|
1854
|
+
"args": {
|
|
1855
|
+
"version": {
|
|
1856
|
+
"description": "The version to set the environment for.",
|
|
1857
|
+
"name": "version",
|
|
1858
|
+
"required": true
|
|
1859
|
+
},
|
|
1860
|
+
"keys...": {
|
|
1861
|
+
"description": "The keys to unset. Keys are case-insensitive.",
|
|
1862
|
+
"name": "keys..."
|
|
1863
|
+
}
|
|
1864
|
+
},
|
|
1865
|
+
"description": "Unset environment variables for a version.",
|
|
1866
|
+
"examples": [
|
|
1867
|
+
"zapier env:unset 1.2.3 SECRET OTHER"
|
|
1868
|
+
],
|
|
1869
|
+
"flags": {
|
|
1870
|
+
"force": {
|
|
1871
|
+
"char": "f",
|
|
1872
|
+
"description": "Force the update of environment variables regardless if the app version is production or not. Use with caution.",
|
|
1873
|
+
"name": "force",
|
|
1874
|
+
"allowNo": false,
|
|
1875
|
+
"type": "boolean"
|
|
1876
|
+
},
|
|
1877
|
+
"debug": {
|
|
1878
|
+
"char": "d",
|
|
1879
|
+
"description": "Show extra debugging output.",
|
|
1880
|
+
"name": "debug",
|
|
1881
|
+
"allowNo": false,
|
|
1882
|
+
"type": "boolean"
|
|
1883
|
+
},
|
|
1884
|
+
"invokedFromAnotherCommand": {
|
|
1885
|
+
"hidden": true,
|
|
1886
|
+
"name": "invokedFromAnotherCommand",
|
|
1887
|
+
"allowNo": false,
|
|
1888
|
+
"type": "boolean"
|
|
1889
|
+
}
|
|
1890
|
+
},
|
|
1891
|
+
"hasDynamicHelp": false,
|
|
1892
|
+
"hiddenAliases": [],
|
|
1893
|
+
"id": "env:unset",
|
|
1894
|
+
"pluginAlias": "zapier-platform-cli",
|
|
1895
|
+
"pluginName": "zapier-platform-cli",
|
|
1896
|
+
"pluginType": "core",
|
|
1897
|
+
"strict": false,
|
|
1898
|
+
"enableJsonFlag": false,
|
|
1899
|
+
"skipValidInstallCheck": true,
|
|
1900
|
+
"isESM": false,
|
|
1901
|
+
"relativePath": [
|
|
1902
|
+
"src",
|
|
1903
|
+
"oclif",
|
|
1904
|
+
"commands",
|
|
1905
|
+
"env",
|
|
1906
|
+
"unset.js"
|
|
1907
|
+
]
|
|
1908
|
+
},
|
|
1722
1909
|
"canary:create": {
|
|
1723
1910
|
"aliases": [],
|
|
1724
1911
|
"args": {
|
|
@@ -1989,182 +2176,6 @@
|
|
|
1989
2176
|
"version.js"
|
|
1990
2177
|
]
|
|
1991
2178
|
},
|
|
1992
|
-
"env:get": {
|
|
1993
|
-
"aliases": [],
|
|
1994
|
-
"args": {
|
|
1995
|
-
"version": {
|
|
1996
|
-
"description": "The version to get the environment for.",
|
|
1997
|
-
"name": "version",
|
|
1998
|
-
"required": true
|
|
1999
|
-
}
|
|
2000
|
-
},
|
|
2001
|
-
"description": "Get environment variables for a version.",
|
|
2002
|
-
"examples": [
|
|
2003
|
-
"zapier env:get 1.2.3"
|
|
2004
|
-
],
|
|
2005
|
-
"flags": {
|
|
2006
|
-
"debug": {
|
|
2007
|
-
"char": "d",
|
|
2008
|
-
"description": "Show extra debugging output.",
|
|
2009
|
-
"name": "debug",
|
|
2010
|
-
"allowNo": false,
|
|
2011
|
-
"type": "boolean"
|
|
2012
|
-
},
|
|
2013
|
-
"format": {
|
|
2014
|
-
"char": "f",
|
|
2015
|
-
"description": "Change the way structured data is presented. If \"json\" or \"raw\", you can pipe the output of the command into other tools, such as jq.",
|
|
2016
|
-
"name": "format",
|
|
2017
|
-
"default": "table",
|
|
2018
|
-
"hasDynamicHelp": false,
|
|
2019
|
-
"multiple": false,
|
|
2020
|
-
"options": [
|
|
2021
|
-
"plain",
|
|
2022
|
-
"json",
|
|
2023
|
-
"raw",
|
|
2024
|
-
"row",
|
|
2025
|
-
"table"
|
|
2026
|
-
],
|
|
2027
|
-
"type": "option"
|
|
2028
|
-
},
|
|
2029
|
-
"invokedFromAnotherCommand": {
|
|
2030
|
-
"hidden": true,
|
|
2031
|
-
"name": "invokedFromAnotherCommand",
|
|
2032
|
-
"allowNo": false,
|
|
2033
|
-
"type": "boolean"
|
|
2034
|
-
}
|
|
2035
|
-
},
|
|
2036
|
-
"hasDynamicHelp": false,
|
|
2037
|
-
"hiddenAliases": [],
|
|
2038
|
-
"id": "env:get",
|
|
2039
|
-
"pluginAlias": "zapier-platform-cli",
|
|
2040
|
-
"pluginName": "zapier-platform-cli",
|
|
2041
|
-
"pluginType": "core",
|
|
2042
|
-
"strict": true,
|
|
2043
|
-
"enableJsonFlag": false,
|
|
2044
|
-
"skipValidInstallCheck": true,
|
|
2045
|
-
"isESM": false,
|
|
2046
|
-
"relativePath": [
|
|
2047
|
-
"src",
|
|
2048
|
-
"oclif",
|
|
2049
|
-
"commands",
|
|
2050
|
-
"env",
|
|
2051
|
-
"get.js"
|
|
2052
|
-
]
|
|
2053
|
-
},
|
|
2054
|
-
"env:set": {
|
|
2055
|
-
"aliases": [],
|
|
2056
|
-
"args": {
|
|
2057
|
-
"version": {
|
|
2058
|
-
"description": "The version to set the environment for. Values are copied forward when a new version is created, but this command will only ever affect the specified version.",
|
|
2059
|
-
"name": "version",
|
|
2060
|
-
"required": true
|
|
2061
|
-
},
|
|
2062
|
-
"key-value pairs...": {
|
|
2063
|
-
"description": "The key-value pairs to set. Keys are case-insensitive. Each pair should be space separated and pairs should be separated by an `=`. For example: `A=123 B=456`",
|
|
2064
|
-
"name": "key-value pairs..."
|
|
2065
|
-
}
|
|
2066
|
-
},
|
|
2067
|
-
"description": "Set environment variables for a version.",
|
|
2068
|
-
"examples": [
|
|
2069
|
-
"zapier env:set 1.2.3 SECRET=12345 OTHER=4321"
|
|
2070
|
-
],
|
|
2071
|
-
"flags": {
|
|
2072
|
-
"force": {
|
|
2073
|
-
"char": "f",
|
|
2074
|
-
"description": "Force the update of environment variables regardless if the app version is production or not. Use with caution.",
|
|
2075
|
-
"name": "force",
|
|
2076
|
-
"allowNo": false,
|
|
2077
|
-
"type": "boolean"
|
|
2078
|
-
},
|
|
2079
|
-
"debug": {
|
|
2080
|
-
"char": "d",
|
|
2081
|
-
"description": "Show extra debugging output.",
|
|
2082
|
-
"name": "debug",
|
|
2083
|
-
"allowNo": false,
|
|
2084
|
-
"type": "boolean"
|
|
2085
|
-
},
|
|
2086
|
-
"invokedFromAnotherCommand": {
|
|
2087
|
-
"hidden": true,
|
|
2088
|
-
"name": "invokedFromAnotherCommand",
|
|
2089
|
-
"allowNo": false,
|
|
2090
|
-
"type": "boolean"
|
|
2091
|
-
}
|
|
2092
|
-
},
|
|
2093
|
-
"hasDynamicHelp": false,
|
|
2094
|
-
"hiddenAliases": [],
|
|
2095
|
-
"id": "env:set",
|
|
2096
|
-
"pluginAlias": "zapier-platform-cli",
|
|
2097
|
-
"pluginName": "zapier-platform-cli",
|
|
2098
|
-
"pluginType": "core",
|
|
2099
|
-
"strict": false,
|
|
2100
|
-
"enableJsonFlag": false,
|
|
2101
|
-
"skipValidInstallCheck": true,
|
|
2102
|
-
"isESM": false,
|
|
2103
|
-
"relativePath": [
|
|
2104
|
-
"src",
|
|
2105
|
-
"oclif",
|
|
2106
|
-
"commands",
|
|
2107
|
-
"env",
|
|
2108
|
-
"set.js"
|
|
2109
|
-
]
|
|
2110
|
-
},
|
|
2111
|
-
"env:unset": {
|
|
2112
|
-
"aliases": [],
|
|
2113
|
-
"args": {
|
|
2114
|
-
"version": {
|
|
2115
|
-
"description": "The version to set the environment for.",
|
|
2116
|
-
"name": "version",
|
|
2117
|
-
"required": true
|
|
2118
|
-
},
|
|
2119
|
-
"keys...": {
|
|
2120
|
-
"description": "The keys to unset. Keys are case-insensitive.",
|
|
2121
|
-
"name": "keys..."
|
|
2122
|
-
}
|
|
2123
|
-
},
|
|
2124
|
-
"description": "Unset environment variables for a version.",
|
|
2125
|
-
"examples": [
|
|
2126
|
-
"zapier env:unset 1.2.3 SECRET OTHER"
|
|
2127
|
-
],
|
|
2128
|
-
"flags": {
|
|
2129
|
-
"force": {
|
|
2130
|
-
"char": "f",
|
|
2131
|
-
"description": "Force the update of environment variables regardless if the app version is production or not. Use with caution.",
|
|
2132
|
-
"name": "force",
|
|
2133
|
-
"allowNo": false,
|
|
2134
|
-
"type": "boolean"
|
|
2135
|
-
},
|
|
2136
|
-
"debug": {
|
|
2137
|
-
"char": "d",
|
|
2138
|
-
"description": "Show extra debugging output.",
|
|
2139
|
-
"name": "debug",
|
|
2140
|
-
"allowNo": false,
|
|
2141
|
-
"type": "boolean"
|
|
2142
|
-
},
|
|
2143
|
-
"invokedFromAnotherCommand": {
|
|
2144
|
-
"hidden": true,
|
|
2145
|
-
"name": "invokedFromAnotherCommand",
|
|
2146
|
-
"allowNo": false,
|
|
2147
|
-
"type": "boolean"
|
|
2148
|
-
}
|
|
2149
|
-
},
|
|
2150
|
-
"hasDynamicHelp": false,
|
|
2151
|
-
"hiddenAliases": [],
|
|
2152
|
-
"id": "env:unset",
|
|
2153
|
-
"pluginAlias": "zapier-platform-cli",
|
|
2154
|
-
"pluginName": "zapier-platform-cli",
|
|
2155
|
-
"pluginType": "core",
|
|
2156
|
-
"strict": false,
|
|
2157
|
-
"enableJsonFlag": false,
|
|
2158
|
-
"skipValidInstallCheck": true,
|
|
2159
|
-
"isESM": false,
|
|
2160
|
-
"relativePath": [
|
|
2161
|
-
"src",
|
|
2162
|
-
"oclif",
|
|
2163
|
-
"commands",
|
|
2164
|
-
"env",
|
|
2165
|
-
"unset.js"
|
|
2166
|
-
]
|
|
2167
|
-
},
|
|
2168
2179
|
"team:add": {
|
|
2169
2180
|
"aliases": [
|
|
2170
2181
|
"team:invite"
|
|
@@ -2544,5 +2555,5 @@
|
|
|
2544
2555
|
]
|
|
2545
2556
|
}
|
|
2546
2557
|
},
|
|
2547
|
-
"version": "17.
|
|
2558
|
+
"version": "17.8.0"
|
|
2548
2559
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zapier-platform-cli",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.8.0",
|
|
4
4
|
"description": "The CLI for managing integrations in Zapier Developer Platform.",
|
|
5
5
|
"repository": "zapier/zapier-platform",
|
|
6
6
|
"homepage": "https://platform.zapier.com/",
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"luxon": "3.6.1",
|
|
65
65
|
"marked": "14.1.4",
|
|
66
66
|
"marked-terminal": "7.2.1",
|
|
67
|
-
"node-fetch": "2.7.0",
|
|
68
67
|
"open": "10.1.2",
|
|
69
68
|
"ora": "5.4.0",
|
|
70
69
|
"parse-gitignore": "0.5.1",
|
|
@@ -152,11 +152,11 @@ MigrateCommand.flags = buildFlags({
|
|
|
152
152
|
commandFlags: {
|
|
153
153
|
user: Flags.string({
|
|
154
154
|
description:
|
|
155
|
-
"Migrates
|
|
155
|
+
"Migrates a user's private Zaps under the user's individual account, excluding organization accounts",
|
|
156
156
|
}),
|
|
157
157
|
account: Flags.string({
|
|
158
158
|
description:
|
|
159
|
-
"Migrates
|
|
159
|
+
"Migrates a user's private and shared Zaps under the user's individual and organization accounts",
|
|
160
160
|
}),
|
|
161
161
|
yes: Flags.boolean({
|
|
162
162
|
char: 'y',
|
|
@@ -6,10 +6,23 @@ const colors = require('colors/safe');
|
|
|
6
6
|
const BuildCommand = require('./build');
|
|
7
7
|
|
|
8
8
|
const { buildAndOrUpload } = require('../../utils/build');
|
|
9
|
+
const { localAppCommand } = require('../../utils/local');
|
|
9
10
|
|
|
10
11
|
class PushCommand extends ZapierBaseCommand {
|
|
11
12
|
async perform() {
|
|
12
13
|
const skipNpmInstall = this.flags['skip-npm-install'];
|
|
14
|
+
const definition = await localAppCommand({ command: 'definition' });
|
|
15
|
+
|
|
16
|
+
const snapshotLabel = this.flags.snapshot;
|
|
17
|
+
if (snapshotLabel && snapshotLabel.length > 18) {
|
|
18
|
+
throw new Error('Snapshot label cannot exceed 18 characters');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const version = snapshotLabel
|
|
22
|
+
? `0.0.0-${snapshotLabel}`
|
|
23
|
+
: definition.version;
|
|
24
|
+
this.throwForInvalidVersion(version);
|
|
25
|
+
|
|
13
26
|
await buildAndOrUpload(
|
|
14
27
|
{ build: true, upload: true },
|
|
15
28
|
{
|
|
@@ -18,6 +31,7 @@ class PushCommand extends ZapierBaseCommand {
|
|
|
18
31
|
skipValidation: this.flags['skip-validation'],
|
|
19
32
|
overwritePartnerChanges: this.flags['overwrite-partner-changes'],
|
|
20
33
|
},
|
|
34
|
+
version,
|
|
21
35
|
);
|
|
22
36
|
this.log(
|
|
23
37
|
`\nPush complete! Built ${BUILD_PATH} and ${SOURCE_PATH} and uploaded them to Zapier.`,
|
|
@@ -38,7 +52,12 @@ PushCommand.flags = {
|
|
|
38
52
|
'(Internal Use Only) Allows Zapier Staff to push changes to integrations in certain situations.',
|
|
39
53
|
hidden: true,
|
|
40
54
|
}),
|
|
55
|
+
snapshot: Flags.string({
|
|
56
|
+
description:
|
|
57
|
+
'Pass in a label to create a snapshot version of this integration for development and testing purposes. The version will be created as: 0.0.0-MY-LABEL',
|
|
58
|
+
}),
|
|
41
59
|
};
|
|
60
|
+
PushCommand.examples = ['zapier push', 'zapier push --snapshot MY-LABEL'];
|
|
42
61
|
PushCommand.description = `Build and upload the current integration.
|
|
43
62
|
|
|
44
63
|
This command is the same as running \`zapier build\` and \`zapier upload\` in sequence. See those for more info.`;
|
|
@@ -62,10 +62,18 @@ class ValidateCommand extends BaseCommand {
|
|
|
62
62
|
checkResult = await validateApp(rawDefinition);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
const success = !checkResult.errors.total_failures;
|
|
66
|
+
const message = 'Integration checks complete';
|
|
67
|
+
this.stopSpinner({ success, message });
|
|
68
|
+
|
|
69
|
+
this.log(` - ${checkResult.passes.length} checks passed`);
|
|
70
|
+
this.log(` - ${checkResult.errors.total_failures} checks failed`);
|
|
71
|
+
this.log(
|
|
72
|
+
` - ${checkResult.warnings.total_failures} checks with publishing warning`,
|
|
73
|
+
);
|
|
74
|
+
this.log(
|
|
75
|
+
` - ${checkResult.suggestions.total_failures} checks with general warning`,
|
|
76
|
+
);
|
|
69
77
|
|
|
70
78
|
const checkIssues = flattenCheckResult(checkResult);
|
|
71
79
|
|
package/src/utils/api.js
CHANGED
|
@@ -11,7 +11,6 @@ const qs = require('querystring');
|
|
|
11
11
|
|
|
12
12
|
const fs = require('fs');
|
|
13
13
|
const AdmZip = require('adm-zip');
|
|
14
|
-
const fetch = require('node-fetch');
|
|
15
14
|
const path = require('path');
|
|
16
15
|
|
|
17
16
|
const { writeFile, readFile } = require('./files');
|
|
@@ -429,6 +428,7 @@ const downloadSourceZip = async (dst) => {
|
|
|
429
428
|
const upload = async (
|
|
430
429
|
app,
|
|
431
430
|
{ skipValidation = false, overwritePartnerChanges = false } = {},
|
|
431
|
+
versionOverride,
|
|
432
432
|
) => {
|
|
433
433
|
const zipPath = constants.BUILD_PATH;
|
|
434
434
|
const sourceZipPath = constants.SOURCE_PATH;
|
|
@@ -461,10 +461,11 @@ const upload = async (
|
|
|
461
461
|
headers['X-Overwrite-Partner-Changes'] = 'true';
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
-
|
|
464
|
+
const version = versionOverride ?? definition.version;
|
|
465
|
+
startSpinner(`Uploading version ${version}`);
|
|
465
466
|
try {
|
|
466
467
|
await callAPI(
|
|
467
|
-
`/apps/${app.id}/versions/${
|
|
468
|
+
`/apps/${app.id}/versions/${version}`,
|
|
468
469
|
{
|
|
469
470
|
method: 'PUT',
|
|
470
471
|
body: {
|
package/src/utils/build.js
CHANGED
|
@@ -761,6 +761,7 @@ const _buildFunc = async ({
|
|
|
761
761
|
const buildAndOrUpload = async (
|
|
762
762
|
{ build = false, upload = false } = {},
|
|
763
763
|
buildOpts,
|
|
764
|
+
versionOverride,
|
|
764
765
|
) => {
|
|
765
766
|
if (!(build || upload)) {
|
|
766
767
|
throw new Error('must either build or upload');
|
|
@@ -777,7 +778,7 @@ const buildAndOrUpload = async (
|
|
|
777
778
|
await _buildFunc(buildOpts);
|
|
778
779
|
}
|
|
779
780
|
if (upload) {
|
|
780
|
-
await _uploadFunc(app, buildOpts);
|
|
781
|
+
await _uploadFunc(app, buildOpts, versionOverride);
|
|
781
782
|
}
|
|
782
783
|
};
|
|
783
784
|
|
package/src/utils/credentials.js
CHANGED
package/src/utils/npm.js
CHANGED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
const fetch = require('node-fetch');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fse = require('fs-extra');
|
|
4
|
-
const AdmZip = require('adm-zip');
|
|
5
|
-
const debug = require('debug')('zapier:example-apps');
|
|
6
|
-
|
|
7
|
-
const xdg = require('./xdg');
|
|
8
|
-
const { copyDir } = require('./files');
|
|
9
|
-
const { PACKAGE_VERSION } = require('../constants');
|
|
10
|
-
|
|
11
|
-
const REPO_ZIP_URL = `https://codeload.github.com/zapier/zapier-platform/zip/zapier-platform-cli%40${PACKAGE_VERSION}`;
|
|
12
|
-
const zipName = `zapier-platform-zapier-platform-cli-${PACKAGE_VERSION}`;
|
|
13
|
-
const folderName = `zapier-platform-cached`; // version independant
|
|
14
|
-
|
|
15
|
-
const checkCacheUpToDate = async (repoDir) => {
|
|
16
|
-
const etagPath = path.join(repoDir, 'etag');
|
|
17
|
-
let currentEtag;
|
|
18
|
-
try {
|
|
19
|
-
currentEtag = await fse.readFile(etagPath, { encoding: 'utf8' });
|
|
20
|
-
} catch (err) {
|
|
21
|
-
currentEtag = '';
|
|
22
|
-
}
|
|
23
|
-
const res = await fetch(REPO_ZIP_URL, { method: 'HEAD' });
|
|
24
|
-
const latestEtag = res.headers.get('etag');
|
|
25
|
-
|
|
26
|
-
return currentEtag === latestEtag;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const downloadRepo = async (destDir) => {
|
|
30
|
-
const destZipPath = path.join(destDir, `${zipName}.zip`);
|
|
31
|
-
|
|
32
|
-
const res = await fetch(REPO_ZIP_URL);
|
|
33
|
-
const dest = fse.createWriteStream(destZipPath);
|
|
34
|
-
res.body.pipe(dest);
|
|
35
|
-
|
|
36
|
-
await new Promise((resolve, reject) => {
|
|
37
|
-
dest.on('finish', () => {
|
|
38
|
-
resolve();
|
|
39
|
-
});
|
|
40
|
-
dest.on('error', reject);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const zip = new AdmZip(destZipPath);
|
|
44
|
-
zip.extractAllTo(destDir, true);
|
|
45
|
-
|
|
46
|
-
// Save etag for cache validation
|
|
47
|
-
// this could probably just be cli version, but this is fine too
|
|
48
|
-
const etagPath = path.join(destDir, zipName, 'etag');
|
|
49
|
-
fse.writeFileSync(etagPath, res.headers.get('etag'));
|
|
50
|
-
|
|
51
|
-
fse.removeSync(destZipPath);
|
|
52
|
-
fse.renameSync(path.join(destDir, zipName), path.join(destDir, folderName));
|
|
53
|
-
|
|
54
|
-
return destZipPath;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const ensureRepoCached = async () => {
|
|
58
|
-
const cacheDir = xdg.ensureCacheDir();
|
|
59
|
-
const repoDir = path.join(cacheDir, folderName);
|
|
60
|
-
|
|
61
|
-
if (fse.existsSync(repoDir)) {
|
|
62
|
-
debug('repo exists');
|
|
63
|
-
if (!(await checkCacheUpToDate(repoDir))) {
|
|
64
|
-
debug('cached repo is stale, re-downloading');
|
|
65
|
-
await fse.remove(repoDir);
|
|
66
|
-
await downloadRepo(cacheDir);
|
|
67
|
-
}
|
|
68
|
-
} else {
|
|
69
|
-
debug('no cached repo, downloading');
|
|
70
|
-
await downloadRepo(cacheDir);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return repoDir;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const downloadExampleAppTo = async (exampleName, destDir) => {
|
|
77
|
-
const repoDir = await ensureRepoCached();
|
|
78
|
-
const cachedExampleDir = path.join(repoDir, 'example-apps', exampleName);
|
|
79
|
-
await copyDir(cachedExampleDir, destDir);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const removeReadme = (dir) => {
|
|
83
|
-
return fse.remove(path.join(dir, 'README.md'));
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
module.exports = {
|
|
87
|
-
downloadExampleAppTo,
|
|
88
|
-
removeReadme,
|
|
89
|
-
};
|
package/src/utils/xdg.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// XDG Base Directory Specification
|
|
2
|
-
// See: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
3
|
-
|
|
4
|
-
const fse = require('fs-extra');
|
|
5
|
-
const os = require('os');
|
|
6
|
-
const path = require('path');
|
|
7
|
-
|
|
8
|
-
const ensureDir = (envVarName, defaultDir, extraPath = []) => {
|
|
9
|
-
const baseDir = process.env[envVarName] || defaultDir;
|
|
10
|
-
let appDir = path.join(baseDir, 'zapier');
|
|
11
|
-
fse.ensureDirSync(appDir, 0o700);
|
|
12
|
-
|
|
13
|
-
if (extraPath.length > 0) {
|
|
14
|
-
const dirParts = [appDir].concat(extraPath);
|
|
15
|
-
appDir = path.join.apply(null, dirParts);
|
|
16
|
-
fse.ensureDirSync(appDir);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return appDir;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const HOME_DIR = os.homedir();
|
|
23
|
-
|
|
24
|
-
let ensureDataDir, ensureCacheDir, ensureConfigDir;
|
|
25
|
-
|
|
26
|
-
if (process.platform === 'win32') {
|
|
27
|
-
const defaultAppDir = path.join(HOME_DIR, 'AppData', 'Local');
|
|
28
|
-
|
|
29
|
-
// NOTE: LOCALAPPDATA is not available on Windows XP
|
|
30
|
-
ensureDataDir = ensureDir.bind(null, 'LOCALAPPDATA', defaultAppDir, ['data']);
|
|
31
|
-
ensureCacheDir = ensureDir.bind(null, 'LOCALAPPDATA', defaultAppDir, [
|
|
32
|
-
'cache',
|
|
33
|
-
]);
|
|
34
|
-
ensureConfigDir = ensureDir.bind(null, 'LOCALAPPDATA', defaultAppDir, [
|
|
35
|
-
'config',
|
|
36
|
-
]);
|
|
37
|
-
} else {
|
|
38
|
-
ensureDataDir = ensureDir.bind(
|
|
39
|
-
null,
|
|
40
|
-
'XDG_DATA_HOME',
|
|
41
|
-
path.join(HOME_DIR, '.local', 'share'),
|
|
42
|
-
);
|
|
43
|
-
ensureCacheDir = ensureDir.bind(
|
|
44
|
-
null,
|
|
45
|
-
'XDG_CACHE_HOME',
|
|
46
|
-
path.join(HOME_DIR, '.cache'),
|
|
47
|
-
);
|
|
48
|
-
ensureConfigDir = ensureDir.bind(
|
|
49
|
-
null,
|
|
50
|
-
'XDG_CONFIG_HOME',
|
|
51
|
-
path.join(HOME_DIR, '.config'),
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
module.exports = {
|
|
56
|
-
ensureDataDir,
|
|
57
|
-
ensureCacheDir,
|
|
58
|
-
ensureConfigDir,
|
|
59
|
-
};
|