@kmlckj/licos-ai-cli 1.0.21 → 1.0.22
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/lib/__templates__/expo/client/app.config.ts +3 -1
- package/lib/__templates__/expo/client/entry.js +27 -0
- package/lib/__templates__/expo/client/package.json +1 -1
- package/lib/__templates__/expo/package.json +34 -34
- package/lib/__templates__/expo/template.config.js +109 -109
- package/lib/__templates__/nextjs/package.json +1 -1
- package/lib/__templates__/nextjs/pnpm-lock.yaml +11549 -11549
- package/lib/__templates__/nextjs/template.config.js +123 -123
- package/lib/__templates__/nuxt-vue/package.json +1 -1
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8586 -8586
- package/lib/__templates__/taro/config/index.ts +5 -5
- package/lib/__templates__/taro/package.json +123 -123
- package/lib/__templates__/taro/pnpm-lock.yaml +20848 -20848
- package/lib/__templates__/vite/package.json +1 -1
- package/lib/__templates__/vite/server/server.ts +70 -70
- package/lib/__templates__/vite/server/vite.ts +93 -93
- package/lib/__templates__/vite/template.config.js +130 -130
- package/lib/cli.js +1 -1
- package/package.json +1 -1
|
@@ -12,7 +12,9 @@ const normalizeBaseUrl = (value?: string) => {
|
|
|
12
12
|
return `/${trimmed.replace(/^\/+|\/+$/g, '')}`;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const baseUrl =
|
|
15
|
+
const baseUrl = process.env.LICOS_PREVIEW_BASE_PATH
|
|
16
|
+
? undefined
|
|
17
|
+
: normalizeBaseUrl(process.env.BASE_PATH || process.env.EXPO_PUBLIC_BASE_PATH);
|
|
16
18
|
|
|
17
19
|
export default ({ config }: ConfigContext): ExpoConfig => {
|
|
18
20
|
return {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const previewBase =
|
|
2
|
+
typeof window !== 'undefined' ? window.__LICOS_PREVIEW_BASE_PATH__ : undefined;
|
|
3
|
+
|
|
4
|
+
let originalUrl;
|
|
5
|
+
|
|
6
|
+
if (
|
|
7
|
+
typeof window !== 'undefined' &&
|
|
8
|
+
previewBase &&
|
|
9
|
+
window.location.pathname.startsWith(previewBase)
|
|
10
|
+
) {
|
|
11
|
+
const rest = window.location.pathname.slice(previewBase.length) || '/';
|
|
12
|
+
const appPath = rest.startsWith('/') ? rest : `/${rest}`;
|
|
13
|
+
originalUrl = `${window.location.pathname}${window.location.search}${window.location.hash}`;
|
|
14
|
+
window.history.replaceState(
|
|
15
|
+
window.history.state,
|
|
16
|
+
document.title,
|
|
17
|
+
`${appPath}${window.location.search}${window.location.hash}`,
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
require('expo-router/entry');
|
|
22
|
+
|
|
23
|
+
if (typeof window !== 'undefined' && originalUrl) {
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
window.history.replaceState(window.history.state, document.title, originalUrl);
|
|
26
|
+
}, 0);
|
|
27
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "expo-express-monorepo",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "bash .licosproj/scripts/dev_run.sh",
|
|
7
|
-
"build": "bash .licosproj/scripts/prod_build.sh",
|
|
8
|
-
"start": "bash .licosproj/scripts/prod_run.sh",
|
|
9
|
-
"ensure:deps": "node -e \"const fs=require('fs'); const bins=['client/node_modules/.bin/expo','server/node_modules/.bin/tsx','server/node_modules/.bin/tsc']; process.exit(bins.every((p)=>fs.existsSync(p)||fs.existsSync(p+'.cmd'))?0:1)\" || pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only",
|
|
10
|
-
"prebuild": "pnpm run ensure:deps",
|
|
11
|
-
"predev": "pnpm run ensure:deps",
|
|
12
|
-
"preinstall": "node -e \"const ua=process.env.npm_config_user_agent||''; if(!ua.includes('pnpm')){console.error('Use pnpm to install dependencies.'); process.exit(1)}\"",
|
|
13
|
-
"lint:client": "pnpm --dir ./client lint",
|
|
14
|
-
"lint:server": "pnpm --dir ./server lint",
|
|
15
|
-
"lint:all": "pnpm --dir ./client lint && pnpm --dir ./server lint"
|
|
16
|
-
},
|
|
17
|
-
"dependencies": {},
|
|
18
|
-
"devDependencies": {},
|
|
19
|
-
"packageManager": "pnpm@9.0.0",
|
|
20
|
-
"engines": {
|
|
21
|
-
"pnpm": ">=9.0.0"
|
|
22
|
-
},
|
|
23
|
-
"pnpm": {
|
|
24
|
-
"overrides": {
|
|
25
|
-
"decode-uri-component": "0.2.2",
|
|
26
|
-
"esbuild": "0.27.2",
|
|
27
|
-
"regenerate-unicode-properties": "10.2.2",
|
|
28
|
-
"requireg": "0.2.2"
|
|
29
|
-
},
|
|
30
|
-
"patchedDependencies": {
|
|
31
|
-
"expo@54.0.33": "patches/expo@54.0.33.patch"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "expo-express-monorepo",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "bash .licosproj/scripts/dev_run.sh",
|
|
7
|
+
"build": "bash .licosproj/scripts/prod_build.sh",
|
|
8
|
+
"start": "bash .licosproj/scripts/prod_run.sh",
|
|
9
|
+
"ensure:deps": "node -e \"const fs=require('fs'); const bins=['client/node_modules/.bin/expo','server/node_modules/.bin/tsx','server/node_modules/.bin/tsc']; process.exit(bins.every((p)=>fs.existsSync(p)||fs.existsSync(p+'.cmd'))?0:1)\" || pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only",
|
|
10
|
+
"prebuild": "pnpm run ensure:deps",
|
|
11
|
+
"predev": "pnpm run ensure:deps",
|
|
12
|
+
"preinstall": "node -e \"const ua=process.env.npm_config_user_agent||''; if(!ua.includes('pnpm')){console.error('Use pnpm to install dependencies.'); process.exit(1)}\"",
|
|
13
|
+
"lint:client": "pnpm --dir ./client lint",
|
|
14
|
+
"lint:server": "pnpm --dir ./server lint",
|
|
15
|
+
"lint:all": "pnpm --dir ./client lint && pnpm --dir ./server lint"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {},
|
|
18
|
+
"devDependencies": {},
|
|
19
|
+
"packageManager": "pnpm@9.0.0",
|
|
20
|
+
"engines": {
|
|
21
|
+
"pnpm": ">=9.0.0"
|
|
22
|
+
},
|
|
23
|
+
"pnpm": {
|
|
24
|
+
"overrides": {
|
|
25
|
+
"decode-uri-component": "0.2.2",
|
|
26
|
+
"esbuild": "0.27.2",
|
|
27
|
+
"regenerate-unicode-properties": "10.2.2",
|
|
28
|
+
"requireg": "0.2.2"
|
|
29
|
+
},
|
|
30
|
+
"patchedDependencies": {
|
|
31
|
+
"expo@54.0.33": "patches/expo@54.0.33.patch"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { spawn } from 'child_process';
|
|
4
|
-
import { resolve, join, basename, dirname } from 'path';
|
|
5
|
-
import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = dirname(__filename);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export const paramsSchema = {
|
|
17
|
-
type: 'object',
|
|
18
|
-
properties: {
|
|
19
|
-
appName: {
|
|
20
|
-
type: 'string',
|
|
21
|
-
minLength: 1,
|
|
22
|
-
pattern: '^[a-z0-9-]+$',
|
|
23
|
-
description:
|
|
24
|
-
'Application name (lowercase, alphanumeric and hyphens only)',
|
|
25
|
-
},
|
|
26
|
-
port: {
|
|
27
|
-
type: 'number',
|
|
28
|
-
default: 8081,
|
|
29
|
-
minimum: 1024,
|
|
30
|
-
maximum: 65535,
|
|
31
|
-
description: 'Metro bundler port',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
required: [],
|
|
35
|
-
additionalProperties: false,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const config = {
|
|
39
|
-
description: 'Expo template for React Native applications',
|
|
40
|
-
paramsSchema,
|
|
41
|
-
defaultParams: {
|
|
42
|
-
port: 9090,
|
|
43
|
-
appName: 'my-expo-app',
|
|
44
|
-
},
|
|
45
|
-
onBeforeRender: async context => {
|
|
46
|
-
console.log(`Creating Expo project: ${context.appName}`);
|
|
47
|
-
return context;
|
|
48
|
-
},
|
|
49
|
-
onAfterRender: async (context, outputPath) => {
|
|
50
|
-
console.log(`\nProject created at: ${outputPath}`);
|
|
51
|
-
console.log(`\nConfiguration:`);
|
|
52
|
-
console.log(` - Framework: Expo`);
|
|
53
|
-
console.log(` - Port: ${context.port}`);
|
|
54
|
-
},
|
|
55
|
-
onComplete: async (_context, outputPath) => {
|
|
56
|
-
if (process.env.NODE_ENV === 'test') {
|
|
57
|
-
console.log('⊘ Skipping dependency install in test environment');
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (_context.options?.skipInstall) {
|
|
61
|
-
console.log('⊘ Skipping dependency install because --skip-install was provided');
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const cmd = 'bash';
|
|
66
|
-
const args = [
|
|
67
|
-
'-lc',
|
|
68
|
-
'pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only',
|
|
69
|
-
];
|
|
70
|
-
console.log(
|
|
71
|
-
`\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
const projectRoot = resolve(outputPath);
|
|
76
|
-
|
|
77
|
-
const logDir = process.env.LICOS_LOG_DIR || resolve(__dirname, '../.log');
|
|
78
|
-
mkdirSync(logDir, { recursive: true });
|
|
79
|
-
|
|
80
|
-
const projectName = basename(projectRoot);
|
|
81
|
-
const logFile = join(logDir, `${projectName}-init.log`);
|
|
82
|
-
|
|
83
|
-
const timestamp = new Date().toISOString();
|
|
84
|
-
appendFileSync(
|
|
85
|
-
logFile,
|
|
86
|
-
`\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const logFd = openSync(logFile, 'a');
|
|
90
|
-
|
|
91
|
-
const child = spawn(cmd, args, {
|
|
92
|
-
cwd: projectRoot,
|
|
93
|
-
detached: true,
|
|
94
|
-
stdio: ['ignore', logFd, logFd],
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
child.unref();
|
|
98
|
-
closeSync(logFd);
|
|
99
|
-
|
|
100
|
-
console.log('✓ pnpm install triggered (running in background)');
|
|
101
|
-
console.log(` Log file: ${logFile}`);
|
|
102
|
-
} catch (error) {
|
|
103
|
-
console.error('✗ Failed to trigger pnpm install:', error);
|
|
104
|
-
console.log(' You can manually run: pnpm install --registry=https://registry.npmmirror.com || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile');
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export default config;
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { spawn } from 'child_process';
|
|
4
|
+
import { resolve, join, basename, dirname } from 'path';
|
|
5
|
+
import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export const paramsSchema = {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
appName: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
minLength: 1,
|
|
22
|
+
pattern: '^[a-z0-9-]+$',
|
|
23
|
+
description:
|
|
24
|
+
'Application name (lowercase, alphanumeric and hyphens only)',
|
|
25
|
+
},
|
|
26
|
+
port: {
|
|
27
|
+
type: 'number',
|
|
28
|
+
default: 8081,
|
|
29
|
+
minimum: 1024,
|
|
30
|
+
maximum: 65535,
|
|
31
|
+
description: 'Metro bundler port',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
required: [],
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const config = {
|
|
39
|
+
description: 'Expo template for React Native applications',
|
|
40
|
+
paramsSchema,
|
|
41
|
+
defaultParams: {
|
|
42
|
+
port: 9090,
|
|
43
|
+
appName: 'my-expo-app',
|
|
44
|
+
},
|
|
45
|
+
onBeforeRender: async context => {
|
|
46
|
+
console.log(`Creating Expo project: ${context.appName}`);
|
|
47
|
+
return context;
|
|
48
|
+
},
|
|
49
|
+
onAfterRender: async (context, outputPath) => {
|
|
50
|
+
console.log(`\nProject created at: ${outputPath}`);
|
|
51
|
+
console.log(`\nConfiguration:`);
|
|
52
|
+
console.log(` - Framework: Expo`);
|
|
53
|
+
console.log(` - Port: ${context.port}`);
|
|
54
|
+
},
|
|
55
|
+
onComplete: async (_context, outputPath) => {
|
|
56
|
+
if (process.env.NODE_ENV === 'test') {
|
|
57
|
+
console.log('⊘ Skipping dependency install in test environment');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (_context.options?.skipInstall) {
|
|
61
|
+
console.log('⊘ Skipping dependency install because --skip-install was provided');
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const cmd = 'bash';
|
|
66
|
+
const args = [
|
|
67
|
+
'-lc',
|
|
68
|
+
'pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only',
|
|
69
|
+
];
|
|
70
|
+
console.log(
|
|
71
|
+
`\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
const projectRoot = resolve(outputPath);
|
|
76
|
+
|
|
77
|
+
const logDir = process.env.LICOS_LOG_DIR || resolve(__dirname, '../.log');
|
|
78
|
+
mkdirSync(logDir, { recursive: true });
|
|
79
|
+
|
|
80
|
+
const projectName = basename(projectRoot);
|
|
81
|
+
const logFile = join(logDir, `${projectName}-init.log`);
|
|
82
|
+
|
|
83
|
+
const timestamp = new Date().toISOString();
|
|
84
|
+
appendFileSync(
|
|
85
|
+
logFile,
|
|
86
|
+
`\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const logFd = openSync(logFile, 'a');
|
|
90
|
+
|
|
91
|
+
const child = spawn(cmd, args, {
|
|
92
|
+
cwd: projectRoot,
|
|
93
|
+
detached: true,
|
|
94
|
+
stdio: ['ignore', logFd, logFd],
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
child.unref();
|
|
98
|
+
closeSync(logFd);
|
|
99
|
+
|
|
100
|
+
console.log('✓ pnpm install triggered (running in background)');
|
|
101
|
+
console.log(` Log file: ${logFile}`);
|
|
102
|
+
} catch (error) {
|
|
103
|
+
console.error('✗ Failed to trigger pnpm install:', error);
|
|
104
|
+
console.log(' You can manually run: pnpm install --registry=https://registry.npmmirror.com || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile');
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export default config;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "bash ./scripts/build.sh",
|
|
7
7
|
"dev": "bash ./scripts/dev.sh",
|
|
8
|
-
"ensure:deps": "node -e \"const fs=require('fs'); const bins=['node_modules/.bin/next','node_modules/.bin/tsx','node_modules/.bin/tsup','node_modules/.bin/eslint','node_modules/.bin/tsc']; process.exit(bins.every((p)=>fs.existsSync(p)||fs.existsSync(p+'.cmd'))?0:1)\" || pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only",
|
|
8
|
+
"ensure:deps": "node -e \"const fs=require('fs'); const bins=['node_modules/.bin/next','node_modules/.bin/tsx','node_modules/.bin/tsup','node_modules/.bin/eslint','node_modules/.bin/tsc']; process.exit(bins.every((p)=>fs.existsSync(p)||fs.existsSync(p+'.cmd'))?0:1)\" || pnpm install --registry=https://registry.npmmirror.com --prefer-frozen-lockfile --prefer-offline --reporter=append-only || pnpm install --registry=https://registry.npmjs.org --no-frozen-lockfile --reporter=append-only",
|
|
9
9
|
"prebuild": "pnpm run ensure:deps",
|
|
10
10
|
"predev": "pnpm run ensure:deps",
|
|
11
11
|
"preinstall": "node -e \"const ua=process.env.npm_config_user_agent||''; if(!ua.includes('pnpm')){console.error('Use pnpm to install dependencies.'); process.exit(1)}\"",
|