@yakuzaa/jade 0.1.0

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.
Files changed (3) hide show
  1. package/README.md +34 -0
  2. package/package.json +42 -0
  3. package/postinstall.js +48 -0
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # @yakuzaa/jade
2
+
3
+ Instalação completa da linguagem **JADE** — compilador + runtime em um único pacote.
4
+
5
+ ```bash
6
+ npm install @yakuzaa/jade
7
+ ```
8
+
9
+ Após a instalação, o VS Code recomendará automaticamente a extensão **JADE Language** com syntax highlighting, autocomplete e diagnósticos em tempo real.
10
+
11
+ ## O que é instalado
12
+
13
+ | Pacote | Função |
14
+ |--------|--------|
15
+ | `@yakuzaa/jade-compiler` | Compila arquivos `.jd` para WebAssembly |
16
+ | `@yakuzaa/jade-runtime` | Executa o WebAssembly gerado (stdlib, APIs, UI engine) |
17
+
18
+ ## Instalação individual
19
+
20
+ Se precisar apenas de uma parte:
21
+
22
+ ```bash
23
+ npm install @yakuzaa/jade-compiler # só o compilador
24
+ npm install @yakuzaa/jade-runtime # só o runtime
25
+ ```
26
+
27
+ ## Extensão VS Code
28
+
29
+ Instale manualmente pelo marketplace: `yakuzaa.jade-lang-vscode`
30
+
31
+ Ou via linha de comando:
32
+ ```bash
33
+ code --install-extension yakuzaa.jade-lang-vscode
34
+ ```
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@yakuzaa/jade",
3
+ "version": "0.1.0",
4
+ "description": "JADE — DSL empresarial em português compilada para WebAssembly. Instala compilador + runtime.",
5
+ "type": "module",
6
+ "files": [
7
+ "postinstall.js",
8
+ "README.md"
9
+ ],
10
+ "scripts": {
11
+ "postinstall": "node postinstall.js"
12
+ },
13
+ "dependencies": {
14
+ "@yakuzaa/jade-compiler": "0.1.0",
15
+ "@yakuzaa/jade-runtime": "0.1.0"
16
+ },
17
+ "keywords": [
18
+ "jade",
19
+ "dsl",
20
+ "compiler",
21
+ "runtime",
22
+ "webassembly",
23
+ "portuguese",
24
+ "enterprise"
25
+ ],
26
+ "author": "yakuzaa",
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/yakuzaa/jade.git"
31
+ },
32
+ "homepage": "https://github.com/yakuzaa/jade",
33
+ "bugs": {
34
+ "url": "https://github.com/yakuzaa/jade/issues"
35
+ },
36
+ "engines": {
37
+ "node": ">=20.0.0"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ }
42
+ }
package/postinstall.js ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * postinstall — recomenda a extensão JADE para VS Code
3
+ *
4
+ * Cria ou atualiza .vscode/extensions.json no projeto do usuário
5
+ * com a recomendação da extensão yakuzaa.jade-lang-vscode.
6
+ *
7
+ * Comportamento idêntico ao que Prettier, ESLint e Svelte fazem.
8
+ */
9
+
10
+ import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
11
+ import { resolve, join } from 'path';
12
+
13
+ const EXTENSION_ID = 'yakuzaa.jade-lang-vscode';
14
+
15
+ // De dentro de node_modules/@yakuzaa/jade/, a raiz do projeto é 3 níveis acima
16
+ const projectRoot = resolve(new URL(import.meta.url).pathname, '..', '..', '..', '..');
17
+ const vscodeDir = join(projectRoot, '.vscode');
18
+ const configPath = join(vscodeDir, 'extensions.json');
19
+
20
+ try {
21
+ // Garante que .vscode/ existe
22
+ if (!existsSync(vscodeDir)) {
23
+ mkdirSync(vscodeDir, { recursive: true });
24
+ }
25
+
26
+ // Lê o arquivo atual ou começa com estrutura vazia
27
+ let config = { recommendations: [] };
28
+ if (existsSync(configPath)) {
29
+ try {
30
+ config = JSON.parse(readFileSync(configPath, 'utf8'));
31
+ if (!Array.isArray(config.recommendations)) {
32
+ config.recommendations = [];
33
+ }
34
+ } catch {
35
+ // arquivo corrompido — recria
36
+ }
37
+ }
38
+
39
+ // Adiciona só se ainda não estiver lá
40
+ if (!config.recommendations.includes(EXTENSION_ID)) {
41
+ config.recommendations.push(EXTENSION_ID);
42
+ writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf8');
43
+ console.log('\x1b[36m[JADE]\x1b[0m Extensão VS Code recomendada: \x1b[33m' + EXTENSION_ID + '\x1b[0m');
44
+ console.log('\x1b[36m[JADE]\x1b[0m Abra o VS Code → Extensions → "Show Recommended Extensions" para instalar.');
45
+ }
46
+ } catch {
47
+ // postinstall nunca deve quebrar a instalação do usuário
48
+ }