@lcap/builder
Advanced tools
Comparing version 1.2.0-beta.8 to 1.2.0-beta.9
@@ -26,2 +26,3 @@ "use strict"; | ||
const build_theme_1 = require("./build-theme"); | ||
const build_declaration_1 = __importDefault(require("./build-declaration")); | ||
const zipDir = (basePath, fileName = 'client.zip', files = []) => new Promise((res) => { | ||
@@ -116,3 +117,9 @@ const zipPath = path_1.default.resolve(basePath, fileName); | ||
}) })); | ||
(0, exec_1.execSync)('npx tsc -p tsconfig.api.json && npm pack'); | ||
yield (0, build_declaration_1.default)(options); | ||
if (options.pnpm) { | ||
(0, exec_1.execSync)('pnpm pack'); | ||
} | ||
else { | ||
(0, exec_1.execSync)('npm pack'); | ||
} | ||
const manifest = (0, gen_manifest_config_1.default)(options); | ||
@@ -119,0 +126,0 @@ naslExtensionConfig.compilerInfoMap.manifest = JSON.stringify(manifest); |
@@ -16,2 +16,3 @@ "use strict"; | ||
exports.lcapBuild = exports.buildNaslUILibrary = exports.buildManifest = exports.buildI18N = exports.buildNaslUI = exports.buildThemeOld = void 0; | ||
/* eslint-disable no-param-reassign */ | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
@@ -27,2 +28,3 @@ const path_1 = __importDefault(require("path")); | ||
const gen_manifest_config_1 = __importDefault(require("./gens/gen-manifest-config")); | ||
const build_declaration_1 = __importDefault(require("./build-declaration")); | ||
function buildThemeOld(rootPath, destDir) { | ||
@@ -99,3 +101,9 @@ const configPath = path_1.default.join(rootPath, './lcap-ui.config.js'); | ||
buildI18N(options); | ||
(0, exec_1.execSync)('npx tsc -p tsconfig.api.json && npm pack'); | ||
yield (0, build_declaration_1.default)(options); | ||
if (options.pnpm) { | ||
(0, exec_1.execSync)('pnpm pack'); | ||
} | ||
else { | ||
(0, exec_1.execSync)('npm pack'); | ||
} | ||
buildManifest(options); | ||
@@ -102,0 +110,0 @@ }); |
@@ -37,2 +37,3 @@ export interface BuildIdeOptions { | ||
destDir: string; | ||
pnpm?: boolean; | ||
} |
@@ -7,3 +7,3 @@ export interface LcapCliConfig { | ||
} | ||
declare const _default: (rootPath: any, platform: any) => void; | ||
declare const _default: (rootPath: any, commandArgs?: {}) => void; | ||
export default _default; |
@@ -61,7 +61,4 @@ "use strict"; | ||
} | ||
exports.default = (rootPath, platform) => { | ||
logger_1.default.start('Start deploy...'); | ||
const lcapCliConfig = { | ||
platform, | ||
}; | ||
exports.default = (rootPath, commandArgs = {}) => { | ||
const lcapCliConfig = Object.assign({}, commandArgs); | ||
const configPath = `${rootPath}/.lcaprc`; | ||
@@ -68,0 +65,0 @@ if (fs_extra_1.default.existsSync(`${rootPath}/.lcaprc`)) { |
@@ -34,4 +34,5 @@ import type { Plugin } from 'vite'; | ||
destDir?: string; | ||
pnpm?: boolean; | ||
} | ||
declare const _default: (options: any) => Plugin<any>; | ||
export default _default; |
@@ -9,2 +9,3 @@ "use strict"; | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
const vite_1 = require("vite"); | ||
const lodash_1 = require("lodash"); | ||
@@ -27,3 +28,3 @@ const virtual_file_names_1 = require("../constants/virtual-file-names"); | ||
} | ||
const code = cssVars.map((filePath) => `@import '${filePath}';`).join('\n'); | ||
const code = cssVars.map((filePath) => `@import '${(0, vite_1.normalizePath)(filePath)}';`).join('\n'); | ||
return code; | ||
@@ -33,3 +34,3 @@ } | ||
const imports = [ | ||
`import createComponentPreview from '${path_1.default.resolve(__dirname, `../../input/${framework}/createComponentPreview`)}';`, | ||
`import createComponentPreview from '${(0, vite_1.normalizePath)(path_1.default.resolve(__dirname, `../../input/${framework}/createComponentPreview`))}';`, | ||
]; | ||
@@ -45,3 +46,3 @@ const stories = ['const stories = [']; | ||
const name = framework && framework.startsWith('vue') ? (0, lodash_1.kebabCase)(varName) : varName; | ||
imports.push(`import ${varName} from '${filePath}';`); | ||
imports.push(`import ${varName} from '${(0, vite_1.normalizePath)(filePath)}';`); | ||
stories.push(`{ demo: ${varName}, name: '${name}' },`); | ||
@@ -61,3 +62,4 @@ }); | ||
previewPages.forEach(({ name }) => { | ||
importCodes.push(`import ${name} from '${path_1.default.resolve(componentFolder, `../previews/${name}`)}';`); | ||
const importPath = (0, vite_1.normalizePath)(path_1.default.resolve(componentFolder, `../previews/${name}`)); | ||
importCodes.push(`import ${name} from '${importPath}';`); | ||
exportCodes.push(` ${name},`); | ||
@@ -76,3 +78,3 @@ }); | ||
'import Vue from \'vue\';', | ||
`import App from '${path_1.default.resolve(__dirname, '../../input/vue2/App')}';`, | ||
`import App from '${(0, vite_1.normalizePath)(path_1.default.resolve(__dirname, '../../input/vue2/App'))}';`, | ||
'Vue.config.productionTip = false;', | ||
@@ -86,3 +88,3 @@ 'const app = new Vue({ ...App });', | ||
'import ReactDOM from \'react-dom/client\'', | ||
`import App from '${path_1.default.resolve(__dirname, '../../input/react/App')}';`, | ||
`import App from '${(0, vite_1.normalizePath)(path_1.default.resolve(__dirname, '../../input/react/App'))}';`, | ||
]; | ||
@@ -133,3 +135,3 @@ const bodyCodes = [ | ||
const codes = [ | ||
`export { default as ComponentWrap } from '${path_1.default.resolve(__dirname, `../../input/${framework}/component-preview`)}'`, | ||
`export { default as ComponentWrap } from '${(0, vite_1.normalizePath)(path_1.default.resolve(__dirname, `../../input/${framework}/component-preview`))}'`, | ||
'export const renderAppPreview = (app) => app;', | ||
@@ -164,3 +166,3 @@ ]; | ||
return [ | ||
`export { renderAppPreview, ComponentWrap } from '${filePath}';`, | ||
`export { renderAppPreview, ComponentWrap } from '${(0, vite_1.normalizePath)(filePath)}';`, | ||
].join('\n'); | ||
@@ -167,0 +169,0 @@ } |
@@ -41,2 +41,6 @@ "use strict"; | ||
name = arr[arr.length - 1]; | ||
const Entity = 'Entity'; | ||
if (namespace.endsWith(Entity)) { | ||
namespace = `${namespace.substring(0, namespace.lastIndexOf(Entity))}.logics`; | ||
} | ||
return { namespace, name }; | ||
@@ -43,0 +47,0 @@ } |
@@ -151,3 +151,7 @@ "use strict"; | ||
|| ast.expression.body.type === 'JSXFragment')) { | ||
element.children.push(parseJSXElement2Slot(ast.expression.body, attrName, '')); | ||
let argName = ''; | ||
if (ast.expression.params && ast.expression.params[0] && ast.expression.params[0].type === 'Identifier') { | ||
argName = ast.expression.params[0].name; | ||
} | ||
element.children.push(parseJSXElement2Slot(ast.expression.body, attrName, argName)); | ||
return; | ||
@@ -154,0 +158,0 @@ } |
{ | ||
"name": "@lcap/builder", | ||
"version": "1.2.0-beta.8", | ||
"version": "1.2.0-beta.9", | ||
"description": "lcap builder utils", | ||
@@ -31,3 +31,4 @@ "main": "./lib/index.js", | ||
"watch": "tsc -w", | ||
"build": "tsc" | ||
"build": "tsc", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
@@ -34,0 +35,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
305414
130
7127
32
5