riot / cli

Riot.js command line tool
MIT License
46 stars 9 forks source link

Missing config parameter #25

Closed jumilla closed 7 years ago

jumilla commented 7 years ago

Missing 'parsers' & 'parserOptions'

See: http://riotjs.com/guide/compiler/

GianlucaGuarini commented 7 years ago

thanks @jumilla please fix the tests and it will be merged soon

jumilla commented 7 years ago

@GianlucaGuarini Already test failed on Dec 8, 2016 ?.

https://github.com/riot/cli/commits/master

2017-02-05 20 11 55

Trying make test on local machine.

  Cli Tests
    output logs
      1) All the cli output logs are fine
    Analyzer
      ✓ returns no error if the tag is valid
      ✓ returns an error if the tag is not closed
      ✓ returns an error if there are unmatched closing tags
      ✓ returns an error within a line tag
      ✓ returns an error if there are invalid tag fragments
    API methods
      ✓ help
      ✓ version
      ✓ check
      ✓ make with the wrong path should return an error
      ✓ make with the right path should not return any error
      ✓ make all the tags in a folder
      ✓ make using the modular flag on a single tag must return compliant UMD code
      ✓ make using the modular flag on multiple tags must return compliant UMD code
      ✓ make using a missing preprocessor should throw an error
cat: no such file or directory: test/generated/export/make-tags.scss.css
      2) make using the --export feature
      ✓ make using the --exclude flag
      ✓ check the error messages when the parser was not found
      ✓ watch folder (3023ms)
      ✓ watch file (114ms)
    External config file
test/tags/component.tag -> test/generated/config-file/parsers.js
      ✓ generate the tags using custom parsers in the config file
Error: Cannot find module 'pug'
test/tags/parsers/pug.pug -> test/generated/config-file/parsers-pug.js
      3) generate the tags using custom pug parser

  19 passing (3s)
  3 failing

  1) Cli Tests output logs All the cli output logs are fine:
     Error: expected '\nBuilds .tag files to .js\n\nOptions:\n\n  -h, --help           You\'re reading it\n  -v, --version        Print Riot\'s version\n  -w, --watch          Watch for changes\n  -c, --compact        Minify </p> <p> to </p><p>\n  -m, --modular        AMD and CommonJS\n  -s, --silent         Silence build output\n  --whitespace         Preserve newlines and whitepace\n  --check              Check the syntax errors on a single tag\n  --colors             Turn on colorized output\n  --expr               Run expressions through parser defined with --type\n  --config String      Specify the path to a configuration file to compile your tags\n  -e, --export String  Compile and export only the css or html or js from your tags - either: css, js, or html\n  -n, --new String     Create an empty tag template\n  -t, --type String    JavaScript pre-processor. Built-in support for: es6, coffeescript, typescript, livescript, none\n  --exclude String     Compile and excluding entities (css, html or js) from the output - either: css, js, or html\n  --template String    HTML pre-processor. Built-in support for: pug\n  --style String       Css pre-processor. Built-in support for: sass, scss, less, stylus\n  --brackets String    Change brackets used for expressions. Defaults to { }\n  --ext String         Change tag file extension. Defaults to .tag - default: tag\n\n\nBuild a single .tag file:\n\n  riot foo.tag           To a same named file (foo.js)\n  riot foo.tag bar.js    To a different named file (bar.js)\n  riot foo.tag bar       To a different dir (bar/foo.js)\n\nBuild all .tag files in a directory:\n\n  riot foo/bar           To a same directory (foo/**/*.js)\n  riot foo/bar baz       To a different directory (baz/**/*.js)\n  riot foo/bar baz.js    To a single concatenated file (baz.js)\n\nCreate an empty tag template\n\n  riot --new foo\n  riot --new foo/bar\n  riot --new foo/bar --ext html\n\nExamples for options:\n\n  riot foo bar\n  riot --config riot.config\n  riot --w foo bar\n  riot --watch foo bar\n  riot --compact foo bar\n  riot foo bar --compact\n  riot foo.tag --type coffeescript --expr\n  riot foo.tag --style sass --export css foo.css\n  riot foo.tag --exclude css foo.js\n\nVersion \n  riot-cli:      3.0.0 - https://github.com/riot/cli\n  riot-compiler: 3.0.0 - https://github.com/riot/compiler\n\n\n' to equal '\nBuilds .tag files to .js\n\nOptions:\n\n  -h, --help           You\'re reading it\n  -v, --version        Print Riot\'s versi

