@tukuyomil032/bricklayer 1.0.41 → 1.0.43
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/LICENSE +21 -0
- package/README.md +3 -3
- package/dist/create/installer.js +19 -7
- package/dist/create/package-versions.js +4 -0
- package/dist/create/prompts.js +2 -0
- package/dist/create/templates.js +60 -32
- package/dist/index.js +1 -1
- package/package.json +4 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tukuyomil032
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -52,9 +52,9 @@ $ brick create -d ~/Documents/dev/CLI/my-test-project
|
|
|
52
52
|
|
|
53
53
|
## Available Options
|
|
54
54
|
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
55
|
+
- `-h --help` - display help for command
|
|
56
|
+
- `-V --version` - output the version number
|
|
57
|
+
- `-d --destination` - Specify the project creation directory
|
|
58
58
|
- This option can be used either to manually select the directory path where the project will be created, or to specify a relative path by entering it directly after “-d”.
|
|
59
59
|
|
|
60
60
|
Follow the interactive prompts to configure your project:
|
package/dist/create/installer.js
CHANGED
|
@@ -89,7 +89,9 @@ function runCommandWithProgress(command, cwd) {
|
|
|
89
89
|
try {
|
|
90
90
|
bar.update(floor);
|
|
91
91
|
}
|
|
92
|
-
catch {
|
|
92
|
+
catch {
|
|
93
|
+
// Ignore update errors during progress
|
|
94
|
+
}
|
|
93
95
|
}
|
|
94
96
|
}, tickInterval);
|
|
95
97
|
const child = spawn(parts[0], parts.slice(1), { cwd, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
@@ -109,25 +111,31 @@ function runCommandWithProgress(command, cwd) {
|
|
|
109
111
|
try {
|
|
110
112
|
bar.update(floor);
|
|
111
113
|
}
|
|
112
|
-
catch {
|
|
114
|
+
catch {
|
|
115
|
+
// Ignore update errors
|
|
116
|
+
}
|
|
113
117
|
}
|
|
114
118
|
};
|
|
115
|
-
if (child.stdout)
|
|
119
|
+
if (child.stdout) {
|
|
116
120
|
child.stdout.on('data', (c) => {
|
|
117
121
|
stdoutChunks.push(Buffer.from(c));
|
|
118
122
|
onOutput();
|
|
119
123
|
});
|
|
120
|
-
|
|
124
|
+
}
|
|
125
|
+
if (child.stderr) {
|
|
121
126
|
child.stderr.on('data', (c) => {
|
|
122
127
|
stderrChunks.push(Buffer.from(c));
|
|
123
128
|
onOutput();
|
|
124
129
|
});
|
|
130
|
+
}
|
|
125
131
|
child.on('error', (err) => {
|
|
126
132
|
clearInterval(timer);
|
|
127
133
|
try {
|
|
128
134
|
bar.stop();
|
|
129
135
|
}
|
|
130
|
-
catch {
|
|
136
|
+
catch {
|
|
137
|
+
// Ignore stop errors
|
|
138
|
+
}
|
|
131
139
|
reject(err);
|
|
132
140
|
});
|
|
133
141
|
child.on('close', (code) => {
|
|
@@ -140,7 +148,9 @@ function runCommandWithProgress(command, cwd) {
|
|
|
140
148
|
bar.update(100);
|
|
141
149
|
bar.stop();
|
|
142
150
|
}
|
|
143
|
-
catch {
|
|
151
|
+
catch {
|
|
152
|
+
// Ignore final update errors
|
|
153
|
+
}
|
|
144
154
|
clearInterval(finishTimer);
|
|
145
155
|
if (code === 0) {
|
|
146
156
|
return resolve();
|
|
@@ -157,7 +167,9 @@ function runCommandWithProgress(command, cwd) {
|
|
|
157
167
|
try {
|
|
158
168
|
bar.update(floor);
|
|
159
169
|
}
|
|
160
|
-
catch {
|
|
170
|
+
catch {
|
|
171
|
+
// Ignore update errors
|
|
172
|
+
}
|
|
161
173
|
}
|
|
162
174
|
}, finishInterval);
|
|
163
175
|
});
|
|
@@ -25,16 +25,20 @@ export async function getLatestVersions() {
|
|
|
25
25
|
'ts-node',
|
|
26
26
|
'husky',
|
|
27
27
|
'@types/node',
|
|
28
|
+
'@types/cli-progress',
|
|
28
29
|
'eslint',
|
|
29
30
|
'eslint-config-prettier',
|
|
30
31
|
'eslint-plugin-prettier',
|
|
31
32
|
'@typescript-eslint/parser',
|
|
32
33
|
'@typescript-eslint/eslint-plugin',
|
|
34
|
+
'typescript-eslint',
|
|
35
|
+
'@eslint/json',
|
|
33
36
|
'prettier',
|
|
34
37
|
'lint-staged',
|
|
35
38
|
'commander',
|
|
36
39
|
'inquirer',
|
|
37
40
|
'chalk',
|
|
41
|
+
'cli-progress',
|
|
38
42
|
'ora',
|
|
39
43
|
'yargs',
|
|
40
44
|
'pnpm',
|
package/dist/create/prompts.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
import Enquirer from 'enquirer';
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
4
|
const Select = Enquirer.Select || Enquirer.default?.Select;
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
6
|
const Input = Enquirer.Input || Enquirer.default?.Input;
|
|
5
7
|
import chalk from 'chalk';
|
|
6
8
|
import readline from 'readline';
|
package/dist/create/templates.js
CHANGED
|
@@ -161,12 +161,23 @@ const hooksTemplates = {
|
|
|
161
161
|
'pnpm run lint && pnpm run format:check',
|
|
162
162
|
],
|
|
163
163
|
};
|
|
164
|
+
// Generate scripts object with OS-specific postbuild handling
|
|
165
|
+
function generateScriptsWithPermissions(baseScripts) {
|
|
166
|
+
// Add postbuild script to handle file permissions across platforms
|
|
167
|
+
// Unix-like systems: set executable permission via chmod
|
|
168
|
+
// Windows: chmodSync still applies but has no effect (harmless)
|
|
169
|
+
return {
|
|
170
|
+
...baseScripts,
|
|
171
|
+
postbuild: "node -e \"require('fs').chmodSync('dist/index.js', 0o755)\"",
|
|
172
|
+
};
|
|
173
|
+
}
|
|
164
174
|
// license texts are provided from src/create/licenses.ts
|
|
165
175
|
export function generatePackageJson(answers, versions) {
|
|
166
176
|
const devDeps = {
|
|
167
177
|
typescript: versions?.['typescript'] || '^5.7.2',
|
|
168
178
|
'ts-node': versions?.['ts-node'] || '^10.9.1',
|
|
169
179
|
'@types/node': versions?.['@types/node'] || '^22.10.5',
|
|
180
|
+
'@types/cli-progress': versions?.['@types/cli-progress'] || '^3.11.6',
|
|
170
181
|
'lint-staged': versions?.['lint-staged'] || '^15.2.11',
|
|
171
182
|
};
|
|
172
183
|
// Include ESLint and Prettier by default in generated projects
|
|
@@ -176,6 +187,8 @@ export function generatePackageJson(answers, versions) {
|
|
|
176
187
|
devDeps['@typescript-eslint/parser'] = versions?.['@typescript-eslint/parser'] || '^8.52.0';
|
|
177
188
|
devDeps['@typescript-eslint/eslint-plugin'] =
|
|
178
189
|
versions?.['@typescript-eslint/eslint-plugin'] || '^8.52.0';
|
|
190
|
+
devDeps['typescript-eslint'] = versions?.['typescript-eslint'] || '^8.52.0';
|
|
191
|
+
devDeps['@eslint/json'] = versions?.['@eslint/json'] || '^0.1.1';
|
|
179
192
|
devDeps['prettier'] = versions?.['prettier'] || '^3.7.4';
|
|
180
193
|
// Husky should only be added when requested (useHusky)
|
|
181
194
|
if (answers.useHusky) {
|
|
@@ -185,6 +198,7 @@ export function generatePackageJson(answers, versions) {
|
|
|
185
198
|
commander: versions?.['commander'] || '^11.1.0',
|
|
186
199
|
inquirer: versions?.['inquirer'] || '^9.0.0',
|
|
187
200
|
chalk: versions?.['chalk'] || '^5.3.0',
|
|
201
|
+
'cli-progress': versions?.['cli-progress'] || '^3.12.0',
|
|
188
202
|
ora: versions?.['ora'] || '^8.1.1',
|
|
189
203
|
yargs: versions?.['yargs'] || '^18.0.0',
|
|
190
204
|
};
|
|
@@ -196,16 +210,19 @@ export function generatePackageJson(answers, versions) {
|
|
|
196
210
|
bun: versions?.['bun'] || '1.3.6',
|
|
197
211
|
};
|
|
198
212
|
function exactVersion(v) {
|
|
199
|
-
if (!v)
|
|
213
|
+
if (!v) {
|
|
200
214
|
return v;
|
|
215
|
+
}
|
|
201
216
|
const m = v.match(/\d+\.\d+\.\d+/);
|
|
202
217
|
return m ? m[0] : v.replace(/^[^\d]*/, '');
|
|
203
218
|
}
|
|
204
219
|
function buildCmdForManager(m) {
|
|
205
|
-
if (m === 'yarn')
|
|
220
|
+
if (m === 'yarn') {
|
|
206
221
|
return 'yarn build';
|
|
207
|
-
|
|
222
|
+
}
|
|
223
|
+
if (m === 'bun') {
|
|
208
224
|
return 'bun run build';
|
|
225
|
+
}
|
|
209
226
|
return `${m} run build`;
|
|
210
227
|
}
|
|
211
228
|
// When Husky is enabled, keep prepare as just 'husky' (user requested).
|
|
@@ -222,8 +239,8 @@ export function generatePackageJson(answers, versions) {
|
|
|
222
239
|
[answers.name]: './dist/index.js',
|
|
223
240
|
},
|
|
224
241
|
files: ['dist', 'README.md'],
|
|
225
|
-
scripts: Object.assign({
|
|
226
|
-
build: 'tsc -p tsconfig.json
|
|
242
|
+
scripts: generateScriptsWithPermissions(Object.assign({
|
|
243
|
+
build: 'tsc -p tsconfig.json',
|
|
227
244
|
prepare: prepareScript,
|
|
228
245
|
prepublishOnly: buildCmdForManager(mgr),
|
|
229
246
|
dev: 'ts-node --esm src/index.ts',
|
|
@@ -234,7 +251,7 @@ export function generatePackageJson(answers, versions) {
|
|
|
234
251
|
'lint-staged': 'lint-staged',
|
|
235
252
|
format: 'prettier --write "src/**/*.ts"',
|
|
236
253
|
'format:check': 'prettier --check "src/**/*.ts"',
|
|
237
|
-
}, answers.useHusky ? {} : {}),
|
|
254
|
+
}, answers.useHusky ? {} : {})),
|
|
238
255
|
keywords: ['cli', 'scaffold', 'typescript', 'generator'],
|
|
239
256
|
author: answers.author,
|
|
240
257
|
license: answers.license,
|
|
@@ -351,43 +368,53 @@ export function generateEditorConfig() {
|
|
|
351
368
|
: staticTemplates.editorconfig;
|
|
352
369
|
}
|
|
353
370
|
export function generateEslintConfig() {
|
|
354
|
-
return `import
|
|
355
|
-
import
|
|
356
|
-
import
|
|
357
|
-
import
|
|
371
|
+
return `import eslint from '@eslint/js';
|
|
372
|
+
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
373
|
+
import tsparser from '@typescript-eslint/parser';
|
|
374
|
+
import prettier from 'eslint-plugin-prettier';
|
|
375
|
+
import prettierConfig from 'eslint-config-prettier';
|
|
358
376
|
|
|
359
377
|
export default [
|
|
378
|
+
eslint.configs.recommended,
|
|
360
379
|
{
|
|
361
|
-
|
|
362
|
-
},
|
|
363
|
-
|
|
364
|
-
{
|
|
365
|
-
files: ['**/*.{js,mjs,cjs}'],
|
|
366
|
-
languageOptions: {
|
|
367
|
-
globals: globals.node,
|
|
368
|
-
},
|
|
369
|
-
...js.configs.recommended,
|
|
370
|
-
},
|
|
371
|
-
|
|
372
|
-
{
|
|
373
|
-
files: ['**/*.{ts,mts,cts}'],
|
|
380
|
+
files: ['src/**/*.ts'],
|
|
374
381
|
languageOptions: {
|
|
375
|
-
|
|
376
|
-
|
|
382
|
+
parser: tsparser,
|
|
383
|
+
parserOptions: {
|
|
384
|
+
ecmaVersion: 'latest',
|
|
385
|
+
sourceType: 'module',
|
|
386
|
+
project: './tsconfig.json',
|
|
387
|
+
},
|
|
388
|
+
globals: {
|
|
389
|
+
console: 'readonly',
|
|
390
|
+
process: 'readonly',
|
|
391
|
+
Buffer: 'readonly',
|
|
392
|
+
__dirname: 'readonly',
|
|
393
|
+
__filename: 'readonly',
|
|
394
|
+
},
|
|
377
395
|
},
|
|
378
396
|
plugins: {
|
|
379
|
-
'@typescript-eslint': tseslint
|
|
397
|
+
'@typescript-eslint': tseslint,
|
|
398
|
+
prettier: prettier,
|
|
380
399
|
},
|
|
381
400
|
rules: {
|
|
382
401
|
...tseslint.configs.recommended.rules,
|
|
402
|
+
...prettierConfig.rules,
|
|
403
|
+
'prettier/prettier': 'error',
|
|
404
|
+
'@typescript-eslint/no-unused-vars': [
|
|
405
|
+
'error',
|
|
406
|
+
{
|
|
407
|
+
argsIgnorePattern: '^_',
|
|
408
|
+
varsIgnorePattern: '^_',
|
|
409
|
+
},
|
|
410
|
+
],
|
|
411
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
412
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
413
|
+
'no-console': 'off',
|
|
383
414
|
},
|
|
384
415
|
},
|
|
385
|
-
|
|
386
416
|
{
|
|
387
|
-
|
|
388
|
-
language: 'json/json',
|
|
389
|
-
plugins: { json },
|
|
390
|
-
...json.configs.recommended,
|
|
417
|
+
ignores: ['dist/**', 'node_modules/**', '*.js'],
|
|
391
418
|
},
|
|
392
419
|
];
|
|
393
420
|
`;
|
|
@@ -405,8 +432,9 @@ export async function generateLicenseText(license, author, year) {
|
|
|
405
432
|
};
|
|
406
433
|
const key = keyMap[license] || 'MIT';
|
|
407
434
|
const textTemplate = (LICENSE_TEXTS && LICENSE_TEXTS[key]) || '';
|
|
408
|
-
if (!textTemplate)
|
|
435
|
+
if (!textTemplate) {
|
|
409
436
|
return `MIT License\n\nCopyright (c) ${year} ${author}`;
|
|
437
|
+
}
|
|
410
438
|
// Common placeholder patterns to replace in license text files.
|
|
411
439
|
// Support multiple variants users may paste: [year], <YEAR>, {{year}}, {yyyy}, etc.
|
|
412
440
|
const yearRegex = /\[year\]|\{yyyy\}|<year>|\{\{year\}\}|\[YEAR\]|<YEAR>|\{YEAR\}/gi;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ const program = new Command();
|
|
|
5
5
|
program
|
|
6
6
|
.name('brick')
|
|
7
7
|
.description('Interactive CLI to scaffold TypeScript CLI projects')
|
|
8
|
-
.version('1.0.
|
|
8
|
+
.version('1.0.43');
|
|
9
9
|
program.addCommand(createCommand());
|
|
10
10
|
program.addCommand(sampleCommand());
|
|
11
11
|
program.parseAsync(process.argv).catch((err) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tukuyomil032/bricklayer",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.43",
|
|
5
5
|
"description": "Interactive TypeScript CLI project scaffolder",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"README.md"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "tsc -p tsconfig.json
|
|
17
|
+
"build": "tsc -p tsconfig.json",
|
|
18
|
+
"postbuild": "node -e \"require('fs').chmodSync('dist/index.js', 0o755)\"",
|
|
18
19
|
"prepare": "husky",
|
|
19
20
|
"prepublishOnly": "pnpm run build",
|
|
20
21
|
"dev": "ts-node --esm src/index.ts",
|
|
@@ -46,11 +47,9 @@
|
|
|
46
47
|
"chalk": "^5.3.0",
|
|
47
48
|
"cli-progress": "^3.12.0",
|
|
48
49
|
"commander": "^11.1.0",
|
|
49
|
-
"consola": "^3.4.2",
|
|
50
50
|
"enquirer": "^2.4.1",
|
|
51
51
|
"inquirer": "^9.2.11",
|
|
52
|
-
"ora": "^8.1.1"
|
|
53
|
-
"yargs": "^18.0.0"
|
|
52
|
+
"ora": "^8.1.1"
|
|
54
53
|
},
|
|
55
54
|
"devDependencies": {
|
|
56
55
|
"@eslint/js": "^9.39.2",
|
|
@@ -58,7 +57,6 @@
|
|
|
58
57
|
"@types/cli-progress": "^3.11.6",
|
|
59
58
|
"@types/inquirer": "^9.0.9",
|
|
60
59
|
"@types/node": "^22.10.5",
|
|
61
|
-
"@types/yargs": "^17.0.35",
|
|
62
60
|
"@typescript-eslint/eslint-plugin": "^8.52.0",
|
|
63
61
|
"@typescript-eslint/parser": "^8.52.0",
|
|
64
62
|
"eslint": "^9.39.2",
|