I'm writing up some API documentation for a Node/Express app with JSDoc. I have a simple configuration file set up when running jsdoc ./routes -c config.json:
{
"source": {
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc", "closure"]
},
"plugins": ["plugins/markdown"],
"templates": {
"cleverLinks": true,
"monospaceLinks": true
},
"opts": {
"destination": "docs",
"recurse": true,
"readme": "README.md"
}
}
The command outputs a folder /docs with fonts, scripts, styles, and index.html. Is there a way to configure JSDoc to exclude outputting all directories besides a simple HTML file?I was thinking something like:
"output": {
"exclude": ["fonts", "scripts", "styles"]
}
Related
How can I prefix the file, css, and assets in a Vite manifest.json file with a CDN URL?
export default defineConfig({
base: 'https://my-cdn.com/',
build: {
manifest: true,
rollupOptions: {
input: '/path/to/main.js'
}
}
})
but the end result is:
{
"main.js": {
"file": "assets/main.4889e940.js",
"src": "main.js",
"isEntry": true,
"dynamicImports": [],
"css": ["assets/main.b82dbe22.css"],
"assets": ["assets/asset.0ab0f9cd.png"]
}
}
instead of:
{
"main.js": {
"file": "https://my-cdn.com/assets/main.4889e940.js",
"src": "main.js",
"isEntry": true,
"dynamicImports": [],
"css": ["https://my-cdn.com/assets/main.b82dbe22.css"],
"assets": ["https://my-cdn.com/assets/asset.0ab0f9cd.png"]
}
}
To achieve that, you need to add a base property with the URL or path in the project.json file under targets/build/options.
Here is an example project.json config file:
{
"name": "app",
"$schema": "node_modules/nx/schemas/project-schema.json",
"sourceRoot": "./src",
"projectType": "application",
"targets": {
"build": {
"executor": "#nrwl/vite:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/app",
"base": "https://my-cdn.com"
}
}
}
}
And if you are using vite without NX, then you can provide a base argument to the vite build command.
An example:
vite build --base="https://my-cdn.com"
I would like to block some files, so that no user can access them. As files / folder css, js, sass ...
I found a part of vercel's documentation that talks about server configuration. However, I couldn't find any way to block these files.
It has the redirect, but it would be a lot of work.
this is my json so far
{
"cleanUrls": true,
"trailingSlash": false,
"rewrites": [
{ "source": "/inicio", "destination": "https://blog-semnome-9ui4b0xed-gobsruiz.vercel.app/html/index" },
{ "source": "/blog", "destination": "https://blog-semnome-9ui4b0xed-gobsruiz.vercel.app/html/blog" },
{ "source": "/contato", "destination": "https://blog-semnome-9ui4b0xed-gobsruiz.vercel.app/html/contact" },
{ "source": "/jogos-gratis-2021-pt1", "destination": "https://blog-semnome-9ui4b0xed-gobsruiz.vercel.app/html/posts/jogos-gratis-2021-pt1" }
]
}
Does anyone know any way to block?
https://vercel.com/docs/configuration
I use create-react-app and just want to add rules to my package.json. I see that I can disable this rule, but how? In the official document, only the phrase "If you don't want to enforce a style for using equality operators, then it's safe to disable this rule."
https://github.com/eslint/eslint/blob/master/docs/rules/eqeqeq.md#when-not-to-use-it
I found that i can write this:
// package.json
{
"name": "mypackage",
...,
"eslintConfig": {
"rules": {
"eqeqeq": "off"
}
}
}
but it not works.
I would like to clarify the question. The reason for my question here is not that I don't know how to disable the rule, I do not know how to disable it in the package.json. I just don't want to clutter up the project's root directory with an additional file.
you can add an eslint configuration file .eslintrc and disable the rules you want inside it.
docs
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:#angular-eslint/recommended",
"plugin:#angular-eslint/template/process-inline-templates"
],
"rules": {
"#angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"#angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:#angular-eslint/template/recommended"
],
"rules": {
"#angular-eslint/template/eqeqeq": "off"
}
}
]
}
Look at the last rule
Now as how to turn it to "smart" rather than "off" I'm yet to figure that out.
** Notice how its in the "files": [.html] or "files": [.ts]. I put mine in the .html rules because my errors were in html files but if they were in a ts file I'd put the rule there instead.
EDIT 1: I found this website useful https://github.com/nrwl/nx-examples/blob/master/.eslintrc.json
Go to your project root folder (where is packaje.json) and create a file named .eslintrc.json
Inside this add the following:
{
"rules": {
"eqeqeq": "off",
}
}
Then re launch the app and the rule should be disabled.
You may locate the eslint configuration file, and change eqeqeq rule to off:
eqeqeq: 'off',
Also, make sure that you don't override the setting farther.
Go to .eslintrc.js then add
rules: {
eqeqeq: 'off',
},
bs-config.json
{
"port": 8000,
"server": {
"baseDir": "./dist",
"serveStaticOptions": {
"extensions": [
"html",
"js"
]
}
},
"startPath": "/my-app"
}
When I load localhost:8000/my-app it says Cannot GET /my-app, yet loading localhost:8000/my-app/index.html works.
It also isn't picking up localhost:8000/my-app/index or Javascript files that index.html tries to load, unless I explicitly put the .js extension.
According to the options guide, maybe you can try this config:
{
"port": 8000,
"server": {
"baseDir": "./dist/my-app",
"index": "index.html",
"serveStaticOptions": {
"extensions": [
"html",
"js"
]
}
}
}
I have a project in Visual Studio that is using typescript and requirejs, and that is running QUnit tests with the help of Chutzpah.
Folderstructure in my project looks basically like this:
- chutzpah.json
- app/
- index.html
- js/
- config.js
- main.ts
- Module.ts
- tests/
- Test1.ts
up until now, I had requirejs configured so that in all my imports, I had to use
app/js/Module, for example, to load that one.
Tests were also running just fine.
Now, I have changed my requirejs config to use baseUrl of js inside the app folder, so I can use just "Module" for the import. application itself is running fine, but I cannot get the tests to work.
With my current chutzpah.json, it seems that it wants to load the test files from ../tests/, so for the Test1 example, it would want to load ../tests/Test1.js
This is my config.js:
require.config({
baseUrl: 'js',
paths: {
'swfJQ': '../libs/js/swfJQ'
},
shim: {
'swfJQ': {
"exports": "swfJQ"
}
}
});
This is my chutzpah.json:
{
"Framework": "qunit",
"TestHarnessReferenceMode": "AMD",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"TypeScriptModuleKind": "AMD",
"Tests": [ { "Path": "tests", "Includes": [ "*Tests.ts" ] } ],
"AMDBaseUrl": "js",
"AMDAppDirectory": "app",
"References": [
{ "Path": "app/libs/js/jquery.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/require.js", "IsTestFrameworkFile": true },
{ "Path": "app/config.js" },
{ "Path": "require.d.ts", "IncludeInTestHarness": false },
{ "Path": "qunit.d.ts", "IncludeInTestHarness": false },
{ "Path": "tests", "IncludeInTestHarness": false, "Excludes": ["*.html"] },
{ "Path": "app/js", "IncludeInTestHarness": false }
],
"EnableCodeCoverage ": "true",
"CodeCoverageIncludes": [
"*app/js/*"
],
"CodeCoverageExcludes": [
"app/libs/*",
"tests/*"
]
}
This is one of the test files:
import Replay = require('../app/js/Module');
QUnit.module("Module tests");
test("Module.constructor", function (assert: QUnitAssert) { /* stuff */ }
I think the require('../app/js/Module') is more or less the culprit and will set the scope to ../, but if I write the code otherwise, the typescript compiler won't compile.
I guess this is probably something very easy I am missing, but I just can't pin it.
Maybe it is not a chutzpah problem I have, but my general Typescript setup should be different (so I don't have to use require('../app ... ') in my test files)?
Turned out this should have been quite easy:
I had to set the AMDBaseUrl in the Chutzpah config to "app/js", and removing the AMDAppDirectory property.
Can't believe I didn't try that before.
My chutzpah.json:
{
"Framework": "qunit",
"TestHarnessReferenceMode": "AMD",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"TypeScriptModuleKind": "AMD",
"Tests": [ { "Path": "tests", "Includes": [ "*Tests.ts" ] } ],
"AMDBasePath": "app/js",
"References": [
{ "Path": "app/libs/js/jquery.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/js/kendo.ui.core.min.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/js/mediaelement-and-player.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/require.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/js/SCORM_API_wrapper.js" },
{ "Path": "require.d.ts", "IncludeInTestHarness": false },
{ "Path": "qunit.d.ts", "IncludeInTestHarness": false },
{ "Path": "tests", "IncludeInTestHarness": false, "Excludes": ["*.html"] },
{ "Path": "app/js", "IncludeInTestHarness": false }
],
"EnableCodeCoverage ": "true",
"CodeCoverageIncludes": [
"*app/js/*"
],
"CodeCoverageExcludes": [
"app/libs/*",
"tests/*"
]
}