@hubspot/npm-scripts 0.2.2 → 0.3.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/package.json +1 -1
- package/src/release.js +2 -0
- package/src/repo-sync.d.ts +1 -1
- package/src/repo-sync.js +6 -3
- package/src/types.d.ts +1 -0
package/package.json
CHANGED
package/src/release.js
CHANGED
|
@@ -107,7 +107,9 @@ function buildHandler({ build, postLatestRelease, packageName, localVersion, reg
|
|
|
107
107
|
await build();
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
|
+
logger.log('Installing dependencies...');
|
|
110
111
|
await exec('yarn');
|
|
112
|
+
logger.log('Building...');
|
|
111
113
|
await exec(`yarn build`);
|
|
112
114
|
}
|
|
113
115
|
let otp = '';
|
package/src/repo-sync.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuildRepoSyncScriptOptions, RepoSyncArguments } from './types.js';
|
|
2
|
-
export declare function handleRepoSync({ targetRepositoryUrl, excludePatterns, buildCommitMessage, internalMainBranch, externalMainBranch, version, dryRun, sshKeyPath, }: BuildRepoSyncScriptOptions & RepoSyncArguments): Promise<void>;
|
|
2
|
+
export declare function handleRepoSync({ sourceDirectory, targetRepositoryUrl, excludePatterns, buildCommitMessage, internalMainBranch, externalMainBranch, version, dryRun, sshKeyPath, }: BuildRepoSyncScriptOptions & RepoSyncArguments): Promise<void>;
|
|
3
3
|
export declare function buildRepoSyncScript({ buildHandlerOptions, }: {
|
|
4
4
|
buildHandlerOptions: BuildRepoSyncScriptOptions;
|
|
5
5
|
}): void;
|
package/src/repo-sync.js
CHANGED
|
@@ -8,14 +8,16 @@ import { DEFAULT_INTERNAL_MAIN_BRANCH, DEFAULT_EXTERNAL_MAIN_BRANCH, SYNC_BRANCH
|
|
|
8
8
|
import { checkoutBranch, cloneRepo, commitChanges, createBranch, getCurrentGitBranch, getGitEnvWithSshKey, pushBranch, } from './utils/git.js';
|
|
9
9
|
import { copyFiles } from './utils/filesystem.js';
|
|
10
10
|
import { confirm } from './utils/prompting.js';
|
|
11
|
-
export async function handleRepoSync({ targetRepositoryUrl, excludePatterns, buildCommitMessage, internalMainBranch, externalMainBranch, version, dryRun, sshKeyPath, }) {
|
|
11
|
+
export async function handleRepoSync({ sourceDirectory, targetRepositoryUrl, excludePatterns, buildCommitMessage, internalMainBranch, externalMainBranch, version, dryRun, sshKeyPath, }) {
|
|
12
12
|
if (!internalMainBranch) {
|
|
13
13
|
internalMainBranch = DEFAULT_INTERNAL_MAIN_BRANCH;
|
|
14
14
|
}
|
|
15
15
|
if (!externalMainBranch) {
|
|
16
16
|
externalMainBranch = DEFAULT_EXTERNAL_MAIN_BRANCH;
|
|
17
17
|
}
|
|
18
|
-
const originalRepoPath =
|
|
18
|
+
const originalRepoPath = sourceDirectory
|
|
19
|
+
? path.resolve(sourceDirectory)
|
|
20
|
+
: process.cwd();
|
|
19
21
|
let tempDir = '';
|
|
20
22
|
try {
|
|
21
23
|
logger.log(`Starting sync to target repository: ${targetRepositoryUrl}...`);
|
|
@@ -86,9 +88,10 @@ export async function handleRepoSync({ targetRepositoryUrl, excludePatterns, bui
|
|
|
86
88
|
process.chdir(originalRepoPath);
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
|
-
function buildHandler({ targetRepositoryUrl, excludePatterns, buildCommitMessage, internalMainBranch, externalMainBranch, }) {
|
|
91
|
+
function buildHandler({ sourceDirectory, targetRepositoryUrl, excludePatterns, buildCommitMessage, internalMainBranch, externalMainBranch, }) {
|
|
90
92
|
return async function handler({ version, dryRun, sshKeyPath, }) {
|
|
91
93
|
await handleRepoSync({
|
|
94
|
+
sourceDirectory,
|
|
92
95
|
targetRepositoryUrl,
|
|
93
96
|
excludePatterns,
|
|
94
97
|
buildCommitMessage,
|
package/src/types.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export interface BuildReleaseScriptOptions extends BuildReleaseScriptBase {
|
|
|
35
35
|
registry: string;
|
|
36
36
|
}
|
|
37
37
|
export interface BuildRepoSyncScriptOptions {
|
|
38
|
+
sourceDirectory?: string;
|
|
38
39
|
targetRepositoryUrl: string;
|
|
39
40
|
buildCommitMessage: (version: string) => string;
|
|
40
41
|
excludePatterns?: string[];
|