zapier-platform-cli 17.8.0 → 17.9.1
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 +177 -177
- package/package.json +1 -1
- package/src/oclif/ZapierBaseCommand.js +2 -10
- package/src/oclif/commands/env/set.js +2 -2
- package/src/oclif/commands/push.js +5 -9
- package/src/utils/api.js +2 -2
- package/src/utils/build.js +17 -10
- package/src/utils/local.js +13 -5
- package/src/utils/version.js +16 -0
package/oclif.manifest.json
CHANGED
|
@@ -1730,182 +1730,6 @@
|
|
|
1730
1730
|
"clear.js"
|
|
1731
1731
|
]
|
|
1732
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
|
-
},
|
|
1909
1733
|
"canary:create": {
|
|
1910
1734
|
"aliases": [],
|
|
1911
1735
|
"args": {
|
|
@@ -2176,6 +2000,182 @@
|
|
|
2176
2000
|
"version.js"
|
|
2177
2001
|
]
|
|
2178
2002
|
},
|
|
2003
|
+
"env:get": {
|
|
2004
|
+
"aliases": [],
|
|
2005
|
+
"args": {
|
|
2006
|
+
"version": {
|
|
2007
|
+
"description": "The version to get the environment for.",
|
|
2008
|
+
"name": "version",
|
|
2009
|
+
"required": true
|
|
2010
|
+
}
|
|
2011
|
+
},
|
|
2012
|
+
"description": "Get environment variables for a version.",
|
|
2013
|
+
"examples": [
|
|
2014
|
+
"zapier env:get 1.2.3"
|
|
2015
|
+
],
|
|
2016
|
+
"flags": {
|
|
2017
|
+
"debug": {
|
|
2018
|
+
"char": "d",
|
|
2019
|
+
"description": "Show extra debugging output.",
|
|
2020
|
+
"name": "debug",
|
|
2021
|
+
"allowNo": false,
|
|
2022
|
+
"type": "boolean"
|
|
2023
|
+
},
|
|
2024
|
+
"format": {
|
|
2025
|
+
"char": "f",
|
|
2026
|
+
"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.",
|
|
2027
|
+
"name": "format",
|
|
2028
|
+
"default": "table",
|
|
2029
|
+
"hasDynamicHelp": false,
|
|
2030
|
+
"multiple": false,
|
|
2031
|
+
"options": [
|
|
2032
|
+
"plain",
|
|
2033
|
+
"json",
|
|
2034
|
+
"raw",
|
|
2035
|
+
"row",
|
|
2036
|
+
"table"
|
|
2037
|
+
],
|
|
2038
|
+
"type": "option"
|
|
2039
|
+
},
|
|
2040
|
+
"invokedFromAnotherCommand": {
|
|
2041
|
+
"hidden": true,
|
|
2042
|
+
"name": "invokedFromAnotherCommand",
|
|
2043
|
+
"allowNo": false,
|
|
2044
|
+
"type": "boolean"
|
|
2045
|
+
}
|
|
2046
|
+
},
|
|
2047
|
+
"hasDynamicHelp": false,
|
|
2048
|
+
"hiddenAliases": [],
|
|
2049
|
+
"id": "env:get",
|
|
2050
|
+
"pluginAlias": "zapier-platform-cli",
|
|
2051
|
+
"pluginName": "zapier-platform-cli",
|
|
2052
|
+
"pluginType": "core",
|
|
2053
|
+
"strict": true,
|
|
2054
|
+
"enableJsonFlag": false,
|
|
2055
|
+
"skipValidInstallCheck": true,
|
|
2056
|
+
"isESM": false,
|
|
2057
|
+
"relativePath": [
|
|
2058
|
+
"src",
|
|
2059
|
+
"oclif",
|
|
2060
|
+
"commands",
|
|
2061
|
+
"env",
|
|
2062
|
+
"get.js"
|
|
2063
|
+
]
|
|
2064
|
+
},
|
|
2065
|
+
"env:set": {
|
|
2066
|
+
"aliases": [],
|
|
2067
|
+
"args": {
|
|
2068
|
+
"version": {
|
|
2069
|
+
"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.",
|
|
2070
|
+
"name": "version",
|
|
2071
|
+
"required": true
|
|
2072
|
+
},
|
|
2073
|
+
"key-value pairs...": {
|
|
2074
|
+
"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`",
|
|
2075
|
+
"name": "key-value pairs..."
|
|
2076
|
+
}
|
|
2077
|
+
},
|
|
2078
|
+
"description": "Set environment variables for a version.",
|
|
2079
|
+
"examples": [
|
|
2080
|
+
"zapier env:set 1.2.3 SECRET=12345 OTHER=4321"
|
|
2081
|
+
],
|
|
2082
|
+
"flags": {
|
|
2083
|
+
"force": {
|
|
2084
|
+
"char": "f",
|
|
2085
|
+
"description": "Force the update of environment variables regardless if the app version is production or not. Use with caution.",
|
|
2086
|
+
"name": "force",
|
|
2087
|
+
"allowNo": false,
|
|
2088
|
+
"type": "boolean"
|
|
2089
|
+
},
|
|
2090
|
+
"debug": {
|
|
2091
|
+
"char": "d",
|
|
2092
|
+
"description": "Show extra debugging output.",
|
|
2093
|
+
"name": "debug",
|
|
2094
|
+
"allowNo": false,
|
|
2095
|
+
"type": "boolean"
|
|
2096
|
+
},
|
|
2097
|
+
"invokedFromAnotherCommand": {
|
|
2098
|
+
"hidden": true,
|
|
2099
|
+
"name": "invokedFromAnotherCommand",
|
|
2100
|
+
"allowNo": false,
|
|
2101
|
+
"type": "boolean"
|
|
2102
|
+
}
|
|
2103
|
+
},
|
|
2104
|
+
"hasDynamicHelp": false,
|
|
2105
|
+
"hiddenAliases": [],
|
|
2106
|
+
"id": "env:set",
|
|
2107
|
+
"pluginAlias": "zapier-platform-cli",
|
|
2108
|
+
"pluginName": "zapier-platform-cli",
|
|
2109
|
+
"pluginType": "core",
|
|
2110
|
+
"strict": false,
|
|
2111
|
+
"enableJsonFlag": false,
|
|
2112
|
+
"skipValidInstallCheck": true,
|
|
2113
|
+
"isESM": false,
|
|
2114
|
+
"relativePath": [
|
|
2115
|
+
"src",
|
|
2116
|
+
"oclif",
|
|
2117
|
+
"commands",
|
|
2118
|
+
"env",
|
|
2119
|
+
"set.js"
|
|
2120
|
+
]
|
|
2121
|
+
},
|
|
2122
|
+
"env:unset": {
|
|
2123
|
+
"aliases": [],
|
|
2124
|
+
"args": {
|
|
2125
|
+
"version": {
|
|
2126
|
+
"description": "The version to set the environment for.",
|
|
2127
|
+
"name": "version",
|
|
2128
|
+
"required": true
|
|
2129
|
+
},
|
|
2130
|
+
"keys...": {
|
|
2131
|
+
"description": "The keys to unset. Keys are case-insensitive.",
|
|
2132
|
+
"name": "keys..."
|
|
2133
|
+
}
|
|
2134
|
+
},
|
|
2135
|
+
"description": "Unset environment variables for a version.",
|
|
2136
|
+
"examples": [
|
|
2137
|
+
"zapier env:unset 1.2.3 SECRET OTHER"
|
|
2138
|
+
],
|
|
2139
|
+
"flags": {
|
|
2140
|
+
"force": {
|
|
2141
|
+
"char": "f",
|
|
2142
|
+
"description": "Force the update of environment variables regardless if the app version is production or not. Use with caution.",
|
|
2143
|
+
"name": "force",
|
|
2144
|
+
"allowNo": false,
|
|
2145
|
+
"type": "boolean"
|
|
2146
|
+
},
|
|
2147
|
+
"debug": {
|
|
2148
|
+
"char": "d",
|
|
2149
|
+
"description": "Show extra debugging output.",
|
|
2150
|
+
"name": "debug",
|
|
2151
|
+
"allowNo": false,
|
|
2152
|
+
"type": "boolean"
|
|
2153
|
+
},
|
|
2154
|
+
"invokedFromAnotherCommand": {
|
|
2155
|
+
"hidden": true,
|
|
2156
|
+
"name": "invokedFromAnotherCommand",
|
|
2157
|
+
"allowNo": false,
|
|
2158
|
+
"type": "boolean"
|
|
2159
|
+
}
|
|
2160
|
+
},
|
|
2161
|
+
"hasDynamicHelp": false,
|
|
2162
|
+
"hiddenAliases": [],
|
|
2163
|
+
"id": "env:unset",
|
|
2164
|
+
"pluginAlias": "zapier-platform-cli",
|
|
2165
|
+
"pluginName": "zapier-platform-cli",
|
|
2166
|
+
"pluginType": "core",
|
|
2167
|
+
"strict": false,
|
|
2168
|
+
"enableJsonFlag": false,
|
|
2169
|
+
"skipValidInstallCheck": true,
|
|
2170
|
+
"isESM": false,
|
|
2171
|
+
"relativePath": [
|
|
2172
|
+
"src",
|
|
2173
|
+
"oclif",
|
|
2174
|
+
"commands",
|
|
2175
|
+
"env",
|
|
2176
|
+
"unset.js"
|
|
2177
|
+
]
|
|
2178
|
+
},
|
|
2179
2179
|
"team:add": {
|
|
2180
2180
|
"aliases": [
|
|
2181
2181
|
"team:invite"
|
|
@@ -2555,5 +2555,5 @@
|
|
|
2555
2555
|
]
|
|
2556
2556
|
}
|
|
2557
2557
|
},
|
|
2558
|
-
"version": "17.
|
|
2558
|
+
"version": "17.9.1"
|
|
2559
2559
|
}
|
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ const { recordAnalytics } = require('../utils/analytics');
|
|
|
8
8
|
const { getWritableApp } = require('../utils/api');
|
|
9
9
|
|
|
10
10
|
const inquirer = require('inquirer');
|
|
11
|
+
const { throwForInvalidVersion } = require('../utils/version');
|
|
11
12
|
|
|
12
13
|
const DATA_FORMATS = ['json', 'raw'];
|
|
13
14
|
|
|
@@ -90,16 +91,7 @@ class ZapierBaseCommand extends Command {
|
|
|
90
91
|
|
|
91
92
|
// validate that user input looks like a semver version
|
|
92
93
|
throwForInvalidVersion(version) {
|
|
93
|
-
|
|
94
|
-
!version.match(
|
|
95
|
-
// this is mirrored in schemas/VersionSchema.js and developer_cli/constants.py
|
|
96
|
-
/^(?:0|[1-9]\d{0,2})\.(?:0|[1-9]\d{0,2})\.(?:0|[1-9]\d{0,2})(?:-(?=.{1,12}$)[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)?$/g,
|
|
97
|
-
)
|
|
98
|
-
) {
|
|
99
|
-
throw new Error(
|
|
100
|
-
`${version} is an invalid version str. Try something like \`1.2.3\` or \`0.0.0-TICKET\``,
|
|
101
|
-
);
|
|
102
|
-
}
|
|
94
|
+
return throwForInvalidVersion(version);
|
|
103
95
|
}
|
|
104
96
|
|
|
105
97
|
async getWritableApp() {
|
|
@@ -73,12 +73,12 @@ class SetEnvCommand extends BaseCommand {
|
|
|
73
73
|
const failedKeys = e.json.errors[0].split('update: ')[1].split(', ');
|
|
74
74
|
const successfulResult = omit(payload, failedKeys);
|
|
75
75
|
if (!Object.keys(successfulResult).length) {
|
|
76
|
-
this.error(e.json.errors
|
|
76
|
+
this.error(e.json.errors.join('\nError: '));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
this.warn(successMessage(version));
|
|
80
80
|
this.logJSON(successfulResult);
|
|
81
|
-
this.warn(
|
|
81
|
+
this.warn(e.json.errors.join('\nWarning: '));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -6,22 +6,18 @@ 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');
|
|
10
|
-
|
|
11
9
|
class PushCommand extends ZapierBaseCommand {
|
|
12
10
|
async perform() {
|
|
13
11
|
const skipNpmInstall = this.flags['skip-npm-install'];
|
|
14
|
-
const definition = await localAppCommand({ command: 'definition' });
|
|
15
12
|
|
|
16
13
|
const snapshotLabel = this.flags.snapshot;
|
|
17
|
-
if (snapshotLabel && snapshotLabel.length >
|
|
18
|
-
throw new Error('Snapshot label cannot exceed
|
|
14
|
+
if (snapshotLabel && snapshotLabel.length > 12) {
|
|
15
|
+
throw new Error('Snapshot label cannot exceed 12 characters');
|
|
19
16
|
}
|
|
20
17
|
|
|
21
|
-
const
|
|
18
|
+
const snapshotVersion = snapshotLabel
|
|
22
19
|
? `0.0.0-${snapshotLabel}`
|
|
23
|
-
:
|
|
24
|
-
this.throwForInvalidVersion(version);
|
|
20
|
+
: undefined;
|
|
25
21
|
|
|
26
22
|
await buildAndOrUpload(
|
|
27
23
|
{ build: true, upload: true },
|
|
@@ -31,7 +27,7 @@ class PushCommand extends ZapierBaseCommand {
|
|
|
31
27
|
skipValidation: this.flags['skip-validation'],
|
|
32
28
|
overwritePartnerChanges: this.flags['overwrite-partner-changes'],
|
|
33
29
|
},
|
|
34
|
-
|
|
30
|
+
snapshotVersion,
|
|
35
31
|
);
|
|
36
32
|
this.log(
|
|
37
33
|
`\nPush complete! Built ${BUILD_PATH} and ${SOURCE_PATH} and uploaded them to Zapier.`,
|
package/src/utils/api.js
CHANGED
|
@@ -428,7 +428,7 @@ const downloadSourceZip = async (dst) => {
|
|
|
428
428
|
const upload = async (
|
|
429
429
|
app,
|
|
430
430
|
{ skipValidation = false, overwritePartnerChanges = false } = {},
|
|
431
|
-
|
|
431
|
+
snapshotVersion,
|
|
432
432
|
) => {
|
|
433
433
|
const zipPath = constants.BUILD_PATH;
|
|
434
434
|
const sourceZipPath = constants.SOURCE_PATH;
|
|
@@ -461,7 +461,7 @@ const upload = async (
|
|
|
461
461
|
headers['X-Overwrite-Partner-Changes'] = 'true';
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
-
const version =
|
|
464
|
+
const version = snapshotVersion ?? definition.version;
|
|
465
465
|
startSpinner(`Uploading version ${version}`);
|
|
466
466
|
try {
|
|
467
467
|
await callAPI(
|
package/src/utils/build.js
CHANGED
|
@@ -45,6 +45,7 @@ const checkMissingAppInfo = require('./check-missing-app-info');
|
|
|
45
45
|
const { findCorePackageDir, isWindows, runCommand } = require('./misc');
|
|
46
46
|
const { isBlocklisted, respectGitIgnore } = require('./ignore');
|
|
47
47
|
const { localAppCommand } = require('./local');
|
|
48
|
+
const { throwForInvalidVersion } = require('./version');
|
|
48
49
|
|
|
49
50
|
const debug = require('debug')('zapier:build');
|
|
50
51
|
|
|
@@ -588,13 +589,16 @@ const testBuildZip = async (zipPath) => {
|
|
|
588
589
|
}
|
|
589
590
|
};
|
|
590
591
|
|
|
591
|
-
const _buildFunc = async (
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
592
|
+
const _buildFunc = async (
|
|
593
|
+
{
|
|
594
|
+
skipNpmInstall = false,
|
|
595
|
+
disableDependencyDetection = false,
|
|
596
|
+
skipValidation = false,
|
|
597
|
+
printProgress = true,
|
|
598
|
+
checkOutdated = true,
|
|
599
|
+
} = {},
|
|
600
|
+
snapshotVersion,
|
|
601
|
+
) => {
|
|
598
602
|
const maybeStartSpinner = printProgress ? startSpinner : () => {};
|
|
599
603
|
const maybeEndSpinner = printProgress ? endSpinner : () => {};
|
|
600
604
|
|
|
@@ -659,6 +663,9 @@ const _buildFunc = async ({
|
|
|
659
663
|
false,
|
|
660
664
|
);
|
|
661
665
|
|
|
666
|
+
const version = snapshotVersion ?? rawDefinition.version;
|
|
667
|
+
throwForInvalidVersion(version);
|
|
668
|
+
|
|
662
669
|
try {
|
|
663
670
|
fs.writeFileSync(
|
|
664
671
|
path.join(workingDir, 'definition.json'),
|
|
@@ -761,7 +768,7 @@ const _buildFunc = async ({
|
|
|
761
768
|
const buildAndOrUpload = async (
|
|
762
769
|
{ build = false, upload = false } = {},
|
|
763
770
|
buildOpts,
|
|
764
|
-
|
|
771
|
+
snapshotVersion,
|
|
765
772
|
) => {
|
|
766
773
|
if (!(build || upload)) {
|
|
767
774
|
throw new Error('must either build or upload');
|
|
@@ -775,10 +782,10 @@ const buildAndOrUpload = async (
|
|
|
775
782
|
}
|
|
776
783
|
|
|
777
784
|
if (build) {
|
|
778
|
-
await _buildFunc(buildOpts);
|
|
785
|
+
await _buildFunc(buildOpts, snapshotVersion);
|
|
779
786
|
}
|
|
780
787
|
if (upload) {
|
|
781
|
-
await _uploadFunc(app, buildOpts,
|
|
788
|
+
await _uploadFunc(app, buildOpts, snapshotVersion);
|
|
782
789
|
}
|
|
783
790
|
};
|
|
784
791
|
|
package/src/utils/local.js
CHANGED
|
@@ -282,13 +282,21 @@ const getLocalAppHandler = async ({
|
|
|
282
282
|
appRaw = loadAppRawUsingRequire(appDir);
|
|
283
283
|
} catch (err) {
|
|
284
284
|
if (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_REQUIRE_ESM') {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
285
|
+
try {
|
|
286
|
+
appRaw = await loadAppRawUsingImport(
|
|
287
|
+
appDir,
|
|
288
|
+
corePackageDir,
|
|
289
|
+
shouldDeleteWrapper,
|
|
290
|
+
);
|
|
291
|
+
} catch (err) {
|
|
292
|
+
err.message =
|
|
293
|
+
'Your ESM integration requires a compiled `dist/` directory. Run `zapier build` to compile your code first.\n\n' +
|
|
294
|
+
err.message;
|
|
295
|
+
throw err;
|
|
296
|
+
}
|
|
290
297
|
} else {
|
|
291
298
|
// err.name === 'SyntaxError' or others
|
|
299
|
+
|
|
292
300
|
throw err;
|
|
293
301
|
}
|
|
294
302
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const throwForInvalidVersion = (version) => {
|
|
2
|
+
if (
|
|
3
|
+
!version.match(
|
|
4
|
+
// this is mirrored in schemas/VersionSchema.js and developer_cli/constants.py
|
|
5
|
+
/^(?:0|[1-9]\d{0,2})\.(?:0|[1-9]\d{0,2})\.(?:0|[1-9]\d{0,2})(?:-(?=.{1,12}$)[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)?$/g,
|
|
6
|
+
)
|
|
7
|
+
) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
`${version} is an invalid version str. Try something like \`1.2.3\` or \`0.0.0-TICKET\``,
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
module.exports = {
|
|
15
|
+
throwForInvalidVersion,
|
|
16
|
+
};
|