grunt-text-replace doesn't work - replace

I installed grunt-text-replace with npm install grunt-text-replace --save-dev command and add grunt.loadNpmTasks('grunt-text-replace'); to gruntfile.js and add write this:
replace: {
example: {
src: ['css/mystyle.css'],
overwrite: true,
replacements: [{
from: 'wizard', // string replacement
to: 'wizardstep'
}]
}
}
then run grunt replace in command line and after that show me done, without error but my replacement doesn't work and applied.

Unfortunately I entered path incorrectly and other hand grunt-text-replace doesn't show me message if source file path incorrect.
just I correct source path

Related

npm build failing due to rescript cannot handle multiple files error

Error:
rescript: [32/234] src/C...ts/Common/Transition.cmj
FAILED: src/Components/Common/Transition.cmj
can not handle multiple files
Caused when I ran:
npm start
or
yarn start
bsconfig.json contents [name doesn't have any spaces]
{
"name": "care_fe",
"reason": {
"react-jsx": 3
},
"bsc-flags": ["-bs-super-errors"],
"sources": [{
"dir": "src",
"subdirs": true
}],
....
...so on
package.json contents
dependencies:
"#rescript/react": "^0.10.3",
"rescript-material-ui": "^2.1.2"
devDependencies:
"rescript": "^9.1.4"
Transition.res contents
type reactClass
module Transition = {
#module("./Transition.tsx") #react.component
external make: (
~show: option<bool>,
~enter: string,
~enterFrom: string,
~enterTo: string,
~leave: string,
~leaveFrom: string,
~leaveTo: string,
~children: 'a,
) => React.element = "default"
}
#react.component
let make = (
~show=None,
~enter="",
~enterFrom="",
~enterTo="",
~leave="",
~leaveFrom="",
~leaveTo="",
~children,
) => <Transition show enter enterFrom enterTo leave leaveFrom leaveTo> children </Transition>
From the comments, it seems the rescript build system has a bug where the current working directory is passed to a build command unescaped, and so a project residing in a path that contains spaces will be interpreted as multiple paths, hence the "multiple files" error.
The workaround is to move the project to a path that does not contain spaces, until the bug is hopefully (soon) fixed.

Deploying to elastic beanstalk using gulp - Static files permissions issue

Recently I've had to change from using eb deploy to using a gulp task to deploy my project to AWS elastic beanstalk.
The reason for this is that I need to babel transform ES6 files to ES5. I don not want to commit the transformed files to our git and eb deploy uses the git-archive command to make the zip to deploy.
The transform and deploy works, I'm running into an issue with static files.
gulp.task('ebDeploy', function() {
return gulp.src([
'./.ebextensions/**', // Include the .ebextensions folder
'./**/*.js', // Match all .js files
'!./es6/**/*', // Exclude files in /es6 dir
'!node_modules', '!node_modules/**', // Exclude the node_modules folder and contained files
'*.js', // Include JS Files in the base dir
'package.json', // Include this specific file in base dir
'./config/**', // Include everything under /config
'./public/**', './public/**/*', // Include everything under /public
'./views/**/*.ejs' // Include all .ejs files under /views
], { base: './' })
.pipe(print())
.pipe(gulpEbDeploy({
//name: 'my-application', // optional: If not set, the name from package.json will be used
//version: '1.0.0', // optional: If not set, the version from package.json will be used
timestamp: true, // optional: If set to false, the zip will not have a timestamp
waitForDeploy: true, // optional: if set to false the task will end as soon as it starts deploying
amazon: {
// accessKeyId: "< your access key (fyi, the 'short' one) >", // optional
// secretAccessKey: "< your secret access key (fyi, the 'long' one) >", // optional
// signatureVersion: "v4", // optional
region: 'eu-west-2',
bucket: 'elasticbeanstalk',
applicationName: 'foo',
environmentName: 'bar'
}
}))
});
I have checked the zip that get's uploaded and it contains all the correct files. However it seems that eb deploy does something to permissions that i need to duplicate.
When I use eb deploy (after committing the /build files which I'm trying to prevent)
Everything works fine.
When I use my gulp task: I get the following error when trying to access static files.
06:49:28.81 server.js:98 | Global Error Handler
06:49:28.81 server.js:99 | { Error: EACCES: permission denied, stat '/var/app/current/public/css/default.css'
at Error (native)
errno: -13,
code: 'EACCES',
syscall: 'stat',
path: '/var/app/current/public/css/default.css',
expose: false,
statusCode: 500,
status: 500 }
What do I need to do to make these files work as intended.

grunt.js ember-template-compiler not working

I have the grunt-ember-templates plugin, and it used to work. But I did a npm install and it got messed up. Now it does not compile.
The error is this:
Running "watch" task
Waiting...
>> File "resources\hbs\index\module.hbs" changed.
Running "emberTemplates:compile" (emberTemplates) task
>> ReferenceError: ember-template-compiler.js:22258
>> module.exports = Ember.__loader.require("ember-template-compiler");
>> ^
>> module is not defined
Warning: Ember Handlebars failed to compile resources/hbs/error.hbs. Use --force to continue.
Aborted due to warnings.
My Gruntfile.js looks somehow like this:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
emberTemplates: {
compile: {
options: {
templateBasePath: /resources\/hbs\//,
// Path to the ember-template-compiler of my ember version
templateCompilerPath: 'resources/js/libs/ember-template-compiler.js',
handlebarsPath: 'node_modules/handlebars/dist/handlebars.js'
},
files: {
'resources/js/templates.js': 'resources/hbs/**/*.hbs'
}
}
},
...
Any idea? thanks in advance.
FWIW, it was just a dependency problem. Modifying the package.json to include the latest packages fixed it.

Verbose output in jest js

is any option for verbore output for testing by jest?
I can see which modules are mocked.
I tried
jasmine.VERBOSE = true;
but not working.
Thanks for answer.
To get verbose mode in Jest, you can run Jest with the --verbose tag.
In your packages.json, you can write:
"scripts": {
"test": "jest --verbose"
},
Then you can run npm test
Alternatively, if you are using gulp-jest, to get Jest in verbose mode, find the index.js file of the gulp-jest folder in node_modules and add a verbose: true to the jest.runCLI block.
jest.runCLI({
config: options,
verbose: true
}
simple add in package.json
{
...
...
"jest": {
"verbose": true
},
...
...
}
Create jest.config.js file in root directory and add this to the module export
module.exports = {
// some code here..
verbose: true,
// some code here...
}

Karma's base directory location

Unable to load template fixtures for my tests while using karma. To simplify,
Went to c:\
Created a 1.txt text file.
Made a simple karma init file containing:
basePath: '',
Started karma using:
C:\> karma start .\sample.conf.js
Chrome opened up at:
http://localhost:9876/?id=49209467
I then tried to navigate to:
http://localhost:9876/base/1.txt
but got a "NOT FOUND" error message in the browser, and a message from karma:
WARN [web-server]: 404: /base/1.txt
What am I missing here?
Found the answer:
By adding the following to the karma config file:
files: [
....
{ pattern: 'mocks/**/*.html', watched: true, served: true, included: false },
....
I managed to access the required file by browsing to
http://localhost:9876/base/mocks/file.html
Where th "/base/" prefix is required by default (if even changable).