使用.projenrc.js的纱线构建YARN build of typecript项目后,包装/包括文本文件或.ts文件以外

发布于 2025-02-13 01:40:25 字数 1053 浏览 0 评论 0原文

我使用projen创建了打字条项目(请参阅链接: https://github.com/projen/projen/projen

mkdir my-project
git init
npx projen new typescript

我创建了两个文件,为 sample.txt & sample.js 和 index.ts是使用文件夹结构创建的默认文件。创建的文件夹结构是& YARN构建后的LIB文件夹结果:

”在此处输入图像说明”

如果我进行纱线构建,则只有.ts file/files在LIB文件夹下包装,但我想包括/打包 .txt& .js 文件 我必须在.projenrc.js中提及什么配置。 我在下面尝试过:

tsconfig: {
    include: [
      'src/*.txt',
      'src/*.js',
      'src/**/*.txt',
      'src/**/*.js',
    ],
    compilerOptions: {
      noUnusedLocals: false, // added this so can iterate through builds without errors for variables that have not been used yet.
      noUnusedParameters: false,
    },
  },

但是没有运气。 对此的任何帮助都非常感谢。

I created typescript project using projen (Refer Link : https://github.com/projen/projen)

mkdir my-project
git init
npx projen new typescript

I have created two files as sample.txt & sample.js, and
index.ts is a default file created with folder structure. Folder structure created is & lib folder outcome after yarn build :

enter image description here

If I do yarn build then only .ts file/files getting packaged under lib folder, But I want to include/packaged .txt & .js file also
what configuration I will have to mention inside .projenrc.js.
I tried below:

tsconfig: {
    include: [
      'src/*.txt',
      'src/*.js',
      'src/**/*.txt',
      'src/**/*.js',
    ],
    compilerOptions: {
      noUnusedLocals: false, // added this so can iterate through builds without errors for variables that have not been used yet.
      noUnusedParameters: false,
    },
  },

But no luck.
Any help on this really appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ヅ她的身影、若隐若现 2025-02-20 01:40:25

单独使用TS Config,.TXT文件将不会移动。您可以将TS Config设置为允许JS:TRUE以获取JS文件捆绑。

对于.txt文件(或其他文件类型),使用脚本来复制这些文件。可能有用的东西是使用CopyFiles软件包:

copyfiles npm npm软件包

href =“ https://nx.dev/” rel =“ nofollow noreferrer“> https://nx.dev/ )提供有助于复制资产的功能,我敢肯定,其他构建系统也可以。

Using ts config alone, the .txt files will not be moved. You can set ts config with allowJs: true to get the js files bundled.

For the .txt files (or other file types) use a script to copy those files. Something that may be useful is to use copyfiles package:

copyfiles npm package

Tools like nx (https://nx.dev/) provide functionality that help with copying assets, I'm sure other build systems do as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文