ic-mops 0.17.2 → 0.18.0
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/cli.js +1 -1
- package/commands/docs.js +2 -2
- package/commands/mmf1.js +1 -1
- package/commands/publish.js +6 -1
- package/commands/test.js +26 -4
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -186,7 +186,7 @@ program
|
|
|
186
186
|
program
|
|
187
187
|
.command('test [filter]')
|
|
188
188
|
.description('Run tests')
|
|
189
|
-
.option('--watch', 'Enable watch mode')
|
|
189
|
+
.option('-w, --watch', 'Enable watch mode')
|
|
190
190
|
.action(async (filter, options) => {
|
|
191
191
|
await test(filter, options);
|
|
192
192
|
});
|
package/commands/docs.js
CHANGED
|
@@ -13,8 +13,8 @@ let moDoc;
|
|
|
13
13
|
|
|
14
14
|
export async function docs({silent} = {}) {
|
|
15
15
|
let rootDir = getRootDir();
|
|
16
|
-
let docsDir = path.join(rootDir, '.mops
|
|
17
|
-
let docsDirRelative = path.relative(process.cwd(),
|
|
16
|
+
let docsDir = path.join(rootDir, '.mops/.docs');
|
|
17
|
+
let docsDirRelative = path.relative(process.cwd(), docsDir);
|
|
18
18
|
|
|
19
19
|
del.sync([docsDir], {force: true});
|
|
20
20
|
|
package/commands/mmf1.js
CHANGED
|
@@ -81,7 +81,7 @@ export class MMF1 {
|
|
|
81
81
|
}
|
|
82
82
|
else if (status === 'fail') {
|
|
83
83
|
this.failed++;
|
|
84
|
-
this._log(' '.repeat(this.stack.length * 2), chalk.red('
|
|
84
|
+
this._log(' '.repeat(this.stack.length * 2), chalk.red('✖'), name);
|
|
85
85
|
}
|
|
86
86
|
else if (status === 'skip') {
|
|
87
87
|
this.skipped++;
|
package/commands/publish.js
CHANGED
|
@@ -171,16 +171,19 @@ export async function publish({noDocs} = {}) {
|
|
|
171
171
|
'mops.toml',
|
|
172
172
|
'README.md',
|
|
173
173
|
'LICENSE',
|
|
174
|
+
'NOTICE',
|
|
174
175
|
'!.mops/**',
|
|
175
176
|
'!test/**',
|
|
177
|
+
'!tests/**',
|
|
176
178
|
'!**/*.test.mo',
|
|
179
|
+
'!**/*.Test.mo',
|
|
177
180
|
];
|
|
178
181
|
let files = config.package.files || ['**/*.mo'];
|
|
179
182
|
files = [...files, ...defaultFiles];
|
|
180
183
|
files = globbySync([...files, ...defaultFiles]);
|
|
181
184
|
|
|
182
185
|
// generate docs
|
|
183
|
-
let docsFile = path.join(rootDir, '.mops/
|
|
186
|
+
let docsFile = path.join(rootDir, '.mops/.docs/docs.tgz');
|
|
184
187
|
if (!noDocs) {
|
|
185
188
|
await docs({silent: true});
|
|
186
189
|
if (fs.existsSync(docsFile)) {
|
|
@@ -257,6 +260,8 @@ export async function publish({noDocs} = {}) {
|
|
|
257
260
|
}
|
|
258
261
|
});
|
|
259
262
|
|
|
263
|
+
fs.rmSync(path.join(rootDir, '.mops/.docs'), {force: true, recursive: true});
|
|
264
|
+
|
|
260
265
|
// finish
|
|
261
266
|
progress();
|
|
262
267
|
let res = await actor.finishPublish(puiblishingId);
|
package/commands/test.js
CHANGED
|
@@ -39,7 +39,10 @@ export async function test(filter = '', {watch = false} = {}) {
|
|
|
39
39
|
console.log(chalk.gray((`Press ${chalk.gray('Ctrl+C')} to exit.`)));
|
|
40
40
|
}, 200);
|
|
41
41
|
|
|
42
|
-
let watcher = chokidar.watch(
|
|
42
|
+
let watcher = chokidar.watch([
|
|
43
|
+
path.join(rootDir, '**/*.mo'),
|
|
44
|
+
path.join(rootDir, 'mops.toml'),
|
|
45
|
+
], {
|
|
43
46
|
ignored: ignore,
|
|
44
47
|
ignoreInitial: true,
|
|
45
48
|
});
|
|
@@ -182,9 +185,28 @@ function pipeMMF(proc, mmf) {
|
|
|
182
185
|
// stderr
|
|
183
186
|
proc.stderr.on('data', (data) => {
|
|
184
187
|
let text = data.toString().trim();
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
+
let failedLine = '';
|
|
189
|
+
text = text.replace(/([\w+._/-]+):(\d+).(\d+)(-\d+.\d+)/g, (m0, m1, m2, m3) => {
|
|
190
|
+
// change absolute file path to relative
|
|
191
|
+
// change :line:col-line:col to :line:col to work in vscode
|
|
192
|
+
let res = `${absToRel(m1)}:${m2}:${m3}`;
|
|
193
|
+
// show failed line
|
|
194
|
+
let content = fs.readFileSync(m1);
|
|
195
|
+
let lines = content.toString().split('\n');
|
|
196
|
+
failedLine += chalk.dim`\n ...`;
|
|
197
|
+
if (m2 - 2 >= 0) {
|
|
198
|
+
failedLine += chalk.dim`\n ${+m2 - 1}\t| ${lines[m2 - 2].replaceAll('\t', ' ')}`;
|
|
199
|
+
}
|
|
200
|
+
failedLine += `\n${chalk.redBright`->`} ${m2}\t| ${lines[m2 - 1].replaceAll('\t', ' ')}`;
|
|
201
|
+
if (lines.length > +m2) {
|
|
202
|
+
failedLine += chalk.dim`\n ${+m2 + 1}\t| ${lines[m2].replaceAll('\t', ' ')}`;
|
|
203
|
+
}
|
|
204
|
+
failedLine += chalk.dim`\n ...`;
|
|
205
|
+
return res;
|
|
206
|
+
});
|
|
207
|
+
if (failedLine) {
|
|
208
|
+
text += failedLine;
|
|
209
|
+
}
|
|
188
210
|
mmf.fail(text);
|
|
189
211
|
});
|
|
190
212
|
|