Closed MangelMaxime closed 2 years ago
Thanks!
@MangelMaxime Is there anything I need to do to use latest nacara? After pulling these changes I cannot build the docs anymore, I'm also getting many vulnerability warnings from npm. And nacara's help shows cli.js
instead of nacara
🤔
alfon@LAPTOP-V7RGQGT0 MINGW64 ~/repos/Fable.Lit (main)
$ npm i
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
> install
> dotnet tool restore
Tool 'fable' (version '3.3.0') was restored. Available commands: fable
Tool 'femto' (version '0.11.0') was restored. Available commands: femto
Restore was successful.
added 2081 packages, and audited 2082 packages in 26s
345 packages are looking for funding
run `npm fund` for details
13 vulnerabilities (8 moderate, 5 high)
To address all issues, run:
npm audit fix
Run `npm audit` for details.
alfon@LAPTOP-V7RGQGT0 MINGW64 ~/repos/Fable.Lit (main)
$ npx nacara --help
cli.js
Build the website
Commands:
cli.js completion generate completion script
cli.js watch Start the development server
cli.js clean Clean up generated files
cli.js serve Serve the website locally
cli.js build Build the website [default]
Options:
-h, --help Show help [boolean]
--version Show version number [boolean]
alfon@LAPTOP-V7RGQGT0 MINGW64 ~/repos/Fable.Lit (main)
$ npm run docs:watch
> docs:watch
> nacara watch
Current directory:
C:\Users\alfon\repos\Fable.Lit
Source folder: docsrc
Server started at: http://localhost:8080
Copied: favicon.ico
Copied: screencast.gif
Processed: style.scss
Processed: index.md
Dependency file C:\Users\alfon\repos\Fable.Lit\node_modules\nacara-layout-standard\scripts\menu.js copied to resources/nacara-standard-layouts/scripts/menu.js
Dependency file C:\Users\alfon\repos\Fable.Lit\node_modules\nacara\scripts\live-reload.js copied to resources/nacara/scripts/live-reload.js
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:782:11)
at Loader.resolve (internal/modules/esm/loader.js:86:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)
at Loader.import (internal/modules/esm/loader.js:165:28)
at importModuleDynamically (internal/modules/esm/translators.js:114:35)
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:30:14)
at file:///C:/Users/alfon/repos/Fable.Lit/node_modules/nacara/dist/Nacara.Core/Types.js:416:40
at file:///C:/Users/alfon/repos/Fable.Lit/node_modules/nacara/dist/.fable/Fable.Promise.2.2.2/Promise.fs.js:58:32 {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:782:11)
at Loader.resolve (internal/modules/esm/loader.js:86:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)
at Loader.import (internal/modules/esm/loader.js:165:28)
at importModuleDynamically (internal/modules/esm/translators.js:114:35)
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:30:14)
at file:///C:/Users/alfon/repos/Fable.Lit/node_modules/nacara/dist/Nacara.Core/Types.js:416:40
at file:///C:/Users/alfon/repos/Fable.Lit/node_modules/nacara/dist/.fable/Fable.Promise.2.2.2/Promise.fs.js:58:32 {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:782:11)
at Loader.resolve (internal/modules/esm/loader.js:86:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)
at Loader.import (internal/modules/esm/loader.js:165:28)
at importModuleDynamically (internal/modules/esm/translators.js:114:35)
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:30:14)
at file:///C:/Users/alfon/repos/Fable.Lit/node_modules/nacara/dist/Nacara.Core/Types.js:416:40
at file:///C:/Users/alfon/repos/Fable.Lit/node_modules/nacara/dist/.fable/Fable.Promise.2.2.2/Promise.fs.js:58:32 {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:782:11)
at Loader.resolve (internal/modules/esm/loader.js:86:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)
at Loader.import (internal/modules/esm/loader.js:165:28)
at importModuleDynamically (internal/modules/esm/translators.js:114:35)
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:30:14)
at file:///C:/Users/alfon/repos/Fable.Lit/node_modules/nacara/dist/Nacara.Core/Types.js:416:40
at file:///C:/Users/alfon/repos/Fable.Lit/node_modules/nacara/dist/.fable/Fable.Promise.2.2.2/Promise.fs.js:58:32 {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:782:11)
at Loader.resolve (internal/modules/esm/loader.js:86:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)
at Loader.import (internal/modules/esm/loader.js:165:28)
at importModuleDynamically (internal/modules/esm/translators.js:114:35)
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:30:14)
at file:///C:/Users/alfon/repos/Fable.Lit/node_modules/nacara/dist/Nacara.Core/Types.js:416:40
at file:///C:/Users/alfon/repos/Fable.Lit/node_modules/nacara/dist/.fable/Fable.Promise.2.2.2/Promise.fs.js:58:32 {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:782:11)
at Loader.resolve (internal/modules/esm/loader.js:86:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)
at Loader.import (internal/modules/esm/loader.js:165:28)
at importModuleDynamically (internal/modules/esm/translators.js:114:35)
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:30:14)
at file:///C:/Users/alfon/repos/Fable.Lit/node_modules/nacara/dist/Nacara.Core/Types.js:416:40
at file:///C:/Users/alfon/repos/Fable.Lit/node_modules/nacara/dist/.fable/Fable.Promise.2.2.2/Promise.fs.js:58:32 {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
Error while processing markdown file: docs/web-components
Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
Error while processing markdown file: docs/testing
Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
Error while processing markdown file: docs/templates
Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
Error while processing markdown file: docs/hook-components
Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
Error while processing markdown file: docs/hmr
Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
Error while processing markdown file: docs/getting-started
Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
Hello @alfonsogarciacaro,
I think the problem is because you are running on Windows.
It seems like it doesn't like the way I build the absolute files because it's complaining about receiving protocol c:
. I think on windows I need to prefix the absolute path with file://
.
About the help displaying cli.js
I had the same behaviour when using a dev version of Nacara because the entry file is cli.js
however when using Nacara from NPM I have the right command. This is probably Windows related too...
About the warnings they are all coming from gatsby-remark-vscode
package...
There are other highlighting remark
or rehype
plugins available but they aren't as complete.
I made a comment about that on https://github.com/gatsbyjs/gatsby/issues/33049#issuecomment-931553755
The position of the gatsby team seems to be:
Gatsby creates static assets and runs everything at build time and not during runtime. npm audit is designed for runtime / Node apps so it flags issues that can occur there. This means that almost every "vulnerability" report we receive are false positives.
It seems like it will be hard to have a fix for the warning right now.
@alfonsogarciacaro
If things don't move I think I will develop a pure rehype plugin which support VSCode grammar/theme and host it under Nacara org to have the minimal number of dependencies.
It should not be that hard, as I already did it for Code-Lightner but without the rehype part.
Let's see how things goes.
Edit:
One way to get rid of the warning is to use Yarn as it seems Yarn and NPM don't have the same warning list 😈😈 (yes this is called hiding stuff under the carpet :p)
Sorry for spamming.
I can confirm that the error you see with Nacara is specific to Windows so if you have a Unix system for now this is the workaround.
I am working on a fix for Nacara but I don't know how long it will take me.
@alfonsogarciacaro I released a new version of Nacara fixing windows support.
The master branch is up to date with the fix
Working now, thanks!
About the warnings, seems Github is not complaining so let's leave it as is for now. If we don't want to give a bad impression to people building the repo we can try to move the docs build to a specific folder.
Just FYI I tried to move the dependencies to build the docs in a subfolder but then when running Nacara node complained "unified" was a commonjs module. Not sure why it works when installed in the root workspace but not in a subfolder 🤔 But anyways I'm ok with keeping the dependencies in the root for now, so don't worry too much 😄 Thanks again for the help! Docs look very beautiful now.
node complained "unified" was a commonjs module.
I am not sure either, because unified is a pure ESM eco-system this is one of the reason that motivated Nacara move to ESM. Perhaps, you needs to add type: "module" somewhere
?
Docs look very beautiful now.
Really happy that you like it, I spent so much time on Nacara...
Yes, I can see that you put a lot of love in Nacara. Thanks a lot for your work!
I did try adding type: module
to the package.json in docs
. "unified" does contain a package.json without "type", so I assume node defaults to "commonjs" when it finds a package.json. What I don't understand is why it works if all the dependencies are in the root project 🤔 But I always get problems when having npm dependencies in nested folders so let's not worry too much about this 😸
But I always get problems when having npm dependencies in nested folders so let's not worry too much about this :smile_cat:
Indeed, and well to be honest I think I will do the plugin extraction that I mentioned before. First, to keep the dependencies small and also because even in Nacara project I need to do a "hack" to make it works with the npm link
version of Nacara and I think one day it will break for no reason ^^.
But this is a problem for the future me, in like 1-2 month I think ahah.
@alfonsogarciacaro This PR make suit to your comment here https://github.com/MangelMaxime/Nacara/issues /118#issuecomment-930802940
Now that we are using gatsby-remark-vscode we get now cool stuff for free like line highlight, diff highlight, etc.
See extra-stuff for more info.