occam-open-cli 5.0.49 → 5.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/action/publish.js +2 -2
- package/bin/operation/loadRelease.js +29 -0
- package/package.json +3 -21
- package/bin/operation/createRelease.js +0 -47
- package/lib/browser.js +0 -75
- package/lib/constants.js +0 -26
- package/lib/dependencies.js +0 -74
- package/lib/dependency.js +0 -61
- package/lib/directory.js +0 -100
- package/lib/entries.js +0 -207
- package/lib/file.js +0 -141
- package/lib/fileNames.js +0 -12
- package/lib/files.js +0 -121
- package/lib/main.js +0 -79
- package/lib/messages.js +0 -13
- package/lib/mixins/bnf.js +0 -47
- package/lib/mixins/entries.js +0 -31
- package/lib/mixins/files.js +0 -41
- package/lib/mixins/pattern.js +0 -47
- package/lib/project.js +0 -154
- package/lib/projects.js +0 -112
- package/lib/release.js +0 -127
- package/lib/shortenedVersion.js +0 -125
- package/lib/types.js +0 -29
- package/lib/utilities/content.js +0 -34
- package/lib/utilities/entries.js +0 -105
- package/lib/utilities/filePath.js +0 -63
- package/lib/utilities/files.js +0 -75
- package/lib/utilities/metaJSON.js +0 -80
- package/lib/utilities/name.js +0 -35
- package/lib/utilities/node.js +0 -81
- package/lib/utilities/query.js +0 -41
- package/lib/utilities/tokens.js +0 -23
- package/lib/version.js +0 -163
- package/src/browser.js +0 -18
- package/src/constants.js +0 -5
- package/src/dependencies.js +0 -40
- package/src/dependency.js +0 -22
- package/src/directory.js +0 -54
- package/src/entries.js +0 -170
- package/src/file.js +0 -95
- package/src/fileNames.js +0 -17
- package/src/files.js +0 -78
- package/src/main.js +0 -18
- package/src/messages.js +0 -3
- package/src/mixins/bnf.js +0 -59
- package/src/mixins/entries.js +0 -18
- package/src/mixins/files.js +0 -52
- package/src/mixins/pattern.js +0 -59
- package/src/project.js +0 -147
- package/src/projects.js +0 -66
- package/src/release.js +0 -99
- package/src/shortenedVersion.js +0 -109
- package/src/types.js +0 -9
- package/src/utilities/content.js +0 -12
- package/src/utilities/entries.js +0 -126
- package/src/utilities/filePath.js +0 -36
- package/src/utilities/files.js +0 -103
- package/src/utilities/metaJSON.js +0 -82
- package/src/utilities/name.js +0 -26
- package/src/utilities/node.js +0 -70
- package/src/utilities/query.js +0 -31
- package/src/utilities/tokens.js +0 -17
- package/src/version.js +0 -151
package/src/file.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { FILE_TYPE } from "./types";
|
|
4
|
-
import { convertContentTabsToWhitespace } from "./utilities/content"
|
|
5
|
-
|
|
6
|
-
export default class File {
|
|
7
|
-
constructor(path, content) {
|
|
8
|
-
this.path = path;
|
|
9
|
-
this.content = content;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
getPath() {
|
|
13
|
-
return this.path;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
getContent() {
|
|
17
|
-
return this.content;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
isFile() {
|
|
21
|
-
const file = true;
|
|
22
|
-
|
|
23
|
-
return file;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
isDirectory() {
|
|
27
|
-
const directory = false;
|
|
28
|
-
|
|
29
|
-
return directory;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
setPath(path) {
|
|
33
|
-
this.path = path;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
setContent(content) {
|
|
37
|
-
this.content = content;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
toJSON() {
|
|
41
|
-
const { type } = File,
|
|
42
|
-
path = this.path,
|
|
43
|
-
content = this.content,
|
|
44
|
-
json = {
|
|
45
|
-
type,
|
|
46
|
-
path,
|
|
47
|
-
content
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
return json;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
static type = FILE_TYPE;
|
|
54
|
-
|
|
55
|
-
static fromJSON(json) {
|
|
56
|
-
let file = null;
|
|
57
|
-
|
|
58
|
-
if (json !== null) {
|
|
59
|
-
const { type } = json;
|
|
60
|
-
|
|
61
|
-
if (type === FILE_TYPE) {
|
|
62
|
-
let { content } = json;
|
|
63
|
-
|
|
64
|
-
const { path } = json;
|
|
65
|
-
|
|
66
|
-
content = convertContentTabsToWhitespace(content); ///
|
|
67
|
-
|
|
68
|
-
file = new File(path, content);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return file;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
static fromDocument(document) {
|
|
76
|
-
const filePath = document.getFilePath(),
|
|
77
|
-
path = filePath; ///
|
|
78
|
-
|
|
79
|
-
let content = document.getContent();
|
|
80
|
-
|
|
81
|
-
content = convertContentTabsToWhitespace(content); ///
|
|
82
|
-
|
|
83
|
-
const file = new File(path, content);
|
|
84
|
-
|
|
85
|
-
return file;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
static fromPathAndContent(path, content) {
|
|
89
|
-
content = convertContentTabsToWhitespace(content); ///
|
|
90
|
-
|
|
91
|
-
const file = new File(path, content);
|
|
92
|
-
|
|
93
|
-
return file;
|
|
94
|
-
}
|
|
95
|
-
}
|
package/src/fileNames.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const TERM_BNF_FILE_NAME = "term.bnf",
|
|
4
|
-
STATEMENT_BNF_FILE_NAME = "statement.bnf",
|
|
5
|
-
METASTATEMENT_BNF_FILE_NAME = "metastatement.bnf",
|
|
6
|
-
TYPE_PATTERN_FILE_NAME = "type.ptn",
|
|
7
|
-
SYMBOL_PATTERN_FILE_NAME = "symbol.ptn",
|
|
8
|
-
OPERATOR_PATTERN_FILE_NAME = "operator.ptn";
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
TERM_BNF_FILE_NAME,
|
|
12
|
-
STATEMENT_BNF_FILE_NAME,
|
|
13
|
-
METASTATEMENT_BNF_FILE_NAME,
|
|
14
|
-
TYPE_PATTERN_FILE_NAME,
|
|
15
|
-
SYMBOL_PATTERN_FILE_NAME,
|
|
16
|
-
OPERATOR_PATTERN_FILE_NAME
|
|
17
|
-
};
|
package/src/files.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import File from "./file";
|
|
4
|
-
|
|
5
|
-
export default class Files {
|
|
6
|
-
constructor(array) {
|
|
7
|
-
this.array = array;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
getFilePaths() {
|
|
11
|
-
const filePaths = this.mapFile((file) => {
|
|
12
|
-
const filePath = file.getPath();
|
|
13
|
-
|
|
14
|
-
return filePath;
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return filePaths;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
addFile(file) {
|
|
21
|
-
this.array.push(file);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
mapFile(callback) {
|
|
25
|
-
return this.array.map(callback);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
someFile(callback) {
|
|
29
|
-
return this.array.some(callback);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
reduceFile(callback, initialValue) {
|
|
33
|
-
return this.array.reduce(callback, initialValue);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
forEachFile(callback) {
|
|
37
|
-
this.array.forEach(callback);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
findFile(callback) {
|
|
41
|
-
return this.array.find(callback) || null; ///
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
toJSON() {
|
|
45
|
-
const filesJSON = this.array.map((file) => {
|
|
46
|
-
const fileJSON = (file !== null) ?
|
|
47
|
-
file.toJSON() :
|
|
48
|
-
null;
|
|
49
|
-
|
|
50
|
-
return fileJSON;
|
|
51
|
-
}),
|
|
52
|
-
json = filesJSON; ///
|
|
53
|
-
|
|
54
|
-
return json;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
static fromJSON(json) {
|
|
58
|
-
const filesJSON = json, ///
|
|
59
|
-
array = [],
|
|
60
|
-
files = new Files(array);
|
|
61
|
-
|
|
62
|
-
filesJSON.forEach((fileJSON) => {
|
|
63
|
-
const json = fileJSON, ///
|
|
64
|
-
file = File.fromJSON(json);
|
|
65
|
-
|
|
66
|
-
files.addFile(file);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return files;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
static fromNothing() {
|
|
73
|
-
const array = [],
|
|
74
|
-
files = new Files(array);
|
|
75
|
-
|
|
76
|
-
return files;
|
|
77
|
-
}
|
|
78
|
-
}
|
package/src/main.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
export { default as File } from "./file";
|
|
4
|
-
export { default as Files } from "./files";
|
|
5
|
-
export { default as Version } from "./version";
|
|
6
|
-
export { default as Release } from "./release";
|
|
7
|
-
export { default as Entries } from "./entries";
|
|
8
|
-
export { default as Project } from "./project";
|
|
9
|
-
export { default as Projects } from "./projects";
|
|
10
|
-
export { default as Dependency } from "./dependency";
|
|
11
|
-
export { default as Dependencies } from "./dependencies";
|
|
12
|
-
export { default as ShortenedVersion } from "./shortenedVersion";
|
|
13
|
-
|
|
14
|
-
export { default as nameUtilities } from "./utilities/name";
|
|
15
|
-
export { default as contentUtilities } from "./utilities/content";
|
|
16
|
-
export { default as entriesUtilities } from "./utilities/entries";
|
|
17
|
-
export { default as filePathUtilities } from "./utilities/filePath";
|
|
18
|
-
export { default as metaJSONUtilities } from "./utilities/metaJSON";
|
package/src/messages.js
DELETED
package/src/mixins/bnf.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { fileNameFromFilePath } from "../utilities/name";
|
|
4
|
-
import { TERM_BNF_FILE_NAME, STATEMENT_BNF_FILE_NAME, METASTATEMENT_BNF_FILE_NAME } from "../fileNames";
|
|
5
|
-
|
|
6
|
-
function getBNF(bnfFileName) {
|
|
7
|
-
let bnf = null;
|
|
8
|
-
|
|
9
|
-
const customGrammarBNFFiles = this.getCustomGrammarBNFFiles(),
|
|
10
|
-
customGrammarBNFFile = customGrammarBNFFiles.find((customGrammarBNFFile) => {
|
|
11
|
-
const customGrammarBNFFilePath = customGrammarBNFFile.getPath(),
|
|
12
|
-
customGrammarBNFFileName = fileNameFromFilePath(customGrammarBNFFilePath);
|
|
13
|
-
|
|
14
|
-
if (customGrammarBNFFileName === bnfFileName) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
}) || null;
|
|
18
|
-
|
|
19
|
-
if (customGrammarBNFFile !== null) {
|
|
20
|
-
const customGrammarBNFFileContent = customGrammarBNFFile.getContent();
|
|
21
|
-
|
|
22
|
-
bnf = customGrammarBNFFileContent; ///
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return bnf;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function getTermBNF() {
|
|
29
|
-
const fileName = TERM_BNF_FILE_NAME, ///
|
|
30
|
-
bnf = this.getBNF(fileName),
|
|
31
|
-
termBNF = bnf; ///
|
|
32
|
-
|
|
33
|
-
return termBNF;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function getStatementBNF() {
|
|
37
|
-
const fileName = STATEMENT_BNF_FILE_NAME, ///
|
|
38
|
-
bnf = this.getBNF(fileName),
|
|
39
|
-
statementBNF = bnf; ///
|
|
40
|
-
|
|
41
|
-
return statementBNF;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function getMetastatementBNF() {
|
|
45
|
-
const fileName = METASTATEMENT_BNF_FILE_NAME, ///
|
|
46
|
-
bnf = this.getBNF(fileName),
|
|
47
|
-
metastatementBNF = bnf; ///
|
|
48
|
-
|
|
49
|
-
return metastatementBNF;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const bnfMixins = {
|
|
53
|
-
getBNF,
|
|
54
|
-
getTermBNF,
|
|
55
|
-
getStatementBNF,
|
|
56
|
-
getMetastatementBNF
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export default bnfMixins;
|
package/src/mixins/entries.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function getFile(filePath) { return this.entries.getFile(filePath); }
|
|
4
|
-
|
|
5
|
-
function getFiles() { return this.entries.getFiles(); }
|
|
6
|
-
|
|
7
|
-
function getFilePaths() { return this.entries.getFilePaths(); }
|
|
8
|
-
|
|
9
|
-
function getDirectoryPaths() { return this.entries.getDirectoryPaths(); }
|
|
10
|
-
|
|
11
|
-
const entriesMixins = {
|
|
12
|
-
getFile,
|
|
13
|
-
getFiles,
|
|
14
|
-
getFilePaths,
|
|
15
|
-
getDirectoryPaths
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default entriesMixins;
|
package/src/mixins/files.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { readmeFileFromFiles,
|
|
4
|
-
metaJSONFileFromFiles,
|
|
5
|
-
florenceFilesFromFiles,
|
|
6
|
-
customGrammarBNFFilesFromFiles,
|
|
7
|
-
customGrammarPatternFilesFromFiles } from "../utilities/files";
|
|
8
|
-
|
|
9
|
-
function getReadmeFile() {
|
|
10
|
-
const files = this.getFiles(),
|
|
11
|
-
readmeFile = readmeFileFromFiles(files);
|
|
12
|
-
|
|
13
|
-
return readmeFile;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function getMetaJSONFile() {
|
|
17
|
-
const files = this.getFiles(),
|
|
18
|
-
metaJSONFile = metaJSONFileFromFiles(files);
|
|
19
|
-
|
|
20
|
-
return metaJSONFile;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function getFlorenceFiles() {
|
|
24
|
-
const files = this.getFiles(),
|
|
25
|
-
florenceFiles = florenceFilesFromFiles(files);
|
|
26
|
-
|
|
27
|
-
return florenceFiles;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function getCustomGrammarBNFFiles() {
|
|
31
|
-
const files = this.getFiles(),
|
|
32
|
-
customGrammarBNFFiles = customGrammarBNFFilesFromFiles(files);
|
|
33
|
-
|
|
34
|
-
return customGrammarBNFFiles;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function getCustomGrammarPatternFiles() {
|
|
38
|
-
const files = this.getFiles(),
|
|
39
|
-
customGrammarPatternFiles = customGrammarPatternFilesFromFiles(files);
|
|
40
|
-
|
|
41
|
-
return customGrammarPatternFiles;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const filesMixins = {
|
|
45
|
-
getReadmeFile,
|
|
46
|
-
getMetaJSONFile,
|
|
47
|
-
getFlorenceFiles,
|
|
48
|
-
getCustomGrammarBNFFiles,
|
|
49
|
-
getCustomGrammarPatternFiles
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default filesMixins;
|
package/src/mixins/pattern.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { fileNameFromFilePath } from "../utilities/name";
|
|
4
|
-
import { TYPE_PATTERN_FILE_NAME, SYMBOL_PATTERN_FILE_NAME, OPERATOR_PATTERN_FILE_NAME } from "../fileNames";
|
|
5
|
-
|
|
6
|
-
function getPattern(patternFileName) {
|
|
7
|
-
let pattern = null;
|
|
8
|
-
|
|
9
|
-
const customGrammarPatternFiles = this.getCustomGrammarPatternFiles(),
|
|
10
|
-
customGrammarPatternFile = customGrammarPatternFiles.find((customGrammarPatternFile) => {
|
|
11
|
-
const customGrammarPatternFilePath = customGrammarPatternFile.getPath(),
|
|
12
|
-
customGrammarPatternFileName = fileNameFromFilePath(customGrammarPatternFilePath);
|
|
13
|
-
|
|
14
|
-
if (customGrammarPatternFileName === patternFileName) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
}) || null;
|
|
18
|
-
|
|
19
|
-
if (customGrammarPatternFile !== null) {
|
|
20
|
-
const customGrammarPatternFileContent = customGrammarPatternFile.getContent();
|
|
21
|
-
|
|
22
|
-
pattern = customGrammarPatternFileContent; ///
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return pattern;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function getTypePattern() {
|
|
29
|
-
const fileName = TYPE_PATTERN_FILE_NAME, ///
|
|
30
|
-
pattern = this.getPattern(fileName),
|
|
31
|
-
typePattern = pattern; ///
|
|
32
|
-
|
|
33
|
-
return typePattern;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function getSymbolPattern() {
|
|
37
|
-
const fileName = SYMBOL_PATTERN_FILE_NAME, ///
|
|
38
|
-
pattern = this.getPattern(fileName),
|
|
39
|
-
symbolPattern = pattern; ///
|
|
40
|
-
|
|
41
|
-
return symbolPattern;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function getOperatorPattern() {
|
|
45
|
-
const fileName = OPERATOR_PATTERN_FILE_NAME, ///
|
|
46
|
-
pattern = this.getPattern(fileName),
|
|
47
|
-
operatorPattern = pattern; ///
|
|
48
|
-
|
|
49
|
-
return operatorPattern;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const patternMixins = {
|
|
53
|
-
getPattern,
|
|
54
|
-
getTypePattern,
|
|
55
|
-
getSymbolPattern,
|
|
56
|
-
getOperatorPattern
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export default patternMixins;
|
package/src/project.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { MetaJSONLexer, MetaJSONParser } from "occam-grammars";
|
|
4
|
-
|
|
5
|
-
import Entries from "./entries";
|
|
6
|
-
import bnfMixins from "./mixins/bnf";
|
|
7
|
-
import filesMixins from "./mixins/files";
|
|
8
|
-
import Dependencies from "./dependencies";
|
|
9
|
-
import entriesMixins from "./mixins/entries";
|
|
10
|
-
import patternMixins from "./mixins/pattern";
|
|
11
|
-
|
|
12
|
-
import { metaJSONFIleFromFiles } from "./utilities/files";
|
|
13
|
-
import { repositoryFromNode, dependenciesFromNode } from "./utilities/metaJSON";
|
|
14
|
-
|
|
15
|
-
const metaJSONLexer = MetaJSONLexer.fromNothing(),
|
|
16
|
-
metaJSONParser = MetaJSONParser.fromNothing();
|
|
17
|
-
|
|
18
|
-
class Project {
|
|
19
|
-
constructor(name, entries, repository, dependencies) {
|
|
20
|
-
this.name = name;
|
|
21
|
-
this.entries = entries;
|
|
22
|
-
this.repository = repository;
|
|
23
|
-
this.dependendies = dependencies;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
getName() {
|
|
27
|
-
return this.name;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
getEntries() {
|
|
31
|
-
return this.entries;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
getRepository() {
|
|
35
|
-
return this.repository;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
getDependencies() {
|
|
39
|
-
return this.dependendies;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
toJSON() {
|
|
43
|
-
const entriesJSON = this.entries.toJSON(),
|
|
44
|
-
dependenciesJSON = this.dependendies.toJSON(),
|
|
45
|
-
name = this.name,
|
|
46
|
-
entries = entriesJSON, ///
|
|
47
|
-
repository = this.repository,
|
|
48
|
-
dependencies = dependenciesJSON, ///
|
|
49
|
-
json = {
|
|
50
|
-
name,
|
|
51
|
-
entries,
|
|
52
|
-
repository,
|
|
53
|
-
dependencies
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return json;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
static fromJSON(json) {
|
|
60
|
-
let { entries, dependencies } = json;
|
|
61
|
-
|
|
62
|
-
const { name, repository } = json,
|
|
63
|
-
entriesJSON = entries, ///
|
|
64
|
-
dependenciesJSON = dependencies; ///
|
|
65
|
-
|
|
66
|
-
json = entriesJSON; ///
|
|
67
|
-
|
|
68
|
-
entries = Entries.fromJSON(json); ///
|
|
69
|
-
|
|
70
|
-
json = dependenciesJSON; ///
|
|
71
|
-
|
|
72
|
-
dependencies = Dependencies.fromJSON(json);
|
|
73
|
-
|
|
74
|
-
const release = new Release(name, entries, repository, dependencies);
|
|
75
|
-
|
|
76
|
-
return release;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
static fromName(name) {
|
|
80
|
-
const entries = Entries.fromNothing(),
|
|
81
|
-
repository = null, ///
|
|
82
|
-
dependencies = Dependencies.fromNothing(),
|
|
83
|
-
project = new Project(name, entries, repository, dependencies);
|
|
84
|
-
|
|
85
|
-
return project;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
static fromNameAndEntries(name, entries) {
|
|
89
|
-
const repository = repositoryFromEntries(entries),
|
|
90
|
-
dependencies = dependenciesFromEntries(entries),
|
|
91
|
-
project = new Project(name, entries, repository, dependencies);
|
|
92
|
-
|
|
93
|
-
return project;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
Object.assign(Project.prototype, bnfMixins);
|
|
98
|
-
Object.assign(Project.prototype, filesMixins);
|
|
99
|
-
Object.assign(Project.prototype, entriesMixins);
|
|
100
|
-
Object.assign(Project.prototype, patternMixins);
|
|
101
|
-
|
|
102
|
-
export default Project;
|
|
103
|
-
|
|
104
|
-
function repositoryFromEntries(entries) {
|
|
105
|
-
let repository = null;
|
|
106
|
-
|
|
107
|
-
const metaJSONFileNode = metaJSONFileNodeFromEntries(entries)
|
|
108
|
-
|
|
109
|
-
if (metaJSONFileNode !== null) {
|
|
110
|
-
const node = metaJSONFileNode;///
|
|
111
|
-
|
|
112
|
-
repository = repositoryFromNode(node);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return repository;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function dependenciesFromEntries(entries) {
|
|
119
|
-
let dependencies = [];
|
|
120
|
-
|
|
121
|
-
const metaJSONFileNode = metaJSONFileNodeFromEntries(entries)
|
|
122
|
-
|
|
123
|
-
if (metaJSONFileNode !== null) {
|
|
124
|
-
const node = metaJSONFileNode;///
|
|
125
|
-
|
|
126
|
-
dependencies = dependenciesFromNode(node);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return dependencies;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function metaJSONFileNodeFromEntries(entries) {
|
|
133
|
-
let metaJSONFileNode = null;
|
|
134
|
-
|
|
135
|
-
const files = entries.getFiles(),
|
|
136
|
-
metaJSONFile = metaJSONFIleFromFiles(files);
|
|
137
|
-
|
|
138
|
-
if (metaJSONFile !== null) {
|
|
139
|
-
const content = metaJSONFile.getContent(),
|
|
140
|
-
tokens = metaJSONLexer.tokenise(content),
|
|
141
|
-
node = metaJSONParser.parse(tokens);
|
|
142
|
-
|
|
143
|
-
metaJSONFileNode = node; ///
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return metaJSONFileNode;
|
|
147
|
-
}
|
package/src/projects.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { asynchronousUtilities } from "necessary";
|
|
4
|
-
|
|
5
|
-
import Project from "./project";
|
|
6
|
-
|
|
7
|
-
const { forEach } = asynchronousUtilities;
|
|
8
|
-
|
|
9
|
-
export default class Projects {
|
|
10
|
-
constructor(array) {
|
|
11
|
-
this.array = array;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
getLength() {
|
|
15
|
-
return this.array.length;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
addProject(project) {
|
|
19
|
-
this.array.push(project);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
mapProject(callback) {
|
|
23
|
-
return this.array.map(callback);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
reduceProject(callback, initialValue) {
|
|
27
|
-
return this.array.reduce(callback, initialValue);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
forEachProject(callback) {
|
|
31
|
-
this.array.forEach(callback);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
asynchronousForEachProject(callback, done) {
|
|
35
|
-
forEach(this.array, callback, done);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
toJSON() {
|
|
39
|
-
const json = this.array.map((project) => {
|
|
40
|
-
const projectJSON = project.toJSON();
|
|
41
|
-
|
|
42
|
-
return projectJSON;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return json;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
static fromJSON(json) {
|
|
49
|
-
const array = json.map((json) => { ///
|
|
50
|
-
const project = Project.fromJSON(json);
|
|
51
|
-
|
|
52
|
-
return project;
|
|
53
|
-
}),
|
|
54
|
-
projects = new Projects(array);
|
|
55
|
-
|
|
56
|
-
return projects;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
static fromNothing() {
|
|
60
|
-
const array = [],
|
|
61
|
-
projects = new Projects(array);
|
|
62
|
-
|
|
63
|
-
return projects;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|