@rindo/core 2.18.0 → 2.18.1
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/index.cjs +74 -21
- package/cli/index.js +74 -21
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +203 -724
- package/compiler/rindo.min.js +2 -2
- package/dependencies.json +1 -1
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +2 -2
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +1 -1
- package/internal/package.json +1 -1
- package/internal/rindo-public-compiler.d.ts +2 -2
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +1 -2
- package/mock-doc/index.js +1 -2
- package/mock-doc/package.json +1 -1
- package/package.json +9 -9
- package/readme.md +44 -31
- package/screenshot/compare/build/p-f4745c2f.entry.js +1 -1
- package/screenshot/package.json +1 -1
- package/sys/node/autoprefixer.js +5 -5
- package/sys/node/glob.js +1 -1
- package/sys/node/graceful-fs.js +1 -1
- package/sys/node/index.js +2 -2
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +767 -918
- package/testing/package.json +1 -1
package/cli/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo CLI (CommonJS) v2.18.
|
|
2
|
+
Rindo CLI (CommonJS) v2.18.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
@@ -829,7 +829,7 @@ LOG_LEVELS.includes(maybeLogLevel);
|
|
|
829
829
|
const dependencies = [
|
|
830
830
|
{
|
|
831
831
|
name: "@rindo/core",
|
|
832
|
-
version: "2.18.
|
|
832
|
+
version: "2.18.1",
|
|
833
833
|
main: "compiler/rindo.js",
|
|
834
834
|
resources: [
|
|
835
835
|
"package.json",
|
|
@@ -1177,7 +1177,7 @@ const isInteractive = (sys, flags, object) => {
|
|
|
1177
1177
|
return terminalInfo.tty && !terminalInfo.ci;
|
|
1178
1178
|
};
|
|
1179
1179
|
const UUID_REGEX = new RegExp(/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i);
|
|
1180
|
-
// Plucked from https://github.com/
|
|
1180
|
+
// Plucked from https://github.com/familyjs/jigra/blob/HEAD/cli/src/util/uuid.ts
|
|
1181
1181
|
function uuidv4() {
|
|
1182
1182
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
1183
1183
|
const r = (Math.random() * 16) | 0;
|
|
@@ -1224,10 +1224,10 @@ async function shouldTrack(config, sys, ci) {
|
|
|
1224
1224
|
}
|
|
1225
1225
|
|
|
1226
1226
|
const isTest$1 = () => process.env.JEST_WORKER_ID !== undefined;
|
|
1227
|
-
const defaultConfig = (sys) => sys.resolvePath(`${sys.homeDir()}/.
|
|
1228
|
-
const defaultConfigDirectory = (sys) => sys.resolvePath(`${sys.homeDir()}/.
|
|
1227
|
+
const defaultConfig = (sys) => sys.resolvePath(`${sys.homeDir()}/.family/${isTest$1() ? 'tmp-config.json' : 'config.json'}`);
|
|
1228
|
+
const defaultConfigDirectory = (sys) => sys.resolvePath(`${sys.homeDir()}/.family`);
|
|
1229
1229
|
/**
|
|
1230
|
-
* Reads an
|
|
1230
|
+
* Reads an Family configuration file from disk, parses it, and performs any necessary corrections to it if certain
|
|
1231
1231
|
* values are deemed to be malformed
|
|
1232
1232
|
* @param sys The system where the command is invoked
|
|
1233
1233
|
* @returns the config read from disk that has been potentially been updated
|
|
@@ -1249,7 +1249,7 @@ async function readConfig(sys) {
|
|
|
1249
1249
|
return config;
|
|
1250
1250
|
}
|
|
1251
1251
|
/**
|
|
1252
|
-
* Writes an
|
|
1252
|
+
* Writes an Family configuration file to disk.
|
|
1253
1253
|
* @param sys The system where the command is invoked
|
|
1254
1254
|
* @param config The config passed into the Rindo command
|
|
1255
1255
|
* @returns boolean If the command was successful
|
|
@@ -1267,7 +1267,7 @@ async function writeConfig(sys, config) {
|
|
|
1267
1267
|
return result;
|
|
1268
1268
|
}
|
|
1269
1269
|
/**
|
|
1270
|
-
* Update a subset of the
|
|
1270
|
+
* Update a subset of the Family config.
|
|
1271
1271
|
* @param sys The system where the command is invoked
|
|
1272
1272
|
* @param newOptions The new options to save
|
|
1273
1273
|
* @returns boolean If the command was successful
|
|
@@ -1483,7 +1483,7 @@ const anonymizeConfigForTelemetry = (config) => {
|
|
|
1483
1483
|
/**
|
|
1484
1484
|
* Reads package-lock.json, yarn.lock, and package.json files in order to cross-reference
|
|
1485
1485
|
* the dependencies and devDependencies properties. Pulls up the current installed version
|
|
1486
|
-
* of each package under the @rindo, @
|
|
1486
|
+
* of each package under the @rindo, @familyjs, and @jigra scopes.
|
|
1487
1487
|
*
|
|
1488
1488
|
* @param sys the system instance where telemetry is invoked
|
|
1489
1489
|
* @param config the Rindo configuration associated with the current task that triggered telemetry
|
|
@@ -1505,16 +1505,16 @@ async function getInstalledPackages(sys, config) {
|
|
|
1505
1505
|
...packageJson.devDependencies,
|
|
1506
1506
|
...packageJson.dependencies,
|
|
1507
1507
|
});
|
|
1508
|
-
// Collect packages only in the rindo,
|
|
1508
|
+
// Collect packages only in the rindo, familyjs, or jigra org's:
|
|
1509
1509
|
// https://www.npmjs.com/org/rindo
|
|
1510
|
-
const
|
|
1510
|
+
const familyPackages = rawPackages.filter(([k]) => k.startsWith('@rindo/') || k.startsWith('@familyjs/') || k.startsWith('@jigra/'));
|
|
1511
1511
|
try {
|
|
1512
|
-
packages = yarn ? await yarnPackages(sys,
|
|
1512
|
+
packages = yarn ? await yarnPackages(sys, familyPackages) : await npmPackages(sys, familyPackages);
|
|
1513
1513
|
}
|
|
1514
1514
|
catch (e) {
|
|
1515
|
-
packages =
|
|
1515
|
+
packages = familyPackages.map(([k, v]) => `${k}@${v.replace('^', '')}`);
|
|
1516
1516
|
}
|
|
1517
|
-
packagesNoVersions =
|
|
1517
|
+
packagesNoVersions = familyPackages.map(([k]) => `${k}`);
|
|
1518
1518
|
return { packages, packagesNoVersions };
|
|
1519
1519
|
}
|
|
1520
1520
|
catch (err) {
|
|
@@ -1525,13 +1525,13 @@ async function getInstalledPackages(sys, config) {
|
|
|
1525
1525
|
/**
|
|
1526
1526
|
* Visits the npm lock file to find the exact versions that are installed
|
|
1527
1527
|
* @param sys The system where the command is invoked
|
|
1528
|
-
* @param
|
|
1528
|
+
* @param familyPackages a list of the found packages matching `@rindo`, `@jigra`, or `@familyjs` from the package.json file.
|
|
1529
1529
|
* @returns an array of strings of all the packages and their versions.
|
|
1530
1530
|
*/
|
|
1531
|
-
async function npmPackages(sys,
|
|
1531
|
+
async function npmPackages(sys, familyPackages) {
|
|
1532
1532
|
const appRootDir = sys.getCurrentDirectory();
|
|
1533
1533
|
const packageLockJson = await tryFn(readJson, sys, sys.resolvePath(appRootDir + '/package-lock.json'));
|
|
1534
|
-
return
|
|
1534
|
+
return familyPackages.map(([k, v]) => {
|
|
1535
1535
|
var _a, _b, _c, _d;
|
|
1536
1536
|
let version = (_d = (_b = (_a = packageLockJson === null || packageLockJson === void 0 ? void 0 : packageLockJson.dependencies[k]) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : (_c = packageLockJson === null || packageLockJson === void 0 ? void 0 : packageLockJson.devDependencies[k]) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : v;
|
|
1537
1537
|
version = version.includes('file:') ? sanitizeDeclaredVersion(v) : version;
|
|
@@ -1541,14 +1541,14 @@ async function npmPackages(sys, navifyPackages) {
|
|
|
1541
1541
|
/**
|
|
1542
1542
|
* Visits the yarn lock file to find the exact versions that are installed
|
|
1543
1543
|
* @param sys The system where the command is invoked
|
|
1544
|
-
* @param
|
|
1544
|
+
* @param familyPackages a list of the found packages matching `@rindo`, `@jigra`, or `@familyjs` from the package.json file.
|
|
1545
1545
|
* @returns an array of strings of all the packages and their versions.
|
|
1546
1546
|
*/
|
|
1547
|
-
async function yarnPackages(sys,
|
|
1547
|
+
async function yarnPackages(sys, familyPackages) {
|
|
1548
1548
|
const appRootDir = sys.getCurrentDirectory();
|
|
1549
1549
|
const yarnLock = sys.readFileSync(sys.resolvePath(appRootDir + '/yarn.lock'));
|
|
1550
1550
|
const yarnLockYml = sys.parseYarnLockFile(yarnLock);
|
|
1551
|
-
return
|
|
1551
|
+
return familyPackages.map(([k, v]) => {
|
|
1552
1552
|
var _a;
|
|
1553
1553
|
const identifiedVersion = `${k}@${v}`;
|
|
1554
1554
|
let version = (_a = yarnLockYml.object[identifiedVersion]) === null || _a === void 0 ? void 0 : _a.version;
|
|
@@ -1613,7 +1613,7 @@ async function sendTelemetry(sys, config, data) {
|
|
|
1613
1613
|
sent_at: now,
|
|
1614
1614
|
};
|
|
1615
1615
|
// This request is only made if telemetry is on.
|
|
1616
|
-
const response = await sys.fetch('https://api
|
|
1616
|
+
const response = await sys.fetch('https://familyjs-api.web.app/events/metrics', {
|
|
1617
1617
|
method: 'POST',
|
|
1618
1618
|
headers: {
|
|
1619
1619
|
'Content-Type': 'application/json',
|
|
@@ -2103,6 +2103,56 @@ const taskServe = async (config) => {
|
|
|
2103
2103
|
});
|
|
2104
2104
|
};
|
|
2105
2105
|
|
|
2106
|
+
/**
|
|
2107
|
+
* Entrypoint for any Rindo tests
|
|
2108
|
+
* @param config a validated Rindo configuration entity
|
|
2109
|
+
*/
|
|
2110
|
+
const taskTest = async (config) => {
|
|
2111
|
+
if (!IS_NODE_ENV) {
|
|
2112
|
+
config.logger.error(`"test" command is currently only implemented for a NodeJS environment`);
|
|
2113
|
+
return config.sys.exit(1);
|
|
2114
|
+
}
|
|
2115
|
+
try {
|
|
2116
|
+
config.buildDocs = false;
|
|
2117
|
+
const testingRunOpts = {
|
|
2118
|
+
e2e: !!config.flags.e2e,
|
|
2119
|
+
screenshot: !!config.flags.screenshot,
|
|
2120
|
+
spec: !!config.flags.spec,
|
|
2121
|
+
updateScreenshot: !!config.flags.updateScreenshot,
|
|
2122
|
+
};
|
|
2123
|
+
// always ensure we have jest modules installed
|
|
2124
|
+
const ensureModuleIds = ['@types/jest', 'jest', 'jest-cli'];
|
|
2125
|
+
if (testingRunOpts.e2e) {
|
|
2126
|
+
// if it's an e2e test, also make sure we're got
|
|
2127
|
+
// puppeteer modules installed and if browserExecutablePath is provided don't download Chromium use only puppeteer-core instead
|
|
2128
|
+
const puppeteer = config.testing.browserExecutablePath ? 'puppeteer-core' : 'puppeteer';
|
|
2129
|
+
ensureModuleIds.push(puppeteer);
|
|
2130
|
+
if (testingRunOpts.screenshot) {
|
|
2131
|
+
// ensure we've got pixelmatch for screenshots
|
|
2132
|
+
config.logger.warn(config.logger.yellow(`EXPERIMENTAL: screenshot visual diff testing is currently under heavy development and has not reached a stable status. However, any assistance testing would be appreciated.`));
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
// ensure we've got the required modules installed
|
|
2136
|
+
const diagnostics = await config.sys.lazyRequire.ensure(config.rootDir, ensureModuleIds);
|
|
2137
|
+
if (diagnostics.length > 0) {
|
|
2138
|
+
config.logger.printDiagnostics(diagnostics);
|
|
2139
|
+
return config.sys.exit(1);
|
|
2140
|
+
}
|
|
2141
|
+
// let's test!
|
|
2142
|
+
const { createTesting } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('../testing/index.js')); });
|
|
2143
|
+
const testing = await createTesting(config);
|
|
2144
|
+
const passed = await testing.run(testingRunOpts);
|
|
2145
|
+
await testing.destroy();
|
|
2146
|
+
if (!passed) {
|
|
2147
|
+
return config.sys.exit(1);
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
catch (e) {
|
|
2151
|
+
config.logger.error(e);
|
|
2152
|
+
return config.sys.exit(1);
|
|
2153
|
+
}
|
|
2154
|
+
};
|
|
2155
|
+
|
|
2106
2156
|
/**
|
|
2107
2157
|
* Creates an instance of a logger
|
|
2108
2158
|
* @returns the new logger instance
|
|
@@ -2309,6 +2359,9 @@ const runTask = async (coreCompiler, config, task, sys) => {
|
|
|
2309
2359
|
case 'telemetry':
|
|
2310
2360
|
await taskTelemetry(strictConfig.flags, sys, strictConfig.logger);
|
|
2311
2361
|
break;
|
|
2362
|
+
case 'test':
|
|
2363
|
+
await taskTest(strictConfig);
|
|
2364
|
+
break;
|
|
2312
2365
|
case 'version':
|
|
2313
2366
|
console.log(coreCompiler.version);
|
|
2314
2367
|
break;
|
package/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo CLI v2.18.
|
|
2
|
+
Rindo CLI v2.18.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* This sets the log level hierarchy for our terminal logger, ranging from
|
|
@@ -805,7 +805,7 @@ LOG_LEVELS.includes(maybeLogLevel);
|
|
|
805
805
|
const dependencies = [
|
|
806
806
|
{
|
|
807
807
|
name: "@rindo/core",
|
|
808
|
-
version: "2.18.
|
|
808
|
+
version: "2.18.1",
|
|
809
809
|
main: "compiler/rindo.js",
|
|
810
810
|
resources: [
|
|
811
811
|
"package.json",
|
|
@@ -1153,7 +1153,7 @@ const isInteractive = (sys, flags, object) => {
|
|
|
1153
1153
|
return terminalInfo.tty && !terminalInfo.ci;
|
|
1154
1154
|
};
|
|
1155
1155
|
const UUID_REGEX = new RegExp(/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i);
|
|
1156
|
-
// Plucked from https://github.com/
|
|
1156
|
+
// Plucked from https://github.com/familyjs/jigra/blob/HEAD/cli/src/util/uuid.ts
|
|
1157
1157
|
function uuidv4() {
|
|
1158
1158
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
1159
1159
|
const r = (Math.random() * 16) | 0;
|
|
@@ -1200,10 +1200,10 @@ async function shouldTrack(config, sys, ci) {
|
|
|
1200
1200
|
}
|
|
1201
1201
|
|
|
1202
1202
|
const isTest$1 = () => process.env.JEST_WORKER_ID !== undefined;
|
|
1203
|
-
const defaultConfig = (sys) => sys.resolvePath(`${sys.homeDir()}/.
|
|
1204
|
-
const defaultConfigDirectory = (sys) => sys.resolvePath(`${sys.homeDir()}/.
|
|
1203
|
+
const defaultConfig = (sys) => sys.resolvePath(`${sys.homeDir()}/.family/${isTest$1() ? 'tmp-config.json' : 'config.json'}`);
|
|
1204
|
+
const defaultConfigDirectory = (sys) => sys.resolvePath(`${sys.homeDir()}/.family`);
|
|
1205
1205
|
/**
|
|
1206
|
-
* Reads an
|
|
1206
|
+
* Reads an Family configuration file from disk, parses it, and performs any necessary corrections to it if certain
|
|
1207
1207
|
* values are deemed to be malformed
|
|
1208
1208
|
* @param sys The system where the command is invoked
|
|
1209
1209
|
* @returns the config read from disk that has been potentially been updated
|
|
@@ -1225,7 +1225,7 @@ async function readConfig(sys) {
|
|
|
1225
1225
|
return config;
|
|
1226
1226
|
}
|
|
1227
1227
|
/**
|
|
1228
|
-
* Writes an
|
|
1228
|
+
* Writes an Family configuration file to disk.
|
|
1229
1229
|
* @param sys The system where the command is invoked
|
|
1230
1230
|
* @param config The config passed into the Rindo command
|
|
1231
1231
|
* @returns boolean If the command was successful
|
|
@@ -1243,7 +1243,7 @@ async function writeConfig(sys, config) {
|
|
|
1243
1243
|
return result;
|
|
1244
1244
|
}
|
|
1245
1245
|
/**
|
|
1246
|
-
* Update a subset of the
|
|
1246
|
+
* Update a subset of the Family config.
|
|
1247
1247
|
* @param sys The system where the command is invoked
|
|
1248
1248
|
* @param newOptions The new options to save
|
|
1249
1249
|
* @returns boolean If the command was successful
|
|
@@ -1459,7 +1459,7 @@ const anonymizeConfigForTelemetry = (config) => {
|
|
|
1459
1459
|
/**
|
|
1460
1460
|
* Reads package-lock.json, yarn.lock, and package.json files in order to cross-reference
|
|
1461
1461
|
* the dependencies and devDependencies properties. Pulls up the current installed version
|
|
1462
|
-
* of each package under the @rindo, @
|
|
1462
|
+
* of each package under the @rindo, @familyjs, and @jigra scopes.
|
|
1463
1463
|
*
|
|
1464
1464
|
* @param sys the system instance where telemetry is invoked
|
|
1465
1465
|
* @param config the Rindo configuration associated with the current task that triggered telemetry
|
|
@@ -1481,16 +1481,16 @@ async function getInstalledPackages(sys, config) {
|
|
|
1481
1481
|
...packageJson.devDependencies,
|
|
1482
1482
|
...packageJson.dependencies,
|
|
1483
1483
|
});
|
|
1484
|
-
// Collect packages only in the rindo,
|
|
1484
|
+
// Collect packages only in the rindo, familyjs, or jigra org's:
|
|
1485
1485
|
// https://www.npmjs.com/org/rindo
|
|
1486
|
-
const
|
|
1486
|
+
const familyPackages = rawPackages.filter(([k]) => k.startsWith('@rindo/') || k.startsWith('@familyjs/') || k.startsWith('@jigra/'));
|
|
1487
1487
|
try {
|
|
1488
|
-
packages = yarn ? await yarnPackages(sys,
|
|
1488
|
+
packages = yarn ? await yarnPackages(sys, familyPackages) : await npmPackages(sys, familyPackages);
|
|
1489
1489
|
}
|
|
1490
1490
|
catch (e) {
|
|
1491
|
-
packages =
|
|
1491
|
+
packages = familyPackages.map(([k, v]) => `${k}@${v.replace('^', '')}`);
|
|
1492
1492
|
}
|
|
1493
|
-
packagesNoVersions =
|
|
1493
|
+
packagesNoVersions = familyPackages.map(([k]) => `${k}`);
|
|
1494
1494
|
return { packages, packagesNoVersions };
|
|
1495
1495
|
}
|
|
1496
1496
|
catch (err) {
|
|
@@ -1501,13 +1501,13 @@ async function getInstalledPackages(sys, config) {
|
|
|
1501
1501
|
/**
|
|
1502
1502
|
* Visits the npm lock file to find the exact versions that are installed
|
|
1503
1503
|
* @param sys The system where the command is invoked
|
|
1504
|
-
* @param
|
|
1504
|
+
* @param familyPackages a list of the found packages matching `@rindo`, `@jigra`, or `@familyjs` from the package.json file.
|
|
1505
1505
|
* @returns an array of strings of all the packages and their versions.
|
|
1506
1506
|
*/
|
|
1507
|
-
async function npmPackages(sys,
|
|
1507
|
+
async function npmPackages(sys, familyPackages) {
|
|
1508
1508
|
const appRootDir = sys.getCurrentDirectory();
|
|
1509
1509
|
const packageLockJson = await tryFn(readJson, sys, sys.resolvePath(appRootDir + '/package-lock.json'));
|
|
1510
|
-
return
|
|
1510
|
+
return familyPackages.map(([k, v]) => {
|
|
1511
1511
|
var _a, _b, _c, _d;
|
|
1512
1512
|
let version = (_d = (_b = (_a = packageLockJson === null || packageLockJson === void 0 ? void 0 : packageLockJson.dependencies[k]) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : (_c = packageLockJson === null || packageLockJson === void 0 ? void 0 : packageLockJson.devDependencies[k]) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : v;
|
|
1513
1513
|
version = version.includes('file:') ? sanitizeDeclaredVersion(v) : version;
|
|
@@ -1517,14 +1517,14 @@ async function npmPackages(sys, navifyPackages) {
|
|
|
1517
1517
|
/**
|
|
1518
1518
|
* Visits the yarn lock file to find the exact versions that are installed
|
|
1519
1519
|
* @param sys The system where the command is invoked
|
|
1520
|
-
* @param
|
|
1520
|
+
* @param familyPackages a list of the found packages matching `@rindo`, `@jigra`, or `@familyjs` from the package.json file.
|
|
1521
1521
|
* @returns an array of strings of all the packages and their versions.
|
|
1522
1522
|
*/
|
|
1523
|
-
async function yarnPackages(sys,
|
|
1523
|
+
async function yarnPackages(sys, familyPackages) {
|
|
1524
1524
|
const appRootDir = sys.getCurrentDirectory();
|
|
1525
1525
|
const yarnLock = sys.readFileSync(sys.resolvePath(appRootDir + '/yarn.lock'));
|
|
1526
1526
|
const yarnLockYml = sys.parseYarnLockFile(yarnLock);
|
|
1527
|
-
return
|
|
1527
|
+
return familyPackages.map(([k, v]) => {
|
|
1528
1528
|
var _a;
|
|
1529
1529
|
const identifiedVersion = `${k}@${v}`;
|
|
1530
1530
|
let version = (_a = yarnLockYml.object[identifiedVersion]) === null || _a === void 0 ? void 0 : _a.version;
|
|
@@ -1589,7 +1589,7 @@ async function sendTelemetry(sys, config, data) {
|
|
|
1589
1589
|
sent_at: now,
|
|
1590
1590
|
};
|
|
1591
1591
|
// This request is only made if telemetry is on.
|
|
1592
|
-
const response = await sys.fetch('https://api
|
|
1592
|
+
const response = await sys.fetch('https://familyjs-api.web.app/events/metrics', {
|
|
1593
1593
|
method: 'POST',
|
|
1594
1594
|
headers: {
|
|
1595
1595
|
'Content-Type': 'application/json',
|
|
@@ -2079,6 +2079,56 @@ const taskServe = async (config) => {
|
|
|
2079
2079
|
});
|
|
2080
2080
|
};
|
|
2081
2081
|
|
|
2082
|
+
/**
|
|
2083
|
+
* Entrypoint for any Rindo tests
|
|
2084
|
+
* @param config a validated Rindo configuration entity
|
|
2085
|
+
*/
|
|
2086
|
+
const taskTest = async (config) => {
|
|
2087
|
+
if (!IS_NODE_ENV) {
|
|
2088
|
+
config.logger.error(`"test" command is currently only implemented for a NodeJS environment`);
|
|
2089
|
+
return config.sys.exit(1);
|
|
2090
|
+
}
|
|
2091
|
+
try {
|
|
2092
|
+
config.buildDocs = false;
|
|
2093
|
+
const testingRunOpts = {
|
|
2094
|
+
e2e: !!config.flags.e2e,
|
|
2095
|
+
screenshot: !!config.flags.screenshot,
|
|
2096
|
+
spec: !!config.flags.spec,
|
|
2097
|
+
updateScreenshot: !!config.flags.updateScreenshot,
|
|
2098
|
+
};
|
|
2099
|
+
// always ensure we have jest modules installed
|
|
2100
|
+
const ensureModuleIds = ['@types/jest', 'jest', 'jest-cli'];
|
|
2101
|
+
if (testingRunOpts.e2e) {
|
|
2102
|
+
// if it's an e2e test, also make sure we're got
|
|
2103
|
+
// puppeteer modules installed and if browserExecutablePath is provided don't download Chromium use only puppeteer-core instead
|
|
2104
|
+
const puppeteer = config.testing.browserExecutablePath ? 'puppeteer-core' : 'puppeteer';
|
|
2105
|
+
ensureModuleIds.push(puppeteer);
|
|
2106
|
+
if (testingRunOpts.screenshot) {
|
|
2107
|
+
// ensure we've got pixelmatch for screenshots
|
|
2108
|
+
config.logger.warn(config.logger.yellow(`EXPERIMENTAL: screenshot visual diff testing is currently under heavy development and has not reached a stable status. However, any assistance testing would be appreciated.`));
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
// ensure we've got the required modules installed
|
|
2112
|
+
const diagnostics = await config.sys.lazyRequire.ensure(config.rootDir, ensureModuleIds);
|
|
2113
|
+
if (diagnostics.length > 0) {
|
|
2114
|
+
config.logger.printDiagnostics(diagnostics);
|
|
2115
|
+
return config.sys.exit(1);
|
|
2116
|
+
}
|
|
2117
|
+
// let's test!
|
|
2118
|
+
const { createTesting } = await import('../testing/index.js');
|
|
2119
|
+
const testing = await createTesting(config);
|
|
2120
|
+
const passed = await testing.run(testingRunOpts);
|
|
2121
|
+
await testing.destroy();
|
|
2122
|
+
if (!passed) {
|
|
2123
|
+
return config.sys.exit(1);
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
catch (e) {
|
|
2127
|
+
config.logger.error(e);
|
|
2128
|
+
return config.sys.exit(1);
|
|
2129
|
+
}
|
|
2130
|
+
};
|
|
2131
|
+
|
|
2082
2132
|
/**
|
|
2083
2133
|
* Creates an instance of a logger
|
|
2084
2134
|
* @returns the new logger instance
|
|
@@ -2285,6 +2335,9 @@ const runTask = async (coreCompiler, config, task, sys) => {
|
|
|
2285
2335
|
case 'telemetry':
|
|
2286
2336
|
await taskTelemetry(strictConfig.flags, sys, strictConfig.logger);
|
|
2287
2337
|
break;
|
|
2338
|
+
case 'test':
|
|
2339
|
+
await taskTest(strictConfig);
|
|
2340
|
+
break;
|
|
2288
2341
|
case 'version':
|
|
2289
2342
|
console.log(coreCompiler.version);
|
|
2290
2343
|
break;
|
package/cli/package.json
CHANGED