zapier-platform-cli 18.0.5 → 18.0.6
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/package.json +2 -2
- package/src/oclif/commands/build.js +7 -6
- package/src/oclif/commands/push.js +4 -4
- package/src/utils/build.js +18 -8
- package/src/utils/misc.js +1 -1
- package/src/utils/package-manager.js +31 -14
- package/oclif.manifest.json +0 -2559
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zapier-platform-cli",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.6",
|
|
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/",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"semver": "7.7.2",
|
|
54
54
|
"string-length": "4.0.2",
|
|
55
55
|
"through2": "4.0.2",
|
|
56
|
-
"tmp": "0.2.
|
|
56
|
+
"tmp": "0.2.5",
|
|
57
57
|
"traverse": "0.6.11",
|
|
58
58
|
"update-notifier": "7.3.1",
|
|
59
59
|
"yeoman-environment": "4.4.3",
|
|
@@ -12,11 +12,11 @@ const colors = require('colors/safe');
|
|
|
12
12
|
|
|
13
13
|
class BuildCommand extends BaseCommand {
|
|
14
14
|
async perform() {
|
|
15
|
-
const
|
|
15
|
+
const skipDepInstall = this.flags['skip-dep-install'];
|
|
16
16
|
await buildAndOrUpload(
|
|
17
17
|
{ build: true },
|
|
18
18
|
{
|
|
19
|
-
|
|
19
|
+
skipDepInstall,
|
|
20
20
|
disableDependencyDetection: this.flags['disable-dependency-detection'],
|
|
21
21
|
skipValidation: this.flags['skip-validation'],
|
|
22
22
|
},
|
|
@@ -27,9 +27,9 @@ class BuildCommand extends BaseCommand {
|
|
|
27
27
|
`Now you can upload them with the ${colors.bold.underline('zapier upload')} command.`,
|
|
28
28
|
);
|
|
29
29
|
|
|
30
|
-
if (!
|
|
30
|
+
if (!skipDepInstall) {
|
|
31
31
|
this.log(
|
|
32
|
-
`\nTip: Try ${colors.bold.underline('zapier build --skip-
|
|
32
|
+
`\nTip: Try ${colors.bold.underline('zapier build --skip-dep-install')} for faster builds.`,
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -40,9 +40,10 @@ BuildCommand.flags = buildFlags({
|
|
|
40
40
|
'disable-dependency-detection': Flags.boolean({
|
|
41
41
|
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 \`${CURRENT_APP_FILE}\`. See the docs about \`includeInBuild\` for more info.`,
|
|
42
42
|
}),
|
|
43
|
-
'skip-
|
|
43
|
+
'skip-dep-install': Flags.boolean({
|
|
44
|
+
aliases: ['skip-npm-install'],
|
|
44
45
|
description:
|
|
45
|
-
'
|
|
46
|
+
'[alias: --skip-npm-install]\nSkips installing a fresh copy of dependencies for shorter build time. Helpful for using yarn, pnpm, or local copies of dependencies.',
|
|
46
47
|
}),
|
|
47
48
|
'skip-validation': Flags.boolean({
|
|
48
49
|
description:
|
|
@@ -8,7 +8,7 @@ const BuildCommand = require('./build');
|
|
|
8
8
|
const { buildAndOrUpload } = require('../../utils/build');
|
|
9
9
|
class PushCommand extends ZapierBaseCommand {
|
|
10
10
|
async perform() {
|
|
11
|
-
const
|
|
11
|
+
const skipDepInstall = this.flags['skip-dep-install'];
|
|
12
12
|
|
|
13
13
|
const snapshotLabel = this.flags.snapshot;
|
|
14
14
|
if (snapshotLabel && snapshotLabel.length > 12) {
|
|
@@ -22,7 +22,7 @@ class PushCommand extends ZapierBaseCommand {
|
|
|
22
22
|
await buildAndOrUpload(
|
|
23
23
|
{ build: true, upload: true },
|
|
24
24
|
{
|
|
25
|
-
|
|
25
|
+
skipDepInstall,
|
|
26
26
|
disableDependencyDetection: this.flags['disable-dependency-detection'],
|
|
27
27
|
skipValidation: this.flags['skip-validation'],
|
|
28
28
|
overwritePartnerChanges: this.flags['overwrite-partner-changes'],
|
|
@@ -33,9 +33,9 @@ class PushCommand extends ZapierBaseCommand {
|
|
|
33
33
|
`\nPush complete! Built ${BUILD_PATH} and ${SOURCE_PATH} and uploaded them to Zapier.`,
|
|
34
34
|
);
|
|
35
35
|
|
|
36
|
-
if (!
|
|
36
|
+
if (!skipDepInstall) {
|
|
37
37
|
this.log(
|
|
38
|
-
`\nTip: Try ${colors.bold.underline('zapier push --skip-
|
|
38
|
+
`\nTip: Try ${colors.bold.underline('zapier push --skip-dep-install')} for faster builds.`,
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
}
|
package/src/utils/build.js
CHANGED
|
@@ -46,6 +46,7 @@ const { findCorePackageDir, isWindows, runCommand } = require('./misc');
|
|
|
46
46
|
const { isBlocklisted, respectGitIgnore } = require('./ignore');
|
|
47
47
|
const { localAppCommand } = require('./local');
|
|
48
48
|
const { throwForInvalidVersion } = require('./version');
|
|
49
|
+
const { getPackageManager } = require('./package-manager');
|
|
49
50
|
|
|
50
51
|
const debug = require('debug')('zapier:build');
|
|
51
52
|
|
|
@@ -592,7 +593,7 @@ const testBuildZip = async (zipPath) => {
|
|
|
592
593
|
|
|
593
594
|
const _buildFunc = async (
|
|
594
595
|
{
|
|
595
|
-
|
|
596
|
+
skipDepInstall = false,
|
|
596
597
|
disableDependencyDetection = false,
|
|
597
598
|
skipValidation = false,
|
|
598
599
|
printProgress = true,
|
|
@@ -609,7 +610,7 @@ const _buildFunc = async (
|
|
|
609
610
|
const appDir = process.cwd();
|
|
610
611
|
|
|
611
612
|
let workingDir;
|
|
612
|
-
if (
|
|
613
|
+
if (skipDepInstall) {
|
|
613
614
|
workingDir = appDir;
|
|
614
615
|
debug('Building in app directory: ', workingDir);
|
|
615
616
|
} else {
|
|
@@ -628,16 +629,25 @@ const _buildFunc = async (
|
|
|
628
629
|
const buildDir = path.join(appDir, BUILD_DIR);
|
|
629
630
|
await fse.ensureDir(buildDir);
|
|
630
631
|
|
|
631
|
-
if (!
|
|
632
|
+
if (!skipDepInstall) {
|
|
632
633
|
maybeStartSpinner('Copying project to temp directory');
|
|
633
634
|
const copyFilter = (src) => !src.endsWith('.zip');
|
|
634
635
|
await copyDir(appDir, workingDir, { filter: copyFilter });
|
|
635
636
|
|
|
636
637
|
maybeEndSpinner();
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
638
|
+
const packageManager = await getPackageManager();
|
|
639
|
+
|
|
640
|
+
maybeStartSpinner(
|
|
641
|
+
`Installing project dependencies using ${packageManager.executable}`,
|
|
642
|
+
);
|
|
643
|
+
|
|
644
|
+
const output = await runCommand(
|
|
645
|
+
packageManager.executable,
|
|
646
|
+
['install', '--production'],
|
|
647
|
+
{
|
|
648
|
+
cwd: workingDir,
|
|
649
|
+
},
|
|
650
|
+
);
|
|
641
651
|
|
|
642
652
|
// `npm install` may fail silently without returning a non-zero exit code,
|
|
643
653
|
// need to check further here
|
|
@@ -744,7 +754,7 @@ const _buildFunc = async (
|
|
|
744
754
|
|
|
745
755
|
maybeEndSpinner();
|
|
746
756
|
|
|
747
|
-
if (
|
|
757
|
+
if (skipDepInstall) {
|
|
748
758
|
maybeStartSpinner('Cleaning up temp files');
|
|
749
759
|
await deleteZapierWrapper(workingDir);
|
|
750
760
|
fs.rmSync(path.join(workingDir, 'definition.json'));
|
package/src/utils/misc.js
CHANGED
|
@@ -1,39 +1,56 @@
|
|
|
1
|
-
const { pathExists } = require('fs-extra');
|
|
1
|
+
const { pathExists, readFile } = require('fs-extra');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
-
const packageManagers =
|
|
5
|
-
{
|
|
4
|
+
const packageManagers = {
|
|
5
|
+
npm: {
|
|
6
6
|
lockFile: 'package-lock.json',
|
|
7
7
|
forceFlag: undefined,
|
|
8
8
|
executable: 'npm',
|
|
9
9
|
useDoubleHyphenBeforeArgs: true,
|
|
10
10
|
},
|
|
11
|
-
{
|
|
11
|
+
yarn: {
|
|
12
12
|
lockFile: 'yarn.lock',
|
|
13
13
|
forceFlag: 'yarn',
|
|
14
14
|
executable: 'yarn',
|
|
15
15
|
useDoubleHyphenBeforeArgs: false, // yarn gives a warning if we include `--`
|
|
16
16
|
},
|
|
17
|
-
{
|
|
17
|
+
pnpm: {
|
|
18
18
|
lockFile: 'pnpm-lock.yaml',
|
|
19
19
|
forceFlag: 'pnpm',
|
|
20
20
|
executable: 'pnpm',
|
|
21
21
|
useDoubleHyphenBeforeArgs: true,
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
bun: {
|
|
24
|
+
lockFile: 'bun.lock',
|
|
25
|
+
forceFlag: 'bun',
|
|
26
|
+
executable: 'bun',
|
|
27
|
+
useDoubleHyphenBeforeArgs: false,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const defaultPackageManager = packageManagers.npm;
|
|
32
|
+
|
|
33
|
+
const getPackageManager = async (flags = {}) => {
|
|
34
|
+
for (const config of Object.values(packageManagers)) {
|
|
35
|
+
if (config.forceFlag && flags[config.forceFlag]) {
|
|
36
|
+
return config;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
24
39
|
|
|
25
|
-
const
|
|
40
|
+
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
41
|
+
if (await pathExists(packageJsonPath)) {
|
|
42
|
+
const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf-8'));
|
|
26
43
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
44
|
+
for (const man of Object.keys(packageManagers)) {
|
|
45
|
+
if (packageJson.packageManager?.startsWith(man)) {
|
|
46
|
+
return packageManagers[man];
|
|
47
|
+
}
|
|
31
48
|
}
|
|
32
49
|
}
|
|
33
50
|
|
|
34
|
-
for (const
|
|
35
|
-
if (await pathExists(path.join(process.cwd(),
|
|
36
|
-
return
|
|
51
|
+
for (const config of Object.values(packageManagers)) {
|
|
52
|
+
if (await pathExists(path.join(process.cwd(), config.lockFile))) {
|
|
53
|
+
return config;
|
|
37
54
|
}
|
|
38
55
|
}
|
|
39
56
|
|