@orxataguy/tyr 1.0.24 → 1.0.25
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/package.json +1 -1
- package/src/core/sys/config.ts +20 -12
- package/src/core/sys/gen.ts +0 -2
- package/src/core/sys/help.ts +0 -7
package/package.json
CHANGED
package/src/core/sys/config.ts
CHANGED
|
@@ -75,7 +75,7 @@ const TSCONFIG_TEMPLATE = `{
|
|
|
75
75
|
"compilerOptions": {
|
|
76
76
|
"target": "ESNext",
|
|
77
77
|
"module": "ESNext",
|
|
78
|
-
"moduleResolution": "
|
|
78
|
+
"moduleResolution": "bundler",
|
|
79
79
|
"esModuleInterop": true,
|
|
80
80
|
"strict": true,
|
|
81
81
|
"allowSyntheticDefaultImports": true,
|
|
@@ -86,8 +86,7 @@ const TSCONFIG_TEMPLATE = `{
|
|
|
86
86
|
}
|
|
87
87
|
`;
|
|
88
88
|
|
|
89
|
-
const ENV_TEMPLATE = `#
|
|
90
|
-
# Environment variables for Tyr. This file must never be committed to git.
|
|
89
|
+
const ENV_TEMPLATE = `# Environment variables for Tyr. This file must never be committed to git.
|
|
91
90
|
#
|
|
92
91
|
# SQL Server database
|
|
93
92
|
MSSQL_USER=
|
|
@@ -99,8 +98,7 @@ MONGO_URI=
|
|
|
99
98
|
MONGO_DATABASE=
|
|
100
99
|
`;
|
|
101
100
|
|
|
102
|
-
const SH_ALIASES_TEMPLATE = `#
|
|
103
|
-
# Add your custom aliases here.
|
|
101
|
+
const SH_ALIASES_TEMPLATE = `# Add your custom aliases here.
|
|
104
102
|
# This file is loaded automatically by your shell.
|
|
105
103
|
#
|
|
106
104
|
# Examples:
|
|
@@ -108,30 +106,34 @@ const SH_ALIASES_TEMPLATE = `# ~/.tyr/aliases
|
|
|
108
106
|
# alias tyr-deploy='tyr deploy'
|
|
109
107
|
`;
|
|
110
108
|
|
|
111
|
-
const SH_PLUGINS_TEMPLATE = `#
|
|
112
|
-
# Add your shell plugins here.
|
|
109
|
+
const SH_PLUGINS_TEMPLATE = `# Add your shell plugins here.
|
|
113
110
|
# Compatible with zsh, bash and other POSIX shells.
|
|
114
111
|
#
|
|
115
112
|
# Examples (zsh):
|
|
116
113
|
# source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
117
114
|
`;
|
|
118
115
|
|
|
119
|
-
const PS_ALIASES_TEMPLATE = `#
|
|
120
|
-
# Add your custom aliases for PowerShell here.
|
|
116
|
+
const PS_ALIASES_TEMPLATE = `# Add your custom aliases for PowerShell here.
|
|
121
117
|
#
|
|
122
118
|
# Examples:
|
|
123
119
|
# Set-Alias gs git-status
|
|
124
120
|
# function tyr-deploy { tyr deploy @args }
|
|
125
121
|
`;
|
|
126
122
|
|
|
127
|
-
const PS_PLUGINS_TEMPLATE = `#
|
|
128
|
-
# Add your PowerShell modules and plugins here.
|
|
123
|
+
const PS_PLUGINS_TEMPLATE = `# Add your PowerShell modules and plugins here.
|
|
129
124
|
#
|
|
130
125
|
# Examples:
|
|
131
126
|
# Import-Module posh-git
|
|
132
127
|
# Import-Module PSReadLine
|
|
133
128
|
`;
|
|
134
129
|
|
|
130
|
+
const GIT_IGNORE = `# ENVIRONMENT
|
|
131
|
+
.env
|
|
132
|
+
|
|
133
|
+
# NODE
|
|
134
|
+
node_modules
|
|
135
|
+
`;
|
|
136
|
+
|
|
135
137
|
function makeTimestamp(): string {
|
|
136
138
|
const now = new Date();
|
|
137
139
|
const pad = (n: number) => String(n).padStart(2, '0');
|
|
@@ -239,11 +241,17 @@ export default function config({ logger, fs: tyrFs, frameworkRoot, shell }: TyrC
|
|
|
239
241
|
await tyrFs.write(mapPath, 'commands: {}\n');
|
|
240
242
|
logger.success(`File created: ${mapPath}`);
|
|
241
243
|
|
|
242
|
-
const envPath = path.join(userRoot, '.env');
|
|
244
|
+
const envPath = path.join(userRoot, '.env.example');
|
|
243
245
|
if (!tyrFs.exists(envPath)) {
|
|
244
246
|
await tyrFs.write(envPath, ENV_TEMPLATE);
|
|
245
247
|
logger.success(`File created: ${envPath}`);
|
|
246
248
|
}
|
|
249
|
+
|
|
250
|
+
const gitignorePath = path.join(userRoot, '.gitignore');
|
|
251
|
+
if (!tyrFs.exists(gitignorePath)) {
|
|
252
|
+
await tyrFs.write(gitignorePath, GIT_IGNORE);
|
|
253
|
+
logger.success(`File created: ${gitignorePath}`);
|
|
254
|
+
}
|
|
247
255
|
|
|
248
256
|
const packageJsonPath = path.join(userRoot, 'package.json');
|
|
249
257
|
if (!tyrFs.exists(packageJsonPath)) {
|
package/src/core/sys/gen.ts
CHANGED
|
@@ -47,7 +47,6 @@ export default function gen({ logger, fs, userRoot }: TyrContext) {
|
|
|
47
47
|
const templateFilled = template.replaceAll('%s', commandName);
|
|
48
48
|
await fs.write(filePath, templateFilled.trim());
|
|
49
49
|
|
|
50
|
-
// Register in ~/.tyr/map.yml
|
|
51
50
|
const mapPath = path.join(userRoot, 'map.yml');
|
|
52
51
|
try {
|
|
53
52
|
const currentConfigRaw = await fs.read(mapPath);
|
|
@@ -59,7 +58,6 @@ export default function gen({ logger, fs, userRoot }: TyrContext) {
|
|
|
59
58
|
logger.warn(`Command '${commandName}' already existed. Updating path...`);
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
// Store path relative to userRoot so it remains portable
|
|
63
61
|
config.commands[commandName] = `./commands/${fileName}.tyr.ts`;
|
|
64
62
|
|
|
65
63
|
const newYaml = yaml.dump(config, { indent: 2, lineWidth: -1 });
|
package/src/core/sys/help.ts
CHANGED
|
@@ -8,10 +8,6 @@ interface CommandDoc {
|
|
|
8
8
|
usage: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Extracts the first JSDoc block from a .tyr.ts file and parses it
|
|
13
|
-
* into a description and usage examples.
|
|
14
|
-
*/
|
|
15
11
|
function parseCommandDoc(filePath: string): CommandDoc {
|
|
16
12
|
const fileName = path.basename(filePath, '.tyr.ts');
|
|
17
13
|
const content = fs.readFileSync(filePath, 'utf-8');
|
|
@@ -21,12 +17,10 @@ function parseCommandDoc(filePath: string): CommandDoc {
|
|
|
21
17
|
return { name: fileName, description: '', usage: '' };
|
|
22
18
|
}
|
|
23
19
|
|
|
24
|
-
// Clean each line: remove leading * and spaces
|
|
25
20
|
const lines = match[1]
|
|
26
21
|
.split('\n')
|
|
27
22
|
.map(line => line.replace(/^\s*\*\s?/, '').trimEnd());
|
|
28
23
|
|
|
29
|
-
// Split into description and "Usage:" block
|
|
30
24
|
const usoIndex = lines.findIndex(l => /^uso:/i.test(l.trim()));
|
|
31
25
|
|
|
32
26
|
let description = '';
|
|
@@ -74,7 +68,6 @@ export default function help({ userRoot }: TyrContext) {
|
|
|
74
68
|
console.log(separator);
|
|
75
69
|
console.log('');
|
|
76
70
|
|
|
77
|
-
// Framework flags and built-in commands
|
|
78
71
|
const builtins = [
|
|
79
72
|
{ name: '--help', description: 'Shows this command listing.', usage: 'tyr --help' },
|
|
80
73
|
{ name: '--version', description: 'Shows the installed version of tyr.', usage: 'tyr --version' },
|