CLI_BIN_NAME和CLI_NAME分开
This commit is contained in:
parent
768c9f4256
commit
3b8a1b8c5e
|
|
@ -1,5 +1,6 @@
|
|||
export declare const CLI_VERSION: any;
|
||||
export declare const CLI_NAME: string;
|
||||
export declare const CLI_NAME: any;
|
||||
export declare const CLI_BIN_NAME: string;
|
||||
export declare const BASE_DIR: string;
|
||||
export declare const USER_CONFIG_FILE_NAME = "oak.config.json";
|
||||
export declare const USER_CONFIG_FILE: string;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MINI_VERSION_URL = exports.CNPM_BASE_URL = exports.NODE_MODULES_DIR_NAME = exports.USER_CONFIG_FILE = exports.USER_CONFIG_FILE_NAME = exports.BASE_DIR = exports.CLI_NAME = exports.CLI_VERSION = void 0;
|
||||
exports.MINI_VERSION_URL = exports.CNPM_BASE_URL = exports.NODE_MODULES_DIR_NAME = exports.USER_CONFIG_FILE = exports.USER_CONFIG_FILE_NAME = exports.BASE_DIR = exports.CLI_BIN_NAME = exports.CLI_NAME = exports.CLI_VERSION = void 0;
|
||||
exports.CLI_VERSION = require('../package.json')['version'];
|
||||
exports.CLI_NAME = Object.keys(require('../package.json')['bin'])[0];
|
||||
exports.CLI_NAME = require('../package.json')['name'];
|
||||
exports.CLI_BIN_NAME = Object.keys(require('../package.json')['bin'])[0];
|
||||
exports.BASE_DIR = process.cwd();
|
||||
exports.USER_CONFIG_FILE_NAME = 'oak.config.json';
|
||||
exports.USER_CONFIG_FILE = exports.BASE_DIR + '/' + exports.USER_CONFIG_FILE_NAME;
|
||||
|
|
|
|||
|
|
@ -108,8 +108,9 @@ async function create(dirName, cmd) {
|
|||
name,
|
||||
version,
|
||||
description,
|
||||
cliversion: config_1.CLI_VERSION,
|
||||
cliname: config_1.CLI_NAME,
|
||||
cliVersion: config_1.CLI_VERSION,
|
||||
cliName: config_1.CLI_NAME,
|
||||
cliBinName: config_1.CLI_BIN_NAME,
|
||||
isDev,
|
||||
});
|
||||
// 获取tsconfig.json内容
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ export interface PackageJsonInput {
|
|||
name: string;
|
||||
version?: string;
|
||||
description?: string;
|
||||
cliversion: string;
|
||||
cliname: string;
|
||||
cliVersion: string;
|
||||
cliName: string;
|
||||
cliBinName: string;
|
||||
isDev?: boolean;
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PackageJsonInput } from './interface';
|
||||
export declare function packageJsonContent({ name, version, description, cliversion, cliname, isDev, }: PackageJsonInput): string;
|
||||
export declare function packageJsonContent({ name, version, description, cliVersion, cliName, cliBinName, isDev, }: PackageJsonInput): string;
|
||||
export declare function tsConfigJsonContent(): string;
|
||||
export declare function tsConfigBuildJsonContent(): string;
|
||||
export declare function tsConfigPathsJsonContent(): string;
|
||||
|
|
|
|||
|
|
@ -1,39 +1,40 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.oakConfigContentWithWeb = exports.appJsonContentWithWeb = exports.oakConfigContentWithWeChatMp = exports.appJsonContentWithWeChatMp = exports.projectConfigContentWithWeChatMp = exports.tsConfigWebJsonContent = exports.tsConfigMpJsonContent = exports.tsConfigPathsJsonContent = exports.tsConfigBuildJsonContent = exports.tsConfigJsonContent = exports.packageJsonContent = void 0;
|
||||
function packageJsonContent({ name, version, description, cliversion, cliname, isDev, }) {
|
||||
let oakPackageStr;
|
||||
function packageJsonContent({ name, version, description, cliVersion, cliName, cliBinName, isDev, }) {
|
||||
let oakDependencyStr;
|
||||
let oakDevDependencyStr;
|
||||
if (isDev) {
|
||||
oakPackageStr = `"${cliname}": "file:../${cliname}",
|
||||
"oak-common-aspect": "file:../oak-common-aspect",
|
||||
oakDependencyStr = `"oak-common-aspect": "file:../oak-common-aspect",
|
||||
"oak-domain": "file:../oak-domain",
|
||||
"oak-frontend-base": "file:../oak-frontend-base",
|
||||
"oak-external-sdk": "file:../oak-external-sdk",
|
||||
"oak-general-business": "file:../oak-general-business",
|
||||
"oak-memory-tree-store": "file:../oak-memory-tree-store",`;
|
||||
oakDevDependencyStr = `"${cliName}": "file:../oak-cli",`;
|
||||
}
|
||||
else {
|
||||
oakPackageStr = `"${cliname}": "^${cliversion}",
|
||||
"oak-common-aspect": "^1.0.0",
|
||||
oakDependencyStr = `"oak-common-aspect": "^1.0.0",
|
||||
"oak-domain": "^1.0.0",
|
||||
"oak-frontend-base": "^1.0.0",
|
||||
"oak-general-business": "^1.0.0",
|
||||
"oak-external-sdk": "^1.0.0",
|
||||
"oak-memory-tree-store": "^1.0.0",`;
|
||||
oakDevDependencyStr = `"${cliName}": "^${cliVersion}",`;
|
||||
}
|
||||
return `{
|
||||
"name": "${name}",
|
||||
"version": "${version}",
|
||||
"description": "${description}",
|
||||
"scripts": {
|
||||
"make:domain": "${cliname} make",
|
||||
"start:mp": "${cliname} start --target mp --mode development",
|
||||
"build:mp": "${cliname} build --target mp --mode production",
|
||||
"build-analyze:mp": "${cliname} build --target mp --mode production --analyze",
|
||||
"start:web": "${cliname} start --target web --mode development",
|
||||
"build:web": "${cliname} build --target web --mode production",
|
||||
"build-analyze:web": "${cliname} build --target web --mode production --analyze",
|
||||
"build": "tsc -p tsconfig.build.json",
|
||||
"make:domain": "${cliBinName} make",
|
||||
"start:mp": "${cliBinName} start --target mp --mode development",
|
||||
"build:mp": "${cliBinName} build --target mp --mode production",
|
||||
"build-analyze:mp": "${cliBinName} build --target mp --mode production --analyze",
|
||||
"start:web": "${cliBinName} start --target web --mode development",
|
||||
"build:web": "${cliBinName} build --target web --mode production",
|
||||
"build-analyze:web": "${cliBinName} build --target web --mode production --analyze",
|
||||
"build": "tsc",
|
||||
"server:init": "cross-env NODE_ENV=development; cross-env OAK_PLATFORM=server ts-node scripts/initServer.ts",
|
||||
"server:start": "cross-env NODE_ENV=development; cross-env OAK_PLATFORM=server ts-node scripts/startServer.ts",
|
||||
"postinstall": "npm run make:domain"
|
||||
|
|
@ -54,7 +55,7 @@ function packageJsonContent({ name, version, description, cliversion, cliname, i
|
|||
"i18next-resource-store-loader": "^0.1.2",
|
||||
"lodash": "^4.17.21",
|
||||
"nprogress": "^0.2.0",
|
||||
${oakPackageStr}
|
||||
${oakDependencyStr}
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.1.0",
|
||||
"react-i18next": "^11.18.0",
|
||||
|
|
@ -92,6 +93,7 @@ function packageJsonContent({ name, version, description, cliversion, cliname, i
|
|||
"@types/shelljs": "^0.8.11",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@types/wechat-miniprogram": "^3.4.0",
|
||||
${oakDevDependencyStr}
|
||||
"assert": "^2.0.0",
|
||||
"babel-jest": "^27.4.2",
|
||||
"babel-loader": "^8.2.3",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@xuchangzju/oak-cli",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.6",
|
||||
"description": "oak-cli脚手架",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
export const CLI_VERSION = require('../package.json')['version'];
|
||||
export const CLI_NAME = Object.keys(require('../package.json')['bin'])[0];
|
||||
export const CLI_NAME = require('../package.json')['name'];
|
||||
export const CLI_BIN_NAME = Object.keys(require('../package.json')['bin'])[0];
|
||||
|
||||
export const BASE_DIR = process.cwd()
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
USER_CONFIG_FILE_NAME,
|
||||
CLI_NAME,
|
||||
MINI_VERSION_URL,
|
||||
CLI_BIN_NAME,
|
||||
} from './config';
|
||||
import {
|
||||
packageJsonContent,
|
||||
|
|
@ -188,8 +189,9 @@ export async function create(dirName: string, cmd: any) {
|
|||
name,
|
||||
version,
|
||||
description,
|
||||
cliversion: CLI_VERSION,
|
||||
cliname: CLI_NAME,
|
||||
cliVersion: CLI_VERSION,
|
||||
cliName: CLI_NAME,
|
||||
cliBinName: CLI_BIN_NAME,
|
||||
isDev,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ export interface PackageJsonInput {
|
|||
name: string;
|
||||
version?: string;
|
||||
description?: string;
|
||||
cliversion: string;
|
||||
cliname: string;
|
||||
cliVersion: string;
|
||||
cliName: string;
|
||||
cliBinName: string;
|
||||
isDev?: boolean;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,28 +3,30 @@ export function packageJsonContent({
|
|||
name,
|
||||
version,
|
||||
description,
|
||||
cliversion,
|
||||
cliname,
|
||||
cliVersion,
|
||||
cliName,
|
||||
cliBinName,
|
||||
isDev,
|
||||
}: PackageJsonInput) {
|
||||
let oakPackageStr;
|
||||
let oakDependencyStr;
|
||||
let oakDevDependencyStr;
|
||||
if (isDev) {
|
||||
oakPackageStr = `"${cliname}": "file:../${cliname}",
|
||||
"oak-common-aspect": "file:../oak-common-aspect",
|
||||
oakDependencyStr = `"oak-common-aspect": "file:../oak-common-aspect",
|
||||
"oak-domain": "file:../oak-domain",
|
||||
"oak-frontend-base": "file:../oak-frontend-base",
|
||||
"oak-external-sdk": "file:../oak-external-sdk",
|
||||
"oak-general-business": "file:../oak-general-business",
|
||||
"oak-memory-tree-store": "file:../oak-memory-tree-store",`;
|
||||
oakDevDependencyStr = `"${cliName}": "file:../oak-cli",`
|
||||
}
|
||||
else {
|
||||
oakPackageStr = `"${cliname}": "^${cliversion}",
|
||||
"oak-common-aspect": "^1.0.0",
|
||||
oakDependencyStr = `"oak-common-aspect": "^1.0.0",
|
||||
"oak-domain": "^1.0.0",
|
||||
"oak-frontend-base": "^1.0.0",
|
||||
"oak-general-business": "^1.0.0",
|
||||
"oak-external-sdk": "^1.0.0",
|
||||
"oak-memory-tree-store": "^1.0.0",`;
|
||||
oakDevDependencyStr = `"${cliName}": "^${cliVersion}",`
|
||||
}
|
||||
|
||||
return `{
|
||||
|
|
@ -32,14 +34,14 @@ export function packageJsonContent({
|
|||
"version": "${version}",
|
||||
"description": "${description}",
|
||||
"scripts": {
|
||||
"make:domain": "${cliname} make",
|
||||
"start:mp": "${cliname} start --target mp --mode development",
|
||||
"build:mp": "${cliname} build --target mp --mode production",
|
||||
"build-analyze:mp": "${cliname} build --target mp --mode production --analyze",
|
||||
"start:web": "${cliname} start --target web --mode development",
|
||||
"build:web": "${cliname} build --target web --mode production",
|
||||
"build-analyze:web": "${cliname} build --target web --mode production --analyze",
|
||||
"build": "tsc -p tsconfig.build.json",
|
||||
"make:domain": "${cliBinName} make",
|
||||
"start:mp": "${cliBinName} start --target mp --mode development",
|
||||
"build:mp": "${cliBinName} build --target mp --mode production",
|
||||
"build-analyze:mp": "${cliBinName} build --target mp --mode production --analyze",
|
||||
"start:web": "${cliBinName} start --target web --mode development",
|
||||
"build:web": "${cliBinName} build --target web --mode production",
|
||||
"build-analyze:web": "${cliBinName} build --target web --mode production --analyze",
|
||||
"build": "tsc",
|
||||
"server:init": "cross-env NODE_ENV=development; cross-env OAK_PLATFORM=server ts-node scripts/initServer.ts",
|
||||
"server:start": "cross-env NODE_ENV=development; cross-env OAK_PLATFORM=server ts-node scripts/startServer.ts",
|
||||
"postinstall": "npm run make:domain"
|
||||
|
|
@ -60,7 +62,7 @@ export function packageJsonContent({
|
|||
"i18next-resource-store-loader": "^0.1.2",
|
||||
"lodash": "^4.17.21",
|
||||
"nprogress": "^0.2.0",
|
||||
${oakPackageStr}
|
||||
${oakDependencyStr}
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.1.0",
|
||||
"react-i18next": "^11.18.0",
|
||||
|
|
@ -98,6 +100,7 @@ export function packageJsonContent({
|
|||
"@types/shelljs": "^0.8.11",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@types/wechat-miniprogram": "^3.4.0",
|
||||
${oakDevDependencyStr}
|
||||
"assert": "^2.0.0",
|
||||
"babel-jest": "^27.4.2",
|
||||
"babel-loader": "^8.2.3",
|
||||
|
|
|
|||
Loading…
Reference in New Issue