Meteor less source map don't get loaded in the client - node.js

I try to get less source maps working in my project but they don't seem to get passed to the client.
> meteor --version
> Release 0.8.1.3
> lessc --version
> lessc 1.7.0 (LESS Compiler) [JavaScript]
> less .meteor/packages |grep less
> less
> ls .meteor/local/build/programs/client
> -rw-r--r-- 1 mhhf staff 342679 Jun 6 13:05 473be00fc614aeff1b93b555c76b905fcc71e56b.css
> -rw-r--r-- 1 mhhf staff 463306 Jun 6 13:05 473be00fc614aeff1b93b555c76b905fcc71e56b.css.map
> less .meteor/local/build/programs/client/program.json
> ...
> {
"path": "473be00fc614aeff1b93b555c76b905fcc71e56b.css",
"where": "client",
"type": "css",
"cacheable": true,
"url": "/473be00fc614aeff1b93b555c76b905fcc71e56b.css",
"sourceMap": "473be00fc614aeff1b93b555c76b905fcc71e56b.css.map",
"sourceMapUrl": "/473be00fc614aeff1b93b555c76b905fcc71e56b.map",
"size": 342679,
"hash": "2aabe450770c6a0872fa79545aaf3f06523197d8"
},
> ...
But somehow the .css file is successfully loaded and the .css.map not.
Where should i look for the error?

Related

Code coverage for integration test by jest and nyc always return 0% for statements and lines

