Skip to content

Commit ab66e71

Browse files
Merge pull request #48 from contentstack/development
Error handling for creating new GitHub projects, Support for validating git remote url for SSH format, update version in package.json file
2 parents 18585ab + 90d4322 commit ab66e71

File tree

10 files changed

+504
-94
lines changed

10 files changed

+504
-94
lines changed

.github/workflows/policy-scan.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,23 @@ jobs:
2424
- uses: actions/checkout@master
2525
- name: Checks for License file
2626
run: |
27-
if ! [[ -f "LICENSE" || -f "License.txt" || -f "LICENSE.md" ]]; then exit 1; fi
27+
expected_license_files=("LICENSE" "LICENSE.txt" "LICENSE.md" "License.txt")
28+
license_file_found=false
29+
current_year=$(date +"%Y")
30+
31+
for license_file in "${expected_license_files[@]}"; do
32+
if [ -f "$license_file" ]; then
33+
license_file_found=true
34+
# check the license file for the current year, if not exists, exit with error
35+
if ! grep -q "$current_year" "$license_file"; then
36+
echo "License file $license_file does not contain the current year."
37+
exit 2
38+
fi
39+
break
40+
fi
41+
done
42+
43+
if [ "$license_file_found" = false ]; then
44+
echo "No license file found. Please add a license file to the repository."
45+
exit 1
46+
fi

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/cli-launch",
3-
"version": "1.9.0",
3+
"version": "1.9.1",
44
"description": "Launch related operations",
55
"author": "Contentstack CLI",
66
"bin": {

src/adapters/base-class.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import BaseClass from './base-class';
22
import { cliux as ux, ContentstackClient } from '@contentstack/cli-utilities';
33
import config from '../config';
4-
import exp from 'constants';
54

65
jest.mock('@contentstack/cli-utilities', () => ({
76
cliux: {

src/adapters/base-class.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { ApolloClient } from '@apollo/client/core';
1818
import { writeFileSync, existsSync, readFileSync } from 'fs';
1919
import { cliux as ux, ContentstackClient } from '@contentstack/cli-utilities';
2020

21-
import config from '../config';
2221
import { print, GraphqlApiClient, LogPolling, getOrganizations } from '../util';
2322
import {
2423
branchesQuery,
@@ -31,7 +30,6 @@ import {
3130
import {
3231
LogFn,
3332
ExitFn,
34-
Providers,
3533
ConfigType,
3634
AdapterConstructorInputs,
3735
EmitMessage,
@@ -148,31 +146,6 @@ export default class BaseClass {
148146
await this.initApolloClient();
149147
}
150148

151-
/**
152-
* @method selectProjectType - select project type/provider/adapter
153-
*
154-
* @return {*} {Promise<void>}
155-
* @memberof BaseClass
156-
*/
157-
async selectProjectType(): Promise<void> {
158-
const choices = [
159-
...map(config.supportedAdapters, (provider) => ({
160-
value: provider,
161-
name: `Continue with ${provider}`,
162-
})),
163-
{ value: 'FileUpload', name: 'Continue with FileUpload' },
164-
];
165-
166-
const selectedProvider: Providers = await ux.inquire({
167-
choices: choices,
168-
type: 'search-list',
169-
name: 'projectType',
170-
message: 'Choose a project type to proceed',
171-
});
172-
173-
this.config.provider = selectedProvider;
174-
}
175-
176149
/**
177150
* @method detectFramework - detect the project framework
178151
*
@@ -427,7 +400,6 @@ export default class BaseClass {
427400
* @memberof BaseClass
428401
*/
429402
async connectToAdapterOnUi(emit = true): Promise<void> {
430-
await this.selectProjectType();
431403

432404
if (includes(this.config.supportedAdapters, this.config.provider)) {
433405
const baseUrl = this.config.host.startsWith('http') ? this.config.host : `https://${this.config.host}`;
@@ -862,4 +834,4 @@ export default class BaseClass {
862834
});
863835
}
864836
}
865-
}
837+
}

0 commit comments

Comments
 (0)