on\n  -w, --watch          Watch for changes\n  -c, --compact        Minify </p> <p> to </p><p>\n  -m, --modular        AMD and CommonJS\n  -s, --silent         Silence build output\n  --whitespace         Preserve newlines and whitepace\n  --check              Check the syntax errors on a single tag\n  --colors             Turn on colorized output\n  --expr               Run expressions through parser defined with --type\n  --config String      Specify the path to a configuration file to compile your tags\n  -e, --export String  Compile and export only the css or html or js from your tags - either: css, js, or html\n  -n, --new String     Create an empty tag template\n  -t, --type String    JavaScript pre-processor. Built-in support for: es6, coffeescript, typescript, livescript, none\n  --exclude String     Compile and excluding entities (css, html or js) from the output - either: css, js, or html\n  --template String    HTML pre-processor. Built-in support for: pug\n  --style String       Css pre-processor. Built-in support for: sass, scss, less, stylus\n  --brackets String    Change brackets used for expressions. Defaults to { }\n  --ext String         Change tag file extension. Defaults to .tag - default: tag\n\n\nBuild a single .tag file:\n\n  riot foo.tag           To a same named file (foo.js)\n  riot foo.tag bar.js    To a different named file (bar.js)\n  riot foo.tag bar       To a different dir (bar/foo.js)\n\nBuild all .tag files in a directory:\n\n  riot foo/bar           To a same directory (foo/**/*.js)\n  riot foo/bar baz       To a different directory (baz/**/*.js)\n  riot foo/bar baz.js    To a single concatenated file (baz.js)\n\nCreate an empty tag template\n\n  riot --new foo\n  riot --new foo/bar\n  riot --new foo/bar --ext html\n\nExamples for options:\n\n  riot foo bar\n  riot --config riot.config\n  riot --w foo bar\n  riot --watch foo bar\n  riot --compact foo bar\n  riot foo bar --compact\n  riot foo.tag --type coffeescript --expr\n  riot foo.tag --style sass --export css foo.css\n  riot foo.tag --exclude css foo.js\n\nVersion \n  riot-cli:      3.0.0 - https://github.com/riot/cli\n  riot-compiler: 3.1.4 - https://github.com/riot/compiler\n\n\n'
      at Assertion.assert (node_modules/expect.js/index.js:96:13)
      at Assertion.be.Assertion.equal (node_modules/expect.js/index.js:216:10)
      at Assertion.(anonymous function) [as be] (node_modules/expect.js/index.js:69:24)
      at logs.forEach (test/specs/output.spec.js:10:64)
      at Array.forEach (native)
      at Context.it (test/specs/output.spec.js:9:10)

  2) Cli Tests API methods make using the --export feature:
     Error: expected '' to equal 'style-export-sass,[data-is="style-export-sass"]{ color: red; } style-export-sass p,[data-is="style-export-sass"] p{ font-size: 11px; }'
      at Assertion.assert (node_modules/expect.js/index.js:96:13)
      at Assertion.be.Assertion.equal (node_modules/expect.js/index.js:216:10)
      at Assertion.(anonymous function) [as be] (node_modules/expect.js/index.js:69:24)
      at Context.<anonymous> (test/specs/api.spec.js:130:99)

  3) Cli Tests External config file generate the tags using custom pug parser:
     Uncaught Error: expected '' to equal 'riot.tag2(\'pug\', \'<p>{message}</p>\', \'\', \'\', function(opts) {\nthis.message = \'hi\'\n});'
      at Assertion.assert (node_modules/expect.js/index.js:96:13)
      at Assertion.be.Assertion.equal (node_modules/expect.js/index.js:216:10)
      at Assertion.(anonymous function) [as be] (node_modules/expect.js/index.js:69:24)
      at Immediate.<anonymous> (test/specs/config-file.spec.js:39:10)
GianlucaGuarini commented 7 years ago

the options added with this pull request can be easier passed via riot.config.js file because they are both objects and they make no sense via cli.