1
0
Fork 0

chore: Lab debug and types. See #2838

This commit is contained in:
Joost De Cock 2022-09-28 19:22:22 +02:00
parent 47c6997d3a
commit e960d31d96
5 changed files with 10 additions and 7 deletions

View file

@ -15,6 +15,7 @@
"?": "node scripts/help.mjs", "?": "node scripts/help.mjs",
"tips": "node scripts/help.mjs", "tips": "node scripts/help.mjs",
"lab": "cd sites/lab && yarn start", "lab": "cd sites/lab && yarn start",
"lab-debug": "cd sites/lab && yarn start-debug",
"kickstart": "npx lerna bootstrap && yarn buildall && yarn prepare && yarn tips", "kickstart": "npx lerna bootstrap && yarn buildall && yarn prepare && yarn tips",
"cleanall": "lerna run clean", "cleanall": "lerna run clean",
"test": "lerna run test", "test": "lerna run test",

View file

@ -467,7 +467,7 @@ Pattern.prototype.__addPartOptions = function (part) {
this.__mutated.optionDistance[optionName] = this.__mutated.partDistance?.[part.name] || 0 this.__mutated.optionDistance[optionName] = this.__mutated.partDistance?.[part.name] || 0
// Keep design parts immutable in the pattern or risk subtle bugs // Keep design parts immutable in the pattern or risk subtle bugs
this.config.options[optionName] = Object.freeze(part.options[optionName]) this.config.options[optionName] = Object.freeze(part.options[optionName])
this.store.log.debug(`🔵 __${optionName}__ option loaded from \`${part.name}\``) this.store.log.debug(`🔵 __${optionName}__ option loaded from part \`${part.name}\``)
} else if ( } else if (
this.__mutated.optionDistance[optionName] > this.__mutated.partDistance[part.name] this.__mutated.optionDistance[optionName] > this.__mutated.partDistance[part.name]
) { ) {
@ -850,7 +850,7 @@ Pattern.prototype.__loadOptionDefaults = function () {
* Loads a plugin * Loads a plugin
* *
* @private * @private
* @param {object} plugin - The plugin object * @param {object} plugin - The plugin object, or an object with `plugin` and `condition` keys
* @param {object} data - Any plugin data to load * @param {object} data - Any plugin data to load
* @return {Pattern} this - The Pattern instance * @return {Pattern} this - The Pattern instance
*/ */
@ -1393,7 +1393,7 @@ Pattern.prototype.__snappedPercentageOption = function (optionName, set) {
* Loads a conditional plugin * Loads a conditional plugin
* *
* @private * @private
* @param {object} plugin - The plugin object * @param {object} plugin - An object with `plugin` and `condition` keys
* @return {Pattern} this - The Pattern instance * @return {Pattern} this - The Pattern instance
*/ */
Pattern.prototype.__useIf = function (plugin) { Pattern.prototype.__useIf = function (plugin) {

View file

@ -5,7 +5,9 @@
"scripts": { "scripts": {
"dev": "node --experimental-json-modules ../../node_modules/.bin/next dev -p 8000", "dev": "node --experimental-json-modules ../../node_modules/.bin/next dev -p 8000",
"develop": "node --experimental-json-modules ../../node_modules/.bin/next dev -p 8000", "develop": "node --experimental-json-modules ../../node_modules/.bin/next dev -p 8000",
"dev-debug": "node --inspect --experimental-json-modules ../../node_modules/.bin/next dev -p 8000",
"start": "yarn prebuild && yarn dev", "start": "yarn prebuild && yarn dev",
"start-debug": "yarn prebuild && yarn dev-debug",
"prebuild": "node --experimental-json-modules ../shared/prebuild/index.mjs", "prebuild": "node --experimental-json-modules ../shared/prebuild/index.mjs",
"cibuild": "yarn prebuild && node --experimental-json-modules ../../node_modules/.bin/next build", "cibuild": "yarn prebuild && node --experimental-json-modules ../../node_modules/.bin/next build",
"build": "node --experimental-json-modules ../../node_modules/.bin/next build", "build": "node --experimental-json-modules ../../node_modules/.bin/next build",

View file

@ -1,6 +1,6 @@
import DefaultErrorView from 'shared/components/error/view' import DefaultErrorView from 'shared/components/error/view'
const Error = ({ logs=[], updateGist }) => { const Error = ({ logs = [], updateGist }) => {
let errors = 0 let errors = 0
let warnings = 0 let warnings = 0
for (const log of logs) { for (const log of logs) {
@ -13,7 +13,7 @@ const Error = ({ logs=[], updateGist }) => {
<li> <li>
Check the{' '} Check the{' '}
<button className="btn-link" onClick={() => updateGist(['_state', 'view'], 'logs')}> <button className="btn-link" onClick={() => updateGist(['_state', 'view'], 'logs')}>
<strong>{errors.length} errors</strong> and <strong>{warnings.length} warnings</strong> <strong>{errors} errors</strong> and <strong>{warnings} warnings</strong>
</button> </button>
</li> </li>
<li>Check the partially rendered pattern below to see which areas are problematic</li> <li>Check the partially rendered pattern below to see which areas are problematic</li>

View file

@ -115,9 +115,9 @@ const WorkbenchWrapper = ({ app, design, preload = false, from = false, layout =
if (['draft', 'logs', 'test', 'printingLayout'].indexOf(gist._state?.view) !== -1) { if (['draft', 'logs', 'test', 'printingLayout'].indexOf(gist._state?.view) !== -1) {
gist.embed = true gist.embed = true
// get the appropriate layout for the view // get the appropriate layout for the view
const layout = gist.layouts?.[gist._state.view] || gist.layout || true gist.layout = gist.layouts?.[gist._state.view] || gist.layout || true
// hand it separately to the design // hand it separately to the design
draft = new design({ ...gist, layout }) draft = new design(gist)
draft.__init() draft.__init()
// add theme to svg renderer // add theme to svg renderer