Skip to content

npm run build can't generate model from scratch #49

@tbolon

Description

@tbolon

Hi,

I am back trying to understand why my PR #46 was raising an error message. It seems that if the model files are missing, the npm run build will fail to generate them.

To reproduce:

  • for reference, run npm run build: it works
  • delete the 4 .it files in the model folder (.blocks.json, .def.json, .model.json, ,tmpl).
  • run npm run build: you receive an error: Exception while compiling template: ./dist/template.it/template-versafix-1.it.html TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined.
  • the dist files are generated but the model only contains template-versafix-1.it.model.json with a different structure and the 3 other files are missing.

Complete log:

translating  ./template-def/template-versafix-1.it.htmml ./dist/template.it/template-versafix-1.it.html
WARNING: Replacing existing mock for module: jquery
Ignoring longTextStyle.lineHeight property because it is not used by the template prop: lineHeight type: styler level: 2 preheaderBlock
Ignoring longTextStyle.linksColor property because it is not used by the template prop: linksColor type: styler level: 2 preheaderBlock
Ignoring longTextStyle.lineHeight property because it is not used by the template prop: lineHeight type: styler level: 2 footerBlock
Ignoring longTextStyle.align property because it is not used by the template prop: align type: styler level: 2 footerBlock
Ignoring externalTextStyle.align property because it is not used by the template prop: align type: styler level: 2 logoBlock
Ignoring longTextStyle.lineHeight property because it is not used by the template prop: lineHeight type: styler level: 2 logoBlock
Ignoring longTextStyle.align property because it is not used by the template prop: align type: styler level: 2 logoBlock
Ignoring longTextStyle.linksColor property because it is not used by the template prop: linksColor type: styler level: 2 logoBlock
Ignoring blockSpacing.topPadding property because it is not used by the template prop: topPadding type: styler level: 2 titleBlock
Ignoring blockSpacing.bottomPadding property because it is not used by the template prop: bottomPadding type: styler level: 2 titleBlock
Ignoring blockSpacing.topPadding property because it is not used by the template prop: topPadding type: styler level: 2 hrBlock
Ignoring blockSpacing.bottomPadding property because it is not used by the template prop: bottomPadding type: styler level: 2 hrBlock
Ignoring longTextStyle.lineHeight property because it is not used by the template prop: lineHeight type: styler level: 2 imageBlock
Ignoring longTextStyle.align property because it is not used by the template prop: align type: styler level: 2 imageBlock
Ignoring longTextStyle.lineHeight property because it is not used by the template prop: lineHeight type: styler level: 2 doubleImageBlock
Ignoring longTextStyle.align property because it is not used by the template prop: align type: styler level: 2 doubleImageBlock
Ignoring longTextStyle.lineHeight property because it is not used by the template prop: lineHeight type: styler level: 2 tripleImageBlock
Ignoring longTextStyle.align property because it is not used by the template prop: align type: styler level: 2 tripleImageBlock
Ignoring longText property because it is not used by the template prop: longText type: edit level: 1 bigSocialBlock
Ignoring longTextStyle property because it is not used by the template prop: longTextStyle type: styler level: 1 bigSocialBlock
Ignoring customUrl property because it is not used by the template prop: customUrl type: edit level: 1 shareBlock
Ignoring shareButtonStyle.align property because it is not used by the template prop: align type: styler level: 2 shareBlock
Ignoring longTextStyle.lineHeight property because it is not used by the template prop: lineHeight type: styler level: 2 socialBlock
Ignoring longTextStyle.align property because it is not used by the template prop: align type: styler level: 2 socialBlock
Ignoring frameTheme.longTextStyle.lineHeight property because it is not used by the template prop: lineHeight type: styler level: 2 theme
Ignoring contentTheme.externalTextStyle.align property because it is not used by the template prop: align type: styler level: 2 theme
Ignoring contentTheme.shareButtonStyle.align property because it is not used by the template prop: align type: styler level: 2 theme
## Creating first time compiled artifacts for template ./dist/template.it/template-versafix-1.it.html
Exception while compiling template: ./dist/template.it/template-versafix-1.it.html TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at Object.writeFileSync (node:fs:2424:5)
    at checkTemplateDefs (D:\code\github\versafix-template\src\checkTemplateDefs.js:100:8)
    at Object.<anonymous> (D:\code\github\versafix-template\src\index.js:45:7)
    at Module._compile (node:internal/modules/cjs/loader:1760:14)
    at Object..js (node:internal/modules/cjs/loader:1893:10)
    at Module.load (node:internal/modules/cjs/loader:1480:32)
    at Module.<anonymous> (node:internal/modules/cjs/loader:1299:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:244:24)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5) {
  code: 'ERR_INVALID_ARG_TYPE'
}
WARNING: loading non-allowed module: async
Creating thumbnails for  ./dist/template.it/template-versafix-1.it.html
logoBlock,sideArticleBlock,sideImageBlock,singleArticleBlock,titleBlock,titleBlock2,textBlock,tripleArticleBlock,doubleArticleBlock,hrBlock,hrBlock2,buttonBlock,imageBlock,doubleImageBlock,tripleImageBlock,bigSocialBlock,shareBlock,spacerBlock,socialBlock
clipRect 34 0 640 186
clipRect 220 0 640 204
clipRect 424 0 640 170
clipRect 594 0 640 340
clipRect 934 0 640 44
clipRect 978 0 640 62
clipRect 1040 0 640 129
clipRect 1169 0 640 296
clipRect 1465 0 640 274
clipRect 1739 0 640 19
clipRect 1758 0 640 37
clipRect 1795 0 640 86
clipRect 1881 0 640 200
clipRect 2081 0 640 180
clipRect 2261 0 640 160
clipRect 2421 0 640 84
clipRect 2505 0 640 72
clipRect 2577 0 640 24
clipRect 2601 0 640 68
clipRect 0 0 640 2666
finished 0 true
finished 1 true
finished 2 true
finished 3 true
finished 4 true
finished 5 true
finished 6 true
finished 7 true
finished 8 true
finished 9 true
finished 10 true
finished 11 true
finished 12 true
finished 13 true
finished 14 true
finished 15 true
finished 16 true
finished 17 true
finished 18 true
finished 19 true
exiting
DONE null

It seems fs.writeFileSync(outBlockDefsFile, JSON.stringify(blockDefs, ' ', 2)); does not receive a correct data parameter certainly because blockDefs is undefined?

It stops anyone from generating correct model data for new templates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions