@book000/create-ts 0.2.105 → 0.2.106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -82,10 +82,11 @@ function patchDockerWorkflow(content, org, repo) {
82
82
  return result;
83
83
  }
84
84
  /**
85
- * Generates .gitignore from the bundled Node.gitignore (which includes a pnpm section), optionally appending a `data/` section.
85
+ * Generates .gitignore from the bundled Node.gitignore, optionally appending a `data/` section and always excluding Discord bot config.
86
86
  */
87
- function generateGitignore(ignoreData) {
87
+ function generateGitignore(ignoreData, variant) {
88
88
  let result = readTemplate("gitignore/Node.gitignore");
89
+ if (variant === "discord-bot") result += "\n\n# Discord bot configuration\ndata/config.json";
89
90
  if (ignoreData) result += "\n\n# データディレクトリ\ndata/";
90
91
  return result;
91
92
  }
@@ -434,7 +435,7 @@ async function main() {
434
435
  const patchedTsConfig = patchTsConfig(JSON.parse(readFileSync(tsconfigPath, "utf8")), options);
435
436
  writeFileSync(tsconfigPath, JSON.stringify(patchedTsConfig, null, 2) + "\n", "utf8");
436
437
  s.start(".gitignore を生成しています...");
437
- const gitignoreContent = generateGitignore(options.ignoreData);
438
+ const gitignoreContent = generateGitignore(options.ignoreData, options.variant);
438
439
  writeFileSync(path.join(outDir, ".gitignore"), gitignoreContent, "utf8");
439
440
  const { stdout: nodeVersion } = await execa("node", ["--version"]);
440
441
  const nodeVersionNumber = nodeVersion.trim().replace("v", "");
@@ -17,9 +17,9 @@ export declare function patchTsConfig(tsconfig: Record<string, unknown>, options
17
17
  */
18
18
  export declare function patchDockerWorkflow(content: string, org: string, repo: string): string;
19
19
  /**
20
- * Generates .gitignore from the bundled Node.gitignore (which includes a pnpm section), optionally appending a `data/` section.
20
+ * Generates .gitignore from the bundled Node.gitignore, optionally appending a `data/` section and always excluding Discord bot config.
21
21
  */
22
- export declare function generateGitignore(ignoreData: boolean): string;
22
+ export declare function generateGitignore(ignoreData: boolean, variant: ProjectOptions['variant']): string;
23
23
  /**
24
24
  * Updates the `ignores` array of .depcheckrc.json without duplicates.
25
25
  * Adds the variant's depcheckIgnore entries, plus `@types/jest` when `test` is set.
@@ -66,10 +66,13 @@ export function patchDockerWorkflow(content, org, repo) {
66
66
  return result;
67
67
  }
68
68
  /**
69
- * Generates .gitignore from the bundled Node.gitignore (which includes a pnpm section), optionally appending a `data/` section.
69
+ * Generates .gitignore from the bundled Node.gitignore, optionally appending a `data/` section and always excluding Discord bot config.
70
70
  */
71
- export function generateGitignore(ignoreData) {
71
+ export function generateGitignore(ignoreData, variant) {
72
72
  let result = readTemplate('gitignore/Node.gitignore');
73
+ if (variant === 'discord-bot') {
74
+ result += '\n\n# Discord bot configuration\ndata/config.json';
75
+ }
73
76
  if (ignoreData) {
74
77
  result += '\n\n# データディレクトリ\ndata/';
75
78
  }
package/dist/src/index.js CHANGED
@@ -156,7 +156,7 @@ async function main() {
156
156
  writeFileSync(tsconfigPath, JSON.stringify(patchedTsConfig, null, 2) + '\n', 'utf8');
157
157
  // generate .gitignore and .node-version (the running Node.js version)
158
158
  s.start('.gitignore を生成しています...');
159
- const gitignoreContent = generateGitignore(options.ignoreData);
159
+ const gitignoreContent = generateGitignore(options.ignoreData, options.variant);
160
160
  writeFileSync(path.join(outDir, '.gitignore'), gitignoreContent, 'utf8');
161
161
  const { stdout: nodeVersion } = await execa('node', ['--version']);
162
162
  const nodeVersionNumber = nodeVersion.trim().replace('v', '');
@@ -135,18 +135,24 @@ describe('patchDockerWorkflow', () => {
135
135
  // ---- generateGitignore ----
136
136
  describe('generateGitignore', () => {
137
137
  it('basic: includes the pnpm section', () => {
138
- const result = generateGitignore(false);
138
+ const result = generateGitignore(false, 'base');
139
139
  expect(result).toContain('node_modules/');
140
140
  expect(result).toContain('# pnpm');
141
141
  expect(result).toContain('pnpm-debug.log*');
142
142
  expect(result).not.toContain('data/');
143
143
  });
144
144
  it('--ignore-data: additionally appends the data/ section', () => {
145
- const result = generateGitignore(true);
145
+ const result = generateGitignore(true, 'base');
146
146
  expect(result).toContain('# pnpm');
147
147
  expect(result).toContain('# データディレクトリ');
148
148
  expect(result).toContain('data/');
149
149
  });
150
+ it('always ignores the Discord bot configuration file', () => {
151
+ const result = generateGitignore(false, 'discord-bot');
152
+ const entries = result.split('\n');
153
+ expect(entries).toContain('data/config.json');
154
+ expect(entries).not.toContain('data/');
155
+ });
150
156
  });
151
157
  // ---- updateDepcheck ----
152
158
  describe('updateDepcheck', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@book000/create-ts",
3
- "version": "0.2.105",
3
+ "version": "0.2.106",
4
4
  "description": "Create book000-style TypeScript projects",
5
5
  "repository": {
6
6
  "type": "git",