The destination path specified in npm copyfiles is not accurate

Currently, I am utilizing the npm package known as "copyfiles" within my buildscript. However, I have noticed that the target directory does not match the expected output.

"copy-template": "copyfiles \"./src/**/*.html\" \"dist\"",

The structure of my base directory is as follows:

src/pages/.../htmlfiles

What I am aiming for is:

dist/pages/.../htmlfiles

I want to maintain the same structure as before but without the "src" folder present in the path. Currently, every time I run the script, the src directory gets duplicated in the dist folder.

dist/src/pages/../htmlfiles

If you have any suggestions or tips on how to achieve this desired outcome, I would greatly appreciate it!

Kind regards, David

Answer №1

To make changes to your script, do the following:

...
"scripts": {
  "copy-template": "copyfiles -u 1 \"./src/**/*.html\" \"dist\"",
  ...
},
...

Please take note of the new --up or -u option specified in the documentation.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unable to generate production package

NPM version (npm --v): 5.4.2 Gulp version (gulp -v): [email protected], [email protected] JHipster version: 4.6.1 Node version: 6.11.3 I am facing difficulties in generating a production package for my application. The process of running ...

Strategies for ensuring a promise is fulfilled before moving on to the next iteration in a never-ending for loop in JavaScript

I've been exploring ways to ensure that a promise is resolved before moving on to the next iteration in a for loop. One suggestion was to use the setInterval() function instead of a for loop, but this isn't ideal since it's hard to predict w ...

What's the best way to implement image size and type validation, specifically for .jpg and .png files, using Multer?

When using multer to receive files from the FrontEnd, I need to validate the image size to ensure it's less than 1MB. Additionally, I want to restrict the accepted file types to .jpg, .jpeg, and .png only. const multer = require("multer"); c ...

When executing multiple promises in parallel, the function Promise.all() does not support the spread() method

I'm attempting to simultaneously run two promises using sequelize, and then display the results in a .ejs template. However, I keep encountering the following error: Promise.all(...).spread is not a function Below is my code snippet: var environme ...

Middleware in action on all routers following its inclusion

I've encountered an issue when trying to add middleware in express.Router(). let router = express.Router(); let mid = function(req, res, next) { console.log("mid"); next(); } router.get("/", function(req, res) { ...

Encountering a CORS policy issue: The requested resource does not have the necessary 'Access-Control-Allow-Origin' header when attempting to upload a file through nodejs and react

[Placeholder for image description][1]Encountering a CORS error "No 'Access-Control-Allow-Origin'" when attempting to upload a file from ReactJS to NodeJS. Despite adding all necessary headers, the issue persists. Other requests are functioning b ...

the optimal technology for maximum persistence

We are currently running an application server on nodejs and looking to switch out our existing MySQL persistence technology. Our main considerations for the replacement are various NoSQL options such as CouchDB, MongoDB, Redis, Riak, and more. The data si ...

Tips for patiently waiting for a function that is filled with promises

Consider the following function: const getData = () => { foo() .then(result => { return result; }) .catch(error => { return error; }); }; Even though getData does not directly return a promise, it internally handles asynchro ...

Why is the updated index.html not loading with the root request?

I'm currently working on an Angular app and facing an issue with the index.html file not being updated when changes are made. I have noticed that even after modifying the index.html file, requests to localhost:8000 do not reflect the updates. This pro ...

Is it possible to simultaneously update two entities using a single endpoint?

In order to update data in two different entities with a @OneToOne relationship between UserEntity and DetailsEntity, I need to create a function in my service that interacts with the database. Here are the entity definitions: UserEntity @Entity() export ...

Introducing a Node JS web application unaccompanied by hosting services

As I prepare for a coding competition and want to display my computer's IP address, I am wondering if it is safe to type in my home computer's IP once I start serving the webapp before leaving my house. Apologies if this question seems silly. ...

Using csv-parse to process data efficiently without the need for a repetitive

Currently, I am utilizing the csv-parse Node package for CSV string parsing purposes. According to the documentation, reading the parsed result can be done with code similar to this: const output = [] parse(` "1","2","3" "a","b","c" `) .on('reada ...

Tips for maintaining ajax headers and enabling CORS in Angular resource requests

Within my ng-resource files, I have configured the ajax header as follows: var app = angular.module('custom_resource', ['ngResource']) app.config(['$httpProvider', function($httpProvider) { //enable XMLHttpRequest, indic ...

404 Response Generated by Express Routes

Exploring the MEAN stack has been a great way for me to expand my knowledge of node and express. Currently, I am working on creating a simple link between two static pages within the app. My routes are set up as follows: //Home route var index = require( ...

Encountering an issue in Laravel 8 JetStream: Mix file '/css/app.css' cannot be found when running npm run prod

I have a Laravel 8 application set up with Jetstream, Inertia Js, and VueJs 3. When I execute: npm run prod An error occurs: Exception Unable to find Mix file: /css/app.css. (View: /var/www/html/mysite/resources/views/app.blade.php) http://subdomain.mysi ...

Adjusting runtime environment variables for a React application

I have a React Application that needs to be deployed to Cloud Foundry and I am looking for a way to segregate the development, staging, and production environments. The challenge is that React only provides .env.development for running the application usin ...

"Communicate through real-time chat applications by leveraging node.js, socket.io,

Looking to create a chat system using nodejs and socket.io, I have a working prototype but the question remains: how should I handle storing chat messages in the database? It doesn't seem practical to store every message as soon as a user presses ent ...

Testing using Azure DevOps platform

I am currently testing an API for uploading profile images. The API takes an image file as input and updates the user's profile picture based on authentication. When I tested this API in Postman, it worked perfectly fine. Now, my goal is to run this s ...

The recognition of express is an issue in the Bitnami MEANstack environment

Recently, I set up a native installation of Bitnami MEAN stack on my Windows system and followed their tutorial to create a new project. However, when attempting step 3 by running the command express myproject, I encountered an error message stating that & ...

Utilize ExpressJS to invoke a separate route from within a different route

I have a file named server.js that contains the following code: import subRouter from "./routes/sub"; import prdRouter from "./routes/prd"; const app = express(); app.use("/sub", subRouter); app.use("/prd", prdRoute ...