-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.json
More file actions
212 lines (212 loc) · 8.37 KB
/
package.json
File metadata and controls
212 lines (212 loc) · 8.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
{
"name": "new-python-package",
"displayName": "New Python Package",
"description": "Adds a 'New Python Package...' option to create Python packages with __init__.py files.",
"version": "1.1.3",
"publisher": "KaninDev",
"packageManager": "pnpm@10.0.0",
"engines": {
"vscode": "^1.99.0"
},
"categories": [
"Other"
],
"keywords": [
"python",
"package",
"__init__"
],
"icon": "images/icon.png",
"repository": {
"type": "git",
"url": "https://github.com/kanin/new-python-package"
},
"activationEvents": [
"onStartupFinished"
],
"main": "./dist/extension.js",
"contributes": {
"configuration": {
"title": "New Python Package",
"properties": {
"new-python-package.watcherTimeout": {
"type": "number",
"default": 30,
"minimum": 5,
"maximum": 120,
"description": "Timeout in seconds for detecting new folder creation."
},
"new-python-package.initFileContent": {
"type": "string",
"default": "",
"editPresentation": "multilineText",
"description": "Default content for __init__.py files. Supports variables like ${name}, ${name:pascal}, etc. Overridden by initFileRules if a rule matches."
},
"new-python-package.initFileSnippet": {
"type": "string",
"default": "",
"description": "VS Code snippet name to insert in __init__.py. Overridden by initFileRules if a rule matches."
},
"new-python-package.initFileRules": {
"type": "array",
"default": [],
"markdownDescription": "Conditional rules for `__init__.py` content. First matching rule wins. Falls back to `initFileContent`/`initFileSnippet` if no rules match.",
"items": {
"type": "object",
"properties": {
"when": {
"type": "object",
"description": "Conditions for when this rule applies.",
"properties": {
"pathMatches": {
"type": "string",
"description": "Glob pattern the package path must match."
},
"nameMatches": {
"type": "string",
"description": "Regex pattern the package name must match."
},
"workspaceContains": {
"type": "string",
"description": "Glob pattern for files that must exist in workspace."
}
}
},
"content": {
"type": "string",
"description": "Content for __init__.py. Supports variables."
},
"snippet": {
"type": "string",
"description": "VS Code snippet name to insert."
},
"templateFile": {
"type": "string",
"description": "Path to a template file."
}
}
}
},
"new-python-package.openFilesAfterCreation": {
"type": "boolean",
"default": false,
"description": "Open created files in the editor after package creation."
},
"new-python-package.ensureParentPackages": {
"type": "boolean",
"default": false,
"description": "Create __init__.py in parent directories (up to workspace root) if missing."
},
"new-python-package.additionalFiles": {
"type": "array",
"default": [],
"markdownDescription": "Rules for creating additional files. Each rule has optional `when` conditions and required `files` array.\n\n**Variables:** `${name}`, `${parent}`, `${date}`, `${year}`\n\n**Transforms:** `:upper`, `:lower`, `:capitalize`, `:pascal`, `:camel`, `:snake`, `:replace:X:Y`, `:slice:N:M`\n\n**Example:** `${name:pascal}` transforms `my_module` → `MyModule`",
"items": {
"type": "object",
"required": [
"files"
],
"properties": {
"when": {
"type": "object",
"description": "Conditions for when this rule applies. All specified conditions must match.",
"properties": {
"pathMatches": {
"type": "string",
"markdownDescription": "Glob pattern the full package path must match.\n\n**Examples:**\n- `**/modules/**` — any package under a `modules` folder\n- `**/tests/**` — any package under `tests`\n- `**/modules/{cogs,events}/**` — packages under `modules/cogs` or `modules/events`"
},
"nameMatches": {
"type": "string",
"markdownDescription": "Regex pattern the package name must match.\n\n**Examples:**\n- `^test_` — names starting with `test_`\n- `_test$` — names ending with `_test`\n- `.*` — any name (default)"
},
"workspaceContains": {
"type": "string",
"markdownDescription": "Glob pattern for files that must exist in workspace.\n\n**Examples:**\n- `pyproject.toml`\n- `**/pytest.ini`\n- `setup.py`"
}
}
},
"files": {
"type": "array",
"description": "Files to create when conditions match.",
"items": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"markdownDescription": "File name with optional variables.\n\n**Examples:**\n- `${name}.py`\n- `test_${name}.py`\n- `${name:pascal}.py`"
},
"content": {
"type": "string",
"markdownDescription": "Inline file content with variables. Use for short content.\n\n**Example:**\n```python\nclass ${name:pascal}:\n pass\n```"
},
"snippet": {
"type": "string",
"markdownDescription": "VS Code snippet name to insert. The file will be opened and the snippet inserted with full snippet features (tabstops, placeholders, choices).\n\n**Example:** `\"python-cog\"` (references a snippet you've defined)"
},
"templateFile": {
"type": "string",
"markdownDescription": "Path to a template file (relative to workspace root). The template content supports all variables.\n\n**Examples:**\n- `.vscode/templates/cog.py`\n- `templates/${parent}.py.template`"
}
}
}
}
}
}
}
}
},
"commands": [
{
"command": "new-python-package.generatePackage",
"title": "New Python Package..."
},
{
"command": "new-python-package.whatsNew",
"title": "New Python Package: What's New"
}
],
"menus": {
"explorer/context": [
{
"when": "explorerResourceIsFolder",
"command": "new-python-package.generatePackage",
"group": "navigation@10"
}
]
}
},
"scripts": {
"vscode:prepublish": "pnpm run package",
"compile": "pnpm run check-types && pnpm run lint && node esbuild.js",
"watch": "npm-run-all -p watch:*",
"watch:esbuild": "node esbuild.js --watch",
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
"package": "pnpm run check-types && pnpm run lint && node esbuild.js --production",
"compile-tests": "tsc -p . --outDir out",
"watch-tests": "tsc -p . -w --outDir out",
"pretest": "pnpm run compile-tests && pnpm run compile && pnpm run lint",
"check-types": "tsc --noEmit",
"lint": "eslint src",
"test": "vscode-test"
},
"devDependencies": {
"@types/mocha": "^10.0.10",
"@types/node": "20.x",
"@types/vscode": "^1.99.0",
"@typescript-eslint/eslint-plugin": "^8.28.0",
"@typescript-eslint/parser": "^8.28.0",
"@vscode/test-cli": "^0.0.10",
"@vscode/test-electron": "^2.4.1",
"esbuild": "^0.25.1",
"eslint": "^9.23.0",
"npm-run-all": "^4.1.5",
"typescript": "^5.8.2"
},
"license": "MIT",
"dependencies": {
"minimatch": "^9.0.5"
}
}