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

[Cherry 3.6.x]: fix: aligned license checker with updated dependencies & runtime #4444

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ test:types:
- src/js/api/types

test:licenses:
image: denoland/deno:alpine
image: denoland/deno:alpine-1.38.0
stage: test
except:
- master
Expand All @@ -109,8 +109,7 @@ test:licenses:
- apk add --no-cache nodejs npm
- npm ci
script:
- cd tests/licenses
- deno run --allow-read --allow-env licenseCheck.ts
- deno run --allow-env --allow-read --allow-sys tests/licenses/licenseCheck.ts
tags:
- mender-qa-worker-generic-light

Expand Down
12 changes: 7 additions & 5 deletions tests/licenses/licenseCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { parse } from 'https://deno.land/[email protected]/flags/mod.ts';
import { parse } from 'https://deno.land/[email protected]/flags/mod.ts';
import { dirname, fromFileUrl, resolve as resolvePath } from 'https://deno.land/[email protected]/path/mod.ts';
import { DiffTerm, diff } from 'https://deno.land/x/[email protected]/mod.ts';
import { asCSV, asSummary, init } from 'npm:[email protected]';
import { asCSV, asSummary, init } from 'npm:[email protected]';

const licenseFile = 'directDependencies.csv';
const licenseFileLocation = resolvePath(dirname(fromFileUrl(Deno.mainModule)), licenseFile);

const licenseFileLocation = './directDependencies.csv';
const knownOptions = [
{ key: 'update', description: 'to update the current license file (needs "--allow-write")' },
{ key: 'summary', description: 'give an overview of the license usage' },
Expand All @@ -27,8 +30,7 @@ const usageMessage = [
''
].join('\n');

const collectUsedLicenses = () =>
new Promise((resolve, reject) => init({ direct: 0, start: '../../.' }, (err, packages) => (err ? reject(err) : resolve(packages))));
const collectUsedLicenses = () => new Promise((resolve, reject) => init({ direct: 0, start: '.' }, (err, packages) => (err ? reject(err) : resolve(packages))));

const createPackageData = packageData => ({ licenses: packageData.licenses ?? 'unknown', repository: packageData.repository || packageData.url || '' });

Expand Down