After running a yarn build on a TypeScript project using a .projenrc.js file, make sure to include any packaged or additional text files in the lib folder, rather

After utilizing projen to create my typescript project, I followed these steps: mkdir my-project, git init, and npx projen new typescript. Additionally, I created two files - sample.txt and sample.js, along with the default file index.ts within the folder structure. Upon running yarn build, only .ts files were packaged under the lib folder, excluding the .txt and .js files. To include these additional file types in the packaging process, I attempted to modify the configuration in the .projenrc.js file as follows:

tsconfig: {
    include: [
      'src/*.txt',
      'src/*.js',
      'src/**/*.txt',
      'src/**/*.js',
    ],
    compilerOptions: {
      noUnusedLocals: false,
      noUnusedParameters: false,
    },
  },

However, this modification did not yield the desired results. Any assistance on how to address this issue would be greatly appreciated.

Answer №1

To move .txt files using a ts config alone may not work as expected. Consider setting allowJs: true in the ts config to bundle js files instead.

If you need to copy .txt files or other file types, you can use a script to achieve this. The copyfiles package could be helpful:

Check out the copyfiles npm package here

Build tools like nx () offer features that assist with asset copying, and there are likely similar functionalities in other build systems too.

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

The installation of npm was unsuccessful due to an error: npm encountered an invalid JSON response

Warning: Peer dependency overridden by npm. Found: [email protected] in node_modules/@ivan/data-insights/node_modules/bootstrap. Bootstrap@^3.3.7 from @ivan/[email protected] version 1.7.26. Could not resolve dependency because peer bootstrap@^4.3.1 nee ...

Dealing with Overwhelmingly Large Angular 5 Components

I'm currently developing a project in Angular 5 and one of our component files is becoming quite large, reaching nearly a thousand lines and continuing to grow. This will eventually make it difficult to manage and understand. We are seeking advice on ...

I'm baffled by how the community response is implemented in this particular TypeScript exercise on Exercism

I am currently learning TypeScript from scratch by working on exercises available on exercism Successfully completed the 5th exercise on Pangram. Below is my solution: class Pangram { alphabet = "abcdefghijklmnopqrstuvwxyz" constructor(privat ...

What is the resolution if I need to utilize a property that is untyped?

Transitioning to TypeScript from plain old JavaScript is a step I'm taking because I believe it offers significant advantages. However, one drawback that has come to light is that not all attributes are typed, as I recently discovered. For instance: ...

When running the command "npm bin", I encountered the following error message: "/usr/local/bin/X: 1: /usr/local/bin/X: Syntax error: "(" unexpected"

Currently, I am attempting to create an npm bin that generates a file in the current directory. // ./index.js const program = require('commander'); const fs = require('fs'); const path = require('path'); program .command(& ...

The TypeScript error is causing issues in the Express router file

Here is the structure of my module: import * as express from 'express'; let router = express.Router(); router.post('/foo', function(req,res,next){ // ... }); export = router; However, I'm encountering the following error: ...

Retrieve parent route parameters from a dynamically loaded route component

Struggling to access the parent route params in a lazy loaded route component using activatedRoute.parent.params. Despite this not working, I have managed to find a solution that involves fetching the value using an array index number which feels like a &a ...

Definition of generic with recursive immutability

I created a type definition to ensure immutability of types and their properties all the way down. However, when I attempt to use this with a generic type, the compiler claims that the types do not overlap, preventing me from casting an object as immutable ...

Configuring Node and NPM: A Step-by-Step Guide

I've encountered some issues with installing MEAN IO multiple times. Typically, I can get one project up and running successfully, but then everything just seems to come to a halt. For example, after working on one project, attempting to create a new ...

TypeScript Yup schema validation combined with the power of Type Inference

I currently have a unique data structure as shown below: type MyDataType = | { type: "pro"; content: { signedAt: string; expiresOn: string }; } | { type: "default" | "regular"; content: { signed ...

Combining enum values to create a new data type

Exploring the implementation of type safety in a particular situation. Let’s consider the following: const enum Color { red = 'red', blue = 'blue', } const enum Shape { rectangle = 'rectangle', square = 'square ...

Ways to merge values across multiple arrays

There is a method to retrieve all unique properties from an array, demonstrated by the following code: var people = [{ "name": "John", "age": 30 }, { "name": "Anna", "job": true }, { "name": "Peter", "age": 35 }]; var result = []; people. ...

Unable to retrieve data following a promise in Ionic 3

Hello, I'm currently working on an Ionic application that needs to display data in a Form Group after retrieving it with a SOAP ReadData request. Although I call my function and try to display the data in the form, there seems to be an issue as the f ...

What is the reason for the prefixing of dependencies in package.json with @polymer?

As I examine this package.json, I notice that there are two different versions of sinonjs listed: "dependencies": { "@polymer/sinonjs": "^1.14.1", ... "sinon": "^2.3.5", ... }, I am curious about the distinction between sinon and @pol ...

Saving large amounts of data in bulk to PostgreSQL using TypeORM

I am looking to perform a bulk insert/update using TypeORM The Test entity is defined below: export class Test { @PrimaryColumn('integer') id: number; @Column('varchar', { length: 255 }) testName: string; } I have the f ...

Guide on sending a message to a specific channel using Discord.js version 13 with TypeScript

After recently diving into TypeScript and seeing that Discord.js has made the move to v13, I have encountered an issue with sending messages to a specific channel using a Channel ID. Below is the code snippet I am currently using: // Define Channel ID cons ...

Angular - Electron interface fails to reflect updated model changes

Whenever I click on a field that allows me to choose a folder from an electron dialog, the dialog opens up and I am able to select the desired folder. However, after clicking okay, even though the folder path is saved in my model, it does not immediately s ...

Issue with displaying data using a custom pure pipe and boolean in ngIf condition

For my current web project, I require a friendship/follow feature. There are two roles involved: admins and regular users. Regular users have the ability to follow other users, while admins do not possess this capability. When a user wishes to follow anot ...

Version 2.8.8 of prettier.js just dropped! Now, the burning question: what is the minimum version of Node

When examining the package.json file for Prettier version 2.8.8 at this link, it shows "engines": { "node": ">=14"} However, upon checking the package.json file of the installed prettier 2.8.8 version, I find: "engines": { "node": ">=10.13.0" }, https:/ ...

Troubleshooting Missing Exports from Local Modules in React Vite (Transitioning from Create React App)

I have encountered an issue while trying to import exported members from local nodejs packages in my project. Everything was working fine with the standard CRA webpack setup, but after switching to Vite, I started getting the following error: Unca ...