zapier-platform-cli 15.19.0 → 16.1.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 +2316 -1
- package/package.json +39 -32
- package/src/bin/run +4 -4
- package/src/bin/run.cmd +0 -3
- package/src/constants.js +2 -2
- package/src/generators/index.js +11 -11
- package/src/generators/templates/dynamic-dropdown/README.md +1 -1
- package/src/generators/templates/dynamic-dropdown/triggers/people.js +2 -2
- package/src/generators/templates/dynamic-dropdown/triggers/species.js +2 -2
- package/src/index.js +1 -1
- package/src/oclif/ZapierBaseCommand.js +52 -45
- package/src/oclif/buildFlags.js +14 -16
- package/src/oclif/commands/analytics.js +6 -6
- package/src/oclif/commands/build.js +6 -6
- package/src/oclif/commands/cache/clear.js +13 -13
- package/src/oclif/commands/canary/create.js +27 -20
- package/src/oclif/commands/canary/delete.js +26 -16
- package/src/oclif/commands/canary/list.js +5 -7
- package/src/oclif/commands/convert.js +16 -16
- package/src/oclif/commands/delete/version.js +6 -6
- package/src/oclif/commands/deprecate.js +10 -11
- package/src/oclif/commands/describe.js +5 -5
- package/src/oclif/commands/env/get.js +5 -5
- package/src/oclif/commands/env/set.js +11 -12
- package/src/oclif/commands/env/unset.js +9 -10
- package/src/oclif/commands/history.js +1 -0
- package/src/oclif/commands/init.js +12 -13
- package/src/oclif/commands/invoke.js +67 -69
- package/src/oclif/commands/jobs.js +1 -1
- package/src/oclif/commands/link.js +2 -2
- package/src/oclif/commands/login.js +15 -15
- package/src/oclif/commands/logout.js +1 -1
- package/src/oclif/commands/logs.js +9 -9
- package/src/oclif/commands/migrate.js +19 -22
- package/src/oclif/commands/promote.js +25 -27
- package/src/oclif/commands/push.js +2 -2
- package/src/oclif/commands/register.js +31 -32
- package/src/oclif/commands/scaffold.js +15 -17
- package/src/oclif/commands/team/add.js +12 -15
- package/src/oclif/commands/team/get.js +2 -2
- package/src/oclif/commands/team/remove.js +6 -6
- package/src/oclif/commands/test.js +8 -8
- package/src/oclif/commands/upload.js +1 -1
- package/src/oclif/commands/users/add.js +9 -11
- package/src/oclif/commands/users/get.js +7 -7
- package/src/oclif/commands/users/links.js +4 -4
- package/src/oclif/commands/users/remove.js +8 -9
- package/src/oclif/commands/validate.js +29 -21
- package/src/oclif/commands/versions.js +26 -1
- package/src/oclif/hooks/checkValidNodeVersion.js +1 -1
- package/src/oclif/hooks/deprecated.js +1 -1
- package/src/oclif/hooks/getAppRegistrationFieldChoices.js +4 -4
- package/src/oclif/hooks/renderMarkdownHelp.js +6 -7
- package/src/oclif/hooks/versionInfo.js +2 -2
- package/src/utils/analytics.js +20 -7
- package/src/utils/api.js +27 -30
- package/src/utils/ast.js +15 -15
- package/src/utils/auth-files-codegen.js +102 -99
- package/src/utils/build.js +27 -28
- package/src/utils/changelog.js +1 -1
- package/src/utils/check-missing-app-info.js +2 -2
- package/src/utils/convert.js +26 -20
- package/src/utils/credentials.js +1 -1
- package/src/utils/display.js +31 -8
- package/src/utils/files.js +3 -3
- package/src/utils/ignore.js +2 -2
- package/src/utils/local.js +1 -1
- package/src/utils/metadata.js +1 -1
- package/src/utils/misc.js +21 -22
- package/src/utils/promisify.js +1 -1
- package/src/utils/scaffold.js +12 -12
- package/src/utils/team.js +3 -3
- package/src/utils/xdg.js +3 -3
- package/src/version-store.js +1 -0
|
@@ -12,13 +12,13 @@ module.exports = (app) => {
|
|
|
12
12
|
{ apiName: 'role' },
|
|
13
13
|
];
|
|
14
14
|
const missingRequiredFields = requiredFields.filter(
|
|
15
|
-
(field) => app[field.apiName] == null
|
|
15
|
+
(field) => app[field.apiName] == null,
|
|
16
16
|
);
|
|
17
17
|
if (missingRequiredFields.length) {
|
|
18
18
|
throw new Error(
|
|
19
19
|
`Your integration is missing required info (${missingRequiredFields
|
|
20
20
|
.map((field) => field.cliName ?? field.apiName)
|
|
21
|
-
.join(', ')}). Please, run "zapier register" to add it
|
|
21
|
+
.join(', ')}). Please, run "zapier register" to add it.`,
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
|
package/src/utils/convert.js
CHANGED
|
@@ -40,19 +40,21 @@ const createFile = async (content, filename, dir) => {
|
|
|
40
40
|
endSpinner();
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
const prettifyJs = (code) =>
|
|
44
|
-
prettier.format(code, { singleQuote: true, parser: 'babel' });
|
|
43
|
+
const prettifyJs = async (code) => {
|
|
44
|
+
return prettier.format(code, { singleQuote: true, parser: 'babel' });
|
|
45
|
+
};
|
|
46
|
+
|
|
45
47
|
const prettifyJSON = (origString) => JSON.stringify(origString, null, 2);
|
|
46
48
|
|
|
47
49
|
const renderTemplate = async (
|
|
48
50
|
templateFile,
|
|
49
51
|
templateContext,
|
|
50
|
-
prettify = true
|
|
52
|
+
prettify = true,
|
|
51
53
|
) => {
|
|
52
54
|
const templateBuf = await readFile(templateFile);
|
|
53
55
|
const template = templateBuf.toString();
|
|
54
56
|
let content = _.template(template, { interpolate: /<%=([\s\S]+?)%>/g })(
|
|
55
|
-
templateContext
|
|
57
|
+
templateContext,
|
|
56
58
|
);
|
|
57
59
|
|
|
58
60
|
if (prettify) {
|
|
@@ -99,7 +101,7 @@ const getAuthFieldKeys = (appDefinition) => {
|
|
|
99
101
|
|
|
100
102
|
const renderPackageJson = async (appInfo, appDefinition) => {
|
|
101
103
|
const name = _.kebabCase(
|
|
102
|
-
appInfo.title || _.get(appInfo, ['general', 'title'])
|
|
104
|
+
appInfo.title || _.get(appInfo, ['general', 'title']),
|
|
103
105
|
);
|
|
104
106
|
|
|
105
107
|
// Not using escapeSpecialChars because we don't want to escape single quotes (not
|
|
@@ -180,7 +182,7 @@ const renderSource = (definition, functions = {}) => {
|
|
|
180
182
|
funcName = `${funcNameBase}${funcNum}`;
|
|
181
183
|
}
|
|
182
184
|
functions[funcName] = `const ${funcName} = async (${args.join(
|
|
183
|
-
', '
|
|
185
|
+
', ',
|
|
184
186
|
)}) => {\n${source}\n};`;
|
|
185
187
|
|
|
186
188
|
this.parent.update(makePlaceholder(funcName));
|
|
@@ -188,26 +190,28 @@ const renderSource = (definition, functions = {}) => {
|
|
|
188
190
|
});
|
|
189
191
|
};
|
|
190
192
|
|
|
191
|
-
const renderDefinitionSlice = (definitionSlice, filename) => {
|
|
193
|
+
const renderDefinitionSlice = async (definitionSlice, filename) => {
|
|
192
194
|
let exportBlock = _.cloneDeep(definitionSlice);
|
|
193
195
|
let functionBlock = {};
|
|
194
196
|
|
|
195
197
|
renderSource(exportBlock, functionBlock);
|
|
196
198
|
|
|
197
199
|
exportBlock = `module.exports = ${replacePlaceholders(
|
|
198
|
-
JSON.stringify(exportBlock)
|
|
200
|
+
JSON.stringify(exportBlock),
|
|
199
201
|
)};\n`;
|
|
200
202
|
|
|
201
203
|
functionBlock = Object.values(functionBlock).join('\n\n');
|
|
202
204
|
|
|
203
205
|
const uglyCode = functionBlock + '\n\n' + exportBlock;
|
|
204
206
|
try {
|
|
205
|
-
|
|
207
|
+
const prettyCode = await prettifyJs(uglyCode);
|
|
208
|
+
return prettyCode;
|
|
206
209
|
} catch (err) {
|
|
207
210
|
console.warn(
|
|
208
211
|
`Warning: Your code has syntax error in ${chalk.underline.bold(
|
|
209
|
-
filename
|
|
210
|
-
)}. ` +
|
|
212
|
+
filename,
|
|
213
|
+
)}. ` +
|
|
214
|
+
`It will be left as is and won't be prettified.\n\n${err.message}`,
|
|
211
215
|
);
|
|
212
216
|
return uglyCode;
|
|
213
217
|
}
|
|
@@ -238,7 +242,7 @@ const renderIndex = async (appDefinition) => {
|
|
|
238
242
|
// replace version and platformVersion with dynamic reference
|
|
239
243
|
exportBlock.version = makePlaceholder("require('./package.json').version");
|
|
240
244
|
exportBlock.platformVersion = makePlaceholder(
|
|
241
|
-
"require('zapier-platform-core').version"
|
|
245
|
+
"require('zapier-platform-core').version",
|
|
242
246
|
);
|
|
243
247
|
|
|
244
248
|
if (appDefinition.authentication) {
|
|
@@ -269,7 +273,7 @@ const renderIndex = async (appDefinition) => {
|
|
|
269
273
|
exportBlock[stepType][makePlaceholder(`[${importName}.key]`)] =
|
|
270
274
|
makePlaceholder(importName);
|
|
271
275
|
});
|
|
272
|
-
}
|
|
276
|
+
},
|
|
273
277
|
);
|
|
274
278
|
|
|
275
279
|
if (!_.isEmpty(appDefinition.hydrators)) {
|
|
@@ -282,21 +286,23 @@ const renderIndex = async (appDefinition) => {
|
|
|
282
286
|
if (appDefinition.legacy && appDefinition.legacy.scriptingSource) {
|
|
283
287
|
importBlock.push("\nconst fs = require('fs');");
|
|
284
288
|
importBlock.push(
|
|
285
|
-
"const scriptingSource = fs.readFileSync('./scripting.js', { encoding: 'utf8' });"
|
|
289
|
+
"const scriptingSource = fs.readFileSync('./scripting.js', { encoding: 'utf8' });",
|
|
286
290
|
);
|
|
287
291
|
exportBlock.legacy.scriptingSource = makePlaceholder('scriptingSource');
|
|
288
292
|
}
|
|
289
293
|
|
|
290
294
|
exportBlock = `module.exports = ${replacePlaceholders(
|
|
291
|
-
JSON.stringify(exportBlock)
|
|
295
|
+
JSON.stringify(exportBlock),
|
|
292
296
|
)};`;
|
|
293
297
|
|
|
294
298
|
importBlock = importBlock.join('\n');
|
|
295
299
|
functionBlock = Object.values(functionBlock).join('\n\n');
|
|
296
300
|
|
|
297
|
-
|
|
298
|
-
importBlock + '\n\n' + functionBlock + '\n\n' + exportBlock
|
|
301
|
+
const prettyCode = await prettifyJs(
|
|
302
|
+
importBlock + '\n\n' + functionBlock + '\n\n' + exportBlock,
|
|
299
303
|
);
|
|
304
|
+
|
|
305
|
+
return prettyCode;
|
|
300
306
|
};
|
|
301
307
|
|
|
302
308
|
const renderEnvironment = (appDefinition) => {
|
|
@@ -339,7 +345,7 @@ const writeScripting = async (appDefinition, newAppDir) => {
|
|
|
339
345
|
await createFile(
|
|
340
346
|
appDefinition.legacy.scriptingSource,
|
|
341
347
|
'scripting.js',
|
|
342
|
-
newAppDir
|
|
348
|
+
newAppDir,
|
|
343
349
|
);
|
|
344
350
|
};
|
|
345
351
|
|
|
@@ -385,7 +391,7 @@ const convertApp = async (appInfo, appDefinition, newAppDir) => {
|
|
|
385
391
|
_.each(appDefinition[stepType], (definition, key) => {
|
|
386
392
|
promises.push(
|
|
387
393
|
writeStep(stepType, definition, key, newAppDir),
|
|
388
|
-
writeStepTest(stepType, definition, key, newAppDir)
|
|
394
|
+
writeStepTest(stepType, definition, key, newAppDir),
|
|
389
395
|
);
|
|
390
396
|
});
|
|
391
397
|
});
|
|
@@ -405,7 +411,7 @@ const convertApp = async (appInfo, appDefinition, newAppDir) => {
|
|
|
405
411
|
writeIndex(appDefinition, newAppDir),
|
|
406
412
|
writeEnvironment(appDefinition, newAppDir),
|
|
407
413
|
writeGitIgnore(newAppDir),
|
|
408
|
-
writeZapierAppRc(appInfo, appDefinition, newAppDir)
|
|
414
|
+
writeZapierAppRc(appInfo, appDefinition, newAppDir),
|
|
409
415
|
);
|
|
410
416
|
|
|
411
417
|
return Promise.all(promises);
|
package/src/utils/credentials.js
CHANGED
|
@@ -3,7 +3,7 @@ const { BASE_ENDPOINT } = require('../constants');
|
|
|
3
3
|
|
|
4
4
|
const isSamlEmail = async (email) => {
|
|
5
5
|
const rawResponse = await fetch(
|
|
6
|
-
`${BASE_ENDPOINT}/api/v4/idp-discovery/?email=${encodeURIComponent(email)}
|
|
6
|
+
`${BASE_ENDPOINT}/api/v4/idp-discovery/?email=${encodeURIComponent(email)}`,
|
|
7
7
|
);
|
|
8
8
|
const { results = [], errors = [] } = await rawResponse.json();
|
|
9
9
|
if (errors.length) {
|
package/src/utils/display.js
CHANGED
|
@@ -61,16 +61,33 @@ const ansiTrim = (s) =>
|
|
|
61
61
|
// '\u001b[90m',
|
|
62
62
|
]);
|
|
63
63
|
|
|
64
|
-
const
|
|
64
|
+
const TABLE_CHARS_DEFAULT = {
|
|
65
65
|
// 'top': '', 'top-mid': '', 'top-left': '', 'top-right': '',
|
|
66
66
|
// 'bottom': ' ', 'bottom-mid': ' ', 'bottom-left': ' ', 'bottom-right': ' '
|
|
67
67
|
};
|
|
68
|
+
const TABLE_CHARS_NONE = {
|
|
69
|
+
top: '',
|
|
70
|
+
'top-mid': '',
|
|
71
|
+
'top-left': '',
|
|
72
|
+
'top-right': '',
|
|
73
|
+
bottom: '',
|
|
74
|
+
'bottom-mid': '',
|
|
75
|
+
'bottom-left': '',
|
|
76
|
+
'bottom-right': '',
|
|
77
|
+
left: '',
|
|
78
|
+
'left-mid': '',
|
|
79
|
+
mid: '',
|
|
80
|
+
'mid-mid': '',
|
|
81
|
+
right: '',
|
|
82
|
+
'right-mid': '',
|
|
83
|
+
middle: ' ',
|
|
84
|
+
};
|
|
68
85
|
|
|
69
86
|
// Similar to makeTable, but prints the column headings in the left-hand column
|
|
70
87
|
// and the values in the right-hand column, in rows
|
|
71
88
|
const makeRowBasedTable = (rows, columnDefs, { includeIndex = true } = {}) => {
|
|
72
89
|
const tableOptions = {
|
|
73
|
-
chars:
|
|
90
|
+
chars: TABLE_CHARS_DEFAULT,
|
|
74
91
|
style: {
|
|
75
92
|
compact: true,
|
|
76
93
|
},
|
|
@@ -85,7 +102,7 @@ const makeRowBasedTable = (rows, columnDefs, { includeIndex = true } = {}) => {
|
|
|
85
102
|
}
|
|
86
103
|
return maxLength;
|
|
87
104
|
},
|
|
88
|
-
1
|
|
105
|
+
1,
|
|
89
106
|
);
|
|
90
107
|
const widthForValue = process.stdout.columns - maxLabelLength - 15; // The last bit accounts for some padding and borders
|
|
91
108
|
if (widthForValue < 1) {
|
|
@@ -141,13 +158,19 @@ const makeRowBasedTable = (rows, columnDefs, { includeIndex = true } = {}) => {
|
|
|
141
158
|
return strTable;
|
|
142
159
|
};
|
|
143
160
|
|
|
144
|
-
// Wraps the cli-table3 library. Rows is an array of objects,
|
|
161
|
+
// Wraps the cli-table3 library. Rows is an array of objects, headers
|
|
145
162
|
// an ordered sub-array [[label, key, (optional_default)], ...].
|
|
146
|
-
const makeTable = (
|
|
163
|
+
const makeTable = (
|
|
164
|
+
rows,
|
|
165
|
+
columnDefs,
|
|
166
|
+
showHeaders = true,
|
|
167
|
+
hasBorder = true,
|
|
168
|
+
style = undefined,
|
|
169
|
+
) => {
|
|
147
170
|
const tableOptions = {
|
|
148
|
-
head: columnDefs.map(([label]) => label),
|
|
149
|
-
chars:
|
|
150
|
-
style: {
|
|
171
|
+
head: showHeaders ? columnDefs.map(([label]) => label) : undefined,
|
|
172
|
+
chars: hasBorder ? TABLE_CHARS_DEFAULT : TABLE_CHARS_NONE,
|
|
173
|
+
style: style ?? {
|
|
151
174
|
compact: true,
|
|
152
175
|
head: ['bold'],
|
|
153
176
|
},
|
package/src/utils/files.js
CHANGED
|
@@ -33,7 +33,7 @@ const validateFileExists = (fileName, errMsg) => {
|
|
|
33
33
|
// Returns a promise that reads a file and returns a buffer.
|
|
34
34
|
const readFile = (fileName, errMsg) => {
|
|
35
35
|
return validateFileExists(fileName, errMsg).then(() =>
|
|
36
|
-
fse.readFile(fixHome(fileName))
|
|
36
|
+
fse.readFile(fixHome(fileName)),
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
39
|
|
|
@@ -137,8 +137,8 @@ const copyDir = async (src, dst, options) => {
|
|
|
137
137
|
if (fse.lstatSync(srcItem).isSymbolicLink()) {
|
|
138
138
|
console.warn(
|
|
139
139
|
colors.yellow(
|
|
140
|
-
`\n! Warning: symlink "${srcItem}" points to a non-existent file. Skipping!\n
|
|
141
|
-
)
|
|
140
|
+
`\n! Warning: symlink "${srcItem}" points to a non-existent file. Skipping!\n`,
|
|
141
|
+
),
|
|
142
142
|
);
|
|
143
143
|
return null;
|
|
144
144
|
}
|
package/src/utils/ignore.js
CHANGED
|
@@ -17,8 +17,8 @@ const respectGitIgnore = (dir, paths) => {
|
|
|
17
17
|
if (!constants.IS_TESTING) {
|
|
18
18
|
console.warn(
|
|
19
19
|
`\n\n\t${colors.yellow(
|
|
20
|
-
'!! Warning !!'
|
|
21
|
-
)}\n\nThere is no .gitignore, so we are including all files. This might make the source.zip file too large\n
|
|
20
|
+
'!! Warning !!',
|
|
21
|
+
)}\n\nThere is no .gitignore, so we are including all files. This might make the source.zip file too large\n`,
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
return paths;
|
package/src/utils/local.js
CHANGED
package/src/utils/metadata.js
CHANGED
|
@@ -33,7 +33,7 @@ const extractMetadata = (token, context) => {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
const appMetadata = token.match(
|
|
36
|
-
/(?<actionType>(trigger|create|search))\/(?<actionKey>\w+)
|
|
36
|
+
/(?<actionType>(trigger|create|search))\/(?<actionKey>\w+)/,
|
|
37
37
|
);
|
|
38
38
|
if (
|
|
39
39
|
appMetadata?.groups?.actionKey &&
|
package/src/utils/misc.js
CHANGED
|
@@ -41,8 +41,8 @@ const runCommand = (command, args, options) => {
|
|
|
41
41
|
debug('\n');
|
|
42
42
|
debug(
|
|
43
43
|
`Running ${colors.bold(
|
|
44
|
-
command + ' ' + args.join(' ')
|
|
45
|
-
)} command in ${colors.bold(options.cwd || process.cwd())}:\n
|
|
44
|
+
command + ' ' + args.join(' '),
|
|
45
|
+
)} command in ${colors.bold(options.cwd || process.cwd())}:\n`,
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
return new Promise((resolve, reject) => {
|
|
@@ -109,7 +109,7 @@ const isValidAppInstall = () => {
|
|
|
109
109
|
return {
|
|
110
110
|
valid: false,
|
|
111
111
|
reason: `Your app doesn't depend on ${PLATFORM_PACKAGE}. Run \`${colors.cyan(
|
|
112
|
-
`npm install -E ${PLATFORM_PACKAGE}
|
|
112
|
+
`npm install -E ${PLATFORM_PACKAGE}`,
|
|
113
113
|
)}\` to resolve.`,
|
|
114
114
|
};
|
|
115
115
|
} else if (!semver.valid(dependedCoreVersion)) {
|
|
@@ -130,20 +130,19 @@ const isValidAppInstall = () => {
|
|
|
130
130
|
return {
|
|
131
131
|
valid: false,
|
|
132
132
|
reason: `Looks like you're missing a local installation of ${PLATFORM_PACKAGE}. Run \`${colors.cyan(
|
|
133
|
-
'npm install'
|
|
133
|
+
'npm install',
|
|
134
134
|
)}\` to resolve.`,
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
const installedPackageJson = require(
|
|
139
|
-
corePackageDir,
|
|
140
|
-
|
|
141
|
-
));
|
|
138
|
+
const installedPackageJson = require(
|
|
139
|
+
path.join(corePackageDir, 'package.json'),
|
|
140
|
+
);
|
|
142
141
|
const installedCoreVersion = installedPackageJson.version;
|
|
143
142
|
|
|
144
143
|
if (installedCoreVersion !== dependedCoreVersion) {
|
|
145
144
|
console.warn(
|
|
146
|
-
`\nYour code depends on v${dependedCoreVersion} of ${PLATFORM_PACKAGE}, but your local copy is v${installedCoreVersion}. You should probably reinstall your dependencies.\n
|
|
145
|
+
`\nYour code depends on v${dependedCoreVersion} of ${PLATFORM_PACKAGE}, but your local copy is v${installedCoreVersion}. You should probably reinstall your dependencies.\n`,
|
|
147
146
|
);
|
|
148
147
|
}
|
|
149
148
|
|
|
@@ -181,7 +180,7 @@ const printVersionInfo = (context) => {
|
|
|
181
180
|
if (fileExistsSync(path.resolve('./package.json'))) {
|
|
182
181
|
let requiredVersion = _.get(
|
|
183
182
|
require(path.resolve('./package.json')),
|
|
184
|
-
`dependencies.${PLATFORM_PACKAGE}
|
|
183
|
+
`dependencies.${PLATFORM_PACKAGE}`,
|
|
185
184
|
);
|
|
186
185
|
if (requiredVersion) {
|
|
187
186
|
// might be a caret, have to coerce for later comparison
|
|
@@ -193,34 +192,34 @@ const printVersionInfo = (context) => {
|
|
|
193
192
|
if (requiredVersion !== PACKAGE_VERSION) {
|
|
194
193
|
versions.push(
|
|
195
194
|
`${colors.yellow('\nWarning!')} "CLI" (${colors.green(
|
|
196
|
-
PACKAGE_VERSION
|
|
195
|
+
PACKAGE_VERSION,
|
|
197
196
|
)}) and "core" (${colors.green(
|
|
198
|
-
requiredVersion
|
|
197
|
+
requiredVersion,
|
|
199
198
|
)}) versions are out of sync. This is probably fine, but if you're experiencing issues, update the ${colors.cyan(
|
|
200
|
-
PLATFORM_PACKAGE
|
|
199
|
+
PLATFORM_PACKAGE,
|
|
201
200
|
)} dependency in your ${colors.cyan(
|
|
202
|
-
'package.json'
|
|
203
|
-
)} to ${colors.green(PACKAGE_VERSION)}
|
|
201
|
+
'package.json',
|
|
202
|
+
)} to ${colors.green(PACKAGE_VERSION)}.`,
|
|
204
203
|
);
|
|
205
204
|
}
|
|
206
205
|
|
|
207
206
|
if (
|
|
208
207
|
fileExistsSync(
|
|
209
|
-
path.resolve(`./node_modules/${PLATFORM_PACKAGE}/package.json`)
|
|
208
|
+
path.resolve(`./node_modules/${PLATFORM_PACKAGE}/package.json`),
|
|
210
209
|
)
|
|
211
210
|
) {
|
|
212
211
|
// double check they have the right version installed
|
|
213
|
-
const installedPkgVersion = require(
|
|
214
|
-
`./node_modules/${PLATFORM_PACKAGE}/package.json`
|
|
215
|
-
)
|
|
212
|
+
const installedPkgVersion = require(
|
|
213
|
+
path.resolve(`./node_modules/${PLATFORM_PACKAGE}/package.json`),
|
|
214
|
+
).version;
|
|
216
215
|
|
|
217
216
|
if (requiredVersion !== installedPkgVersion) {
|
|
218
217
|
versions.push(
|
|
219
218
|
`${colors.yellow('\nWarning!')} Required version (${colors.green(
|
|
220
|
-
requiredVersion
|
|
219
|
+
requiredVersion,
|
|
221
220
|
)}) and installed version (${colors.green(
|
|
222
|
-
installedPkgVersion
|
|
223
|
-
)}) are out of sync. Run ${colors.cyan('`npm install`')} to fix.\n
|
|
221
|
+
installedPkgVersion,
|
|
222
|
+
)}) are out of sync. Run ${colors.cyan('`npm install`')} to fix.\n`,
|
|
224
223
|
);
|
|
225
224
|
}
|
|
226
225
|
}
|
package/src/utils/promisify.js
CHANGED
package/src/utils/scaffold.js
CHANGED
|
@@ -26,7 +26,7 @@ const getTemplatePath = (templateType, language = 'js') =>
|
|
|
26
26
|
'..',
|
|
27
27
|
'..',
|
|
28
28
|
'scaffold',
|
|
29
|
-
`${templateType}.template.${language}
|
|
29
|
+
`${templateType}.template.${language}`,
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
// useful for making sure we don't conflict with other, similarly named things
|
|
@@ -104,15 +104,15 @@ const writeTemplateFile = async ({
|
|
|
104
104
|
throw new Error(
|
|
105
105
|
[
|
|
106
106
|
`File ${colors.bold(filename)} already exists within ${colors.bold(
|
|
107
|
-
location
|
|
107
|
+
location,
|
|
108
108
|
)}.`,
|
|
109
109
|
'You can either:',
|
|
110
110
|
' 1. Choose a different filename',
|
|
111
111
|
` 2. Delete ${filename} from ${location}`,
|
|
112
112
|
` 3. Run ${colors.italic('scaffold')} with ${colors.bold(
|
|
113
|
-
'--force'
|
|
113
|
+
'--force',
|
|
114
114
|
)} to overwrite the current ${filename}`,
|
|
115
|
-
].join('\n')
|
|
115
|
+
].join('\n'),
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -130,7 +130,7 @@ const isValidEntryFileUpdate = (
|
|
|
130
130
|
language,
|
|
131
131
|
indexFileResolved,
|
|
132
132
|
actionType,
|
|
133
|
-
newActionKey
|
|
133
|
+
newActionKey,
|
|
134
134
|
) => {
|
|
135
135
|
if (language === 'js') {
|
|
136
136
|
// ensure a clean access
|
|
@@ -196,12 +196,12 @@ const updateEntryFileJs = async ({
|
|
|
196
196
|
codeStr = importActionInJsApp(
|
|
197
197
|
codeStr,
|
|
198
198
|
actionImportName,
|
|
199
|
-
actionRelativeImportPath
|
|
199
|
+
actionRelativeImportPath,
|
|
200
200
|
);
|
|
201
201
|
codeStr = registerActionInJsApp(
|
|
202
202
|
codeStr,
|
|
203
203
|
plural(actionType),
|
|
204
|
-
actionImportName
|
|
204
|
+
actionImportName,
|
|
205
205
|
);
|
|
206
206
|
await writeFile(indexFileResolved, codeStr);
|
|
207
207
|
return originalCodeStr;
|
|
@@ -227,12 +227,12 @@ const updateEntryFileTs = async ({
|
|
|
227
227
|
codeStr = importActionInTsApp(
|
|
228
228
|
codeStr,
|
|
229
229
|
actionImportName,
|
|
230
|
-
actionRelativeImportPath
|
|
230
|
+
actionRelativeImportPath,
|
|
231
231
|
);
|
|
232
232
|
codeStr = registerActionInTsApp(
|
|
233
233
|
codeStr,
|
|
234
234
|
plural(actionType),
|
|
235
|
-
actionImportName
|
|
235
|
+
actionImportName,
|
|
236
236
|
);
|
|
237
237
|
await writeFile(indexFileResolved, codeStr);
|
|
238
238
|
return originalCodeStr;
|
|
@@ -271,7 +271,7 @@ const createScaffoldingContext = ({
|
|
|
271
271
|
const actionFileResolved = `${path.join(
|
|
272
272
|
cwd,
|
|
273
273
|
actionDirLocal,
|
|
274
|
-
key
|
|
274
|
+
key,
|
|
275
275
|
)}.${language}`;
|
|
276
276
|
const actionFileResolvedStem = path.join(cwd, actionDirLocal, key);
|
|
277
277
|
const actionFileLocal = `${path.join(actionDirLocal, key)}.${language}`;
|
|
@@ -279,13 +279,13 @@ const createScaffoldingContext = ({
|
|
|
279
279
|
const testFileResolved = `${path.join(
|
|
280
280
|
cwd,
|
|
281
281
|
testDirLocal,
|
|
282
|
-
key
|
|
282
|
+
key,
|
|
283
283
|
)}.test.${language}`;
|
|
284
284
|
const testFileLocal = `${path.join(testDirLocal, key)}.${language}`;
|
|
285
285
|
const testFileLocalStem = path.join(testDirLocal, key);
|
|
286
286
|
const actionRelativeImportPath = `./${getRelativeRequirePath(
|
|
287
287
|
indexFileResolved,
|
|
288
|
-
actionFileResolvedStem
|
|
288
|
+
actionFileResolvedStem,
|
|
289
289
|
)}`;
|
|
290
290
|
|
|
291
291
|
return {
|
package/src/utils/team.js
CHANGED
|
@@ -10,8 +10,8 @@ const transformUserRole = (role) =>
|
|
|
10
10
|
role === 'collaborator'
|
|
11
11
|
? 'admin'
|
|
12
12
|
: role === 'subscriber'
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
? 'subscriber'
|
|
14
|
+
: 'collaborator';
|
|
15
15
|
|
|
16
16
|
const listTeamMembers = async () => {
|
|
17
17
|
return listEndpointMulti(
|
|
@@ -24,7 +24,7 @@ const listTeamMembers = async () => {
|
|
|
24
24
|
endpoint: (app) =>
|
|
25
25
|
`${constants.BASE_ENDPOINT}/api/platform/v3/integrations/${app.id}/subscribers`,
|
|
26
26
|
keyOverride: 'subscribers',
|
|
27
|
-
}
|
|
27
|
+
},
|
|
28
28
|
);
|
|
29
29
|
};
|
|
30
30
|
module.exports = {
|
package/src/utils/xdg.js
CHANGED
|
@@ -38,17 +38,17 @@ if (process.platform === 'win32') {
|
|
|
38
38
|
ensureDataDir = ensureDir.bind(
|
|
39
39
|
null,
|
|
40
40
|
'XDG_DATA_HOME',
|
|
41
|
-
path.join(HOME_DIR, '.local', 'share')
|
|
41
|
+
path.join(HOME_DIR, '.local', 'share'),
|
|
42
42
|
);
|
|
43
43
|
ensureCacheDir = ensureDir.bind(
|
|
44
44
|
null,
|
|
45
45
|
'XDG_CACHE_HOME',
|
|
46
|
-
path.join(HOME_DIR, '.cache')
|
|
46
|
+
path.join(HOME_DIR, '.cache'),
|
|
47
47
|
);
|
|
48
48
|
ensureConfigDir = ensureDir.bind(
|
|
49
49
|
null,
|
|
50
50
|
'XDG_CONFIG_HOME',
|
|
51
|
-
path.join(HOME_DIR, '.config')
|
|
51
|
+
path.join(HOME_DIR, '.config'),
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
|
package/src/version-store.js
CHANGED