Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next branch changes #1315

Merged
merged 62 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
8e9d29c
Refactor(config): Sister PR in local-dev-lib (#1123)
kemmerle Nov 21, 2024
80bd984
Create new prompt for `is_available_for_new_content`. (#1226)
tenas97 Nov 21, 2024
c2064f8
Modify `hs create module` command to correspondence to content_types …
kotto5 Nov 22, 2024
4ead713
Merge branch 'main' into next
brandenrodgers Nov 22, 2024
e9887f2
yarn install
brandenrodgers Nov 22, 2024
c4ae858
Merge branch 'main' into next
brandenrodgers Nov 22, 2024
eefb1e0
feat: Update secrets commands to match design guidelines (#1257)
joe-yeager Nov 22, 2024
60389fb
feat!: restructure the open command (#1260)
brandenrodgers Nov 22, 2024
f488c36
feat!: Refactor auth commands (#1254)
brandenrodgers Nov 22, 2024
6d004ec
feat!: Restructure sandbox commands (#1268)
brandenrodgers Nov 22, 2024
c34a566
feat!: Refactor function commands (#1256)
brandenrodgers Nov 22, 2024
3d882c9
feat!: Restructure config commands to match design guidelines (#1264)
joe-yeager Nov 22, 2024
5933219
feat!: Restructure account commands to meet the new design guidelines…
joe-yeager Nov 22, 2024
d735b4f
feat!: remove global --version flag + remove --debug option from hs h…
camden11 Nov 25, 2024
790e038
feat: Add `h` alias for `help` (#1271)
joe-yeager Nov 25, 2024
d9dbd5e
feat!: Restructure completion command (#1263)
brandenrodgers Nov 25, 2024
16ea9c1
feat!: Refactor hubdb commands (#1267)
kemmerle Nov 25, 2024
d8bd3d6
chore: Stabilize the secrets tests (#1272)
joe-yeager Nov 25, 2024
83feeab
feat!: Restructure theme commands to match new design guidelines (#1270)
joe-yeager Nov 26, 2024
db92d75
feat!: Restructure custom-object commands to match design guidelines …
joe-yeager Nov 26, 2024
c533b73
feat!: estructure filemanager commands (#1258)
brandenrodgers Nov 26, 2024
21ede3c
feat!: Restructure project commands to meet guidelines (#1266)
brandenrodgers Nov 26, 2024
4fed1c7
fix: Add --disable-tracking flag back to hs init (#1246)
joe-yeager Nov 26, 2024
154cb19
chore!: Rename Mode to CmsPublishMode (#1269)
camden11 Nov 26, 2024
1c46a3e
chore!: Remove --portal flag and change HUBSPOT_PORTAL_ID env var to …
camden11 Nov 26, 2024
a2e13a9
choreMake --account and --use-env mutually exclusive (#1279)
camden11 Nov 26, 2024
1a0ccff
chore: Clean up buckets and command descriptions (#1280)
camden11 Nov 27, 2024
4e1a46c
feat!: Restructure cms commands (#1281)
brandenrodgers Nov 27, 2024
a0e8e20
v7.0.0-experimental.0
brandenrodgers Nov 27, 2024
aab3260
chore: Convert simple prompts to TypeScript (#1273)
kemmerle Dec 3, 2024
6031f66
chore: Silence deprecation warnings (#1283)
brandenrodgers Dec 4, 2024
68c2028
[chore] Bump TPDS for new LDL major version (#1285)
jsines Dec 4, 2024
175835c
chore: convert usageTracking to TS (#1284)
brandenrodgers Dec 4, 2024
fcb2dab
Merge branch 'main' of github.com:HubSpot/hubspot-cli into next
joe-yeager Dec 4, 2024
962da9a
refactor!: Remove unused hidden commands (#1291)
joe-yeager Dec 6, 2024
36fd210
chore: Convert lib/developerTestAccounts to TS (#1286)
camden11 Dec 6, 2024
ae7f51e
Convert generateSelectors and marketplaceValidate to TS (#1290)
camden11 Dec 6, 2024
cf07cd2
Chore: Convert prompts to TS p.2 (#1288)
kemmerle Dec 6, 2024
d928037
Revert "refactor!: Remove unused hidden commands (#1291)" (#1294)
joe-yeager Dec 9, 2024
af65079
Merge branch 'main' into next
camden11 Dec 10, 2024
ac847e2
Upgrade prettier and update style (#1300)
camden11 Dec 11, 2024
e34c6dc
chore: Convert prompts to TypeScript (final part) (#1293)
kemmerle Dec 11, 2024
053bf3a
Refactor `loadAndValidateOptions` into middleware p.1 (#1297)
kemmerle Dec 11, 2024
a8858bd
chore: Add a script to generate a list of all the commands and subcom…
joe-yeager Dec 11, 2024
37700a9
Merge main
kemmerle Dec 12, 2024
d9a6cf1
Fix bug in `hs fetch` (#1304)
kemmerle Dec 12, 2024
668aa6c
Fix bug with account middleware in `hs project dev` (#1303)
kemmerle Dec 13, 2024
40f325b
Refactor `loadAndValidateOptions` p.2 (config middleware) (#1305)
kemmerle Dec 13, 2024
9422cfe
Chore: project structure ts port (#1302)
brandenrodgers Dec 16, 2024
b20ec8b
Convert Oauth, Polling, and Projects to TS (#1306)
camden11 Dec 18, 2024
26783ae
chore: Fix project upload link (#1311)
brandenrodgers Dec 18, 2024
6305513
Convert ProjectLogsManager to TS (#1312)
camden11 Dec 20, 2024
953e514
Refactor `loadAndValidateOptions` p3: Add config validation (#1307)
kemmerle Dec 20, 2024
58332a2
Fix bug in `hs sandbox delete` (#1313)
kemmerle Dec 20, 2024
a20161b
Refactor `loadAndValidateOptions`: Add account middleware (Final part…
kemmerle Dec 20, 2024
fafbd92
chore: port validation and configOptions to TS (#1309)
brandenrodgers Dec 20, 2024
31b9051
v7.0.0-experimental.2
brandenrodgers Dec 20, 2024
34f0327
Chore: Fix the no config error for hs --version (#1314)
brandenrodgers Jan 6, 2025
0916a0a
chore: Better error for secret deletes (#1316)
brandenrodgers Jan 7, 2025
cfba705
test: Increase the polling timeout (#1319)
joe-yeager Jan 7, 2025
ce17c8e
fix: Fix build id prompt in hs project deploy (#1318)
camden11 Jan 7, 2025
99b9b37
Fix bug in `hubdb create` (#1317)
kemmerle Jan 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion acceptance-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This project tests our CLI's `hs <*>` commands as if they were being used by an

The main test execution is kicked off by running `yarn test-cli` from the root of `hubspot-cli`. This will run the test suites defined in the `tests` directory.

Note that if you are testing against a QA portal, not a PROD one, you'll need to run `yarn test-qa`. There is still an outstanding issue with this because we attempt to add the `--qa` flag to all `hs` commands, however it is not available for all commands.
Note that if you are testing against a QA account, not a PROD one, you'll need to run `yarn test-qa`. There is still an outstanding issue with this because we attempt to add the `--qa` flag to all `hs` commands, however it is not available for all commands.

### Setup

Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/lib/TestState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class TestState {
async initializeAuth() {
try {
await this.cli.executeWithTestConfig(
['init'],
['init', '--disable-tracking'],
getInitPromptSequence(this.getPAK())
);

Expand Down
19 changes: 9 additions & 10 deletions acceptance-tests/lib/cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function executeWithInput(
const { env, timeout = 1000, maxTimeout = 30000 } = opts;

const childProcess = createProcess(config, args, env);
childProcess.stdin.setEncoding('utf-8');
childProcess.stdin!.setEncoding('utf-8');

let currentInputTimeout: NodeJS.Timeout;
let killIOTimeout: NodeJS.Timeout;
Expand All @@ -78,7 +78,7 @@ function executeWithInput(
}

if (!inputs.length) {
childProcess.stdin.end();
childProcess.stdin!.end();

// Set a timeout to wait for CLI response. If CLI takes longer than
// maxTimeout to respond, kill the childProcess and notify user
Expand All @@ -94,7 +94,7 @@ function executeWithInput(
if (typeof inputs[0] === 'function') {
await inputs[0]();
} else {
childProcess.stdin.write(inputs[0]);
childProcess.stdin!.write(inputs[0]);
}

if (config.debug) {
Expand All @@ -106,14 +106,14 @@ function executeWithInput(
};

// Get errors from CLI for debugging
childProcess.stderr.on('data', (err: unknown) => {
childProcess.stderr!.on('data', (err: unknown) => {
if (config.debug) {
console.log('error:', String(err));
}
});

// Get output from CLI for debugging
childProcess.stdout.on('data', (data: unknown) => {
childProcess.stdout!.on('data', (data: unknown) => {
if (config.debug) {
console.log('output:', String(data));
}
Expand All @@ -123,7 +123,6 @@ function executeWithInput(
const handleStderr = (err: unknown) => {
// Ignore any allowed errors so tests can continue
const allowedErrors = [
'DeprecationWarning', // Ignore package deprecation warnings.
'[WARNING]', // Ignore our own CLI warning messages
];

Expand All @@ -134,12 +133,12 @@ function executeWithInput(
}

// Resubscribe if we ignored this error
childProcess.stderr.once('data', handleStderr);
childProcess.stderr!.once('data', handleStderr);
return;
}

// If the childProcess errors out, stop all the pending inputs
childProcess.stdin.end();
childProcess.stdin!.end();

if (currentInputTimeout) {
clearTimeout(currentInputTimeout);
Expand All @@ -149,10 +148,10 @@ function executeWithInput(
reject(error);
};

childProcess.stderr.once('data', handleStderr);
childProcess.stderr!.once('data', handleStderr);
childProcess.on('error', reject);

childProcess.stdout.pipe(
childProcess.stdout!.pipe(
concat((result: unknown) => {
if (killIOTimeout) {
clearTimeout(killIOTimeout);
Expand Down
4 changes: 2 additions & 2 deletions acceptance-tests/tests/commands/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ describe('hs config', () => {
});

describe('hs config set', () => {
it('should set the default mode to draft', async () => {
it('should set the default CMS publish mode to draft', async () => {
await testState.cli.executeWithTestConfig(
['config', 'set'],
[ENTER, DOWN, ENTER]
);

const parsedConfig = testState.getParsedConfig();

expect(parsedConfig.defaultMode).toEqual('draft');
expect(parsedConfig.defaultCmsPublishMode).toEqual('draft');
});
});
});
29 changes: 19 additions & 10 deletions acceptance-tests/tests/commands/create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ describe('hs create', () => {
});

it('creates a module', async () => {
await testState.cli.execute(
await testState.cli.executeWithTestConfig(
['create', 'module', FOLDERS.module.name],
['label', ENTER, ENTER, ENTER, 'y', ENTER]
['label', ENTER, ENTER, ENTER, 'y', ENTER, ENTER]
);

expect(testState.existsInTestOutputDirectory(FOLDERS.module.folder)).toBe(
Expand All @@ -80,7 +80,7 @@ describe('hs create', () => {
});

it('creates a template', async () => {
await testState.cli.execute(
await testState.cli.executeWithTestConfig(
['create', 'template', FOLDERS.template.name],
[ENTER]
);
Expand All @@ -90,35 +90,44 @@ describe('hs create', () => {
});

it('website-theme', async () => {
await testState.cli.execute(['create', FOLDERS.websiteTheme.name]);
await testState.cli.executeWithTestConfig([
'create',
FOLDERS.websiteTheme.name,
]);
expect(
testState.existsInTestOutputDirectory(FOLDERS.websiteTheme.folder)
).toBe(true);
});

it('react-app', async () => {
await testState.cli.execute(['create', FOLDERS.reactApp.name]);
await testState.cli.executeWithTestConfig([
'create',
FOLDERS.reactApp.name,
]);
expect(testState.existsInTestOutputDirectory(FOLDERS.reactApp.folder)).toBe(
true
);
});

it('vue-app', async () => {
await testState.cli.execute(['create', FOLDERS.vueApp.name]);
await testState.cli.executeWithTestConfig(['create', FOLDERS.vueApp.name]);
expect(testState.existsInTestOutputDirectory(FOLDERS.vueApp.folder)).toBe(
true
);
});

it('webpack-serverless', async () => {
await testState.cli.execute(['create', FOLDERS.webpackServerless.name]);
await testState.cli.executeWithTestConfig([
'create',
FOLDERS.webpackServerless.name,
]);
expect(
testState.existsInTestOutputDirectory(FOLDERS.webpackServerless.folder)
).toBe(true);
});

it('api-sample', async () => {
await testState.cli.execute(
await testState.cli.executeWithTestConfig(
['create', FOLDERS.apiSample.name, FOLDERS.apiSample.name],
[ENTER, ENTER]
);
Expand All @@ -129,14 +138,14 @@ describe('hs create', () => {
});

it('app', async () => {
await testState.cli.execute(['create', FOLDERS.app.name]);
await testState.cli.executeWithTestConfig(['create', FOLDERS.app.name]);
expect(testState.existsInTestOutputDirectory(FOLDERS.app.folder)).toBe(
true
);
});

it('function', async () => {
await testState.cli.execute(
await testState.cli.executeWithTestConfig(
['create', 'function'],
[
FOLDERS.function.name,
Expand Down
36 changes: 36 additions & 0 deletions acceptance-tests/tests/commands/hs.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { describe, beforeAll, it, expect, afterAll } from 'vitest';
import { TestState } from '../../lib/TestState';

describe('hs', () => {
let testState: TestState;

beforeAll(async () => {
testState = new TestState();
});

afterAll(() => {
testState.cleanup();
});

describe('hs', () => {
it('should log out the help message', async () => {
const output = await testState.cli.executeWithTestConfig([]);

expect(output).toContain(
'The command line interface to interact with HubSpot'
);
});

it('should log out the help message when --help is passed', async () => {
const output = await testState.cli.executeWithTestConfig(['--help']);

expect(output).toContain(
'The command line interface to interact with HubSpot'
);
});

it('should not throw when --version is passed', async () => {
await testState.cli.executeWithTestConfig(['--version']);
});
});
});
2 changes: 1 addition & 1 deletion acceptance-tests/tests/commands/projectCreate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('hs project create', () => {
'project',
'create',
`--name="${PROJECT_FOLDER}"`,
`--location="${PROJECT_FOLDER}"`,
`--dest="${PROJECT_FOLDER}"`,
'--template="getting-started-private-app"',
]);
expect(testState.existsInTestOutputDirectory(PROJECT_FOLDER)).toBe(true);
Expand Down
13 changes: 6 additions & 7 deletions acceptance-tests/tests/workflows/accountManagementFlow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Account Management Flow', () => {
describe('hs init', () => {
it('should generate a config file', async () => {
await testState.cli.executeWithTestConfig(
['init'],
['init', '--disable-tracking'],
getInitPromptSequence(testState.getPAK(), accountName)
);

Expand Down Expand Up @@ -73,12 +73,11 @@ describe('Account Management Flow', () => {

describe('hs accounts list', () => {
it('should not list the removed authenticated account', async () => {
const output = await testState.cli.executeWithTestConfig([
'accounts',
'list',
]);

expect(output).not.toContain(accountName);
await expect(() =>
testState.cli.executeWithTestConfig(['accounts', 'list'])
).rejects.toThrow(
/There are no accounts defined in the configuration file/
);
});
});

Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/tests/workflows/cmsTemplateFlow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('CMS Template Flow', () => {

describe('hs create', () => {
it('should create a CMS template', async () => {
await testState.cli.execute(
await testState.cli.executeWithTestConfig(
['create', 'template', TEMPLATE_NAME],
[ENTER]
);
Expand Down
52 changes: 29 additions & 23 deletions acceptance-tests/tests/workflows/secretsFlow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ const SECRET = {
value: 'an initial secret value',
};

const secretPollingOptions = {
interval: 5000,
timeout: 60000,
};

async function waitForSecretsListToContainSecret(testState: TestState) {
await expect
.poll(
() => testState.cli.executeWithTestConfig(['secrets', 'list']),
secretPollingOptions
)
.toContain(SECRET.name);
}

describe('Secrets Flow', () => {
let testState: TestState;

Expand All @@ -29,22 +43,16 @@ describe('Secrets Flow', () => {
['secrets', 'add', SECRET.name],
[SECRET.value, ENTER]
);
});
});

describe('hs secrets list', () => {
it('should list the secret', async () => {
await expect
.poll(() => testState.cli.executeWithTestConfig(['secrets', 'list']), {
interval: 1000,
timeout: 10000,
})
.toContain(SECRET.name);
await waitForSecretsListToContainSecret(testState);
});
});

describe('hs secrets update', () => {
it('should update the existing secret', async () => {
// Wait for the secret to exist before updating it
await waitForSecretsListToContainSecret(testState);

await testState.cli.executeWithTestConfig(
['secrets', 'update', SECRET.name],
['a different secret value', ENTER]
Expand All @@ -54,21 +62,19 @@ describe('Secrets Flow', () => {

describe('hs secrets delete', () => {
it('should delete the secret', async () => {
await testState.cli.executeWithTestConfig([
'secrets',
'delete',
SECRET.name,
]);
});
});
// Wait for the secret to exist before deleting it
await waitForSecretsListToContainSecret(testState);

await testState.cli.executeWithTestConfig(
['secrets', 'delete', SECRET.name],
['Y', ENTER]
);

describe('hs secrets list', () => {
it('should not list the secret', async () => {
await expect
.poll(() => testState.cli.executeWithTestConfig(['secrets', 'list']), {
interval: 1000,
timeout: 10000,
})
.poll(
() => testState.cli.executeWithTestConfig(['secrets', 'list']),
secretPollingOptions
)
.not.toContain(SECRET.name);
});
});
Expand Down
Loading
Loading