Skip to content
Merged
21 changes: 20 additions & 1 deletion .github/workflows/policy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,23 @@ jobs:
- uses: actions/checkout@master
- name: Checks for License file
run: |
if ! [[ -f "LICENSE" || -f "License.txt" || -f "LICENSE.md" ]]; then exit 1; fi
expected_license_files=("LICENSE" "LICENSE.txt" "LICENSE.md" "License.txt")
license_file_found=false
current_year=$(date +"%Y")

for license_file in "${expected_license_files[@]}"; do
if [ -f "$license_file" ]; then
license_file_found=true
# check the license file for the current year, if not exists, exit with error
if ! grep -q "$current_year" "$license_file"; then
echo "License file $license_file does not contain the current year."
exit 2
fi
break
fi
done

if [ "$license_file_found" = false ]; then
echo "No license file found. Please add a license file to the repository."
exit 1
fi
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-launch",
"version": "1.9.0",
"version": "1.9.1",
"description": "Launch related operations",
"author": "Contentstack CLI",
"bin": {
Expand Down
1 change: 0 additions & 1 deletion src/adapters/base-class.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import BaseClass from './base-class';
import { cliux as ux, ContentstackClient } from '@contentstack/cli-utilities';
import config from '../config';
import exp from 'constants';

jest.mock('@contentstack/cli-utilities', () => ({
cliux: {
Expand Down
30 changes: 1 addition & 29 deletions src/adapters/base-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { ApolloClient } from '@apollo/client/core';
import { writeFileSync, existsSync, readFileSync } from 'fs';
import { cliux as ux, ContentstackClient } from '@contentstack/cli-utilities';

import config from '../config';
import { print, GraphqlApiClient, LogPolling, getOrganizations } from '../util';
import {
branchesQuery,
Expand All @@ -31,7 +30,6 @@ import {
import {
LogFn,
ExitFn,
Providers,
ConfigType,
AdapterConstructorInputs,
EmitMessage,
Expand Down Expand Up @@ -148,31 +146,6 @@ export default class BaseClass {
await this.initApolloClient();
}

/**
* @method selectProjectType - select project type/provider/adapter
*
* @return {*} {Promise<void>}
* @memberof BaseClass
*/
async selectProjectType(): Promise<void> {
const choices = [
...map(config.supportedAdapters, (provider) => ({
value: provider,
name: `Continue with ${provider}`,
})),
{ value: 'FileUpload', name: 'Continue with FileUpload' },
];

const selectedProvider: Providers = await ux.inquire({
choices: choices,
type: 'search-list',
name: 'projectType',
message: 'Choose a project type to proceed',
});

this.config.provider = selectedProvider;
}

/**
* @method detectFramework - detect the project framework
*
Expand Down Expand Up @@ -427,7 +400,6 @@ export default class BaseClass {
* @memberof BaseClass
*/
async connectToAdapterOnUi(emit = true): Promise<void> {
await this.selectProjectType();

if (includes(this.config.supportedAdapters, this.config.provider)) {
const baseUrl = this.config.host.startsWith('http') ? this.config.host : `https://${this.config.host}`;
Expand Down Expand Up @@ -862,4 +834,4 @@ export default class BaseClass {
});
}
}
}
}
Loading