I'm trying to do code coverage for our Jest integration tests.
The tests directory is inside some sub-directory inside the server project with standalone package.json and configurations.
The services and libs that need to cover are located in the main project root directory, that mean outside the tests sub-directory.
When I've tried to it by nyc is able to include the required directories outside the tests dir but no real coverage are return in the report.
When I've tried to id by the --coverage flag in Jest, It's not able to access outside the tests dir, even when adding rootDir option inside the configuration file, it just make a mess in the project.
I've also tried to execute nyc together with the api-gateway launching and together with the services launching but it didn't change the results as well.
The project architecture is something like the following -->
server-project root
.nyc_output
_coverage_
services
libs
src
api-gateway
test
- src
- integration-tests
- test.ts
- ...
- jest.config.ts
- jest-integration.config.ts
- package.json
package.json
Related versions:
Node v14.18.1
npm 6.14.15
pnpm 6.9.1
"istanbul-reports": "^3.1.5",
"jest": "^26.6.3",
"#types/jest": "^26.0.18",
"#types/node": "13.7.1",
"babel-plugin-istanbul": "^6.1.1",
"nyc": "^15.1.0",
"ts-jest": "^26.4.4",
"ts-node": "^9.1.1",
"typescript": "^4.1.2"
The script below contains nyc together with jest - non of them work as expected:
"test:integration:coverage": "nyc --cwd='../' --exclude-after-remapjest=false --reporter=lcov --reporter=text pnpm run test:integration -- --coverage --collectCoverageFrom='./../services/**/src/*.ts'",
It's located inside test/package.json and launchd by pnpm
nyc configuration inside package.json (project root) -->
"nyc": {
"extends": "#istanbuljs/nyc-config-typescript",
"require": "#babel/register",
"check-coverage": true,
"all": true,
"cache": true,
"sourceMap": false,
"instrument": true,
"lines": 90,
"branches": 90,
"functions": 90,
"statements": 90,
"reporter": [
"text-summary",
"lcov",
"text"
],
"report-dir": "coverage",
"include": [
"services/**/src/*.ts",
"api-gateway/src/*.ts",
"libs/**/src/*.ts"
],
"exclude": [
"**/test/**",
"**/*.d.ts"
],
"extension": [
".ts",
".tsx"
],
"temp-dir": ".nyc_output",
"excludeNodeModules": true,
"source-map": true,
"produce-source-map": true
}
Jest configuration iside test/jest-integration.config.ts (extends to the main jest.config.ts file) -->
// eslint-disable-next-line #typescript-eslint/no-var-requires
const baseConfig = require('./jest.config');
const base = '**/integration-tests/services';
const setupDir = './src/tests/integration-tests/setup';
module.exports = {
...baseConfig,
testMatch: [
...[
'abtests/*.test.ts',
'moretests/*.test.ts',
],
globalSetup: `${setupDir}/jest-integration-setup.ts`,
globalTeardown: `${setupDir}/jest-integration-teardown.ts`,
};
Output results:
at src/tests/integration-tests/services/abtests/abtest.test.ts:18:13
PASS src/tests/integration-tests/services/abtests/abtest.test.ts
abtests
✓ abtests params in me query (300 ms)
✓ override existing test (110 ms)
✓ create a new test with value (109 ms)
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
----------|---------|----------|---------|---------|-------------------
Failed to write coverage reports:
ERROR: TypeError: Cannot convert undefined or null to object
STACK: TypeError: Cannot convert undefined or null to object
at Function.getPrototypeOf (<anonymous>)
at Date (/Users/myname/repos/server-project/node_modules/.pnpm/jest-date-mock#1.0.8/node_modules/jest-date-mock/lib/mockDate.js:39:44)
at new HtmlReport (/Users/myname/repos/server-project/node_modules/.pnpm/istanbul-reports#3.0.2/node_modules/istanbul-reports/lib/html/index.js:260:21)
at new LcovReport (/Users/myname/repos/server-project/node_modules/.pnpm/istanbul-reports#3.0.2/node_modules/istanbul-reports/lib/lcov/index.js:14:21)
at Object.create (/Users/myname/repos/server-project/node_modules/.pnpm/istanbul-reports#3.0.2/node_modules/istanbul-reports/index.js:22:16)
at /Users/myname/repos/server-project/node_modules/.pnpm/#jest+reporters#26.6.2/node_modules/#jest/reporters/build/CoverageReporter.js:248:20
at Array.forEach (<anonymous>)
at CoverageReporter.onRunComplete (/Users/myname/repos/server-project/node_modules/.pnpm/#jest+reporters#26.6.2/node_modules/#jest/reporters/build/CoverageReporter.js:240:25)
at ReporterDispatcher.onRunComplete (/Users/myname/repos/server-project/node_modules/.pnpm/#jest+core#26.6.3/node_modules/#jest/core/build/ReporterDispatcher.js:88:9)
at TestScheduler.scheduleTests (/Users/myname/repos/server-project/node_modules/.pnpm/#jest+core#26.6.3/node_modules/#jest/core/build/TestScheduler.js:350:5)
at runJest (/Users/myname/repos/server-project/node_modules/.pnpm/#jest+core#26.6.3/node_modules/#jest/core/build/runJest.js:376:19)
at _run10000 (/Users/myanme/repos/server-project/node_modules/.pnpm/#jest+core#26.6.3/node_modules/#jest/core/build/cli/index.js:416:7)
at runCLI (/Users/myname/repos/server-project/node_modules/.pnpm/#jest+core#26.6.3/node_modules/#jest/core/build/cli/index.js:271:3)
at Object.run (/Users/myname/repos/server-project/node_modules/.pnpm/jest-cli#26.6.3/node_modules/jest-cli/build/cli/index.js:163:37)
Test Suites: 2 passed, 2 total
Tests: 1 skipped, 4 passed, 5 total
Snapshots: 0 total
Time: 10.01 s
Ran all test suites.
📦 report is created on: /Users/myname/repos/server-project/test/html-report/report.html
ERROR: Coverage for lines (0%) does not meet global threshold (90%)
ERROR: Coverage for functions (0%) does not meet global threshold (90%)
ERROR: Coverage for branches (0%) does not meet global threshold (90%)
ERROR: Coverage for statements (0%) does not meet global threshold (90%)
-----------------------------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-----------------------------------------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
api-gateway/src | 0 | 0 | 0 | 0 |
config.ts | 0 | 100 | 100 | 0 | 81
main.ts | 0 | 0 | 0 | 0 | 11-43
storage.ts | 0 | 0 | 0 | 0 | 6-19
libs/apollo-federation-tester/src | 0 | 0 | 0 | 0 |
index.ts | 0 | 0 | 0 | 0 | 17-85
Please your help!
Thanks.

Kubernetes gitconfig mounted as directory instead of file

I have some helm charts in which I would like to mount the git config globally on each container.
In this case the home directory for each container is / path. When I would like to do it manually on the container I am getting following
git config --global --add safe.directory "*" error: could not lock config file //.gitconfig: Permission denied
Now I want to map my config map to the global .gitconfig file.
set {
name = "git.sync.extraVolumeMounts[0].name"
value = "git-config"
}
set {
name = "git.sync.extraVolumeMounts[0].mountPath"
value = "/.gitconfig"
}
set {
name = "git.sync.extraVolumeMounts[0].subPath"
value = ".gitconfig"
}
With such config I am getting the .gitconfig as folder not the file
bitnami#airflow-web-7cdb6f5d6f-48mzh:/$ ls -la
total 84
drwxr-xr-x 1 root root 4096 Dec 2 12:20 .
drwxr-xr-x 1 root root 4096 Dec 2 12:20 ..
drwxrwsrwx 2 root bitnami 4096 Dec 2 12:20 .gitconfig
drwxr-xr-x 1 root root 4096 Jul 30 11:21 bin
Any idea what I am doing wrong? Is there any environment variable instead I can set?
I tried to use system config but it does not work either as some folder structure is missing.
Just for future, I was able to achieve that with the usage of the proper escaping
{
"name": "git.sync.extraVolumeMounts[0].mountPath",
"type": null,
"value": "/\\.gitconfig"
},
{
"name": "git.sync.extraVolumeMounts[0].name",
"type": null,
"value": "git-config"
},
{
"name": "git.sync.extraVolumeMounts[0].subPath",
"type": null,
"value": "gitconfig"
},
This basically, creates a .gitconfig file and not a folder.
Setup is working fine.

Ansible dnf module returns success even when dnf fails

This is the initial state of my system:
I have myrpm-2.0 installed.
This rpm creates just a file.
/usr/share/myfile exists as a file.
/root# rpm -q myrpm
myrpm-2.0-0.x86_64
/root# rpm -ql myrpm-2.0-0.x86_64
/usr/share
/usr/share/myfile
/root# ls -lrt /usr/share | grep myfile
-rw-r--r-- 1 root root 11 May 25 17:32 myfile
/root#
Now I am simulating an error condition. I manually removed the file and created a directory in it's place.
/root# ls -lrt /usr/share | grep myfile
drwxr-xr-x 2 root root 4096 May 25 18:33 myfile
/root#
I prepared a higher version 3.0 of the same rpm, which copies the same file.
/root# rpm -ql /root/update/myrpm-3.0-0.x86_64.rpm
/usr/share
/usr/share/myfile
/root#
4-Test-1: Trying rpm upgrade using ansible's builtin dnf module.
Following is my playbook:
/root# cat test.yaml
---
- hosts: localhost
tasks:
- name: update rpm
dnf:
name: "myrpm"
state: latest
/root#
Executing this playbook gives return code as 0.
/root# ansible-playbook -vvv test.yaml
...
changed: [localhost] => {
"changed": true,
"invocation": {
"module_args": {
"allow_downgrade": false,
"autoremove": false,
"bugfix": false,
"conf_file": null,
"disable_excludes": null,
"disable_gpg_check": false,
"disable_plugin": [],
"disablerepo": [],
"download_dir": null,
"download_only": false,
"enable_plugin": [],
"enablerepo": [],
"exclude": [],
"install_repoquery": true,
"install_weak_deps": true,
"installroot": "/",
"list": null,
"lock_timeout": 30,
"name": [
"myrpm"
],
"releasever": null,
"security": false,
"skip_broken": false,
"state": "latest",
"update_cache": false,
"update_only": false,
"validate_certs": true
}
},
"msg": "",
"rc": 0,
"results": [
"Installed: myrpm-3.0-0.x86_64",
"Removed: myrpm-2.0-0.x86_64"
]
}
META: ran handlers
META: ran handlers
PLAY RECAP *******************************************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
/root# echo $?
0
/root#
rc is 0 as per the verbose log.
However, I can see that dnf command has failed.
/root# dnf history | head -n 3
ID | Command line | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
27 | | 2022-05-25 18:39 | Upgrade | 1 EE
/root# dnf history info 27 | tail -6
Packages Altered:
** Upgrade myrpm-3.0-0.x86_64 #My_Update
Upgraded myrpm-2.0-0.x86_64 ##System
Scriptlet output:
1 error: unpacking of archive failed on file /usr/share/myfile: cpio: File from package already exists as a directory in system
2 error: myrpm-3.0-0.x86_64: install failed
/root#
4-Test-2: I made my system in exact same state as 3, and used direct dnf command instead of playbook.
/root# dnf update myrpm
...
Preparing : 1/1
Upgrading : myrpm-3.0-0.x86_64 1/2
Error unpacking rpm package myrpm-3.0-0.x86_64
error: unpacking of archive failed on file /usr/share/myfile: cpio: File from package already exists as a directory in system
Cleanup : myrpm-2.0-0.x86_64 2/2
error: myrpm-3.0-0.x86_64: install failed
Verifying : myrpm-3.0-0.x86_64 1/2
Verifying : myrpm-2.0-0.x86_64 2/2
Failed:
myrpm-3.0-0.x86_64
Error: Transaction failed
/root# echo $?
1
/root#
Any clue on why the playbook did not show task as failed?
Got to know that this is a bug fixed in higher versions of ansible.
Refer https://github.com/ansible/ansible/issues/77917

TSC command taking 372s to complete

I have a very small TypeScript Firebase repo that I use for cloud functions (totals 6 files in my src directory). The tsc command was taking a really long time to complete so I ran it with --diagnotics and got this output:
functions % tsc --extendedDiagnostics
Files: 290
Lines of Library: 28331
Lines of Definitions: 110562
Lines of TypeScript: 123
Lines of JavaScript: 0
Lines of JSON: 0
Lines of Other: 0
Nodes of Library: 117266
Nodes of Definitions: 336850
Nodes of TypeScript: 659
Nodes of JavaScript: 0
Nodes of JSON: 0
Nodes of Other: 0
Identifiers: 167151
Symbols: 183758
Types: 53351
Instantiations: 68377
Memory used: 209026K
Assignability cache size: 12195
Identity cache size: 223
Subtype cache size: 34
Strict subtype cache size: 0
I/O Read time: 0.58s
Parse time: 93.62s
ResolveModule time: 9.01s
ResolveTypeReference time: 1.41s
Program time: 107.81s
Bind time: 49.14s
Check time: 212.69s
transformTime time: 0.42s
Source Map time: 0.26s
commentTime time: 0.21s
I/O Write time: 0.01s
printTime time: 2.52s
Emit time: 2.53s
Total time: 372.17s
From what I can see online this seems to be really high. I've Googled around and some have suggested including "typeRoots": [ "node_modules/#types" ] in my tsconfig.json or ensuring include has only my src directory, as well as updating to the latest TS (running 4.4.2) but none of this has helped. I'm not a Node eng so not sure where to start.
In case it helps, here's my tsconfig.json:
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017",
"typeRoots": [ "node_modules/#types" ],
},
"compileOnSave": true,
"include": [
"src"
]
}
After further experimenting, I tried installing the current (non-LTS) build of Node as it explicitly lists arm64 as an architecture (I'm running an M1 Mac), and everything ran blazingly fast.
Running the bleeding edge version of Node isn't possible for me because Firebase doesn't support it yet, but I found this post which recommends running Terminal in Open in Rosetta mode to circumvent issues like these. This fixed the issue.

gruntfile files named patterns, possible?

I'm playing around with Ghost, and I'd like to make the gruntfile compile the sass files from my theme.
So I started by modifying the sass task:
...
sass: {
admin: {
files: {
'<%= paths.adminAssets %>/css/screen.css': '<%= paths.adminAssets %>/sass/screen.scss'
}
},
themes: {
files:{
'content/themes/**/css/ie.css': 'content/themes/**/src/sass/ie.sass',
'content/themes/**/css/print.css': 'content/themes/**/src/sass/print.sass',
'content/themes/**/css/screen.css': 'content/themes/**/src/sass/screen.sass'
}
}
}
...
I realised that I could simplfy this to :
...
sass: {
admin: {
files: {
'<%= paths.adminAssets %>/css/screen.css': '<%= paths.adminAssets %>/sass/screen.scss'
}
},
themes: {
files:{
'content/themes/**/css/*.css': 'content/themes/**/src/sass/*.sass',
}
}
}
...
But then I was thinking, why isn't it replacing the stars in the destination with what it matches from the source?
Ends up it was just creating the following:
$ ls -al ./content/themes/
total 0
drwxrwxr-x 1 zenobius zenobius 50 Nov 18 02:10 .
drwxrwxr-x 1 zenobius zenobius 46 Nov 15 11:02 ..
drwxrwxr-x 1 zenobius zenobius 6 Nov 18 02:10 ** <----- sigh
drwxrwxr-x 1 zenobius zenobius 128 Nov 15 11:02 casper
drwxrwxr-x 1 zenobius zenobius 250 Nov 18 00:08 crycilium
I guess my question is really:
can i use some kind of regex named patterns
could I use a function in the files option to process the output name as the destination?
So the solution was to make use of grunt.file.expandMapping, (thanks to : https://stackoverflow.com/a/16672303/454615):
...
themes: {
files: grunt.file.expandMapping([
"content/themes/**/src/**/*.sass",
"!content/themes/**/src/**/_*.sass",
], '', {
expand: true,
ext: '.css',
rename: function(base, src) {
grunt.log.write(base + " " + src);
return src.replace('/src/', '/../'); // or some variation
}
})
}
...

Resources