create-lupine 1.0.19 → 1.0.21
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/index.js
CHANGED
|
@@ -94,6 +94,55 @@ const TEMPLATES = [
|
|
|
94
94
|
];
|
|
95
95
|
|
|
96
96
|
async function init() {
|
|
97
|
+
console.log('Fetching latest versions...');
|
|
98
|
+
const versions = {
|
|
99
|
+
'lupine.api': getLatestVersion('lupine.api', '^1.0.1'),
|
|
100
|
+
'lupine.web': getLatestVersion('lupine.web', '^1.0.1'),
|
|
101
|
+
'lupine.components': getLatestVersion('lupine.components', '^1.0.1'),
|
|
102
|
+
'lupine.press': getLatestVersion('lupine.press', '^1.0.1')
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
if (argv['update-version']) {
|
|
106
|
+
const targetPkgPath = path.join(cwd, 'package.json');
|
|
107
|
+
if (!fs.existsSync(targetPkgPath)) {
|
|
108
|
+
console.log(red('✖ No package.json found in current directory.'));
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
let pkg;
|
|
113
|
+
try {
|
|
114
|
+
pkg = JSON.parse(fs.readFileSync(targetPkgPath, 'utf-8'));
|
|
115
|
+
} catch (e) {
|
|
116
|
+
console.log(red('✖ Failed to parse package.json.'));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
let updated = false;
|
|
121
|
+
['dependencies', 'devDependencies', 'peerDependencies'].forEach(depType => {
|
|
122
|
+
if (pkg[depType]) {
|
|
123
|
+
for (const [name, latestVer] of Object.entries(versions)) {
|
|
124
|
+
if (pkg[depType][name]) {
|
|
125
|
+
if (pkg[depType][name] !== latestVer) {
|
|
126
|
+
console.log(`${green('Upgrading')} ${name}: ${pkg[depType][name]} -> ${latestVer}`);
|
|
127
|
+
pkg[depType][name] = latestVer;
|
|
128
|
+
updated = true;
|
|
129
|
+
} else {
|
|
130
|
+
console.log(`${name} is already at latest version (${latestVer}).`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
if (updated) {
|
|
138
|
+
fs.writeFileSync(targetPkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
139
|
+
console.log(green('\n✔ package.json updated successfully. Please run "npm install" to apply changes.'));
|
|
140
|
+
} else {
|
|
141
|
+
console.log(green('\n✔ All target packages are already up-to-date.'));
|
|
142
|
+
}
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
97
146
|
let targetDir = argv._[0];
|
|
98
147
|
let template = argv.template || argv.t;
|
|
99
148
|
|
|
@@ -257,20 +306,14 @@ async function init() {
|
|
|
257
306
|
},
|
|
258
307
|
};
|
|
259
308
|
|
|
260
|
-
console.log('Fetching latest versions...');
|
|
261
|
-
const latestApi = getLatestVersion('lupine.api', '^1.0.1');
|
|
262
|
-
const latestWeb = getLatestVersion('lupine.web', '^1.0.1');
|
|
263
|
-
const latestComponents = getLatestVersion('lupine.components', '^1.0.1');
|
|
264
|
-
const latestPress = getLatestVersion('lupine.press', '^1.0.1');
|
|
265
|
-
|
|
266
309
|
pkg.dependencies = {
|
|
267
|
-
'lupine.api':
|
|
268
|
-
'lupine.components':
|
|
269
|
-
'lupine.web':
|
|
310
|
+
'lupine.api': versions['lupine.api'],
|
|
311
|
+
'lupine.components': versions['lupine.components'],
|
|
312
|
+
'lupine.web': versions['lupine.web'],
|
|
270
313
|
};
|
|
271
314
|
|
|
272
315
|
if (templateObj && templateObj.needsPress) {
|
|
273
|
-
pkg.dependencies['lupine.press'] =
|
|
316
|
+
pkg.dependencies['lupine.press'] = versions['lupine.press'];
|
|
274
317
|
pkg.devDependencies['gray-matter'] = '^4.0.3';
|
|
275
318
|
pkg.devDependencies['marked'] = '^17.0.1';
|
|
276
319
|
pkg.scripts['cp-docs'] = `node dev/cp-folder.js dist/server_root/${appName}_web/github-pj-name docs`;
|
package/package.json
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# AI Context for Lupine.js
|
|
2
2
|
|
|
3
|
+
**[CRITICAL SAFEGUARDS FOR CODE MODIFICATION]**
|
|
4
|
+
When performing multi-line code refactoring or replacement operations (`replace_file_content` / `multi_replace_file_content`), massive block-level overwrites and arbitrary code restructuring are **STRICTLY PROHIBITED**!
|
|
5
|
+
|
|
6
|
+
- Before making any modifications, you MUST invoke `view_file` or `grep_search` to verify the exact, up-to-date file structure and line numbers.
|
|
7
|
+
- The `StartLine` and `EndLine` range MUST be restricted strictly to the absolute minimum lines you intend to modify or delete.
|
|
8
|
+
- If you are merely inserting new code (e.g., adding a button or appending logic), target ONLY the immediately preceding line or bracket as your anchor. You are strictly forbidden from wrapping innocent, unmodified surrounding code into the `Replacement` payload. Violating this red line causes severe production accidents!
|
|
9
|
+
|
|
10
|
+
|
|
3
11
|
**SYSTEM ROLE**: You are an expert developer in `lupine.js`, a custom TypeScript full-stack framework.
|
|
4
12
|
|
|
5
13
|
**🛑 CRITICAL WARNINGS 🛑**
|
|
@@ -62,6 +70,32 @@ Supports nesting and media queries. **Prefer this over inline styles.** Define y
|
|
|
62
70
|
|
|
63
71
|
**NEVER hardcode colors** (e.g., `#000`, `#fff`, `#f0f0f0`). Always use CSS variables to support Dark/Light modes. If you must use a fallback, wrap it: `var(--primary-bg-color, #fff)`.
|
|
64
72
|
|
|
73
|
+
**Defining Variables for Modes in CSS-in-JS**:
|
|
74
|
+
Since Lupine.js uses a CSS-in-JS styling approach, when you need to define or override CSS variables specifically for light and dark modes within a component, use the `[data-theme="light" i]` and `[data-theme="dark" i]` selectors. **CRITICAL**: Because `CssProps` scopes styles by default, you MUST separate these mode styles into their own object and bind them using `bindGlobalStyle` with `noTopClassName = true` (the 4th argument).
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// 1. Separate theme variables into their own CSS object
|
|
78
|
+
const cssTheme: CssProps = {
|
|
79
|
+
'[data-theme="light" i]': {
|
|
80
|
+
'--my-comp-bg-color': '#e6e6e6',
|
|
81
|
+
},
|
|
82
|
+
'[data-theme="dark" i]': {
|
|
83
|
+
'--my-comp-bg-color': 'var(--primary-accent-color)',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
// 2. Bind globally. Param 4 (noTopClassName) MUST be true to prevent injecting a namespace prefix.
|
|
87
|
+
bindGlobalStyle('my-comp-theme', cssTheme, false, true);
|
|
88
|
+
|
|
89
|
+
// 3. Use the variable in your standard component styles
|
|
90
|
+
const css: CssProps = {
|
|
91
|
+
'.&-element': {
|
|
92
|
+
backgroundColor: 'var(--my-comp-bg-color)',
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
// Bind your component styles normally
|
|
96
|
+
bindGlobalStyle('my-comp-main', css);
|
|
97
|
+
```
|
|
98
|
+
|
|
65
99
|
#### 🎨 Color Variable Semantics (CRITICAL FOR DARK MODE)
|
|
66
100
|
|
|
67
101
|
1. **Backgrounds (`--primary-bg-color` vs `--secondary-bg-color`)**:
|
|
@@ -1,41 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { appLoader } from 'lupine.api/app-loader';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
const startApp = () => {
|
|
6
|
-
console.log('Loader: starting app...');
|
|
7
|
-
app = fork(path.join(__dirname, './index.js'), [], {
|
|
8
|
-
env: { ...process.env, FROM_LOADER: '1' },
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
// child->parent
|
|
12
|
-
app.on('message', async (msg: any) => {
|
|
13
|
-
if (msg?.id === 'debug' && msg?.message === 'restartApp') {
|
|
14
|
-
console.log('Loader: app requested restart.');
|
|
15
|
-
await restartApp();
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// child exit
|
|
20
|
-
app.on('exit', (code) => {
|
|
21
|
-
console.log('Loader: app exited with code', code);
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const restartApp = async () => {
|
|
26
|
-
if (!app) return;
|
|
27
|
-
|
|
28
|
-
return new Promise<void>((resolve) => {
|
|
29
|
-
console.log('Loader: sending shutdown to app...');
|
|
30
|
-
app!.send({ id: 'debug', message: 'shutdown' });
|
|
31
|
-
|
|
32
|
-
// wait for app.ts to exit
|
|
33
|
-
app!.once('exit', () => {
|
|
34
|
-
console.log('Loader: app fully exited, restarting...');
|
|
35
|
-
startApp();
|
|
36
|
-
resolve();
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
startApp();
|
|
4
|
+
appLoader.startApp(path.join(__dirname, './index.js'));
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
|
|
32
32
|
/* Modules */
|
|
33
33
|
// "module": "commonjs", amd, es2015 /* Specify what module code is generated. */,
|
|
34
|
-
"module": "
|
|
34
|
+
"module": "esnext" /* Specify what module code is generated. */,
|
|
35
35
|
// "rootDir": "./" /* Specify the root folder within your source files. */,
|
|
36
|
-
"moduleResolution": "
|
|
36
|
+
"moduleResolution": "bundler" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
|
37
37
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
38
38
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
39
39
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
40
40
|
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
41
41
|
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
42
|
-
"types": ["node"
|
|
42
|
+
"types": ["node"],
|
|
43
43
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
44
44
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
45
45
|
// "resolveJsonModule": true /* Enable importing .json files. */,
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
57
57
|
"sourceMap": true /* Create source map files for emitted JavaScript files. */,
|
|
58
58
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
59
|
-
"outFile": "../dist/build.js",
|
|
59
|
+
// "outFile": "../dist/build.js",
|
|
60
60
|
"outDir": "../dist" /* Specify an output folder for all emitted files. */,
|
|
61
61
|
// "removeComments": true, /* Disable emitting comments. */
|
|
62
62
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|