@plumeria/compiler 0.1.2 → 0.2.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.
- package/bin/css.mjs +44 -0
- package/package.json +5 -1
package/bin/css.mjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { styleText } from 'util';
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
|
|
8
|
+
const checkMark = styleText('greenBright', '✓');
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
const isPnpm = fs.existsSync(path.join(process.cwd(), 'node_modules/.pnpm'));
|
|
12
|
+
|
|
13
|
+
const typecheck = process.argv.includes('--type-check');
|
|
14
|
+
if (typecheck)
|
|
15
|
+
execSync('npx tsc --noEmit --incremental false', {
|
|
16
|
+
stdio: 'inherit',
|
|
17
|
+
cwd: process.cwd(),
|
|
18
|
+
});
|
|
19
|
+
// In the monorepo repository pnpm the right side is executed
|
|
20
|
+
const plumeriaPath = isPnpm ? findPnpmPlumeriaPath() : path.join(process.cwd(), 'node_modules/@plumeria');
|
|
21
|
+
|
|
22
|
+
const argv = process.argv.includes('--log') ? ' --log' : '';
|
|
23
|
+
execSync('npx tsx compiler/src/index.ts' + argv, {
|
|
24
|
+
stdio: 'inherit',
|
|
25
|
+
cwd: plumeriaPath,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const completed = typecheck ? 'Type-check completed' : '';
|
|
29
|
+
console.log(` ${checkMark} Compiled... ${completed}`);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error('Compilation failed:', error.message);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function findPnpmPlumeriaPath() {
|
|
36
|
+
const pnpmPath = path.join(process.cwd(), 'node_modules/.pnpm');
|
|
37
|
+
const plumeriaDir = fs.readdirSync(pnpmPath).find(dir => dir.startsWith('@plumeria+core@'));
|
|
38
|
+
|
|
39
|
+
if (!plumeriaDir) {
|
|
40
|
+
throw new Error('Could not find @plumeria package in pnpm directory');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return path.join(pnpmPath, plumeriaDir, 'node_modules/@plumeria');
|
|
44
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Compiler for Plumeria that build and optimizes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -13,9 +13,13 @@
|
|
|
13
13
|
"repository": "github:zss-in-js/plumeria",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"files": [
|
|
16
|
+
"bin",
|
|
16
17
|
"src",
|
|
17
18
|
"tsconfig.json"
|
|
18
19
|
],
|
|
20
|
+
"bin": {
|
|
21
|
+
"css": "./bin/css.mjs"
|
|
22
|
+
},
|
|
19
23
|
"dependencies": {
|
|
20
24
|
"fast-glob": "^3.3.3",
|
|
21
25
|
"postcss": "^8.4.49",
|