occam-open-cli 5.0.48 → 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/release.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import Entries from "./entries";
|
|
4
|
-
import Version from "./version";
|
|
5
|
-
import bnfMixins from "./mixins/bnf";
|
|
6
|
-
import filesMixins from "./mixins/files";
|
|
7
|
-
import Dependencies from "./dependencies";
|
|
8
|
-
import entriesMixins from "./mixins/entries";
|
|
9
|
-
import patternMixins from "./mixins/pattern";
|
|
10
|
-
|
|
11
|
-
class Release {
|
|
12
|
-
constructor(name, entries, version, repository, dependencies) {
|
|
13
|
-
this.name = name;
|
|
14
|
-
this.entries = entries;
|
|
15
|
-
this.version = version;
|
|
16
|
-
this.repository = repository;
|
|
17
|
-
this.dependendies = dependencies;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
getName() {
|
|
21
|
-
return this.name;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
getEntries() {
|
|
25
|
-
return this.entries;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getVersion() {
|
|
29
|
-
return this.version;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getRepository() {
|
|
33
|
-
return this.repository;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getDependencies() {
|
|
37
|
-
return this.dependendies;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
toJSON() {
|
|
41
|
-
const entriesJSON = this.entries.toJSON(),
|
|
42
|
-
versionJSON = this.version.toJSON(),
|
|
43
|
-
dependenciesJSON = this.dependendies.toJSON(),
|
|
44
|
-
name = this.name,
|
|
45
|
-
entries = entriesJSON, ///
|
|
46
|
-
version = versionJSON, ///
|
|
47
|
-
repository = this.repository,
|
|
48
|
-
dependencies = dependenciesJSON, ///
|
|
49
|
-
json = {
|
|
50
|
-
name,
|
|
51
|
-
entries,
|
|
52
|
-
version,
|
|
53
|
-
repository,
|
|
54
|
-
dependencies
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return json;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
static fromJSON(json) {
|
|
61
|
-
let { entries, version, dependencies } = json;
|
|
62
|
-
|
|
63
|
-
const { name, repository } = json,
|
|
64
|
-
entriesJSON = entries, ///
|
|
65
|
-
versionJSOM = version, ///
|
|
66
|
-
dependenciesJSON = dependencies; ///
|
|
67
|
-
|
|
68
|
-
json = entriesJSON; ///
|
|
69
|
-
|
|
70
|
-
entries = Entries.fromJSON(json); ///
|
|
71
|
-
|
|
72
|
-
json = versionJSOM; ///
|
|
73
|
-
|
|
74
|
-
version = Version.fromJSON(json);
|
|
75
|
-
|
|
76
|
-
json = dependenciesJSON; ///
|
|
77
|
-
|
|
78
|
-
dependencies = Dependencies.fromJSON(json);
|
|
79
|
-
|
|
80
|
-
const release = new Release(name, entries, version, repository, dependencies);
|
|
81
|
-
|
|
82
|
-
return release;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
static fromNameEntriesAndVersion(name, entries, version) {
|
|
86
|
-
const repository = repository,
|
|
87
|
-
dependencies = Dependencies.fromNothing(),
|
|
88
|
-
release = new Release(name, entries, version, repository, dependencies);
|
|
89
|
-
|
|
90
|
-
return release;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
Objecct.assign(Release.prototype, bnfMixins);
|
|
95
|
-
Objecct.assign(Release.prototype, filesMixins);
|
|
96
|
-
Objecct.assign(Release.prototype, entriesMixins);
|
|
97
|
-
Objecct.assign(Release.prototype, patternMixins);
|
|
98
|
-
|
|
99
|
-
export default Release;
|
package/src/shortenedVersion.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { arrayUtilities } from "necessary";
|
|
4
|
-
|
|
5
|
-
const { second } = arrayUtilities;
|
|
6
|
-
|
|
7
|
-
export default class ShortenedVersion {
|
|
8
|
-
constructor(majorNumber, minorNumber) {
|
|
9
|
-
this.majorNumber = majorNumber;
|
|
10
|
-
this.minorNumber = minorNumber;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
getMajorNumber() {
|
|
14
|
-
return this.majorNumber;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
getMinorNumber() {
|
|
18
|
-
return this.minorNumber;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
toString() {
|
|
22
|
-
const string = `${this.majorNumber}.${this.minorNumber}`;
|
|
23
|
-
|
|
24
|
-
return string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
asNumber() {
|
|
28
|
-
const number = this.majorNumber * 1e12 + this.minorNumber * 1e6; ///
|
|
29
|
-
|
|
30
|
-
return number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
toJSON() {
|
|
34
|
-
const majorNumber = this.majorNumber,
|
|
35
|
-
minorNumber = this.minorNumber,
|
|
36
|
-
json = {
|
|
37
|
-
majorNumber,
|
|
38
|
-
minorNumber
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return json;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
static fromJSON(json) {
|
|
45
|
-
const { majorNumber, minorNumber } = json,
|
|
46
|
-
shortenedVersion = new ShortenedVersion(majorNumber, minorNumber);
|
|
47
|
-
|
|
48
|
-
return shortenedVersion;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
static fromString(string) {
|
|
52
|
-
const majorNumber = majorNumberFromString(string),
|
|
53
|
-
minorNumber = minorNumberFromString(string),
|
|
54
|
-
shortenedVersion = new ShortenedVersion(majorNumber, minorNumber);
|
|
55
|
-
|
|
56
|
-
return shortenedVersion;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
static fromVersionNumber(versionNumber) {
|
|
60
|
-
const number = versionNumber, ///
|
|
61
|
-
majorNumber = majorNumberFromNumber(number),
|
|
62
|
-
minorNumber = minorNumberFromNumber(number),
|
|
63
|
-
shortenedVersion = new ShortenedVersion(majorNumber, minorNumber);
|
|
64
|
-
|
|
65
|
-
return shortenedVersion;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function majorNumberFromNumber(number) {
|
|
70
|
-
const majorNumber = (number !== null) ?
|
|
71
|
-
Math.floor(number / 1e12) :
|
|
72
|
-
0; ///
|
|
73
|
-
|
|
74
|
-
return majorNumber;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function minorNumberFromNumber(number) {
|
|
78
|
-
const minorNumber = (number !== null) ?
|
|
79
|
-
Math.floor(number / 1e6) :
|
|
80
|
-
0; ///
|
|
81
|
-
|
|
82
|
-
return minorNumber;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function majorNumberFromString(string) {
|
|
86
|
-
let majorNumber = 0;
|
|
87
|
-
|
|
88
|
-
if (string) {
|
|
89
|
-
const matches = string.match(/^(\d+)\.\d+$/),
|
|
90
|
-
secondMatch = second(matches);
|
|
91
|
-
|
|
92
|
-
majorNumber = secondMatch; ///
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return majorNumber;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function minorNumberFromString(string) {
|
|
99
|
-
let minorNumber = 0;
|
|
100
|
-
|
|
101
|
-
if (string) {
|
|
102
|
-
const matches = string.match(/^\d+\.(\d+)$/),
|
|
103
|
-
secondMatch = second(matches);
|
|
104
|
-
|
|
105
|
-
minorNumber = secondMatch; ///
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return minorNumber;
|
|
109
|
-
}
|
package/src/types.js
DELETED
package/src/utilities/content.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { EMPTY_STRING, DOUBLE_SPACE } from "../constants";
|
|
4
|
-
|
|
5
|
-
export function trimDoubleQuotes(content) { return content.replace(/(^"|"$)/g, EMPTY_STRING); } ///
|
|
6
|
-
|
|
7
|
-
export function convertContentTabsToWhitespace(content) { return content.replace(/\t/g, DOUBLE_SPACE); } ///
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
trimDoubleQuotes,
|
|
11
|
-
convertContentTabsToWhitespace
|
|
12
|
-
};
|
package/src/utilities/entries.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { pathUtilities, fileSystemUtilities } from "necessary";
|
|
4
|
-
|
|
5
|
-
import File from "../file";
|
|
6
|
-
import Entries from "../entries";
|
|
7
|
-
import Directory from "../directory";
|
|
8
|
-
|
|
9
|
-
import { isNameHiddenName } from "../utilities/name";
|
|
10
|
-
import { ENTRIES_MAXIMUM_ARRAY_LENGTH } from "../constants";
|
|
11
|
-
import { isFilePathRecognisedFilePath } from "../utilities/filePath";
|
|
12
|
-
import { convertContentTabsToWhitespace } from "../utilities/content";
|
|
13
|
-
import { ENTRIES_MAXIMUM_ARRAY_LENGTH_EXCEEDED_MESSAGE } from "../messages";
|
|
14
|
-
|
|
15
|
-
const { concatenatePaths } = pathUtilities,
|
|
16
|
-
{ readFile, readDirectory, isEntryFile, isEntryDirectory } = fileSystemUtilities;
|
|
17
|
-
|
|
18
|
-
export function entriesFromTopmostDirectoryName(topmostDirectoryName, projectsDirectoryPath, loadOnlyRecognisedFiles, doNotLoadHiddenFilesAndDirectories) {
|
|
19
|
-
const array = [],
|
|
20
|
-
relativeDirectoryPath = topmostDirectoryName; ///
|
|
21
|
-
|
|
22
|
-
entriesFromRelativeDirectoryPath(array, relativeDirectoryPath, projectsDirectoryPath, loadOnlyRecognisedFiles, doNotLoadHiddenFilesAndDirectories);
|
|
23
|
-
|
|
24
|
-
const entries = new Entries(array);
|
|
25
|
-
|
|
26
|
-
return entries;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default {
|
|
30
|
-
entriesFromTopmostDirectoryName
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
function fileFromPath(path, projectsDirectoryPath) {
|
|
34
|
-
let file = null;
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
const absolutePath = concatenatePaths(projectsDirectoryPath, path),
|
|
38
|
-
entryFile = isEntryFile(absolutePath);
|
|
39
|
-
|
|
40
|
-
if (entryFile) {
|
|
41
|
-
let content = readFile(absolutePath);
|
|
42
|
-
|
|
43
|
-
content = convertContentTabsToWhitespace(content); ///
|
|
44
|
-
|
|
45
|
-
file = new File(path, content);
|
|
46
|
-
}
|
|
47
|
-
} catch (error) {
|
|
48
|
-
///
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return file;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function directoryFromPath(path, projectsDirectoryPath) {
|
|
55
|
-
let directory = null;
|
|
56
|
-
|
|
57
|
-
try {
|
|
58
|
-
const absolutePath = concatenatePaths(projectsDirectoryPath, path),
|
|
59
|
-
entryDirectory = isEntryDirectory(absolutePath);
|
|
60
|
-
|
|
61
|
-
if (entryDirectory) {
|
|
62
|
-
directory = new Directory(path);
|
|
63
|
-
}
|
|
64
|
-
} catch (error) {
|
|
65
|
-
///
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return directory;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function entriesFromRelativeDirectoryPath(array, relativeDirectoryPath, projectsDirectoryPath, loadOnlyRecognisedFiles, doNotLoadHiddenFilesAndDirectories) {
|
|
72
|
-
const absoluteDirectoryPath = concatenatePaths(projectsDirectoryPath, relativeDirectoryPath),
|
|
73
|
-
subEntryNames = readDirectory(absoluteDirectoryPath);
|
|
74
|
-
|
|
75
|
-
subEntryNames.forEach((subEntryName) => {
|
|
76
|
-
const subEntryNameHiddenName = isNameHiddenName(subEntryName),
|
|
77
|
-
subEntryNameNotHiddenName = !subEntryNameHiddenName,
|
|
78
|
-
loadHiddenFilesAndDirectories = !doNotLoadHiddenFilesAndDirectories,
|
|
79
|
-
loadUnrecognisedFilesAndDirectories = !loadOnlyRecognisedFiles;
|
|
80
|
-
|
|
81
|
-
if (subEntryNameNotHiddenName || loadHiddenFilesAndDirectories) {
|
|
82
|
-
let entry;
|
|
83
|
-
|
|
84
|
-
const path = concatenatePaths(relativeDirectoryPath, subEntryName),
|
|
85
|
-
directory = directoryFromPath(path, projectsDirectoryPath);
|
|
86
|
-
|
|
87
|
-
if (directory !== null) {
|
|
88
|
-
const directoryPath = path; ///
|
|
89
|
-
|
|
90
|
-
if (loadUnrecognisedFilesAndDirectories) {
|
|
91
|
-
entry = directory; ///
|
|
92
|
-
|
|
93
|
-
array.push(entry); ///
|
|
94
|
-
|
|
95
|
-
const arrayLength = array.length;
|
|
96
|
-
|
|
97
|
-
if (arrayLength > ENTRIES_MAXIMUM_ARRAY_LENGTH) {
|
|
98
|
-
throw new Error(ENTRIES_MAXIMUM_ARRAY_LENGTH_EXCEEDED_MESSAGE)
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
entriesFromRelativeDirectoryPath(array, directoryPath, projectsDirectoryPath, loadOnlyRecognisedFiles, doNotLoadHiddenFilesAndDirectories); ///
|
|
103
|
-
} else {
|
|
104
|
-
const file = fileFromPath(path, projectsDirectoryPath);
|
|
105
|
-
|
|
106
|
-
if (file !== null) {
|
|
107
|
-
const filePath = file.getPath(),
|
|
108
|
-
filePathRecognisedFilePath = isFilePathRecognisedFilePath(filePath),
|
|
109
|
-
fileRecognisedFile = filePathRecognisedFilePath; ///
|
|
110
|
-
|
|
111
|
-
if (fileRecognisedFile || loadUnrecognisedFilesAndDirectories) {
|
|
112
|
-
entry = file; ///
|
|
113
|
-
|
|
114
|
-
array.push(entry); ///
|
|
115
|
-
|
|
116
|
-
const arrayLength = array.length;
|
|
117
|
-
|
|
118
|
-
if (arrayLength > ENTRIES_MAXIMUM_ARRAY_LENGTH) {
|
|
119
|
-
throw new Error(ENTRIES_MAXIMUM_ARRAY_LENGTH_EXCEEDED_MESSAGE)
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const readmeFilePathPattern = "^(?:[^\\/]+\\/){1}README\\.md$",
|
|
4
|
-
florenceFilePathPattern = "^(?:[^\\/]+\\/){1,}[^\\.]+\\.fls$",
|
|
5
|
-
metaJSONFilePathPattern = "^(?:[^\\/]+\\/){1}meta\\.json$",
|
|
6
|
-
customGrammarBNFFilePathPattern = "^(?:[^\\/]+\\/){1}(term|statement|metastatement)\\.bnf$",
|
|
7
|
-
customGrammarPatternFilePathPattern = "^(?:[^\\/]+\\/){1}(type|symbol|operator)\\.ptn$",
|
|
8
|
-
recognisedFilePathPattern = `${readmeFilePathPattern}|${florenceFilePathPattern}|${metaJSONFilePathPattern}|${customGrammarBNFFilePathPattern}|${customGrammarPatternFilePathPattern}`;
|
|
9
|
-
|
|
10
|
-
const readmeFilePathRegularExpression = new RegExp(readmeFilePathPattern),
|
|
11
|
-
florenceFilePathRegularExpression = new RegExp(florenceFilePathPattern),
|
|
12
|
-
metaJSONFilePathRegularExpression = new RegExp(metaJSONFilePathPattern),
|
|
13
|
-
recognisedFilePathRegularExpression = new RegExp(recognisedFilePathPattern),
|
|
14
|
-
customGrammarBNFFilePathRegularExpression = new RegExp(customGrammarBNFFilePathPattern),
|
|
15
|
-
customGrammarPatternFilePathRegularExpression = new RegExp(customGrammarPatternFilePathPattern);
|
|
16
|
-
|
|
17
|
-
export function isFilePathReadmeFilePath(filePath) { return readmeFilePathRegularExpression.test(filePath); }
|
|
18
|
-
|
|
19
|
-
export function isFilePathFlorenceFilePath(filePath) { return florenceFilePathRegularExpression.test(filePath); }
|
|
20
|
-
|
|
21
|
-
export function isFilePathMetaJSONFilePath(filePath) { return metaJSONFilePathRegularExpression.test(filePath); }
|
|
22
|
-
|
|
23
|
-
export function isFilePathRecognisedFilePath(filePath) { return recognisedFilePathRegularExpression.test(filePath); }
|
|
24
|
-
|
|
25
|
-
export function isFilePathCustomGrammarBNFFilePath(filePath) { return customGrammarBNFFilePathRegularExpression.test(filePath); }
|
|
26
|
-
|
|
27
|
-
export function isFilePathCustomGrammarPatternFilePath(filePath) { return customGrammarPatternFilePathRegularExpression.test(filePath); }
|
|
28
|
-
|
|
29
|
-
export default {
|
|
30
|
-
isFilePathReadmeFilePath,
|
|
31
|
-
isFilePathFlorenceFilePath,
|
|
32
|
-
isFilePathMetaJSONFilePath,
|
|
33
|
-
isFilePathRecognisedFilePath,
|
|
34
|
-
isFilePathCustomGrammarBNFFilePath,
|
|
35
|
-
isFilePathCustomGrammarPatternFilePath
|
|
36
|
-
};
|
package/src/utilities/files.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { isFilePathReadmeFilePath,
|
|
4
|
-
isFilePathFlorenceFilePath,
|
|
5
|
-
isFilePathMetaJSONFilePath,
|
|
6
|
-
isFilePathCustomGrammarBNFFilePath,
|
|
7
|
-
isFilePathCustomGrammarPatternFilePath } from "../utilities/filePath";
|
|
8
|
-
|
|
9
|
-
function readmeFileFromFiles(files) {
|
|
10
|
-
let readmeFile = null;
|
|
11
|
-
|
|
12
|
-
files.someFile((file) => {
|
|
13
|
-
const filePath = file.getPath(),
|
|
14
|
-
filePathReadmeFilePath = isFilePathReadmeFilePath(filePath);
|
|
15
|
-
|
|
16
|
-
if (filePathReadmeFilePath) {
|
|
17
|
-
readmeFile = file; ///
|
|
18
|
-
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
return readmeFile;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function metaJSONFileFromFiles(files) {
|
|
27
|
-
let metaJSONFile = null;
|
|
28
|
-
|
|
29
|
-
files.someFile((file) => {
|
|
30
|
-
const filePath = file.getPath(),
|
|
31
|
-
filePathMetaJSONFilePath = isFilePathMetaJSONFilePath(filePath);
|
|
32
|
-
|
|
33
|
-
if (filePathMetaJSONFilePath) {
|
|
34
|
-
metaJSONFile = file; ///
|
|
35
|
-
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
return metaJSONFile;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function florenceFilesFromFiles(files) {
|
|
44
|
-
const florenceFiles = files.reduceFile((florenceFiles, file) => {
|
|
45
|
-
const filePath = file.getPath(),
|
|
46
|
-
filePathFlorenceFilePath = isFilePathFlorenceFilePath(filePath),
|
|
47
|
-
fileFlorenceFile = filePathFlorenceFilePath; ///
|
|
48
|
-
|
|
49
|
-
if (fileFlorenceFile) {
|
|
50
|
-
const florenceFile = file; ///
|
|
51
|
-
|
|
52
|
-
florenceFiles.push(florenceFile);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return florenceFiles;
|
|
56
|
-
}, []);
|
|
57
|
-
|
|
58
|
-
return florenceFiles;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function customGrammarBNFFilesFromFiles(files) {
|
|
62
|
-
const customGrammarBNFFiles = files.reduceFile((customGrammarBNFFiles, file) => {
|
|
63
|
-
const filePath = file.getPath(),
|
|
64
|
-
filePathCustomGrammarBNFFilePath = isFilePathCustomGrammarBNFFilePath(filePath),
|
|
65
|
-
fileCustomGrammarBNFFile = filePathCustomGrammarBNFFilePath; ///
|
|
66
|
-
|
|
67
|
-
if (fileCustomGrammarBNFFile) {
|
|
68
|
-
const customGrammarBNFFile = file; ///
|
|
69
|
-
|
|
70
|
-
customGrammarBNFFiles.push(customGrammarBNFFile);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return customGrammarBNFFiles;
|
|
74
|
-
}, []);
|
|
75
|
-
|
|
76
|
-
return customGrammarBNFFiles;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function customGrammarPatternFilesFromFiles(files) {
|
|
80
|
-
const customGrammarPatternFiles = files.reduceFile((customGrammarPatternFiles, file) => {
|
|
81
|
-
const filePath = file.getPath(),
|
|
82
|
-
filePathCustomGrammarPatternFilePath = isFilePathCustomGrammarPatternFilePath(filePath),
|
|
83
|
-
fileCustomGrammarPatternFile = filePathCustomGrammarPatternFilePath; ///
|
|
84
|
-
|
|
85
|
-
if (fileCustomGrammarPatternFile) {
|
|
86
|
-
const customGrammarPatternFile = file; ///
|
|
87
|
-
|
|
88
|
-
customGrammarPatternFiles.push(customGrammarPatternFile);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return customGrammarPatternFiles;
|
|
92
|
-
}, []);
|
|
93
|
-
|
|
94
|
-
return customGrammarPatternFiles;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export default {
|
|
98
|
-
readmeFileFromFiles,
|
|
99
|
-
metaJSONFileFromFiles,
|
|
100
|
-
florenceFilesFromFiles,
|
|
101
|
-
customGrammarBNFFilesFromFiles,
|
|
102
|
-
customGrammarPatternFilesFromFiles
|
|
103
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import Version from "../version";
|
|
4
|
-
import Dependency from "../dependency";
|
|
5
|
-
import ShortenedVersion from "../shortenedVersion";
|
|
6
|
-
|
|
7
|
-
import { trimDoubleQuotes } from "../utilities/content";
|
|
8
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
9
|
-
|
|
10
|
-
const dependencyNodesQuery = nodesQuery("//dependencies/dependency"),
|
|
11
|
-
repositoryTerminalNodeQuery = nodeQuery("//repository!/@*!"),
|
|
12
|
-
versionNumberTerminalNodeQuery = nodeQuery("//version!/versionNumber!/@*!"),
|
|
13
|
-
dependencyNameTerminalNodeQuery = nodeQuery("/dependency/name!/@*!"),
|
|
14
|
-
shortenedVersionNumberTerminalNodeQuery = nodeQuery("//dependency/shortenedVersionNumber/@*!");
|
|
15
|
-
|
|
16
|
-
export function versionFromNode(node) {
|
|
17
|
-
let version = null;
|
|
18
|
-
|
|
19
|
-
if (node !== null) {
|
|
20
|
-
const versionNumberTerminalNode = versionNumberTerminalNodeQuery(node),
|
|
21
|
-
versionNumberTerminalNodeContent = versionNumberTerminalNode.getContent(),
|
|
22
|
-
versionNumber = trimDoubleQuotes(versionNumberTerminalNodeContent); //
|
|
23
|
-
|
|
24
|
-
version = Version.fromVersionNumber(versionNumber);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return version;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function repositoryFromNode(node) {
|
|
31
|
-
let repository = null;
|
|
32
|
-
|
|
33
|
-
if (node !== null) {
|
|
34
|
-
const repositoryTerminalNode = repositoryTerminalNodeQuery(node),
|
|
35
|
-
repositoryTerminalNodeContent = repositoryTerminalNode.getContent();
|
|
36
|
-
|
|
37
|
-
repository = trimDoubleQuotes(repositoryTerminalNodeContent); //
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return repository;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function dependenciesFromNode(node) {
|
|
44
|
-
const dependencies = [];
|
|
45
|
-
|
|
46
|
-
if (node !== null) {
|
|
47
|
-
const dependencyNodes = dependencyNodesQuery(node);
|
|
48
|
-
|
|
49
|
-
dependencyNodes.forEach((dependencyNode) => {
|
|
50
|
-
const dependencyNameTerminalNode = dependencyNameTerminalNodeQuery(dependencyNode),
|
|
51
|
-
shortenedVersionNumberTerminalNode = shortenedVersionNumberTerminalNodeQuery(dependencyNode),
|
|
52
|
-
dependencyNameTerminalNodeContent = dependencyNameTerminalNode.getContent(),
|
|
53
|
-
shortenedVersionNumberTerminalNodeContent = shortenedVersionNumberTerminalNode.getContent(),
|
|
54
|
-
string = trimDoubleQuotes(shortenedVersionNumberTerminalNodeContent), ///
|
|
55
|
-
name = trimDoubleQuotes(dependencyNameTerminalNodeContent),///
|
|
56
|
-
shortenedVersion = ShortenedVersion.fromString(string),
|
|
57
|
-
dependency = Dependency.fromNameAndShortenedVersion(name, shortenedVersion);
|
|
58
|
-
|
|
59
|
-
dependencies.push(dependency);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return dependencies;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function dependencyNamesFromNode(node) {
|
|
67
|
-
const dependencies = this.dependenciesFromNode(node),
|
|
68
|
-
dependencyNames = dependencies.map((dependency) => {
|
|
69
|
-
const dependencyName = dependency.getName();
|
|
70
|
-
|
|
71
|
-
return dependencyName;
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
return dependencyNames;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export default {
|
|
78
|
-
versionFromNode,
|
|
79
|
-
repositoryFromNode,
|
|
80
|
-
dependenciesFromNode,
|
|
81
|
-
dependencyNamesFromNode
|
|
82
|
-
};
|
package/src/utilities/name.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { pathUtilities } from "necessary";
|
|
4
|
-
|
|
5
|
-
const hiddenNameRegularExpression = /^\..+/;
|
|
6
|
-
|
|
7
|
-
const { bottommostNameFromPath } = pathUtilities;
|
|
8
|
-
|
|
9
|
-
export function isNameHiddenName(name) {
|
|
10
|
-
const nameHiddenName = hiddenNameRegularExpression.test(name);
|
|
11
|
-
|
|
12
|
-
return nameHiddenName;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function fileNameFromFilePath(filePath) {
|
|
16
|
-
const path = filePath, ///
|
|
17
|
-
bottommostName = bottommostNameFromPath(path),
|
|
18
|
-
fileName = bottommostName; //
|
|
19
|
-
|
|
20
|
-
return fileName;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
isNameHiddenName,
|
|
25
|
-
fileNameFromFilePath
|
|
26
|
-
};
|
package/src/utilities/node.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export function findNodeByClass(node, Class) {
|
|
4
|
-
let foundNode = null;
|
|
5
|
-
|
|
6
|
-
if (node instanceof Class) {
|
|
7
|
-
foundNode = node;
|
|
8
|
-
} else {
|
|
9
|
-
const nodeNonTerminalNode = node.isNonTerminalNode();
|
|
10
|
-
|
|
11
|
-
if (nodeNonTerminalNode) {
|
|
12
|
-
const nonTerminalNode = node, ///
|
|
13
|
-
childNodes = nonTerminalNode.getChildNodes();
|
|
14
|
-
|
|
15
|
-
childNodes.some((childNode) => {
|
|
16
|
-
foundNode = findNodeByClass(childNode, Class);
|
|
17
|
-
|
|
18
|
-
if (foundNode !== null) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return foundNode;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function findNodesByClass(node, Class, foundNodes = []) {
|
|
29
|
-
if (node instanceof Class) {
|
|
30
|
-
const foundNode = node; ///
|
|
31
|
-
|
|
32
|
-
foundNodes.push(foundNode);
|
|
33
|
-
} else {
|
|
34
|
-
const nodeNonTerminalNode = node.isNonTerminalNode();
|
|
35
|
-
|
|
36
|
-
if (nodeNonTerminalNode) {
|
|
37
|
-
const nonTerminalNode = node, ///
|
|
38
|
-
childNodes = nonTerminalNode.getChildNodes();
|
|
39
|
-
|
|
40
|
-
childNodes.forEach((childNode) => {
|
|
41
|
-
findNodesByClass(childNode, Class, foundNodes);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return foundNodes;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function findTerminalNodes(node, foundTerminalNodes = []) {
|
|
50
|
-
const nodeTerminalNode = node.isTerminalNode();
|
|
51
|
-
|
|
52
|
-
if (nodeTerminalNode) {
|
|
53
|
-
const foundTerminalNode = node; ///
|
|
54
|
-
|
|
55
|
-
foundTerminalNodes.push(foundTerminalNode);
|
|
56
|
-
} else {
|
|
57
|
-
const nodeNonTerminalNode = node.isNonTerminalNode();
|
|
58
|
-
|
|
59
|
-
if (nodeNonTerminalNode) {
|
|
60
|
-
const nonTerminalNode = node, ///
|
|
61
|
-
childNodes = nonTerminalNode.getChildNodes();
|
|
62
|
-
|
|
63
|
-
childNodes.forEach((childNode) => {
|
|
64
|
-
findTerminalNodes(childNode, foundTerminalNodes);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return foundTerminalNodes;
|
|
70
|
-
}
|