occam-open-cli 5.0.44 → 5.0.46
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/README.md +3 -3
- package/bin/action/createAccount.js +2 -6
- package/bin/action/help.js +5 -3
- package/bin/action/open.js +13 -0
- package/bin/action/resetPassword.js +2 -3
- package/bin/action/signIn.js +2 -6
- package/bin/action/version.js +2 -0
- package/bin/actions.js +3 -3
- package/bin/commands.js +0 -2
- package/bin/messages.js +4 -14
- package/bin/operation/clone.js +0 -2
- package/bin/operation/createAccount.js +2 -7
- package/bin/operation/createRelease.js +9 -2
- package/bin/operation/deprecate.js +1 -5
- package/bin/operation/resetPassword.js +6 -0
- package/bin/operation/setIdentityToken.js +3 -1
- package/bin/operation/signIn.js +2 -7
- package/bin/post.js +34 -21
- package/bin/utilities/status.js +62 -0
- package/lib/browser.js +16 -8
- package/lib/constants.js +5 -1
- package/lib/dependencies.js +74 -0
- package/lib/dependency.js +61 -0
- package/lib/main.js +16 -8
- package/lib/mixin/bnf.js +46 -0
- package/lib/mixin/entries.js +30 -0
- package/lib/mixin/files.js +40 -0
- package/lib/mixin/pattern.js +46 -0
- package/lib/project.js +71 -82
- package/lib/release.js +40 -100
- package/lib/shortenedVersion.js +125 -0
- package/lib/utilities/content.js +8 -1
- package/lib/utilities/files.js +75 -0
- package/lib/utilities/metaJSON.js +80 -0
- package/lib/utilities/name.js +9 -2
- package/lib/utilities/query.js +41 -0
- package/lib/version.js +33 -3
- package/package.json +4 -2
- package/src/browser.js +6 -2
- package/src/constants.js +1 -0
- package/src/dependencies.js +40 -0
- package/src/dependency.js +22 -0
- package/src/main.js +5 -2
- package/src/mixin/bnf.js +57 -0
- package/src/mixin/entries.js +16 -0
- package/src/mixin/files.js +50 -0
- package/src/mixin/pattern.js +57 -0
- package/src/project.js +97 -82
- package/src/release.js +51 -117
- package/src/shortenedVersion.js +109 -0
- package/src/utilities/content.js +4 -1
- package/src/utilities/files.js +103 -0
- package/src/utilities/metaJSON.js +82 -0
- package/src/utilities/name.js +14 -1
- package/src/utilities/query.js +31 -0
- package/src/version.js +30 -2
- package/bin/action/install.js +0 -13
package/src/project.js
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { MetaJSONLexer, MetaJSONParser } from "occam-grammars";
|
|
4
|
+
|
|
3
5
|
import Entries from "./entries";
|
|
6
|
+
import bnfMixin from "./mixin/bnf";
|
|
7
|
+
import filesMixin from "./mixin/files";
|
|
8
|
+
import Dependencies from "./dependencies";
|
|
9
|
+
import entriesMixin from "./mixin/entries";
|
|
10
|
+
import patternMixin from "./mixin/pattern";
|
|
11
|
+
|
|
12
|
+
import { metaJSONFIleFromFiles } from "./utilities/files";
|
|
13
|
+
import { repositoryFromNode, dependenciesFromNode } from "./utilities/metaJSON";
|
|
4
14
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
isFilePathCustomGrammarBNFFilePath,
|
|
8
|
-
isFilePathCustomGrammarPatternFilePath } from "./utilities/filePath";
|
|
15
|
+
const metaJSONLexer = MetaJSONLexer.fromNothing(),
|
|
16
|
+
metaJSONParser = MetaJSONParser.fromNothing();
|
|
9
17
|
|
|
10
|
-
|
|
11
|
-
constructor(name, entries) {
|
|
18
|
+
class Project {
|
|
19
|
+
constructor(name, entries, repository, dependencies) {
|
|
12
20
|
this.name = name;
|
|
13
21
|
this.entries = entries;
|
|
22
|
+
this.repository = repository;
|
|
23
|
+
this.dependendies = dependencies;
|
|
14
24
|
}
|
|
15
25
|
|
|
16
26
|
getName() {
|
|
@@ -21,112 +31,117 @@ export default class Project {
|
|
|
21
31
|
return this.entries;
|
|
22
32
|
}
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
getRepository() {
|
|
35
|
+
return this.repository;
|
|
36
|
+
}
|
|
25
37
|
|
|
26
|
-
|
|
38
|
+
getDependencies() {
|
|
39
|
+
return this.dependendies;
|
|
40
|
+
}
|
|
27
41
|
|
|
28
|
-
|
|
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
|
+
};
|
|
29
55
|
|
|
30
|
-
|
|
56
|
+
return json;
|
|
57
|
+
}
|
|
31
58
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
metaJSONFile = files.findFile((file) => {
|
|
35
|
-
const filePath = file.getPath(),
|
|
36
|
-
filePathMetaJSONFilePath = isFilePathMetaJSONFilePath(filePath);
|
|
59
|
+
static fromJSON(json) {
|
|
60
|
+
let { entries, dependencies } = json;
|
|
37
61
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
62
|
+
const { name, repository } = json,
|
|
63
|
+
entriesJSON = entries, ///
|
|
64
|
+
dependenciesJSON = dependencies; ///
|
|
42
65
|
|
|
43
|
-
|
|
44
|
-
}
|
|
66
|
+
json = entriesJSON; ///
|
|
45
67
|
|
|
46
|
-
|
|
47
|
-
const files = this.getFiles(),
|
|
48
|
-
florenceFiles = files.reduceFile((florenceFiles, file) => {
|
|
49
|
-
const filePath = file.getPath(),
|
|
50
|
-
filePathFlorenceFilePath = isFilePathFlorenceFilePath(filePath),
|
|
51
|
-
fileFlorenceFile = filePathFlorenceFilePath; ///
|
|
68
|
+
entries = Entries.fromJSON(json); ///
|
|
52
69
|
|
|
53
|
-
|
|
54
|
-
const florenceFile = file; ///
|
|
70
|
+
json = dependenciesJSON; ///
|
|
55
71
|
|
|
56
|
-
|
|
57
|
-
}
|
|
72
|
+
dependencies = Dependencies.fromJSON(json);
|
|
58
73
|
|
|
59
|
-
|
|
60
|
-
}, []);
|
|
74
|
+
const release = new Release(name, entries, repository, dependencies);
|
|
61
75
|
|
|
62
|
-
return
|
|
76
|
+
return release;
|
|
63
77
|
}
|
|
64
78
|
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
fileCustomGrammarBNFFile = filePathCustomGrammarBNFFilePath; ///
|
|
71
|
-
|
|
72
|
-
if (fileCustomGrammarBNFFile) {
|
|
73
|
-
const customGrammarBNFFile = file; ///
|
|
79
|
+
static fromName(name) {
|
|
80
|
+
const entries = Entries.fromNothing(),
|
|
81
|
+
repository = null, ///
|
|
82
|
+
dependencies = Dependencies.fromNothing(),
|
|
83
|
+
project = new Project(name, entries, repository, dependencies);
|
|
74
84
|
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
return project;
|
|
86
|
+
}
|
|
77
87
|
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
static fromNameAndEntries(name, entries) {
|
|
89
|
+
const repository = repositoryFromEntries(entries),
|
|
90
|
+
dependencies = dependenciesFromEntries(entries),
|
|
91
|
+
project = new Project(name, entries, repository, dependencies);
|
|
80
92
|
|
|
81
|
-
return
|
|
93
|
+
return project;
|
|
82
94
|
}
|
|
95
|
+
}
|
|
83
96
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
filePathCustomGrammarPatternFilePath = isFilePathCustomGrammarPatternFilePath(filePath),
|
|
89
|
-
fileCustomGrammarPatternFile = filePathCustomGrammarPatternFilePath; ///
|
|
90
|
-
|
|
91
|
-
if (fileCustomGrammarPatternFile) {
|
|
92
|
-
const customGrammarPatternFile = file; ///
|
|
97
|
+
Object.assign(Project.prototype, bnfMixin);
|
|
98
|
+
Object.assign(Project.prototype, filesMixin);
|
|
99
|
+
Object.assign(Project.prototype, entriesMixin);
|
|
100
|
+
Object.assign(Project.prototype, patternMixin);
|
|
93
101
|
|
|
94
|
-
|
|
95
|
-
}
|
|
102
|
+
export default Project;
|
|
96
103
|
|
|
97
|
-
|
|
98
|
-
|
|
104
|
+
function repositoryFromEntries(entries) {
|
|
105
|
+
let repository = null;
|
|
99
106
|
|
|
100
|
-
|
|
101
|
-
}
|
|
107
|
+
const metaJSONFileNode = metaJSONFileNodeFromEntries(entries)
|
|
102
108
|
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
entriesJSON = this.entries.toJSON(),
|
|
106
|
-
entries = entriesJSON, ///
|
|
107
|
-
json = {
|
|
108
|
-
name,
|
|
109
|
-
entries
|
|
110
|
-
};
|
|
109
|
+
if (metaJSONFileNode !== null) {
|
|
110
|
+
const node = metaJSONFileNode;///
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
repository = repositoryFromNode(node);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
return repository;
|
|
116
|
+
}
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
function dependenciesFromEntries(entries) {
|
|
119
|
+
let dependencies = [];
|
|
119
120
|
|
|
120
|
-
|
|
121
|
-
project = new Project(name, entries);
|
|
121
|
+
const metaJSONFileNode = metaJSONFileNodeFromEntries(entries)
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
if (metaJSONFileNode !== null) {
|
|
124
|
+
const node = metaJSONFileNode;///
|
|
125
|
+
|
|
126
|
+
dependencies = dependenciesFromNode(node);
|
|
124
127
|
}
|
|
125
128
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
project = new Project(name, entries);
|
|
129
|
+
return dependencies;
|
|
130
|
+
}
|
|
129
131
|
|
|
130
|
-
|
|
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; ///
|
|
131
144
|
}
|
|
145
|
+
|
|
146
|
+
return metaJSONFileNode;
|
|
132
147
|
}
|
package/src/release.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Entries from "./entries";
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
constructor(name, entries,
|
|
4
|
+
import Version from "./version";
|
|
5
|
+
import bnfMixin from "./mixin/bnf";
|
|
6
|
+
import filesMixin from "./mixin/files";
|
|
7
|
+
import Dependencies from "./dependencies";
|
|
8
|
+
import entriesMixin from "./mixin/entries";
|
|
9
|
+
import patternMixin from "./mixin/pattern";
|
|
10
|
+
|
|
11
|
+
class Release {
|
|
12
|
+
constructor(name, entries, version, repository, dependencies) {
|
|
13
13
|
this.name = name;
|
|
14
14
|
this.entries = entries;
|
|
15
|
-
this.
|
|
15
|
+
this.version = version;
|
|
16
|
+
this.repository = repository;
|
|
17
|
+
this.dependendies = dependencies;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
getName() {
|
|
@@ -23,143 +25,75 @@ export default class Release {
|
|
|
23
25
|
return this.entries;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
return this.
|
|
28
|
+
getVersion() {
|
|
29
|
+
return this.version;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
getFiles() { return this.entries.getFiles(); }
|
|
33
|
-
|
|
34
|
-
getFilePaths() { return this.entries.getFilePaths(); }
|
|
35
|
-
|
|
36
|
-
getReadmeFile() {
|
|
37
|
-
let readmeFile = null;
|
|
38
|
-
|
|
39
|
-
const files = this.getFiles();
|
|
40
|
-
|
|
41
|
-
files.someFile((file) => {
|
|
42
|
-
const filePath = file.getPath(),
|
|
43
|
-
filePathReadmeFilePath = isFilePathReadmeFilePath(filePath);
|
|
44
|
-
|
|
45
|
-
if (filePathReadmeFilePath) {
|
|
46
|
-
readmeFile = file; ///
|
|
47
|
-
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
return readmeFile;
|
|
32
|
+
getRepository() {
|
|
33
|
+
return this.repository;
|
|
53
34
|
}
|
|
54
35
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const files = this.getFiles();
|
|
59
|
-
|
|
60
|
-
files.someFile((file) => {
|
|
61
|
-
const filePath = file.getPath(),
|
|
62
|
-
filePathMetaJSONFilePath = isFilePathMetaJSONFilePath(filePath);
|
|
63
|
-
|
|
64
|
-
if (filePathMetaJSONFilePath) {
|
|
65
|
-
metaJSONFile = file; ///
|
|
66
|
-
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
return metaJSONFile;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
getFlorenceFiles() {
|
|
75
|
-
const files = this.getFiles(),
|
|
76
|
-
florenceFiles = files.reduceFile((florenceFiles, file) => {
|
|
77
|
-
const filePath = file.getPath(),
|
|
78
|
-
filePathFlorenceFilePath = isFilePathFlorenceFilePath(filePath),
|
|
79
|
-
fileFlorenceFile = filePathFlorenceFilePath; ///
|
|
80
|
-
|
|
81
|
-
if (fileFlorenceFile) {
|
|
82
|
-
const florenceFile = file; ///
|
|
83
|
-
|
|
84
|
-
florenceFiles.push(florenceFile);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return florenceFiles;
|
|
88
|
-
}, []);
|
|
89
|
-
|
|
90
|
-
return florenceFiles;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
getCustomGrammarBNFFiles() {
|
|
94
|
-
const files = this.getFiles(),
|
|
95
|
-
customGrammarBNFFiles = files.reduceFile((customGrammarBNFFiles, file) => {
|
|
96
|
-
const filePath = file.getPath(),
|
|
97
|
-
filePathCustomGrammarBNFFilePath = isFilePathCustomGrammarBNFFilePath(filePath),
|
|
98
|
-
fileCustomGrammarBNFFile = filePathCustomGrammarBNFFilePath; ///
|
|
99
|
-
|
|
100
|
-
if (fileCustomGrammarBNFFile) {
|
|
101
|
-
const customGrammarBNFFile = file; ///
|
|
102
|
-
|
|
103
|
-
customGrammarBNFFiles.push(customGrammarBNFFile);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return customGrammarBNFFiles;
|
|
107
|
-
}, []);
|
|
108
|
-
|
|
109
|
-
return customGrammarBNFFiles;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
getCustomGrammarPatternFiles() {
|
|
113
|
-
const files = this.getFiles(),
|
|
114
|
-
customGrammarPatternFiles = files.reduceFile((customGrammarPatternFiles, file) => {
|
|
115
|
-
const filePath = file.getPath(),
|
|
116
|
-
filePathCustomGrammarPatternFilePath = isFilePathCustomGrammarPatternFilePath(filePath),
|
|
117
|
-
fileCustomGrammarPatternFile = filePathCustomGrammarPatternFilePath; ///
|
|
118
|
-
|
|
119
|
-
if (fileCustomGrammarPatternFile) {
|
|
120
|
-
const customGrammarPatternFile = file; ///
|
|
121
|
-
|
|
122
|
-
customGrammarPatternFiles.push(customGrammarPatternFile);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return customGrammarPatternFiles;
|
|
126
|
-
}, []);
|
|
127
|
-
|
|
128
|
-
return customGrammarPatternFiles;
|
|
36
|
+
getDependencies() {
|
|
37
|
+
return this.dependendies;
|
|
129
38
|
}
|
|
130
39
|
|
|
131
40
|
toJSON() {
|
|
132
41
|
const entriesJSON = this.entries.toJSON(),
|
|
42
|
+
versionJSON = this.version.toJSON(),
|
|
43
|
+
dependenciesJSON = this.dependendies.toJSON(),
|
|
133
44
|
name = this.name,
|
|
134
45
|
entries = entriesJSON, ///
|
|
135
|
-
|
|
46
|
+
version = versionJSON, ///
|
|
47
|
+
repository = this.repository,
|
|
48
|
+
dependencies = dependenciesJSON, ///
|
|
136
49
|
json = {
|
|
137
50
|
name,
|
|
138
51
|
entries,
|
|
139
|
-
|
|
52
|
+
version,
|
|
53
|
+
repository,
|
|
54
|
+
dependencies
|
|
140
55
|
};
|
|
141
56
|
|
|
142
57
|
return json;
|
|
143
58
|
}
|
|
144
59
|
|
|
145
60
|
static fromJSON(json) {
|
|
146
|
-
let { entries } = json;
|
|
61
|
+
let { entries, version, dependencies } = json;
|
|
147
62
|
|
|
148
|
-
const { name,
|
|
149
|
-
entriesJSON = entries
|
|
63
|
+
const { name, repository } = json,
|
|
64
|
+
entriesJSON = entries, ///
|
|
65
|
+
versionJSOM = version, ///
|
|
66
|
+
dependenciesJSON = dependencies; ///
|
|
150
67
|
|
|
151
68
|
json = entriesJSON; ///
|
|
152
69
|
|
|
153
70
|
entries = Entries.fromJSON(json); ///
|
|
154
71
|
|
|
155
|
-
|
|
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);
|
|
156
81
|
|
|
157
82
|
return release;
|
|
158
83
|
}
|
|
159
84
|
|
|
160
|
-
static
|
|
161
|
-
const
|
|
85
|
+
static fromNameEntriesAndVersion(name, entries, version) {
|
|
86
|
+
const repository = repository,
|
|
87
|
+
dependencies = Dependencies.fromNothing(),
|
|
88
|
+
release = new Release(name, entries, version, repository, dependencies);
|
|
162
89
|
|
|
163
90
|
return release;
|
|
164
91
|
}
|
|
165
92
|
}
|
|
93
|
+
|
|
94
|
+
Objecct.assign(Release.prototype, bnfMixin);
|
|
95
|
+
Objecct.assign(Release.prototype, filesMixin);
|
|
96
|
+
Objecct.assign(Release.prototype, entriesMixin);
|
|
97
|
+
Objecct.assign(Release.prototype, patternMixin);
|
|
98
|
+
|
|
99
|
+
export default Release;
|
|
@@ -0,0 +1,109 @@
|
|
|
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/utilities/content.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { DOUBLE_SPACE } from "../constants";
|
|
3
|
+
import { EMPTY_STRING, DOUBLE_SPACE } from "../constants";
|
|
4
|
+
|
|
5
|
+
export function trimDoubleQuotes(content) { return content.replace(/(^"|"$)/g, EMPTY_STRING); } ///
|
|
4
6
|
|
|
5
7
|
export function convertContentTabsToWhitespace(content) { return content.replace(/\t/g, DOUBLE_SPACE); } ///
|
|
6
8
|
|
|
7
9
|
export default {
|
|
10
|
+
trimDoubleQuotes,
|
|
8
11
|
convertContentTabsToWhitespace
|
|
9
12
|
};
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
};
|