Skip to content

Commit

Permalink
Merge pull request #28 from ditrit/library/plugin_core_version_0.17.0
Browse files Browse the repository at this point in the history
Library: plugin core version 0.17.0
  • Loading branch information
Zorin95670 authored Jul 5, 2023
2 parents 295d2cd + 19d05e6 commit 6da1a57
Show file tree
Hide file tree
Showing 7 changed files with 2,040 additions and 2,059 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

## [Unreleased]

### Changed

- Update to plugin-core version 0.17.0.

## [0.2.0] - 2023/06/06

### Added
Expand Down
4,046 changes: 2,008 additions & 2,038 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@
},
"homepage": "https://github.com/ditrit/githubator-plugin#readme",
"dependencies": {
"leto-modelizer-plugin-core": "github:ditrit/leto-modelizer-plugin-core#0.16.0",
"leto-modelizer-plugin-core": "github:ditrit/leto-modelizer-plugin-core#0.17.0",
"lidy-js": "github:ditrit/lidy-js#1.0.1",
"nunjucks": "=3.2.4"
},
"devDependencies": {
"@babel/core": "=7.22.1",
"@babel/preset-env": "=7.22.4",
"babel-jest": "=29.5.0",
"@babel/core": "=7.22.6",
"@babel/preset-env": "=7.22.6",
"babel-jest": "=29.6.0",
"babel-loader": "=9.1.2",
"esdoc": "=1.1.0",
"esdoc-standard-plugin": "=1.0.0",
"eslint": "=8.42.0",
"eslint": "=8.44.0",
"eslint-config-airbnb-base": "=15.0.0",
"eslint-formatter-json-relative": "=0.1.0",
"eslint-plugin-import": "=2.27.5",
"eslint-plugin-jest": "=27.2.1",
"eslint-plugin-jsdoc": "=46.2.4",
"eslint-plugin-jest": "=27.2.2",
"eslint-plugin-jsdoc": "=46.4.3",
"eslint-webpack-plugin": "=4.0.1",
"jest": "=29.5.0",
"jest-environment-jsdom": "=29.5.0",
"jest": "=29.6.0",
"jest-environment-jsdom": "=29.6.0",
"jest-sonar-reporter": "=2.0.0",
"webpack": "=5.85.1",
"webpack-cli": "=5.1.3"
"webpack": "=5.88.1",
"webpack-cli": "=5.1.4"
}
}
9 changes: 7 additions & 2 deletions src/models/GithubActionConfiguration.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DefaultConfiguration } from 'leto-modelizer-plugin-core';
import { DefaultConfiguration, Tag } from 'leto-modelizer-plugin-core';
import syntax from 'src/configuration/syntax';

/**
Expand All @@ -16,7 +16,12 @@ class GithubActionConfiguration extends DefaultConfiguration {
...props.editor,
syntax,
},
tags: ['Github', 'CI', 'CD', 'Workflow', 'Pipeline'],
tags: [
new Tag({ type: 'language', value: 'Github' }),
new Tag({ type: 'category', value: 'CI' }),
new Tag({ type: 'category', value: 'CD' }),
],
restrictiveFolder: '.github/workflows/',
});
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/parser/GithubActionParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ class GithubActionParser extends DefaultParser {
* @returns {boolean} - Boolean that indicates if this file can be parsed or not.
*/
isParsable({ path }) {
// TODO: rework when we can use any folder we want on leto-modelizer
// Use: return /^\.github\/workflows\/.*\.ya?ml$/.test(path);
return /\/.*\.ya?ml$/.test(path);
return /^\.github\/workflows\/.*\.ya?ml$/.test(path);
}

/**
* Convert the content of files into Components.
* @param {FileInformation} diagram - Diagram file information.
* @param {FileInput[]} [inputs] - Data you want to parse.
* @param {string} [parentEventId] - Parent event id.
*/
parse(inputs = [], parentEventId = null) {
parse(diagram, inputs = [], parentEventId = null) {
this.pluginData.components = [];
this.pluginData.parseErrors = [];

inputs
.filter(({ path }) => diagram.path === path)
.filter(({ path, content }) => {
if (content && content.trim() !== '') {
return true;
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/parser/GithubActionParser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('Test GithubActionParser', () => {
content: fs.readFileSync('tests/resources/yml/emptyTriggers.yml', 'utf8'),
});
metadata.parse();
parser.parse([file]);
parser.parse(new FileInformation({ path: './completeCI.yml' }), [file]);

expect(pluginData.components).toEqual(emptyTriggers);
});
Expand Down Expand Up @@ -101,7 +101,7 @@ describe('Test GithubActionParser', () => {
content: fs.readFileSync('tests/resources/yml/completeCI.yml', 'utf8'),
});
metadata.parse();
parser.parse([file]);
parser.parse(new FileInformation({ path: './completeCI.yml' }), [file]);

expect(pluginData.components).toEqual(completeCI);
});
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/render/GithubActionRenderer.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import GithubActionRenderer from 'src/render/GithubActionRenderer';
import { DefaultData, FileInput } from 'leto-modelizer-plugin-core';
import { DefaultData, FileInput, FileInformation } from 'leto-modelizer-plugin-core';
import fs from 'fs';
import GithubActionParser from 'src/parser/GithubActionParser';
import GithubActionMetadata from 'src/metadata/GithubActionMetadata';
Expand All @@ -17,7 +17,7 @@ describe('Test GithubActionMetadata', () => {
});

metadata.parse();
parser.parse([fileToParse]);
parser.parse(new FileInformation({ path: './completeCI.yml' }), [fileToParse]);

const [file] = render.render([]);

Expand Down

0 comments on commit 6da1a57

Please sign in to comment.