aiot-toolkit 1.0.17 → 1.0.18-aspect-beta.1
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/CHANGELOG.md +0 -9
- package/README.md +0 -9
- package/bin/index.js +0 -1
- package/gen-webpack-conf/helpers.js +14 -7
- package/gen-webpack-conf/index.js +24 -14
- package/gen-webpack-conf/validate.js +30 -1
- package/lib/commands/compile.js +1 -1
- package/lib/commands/utils.js +1 -1
- package/lib/utils.js +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
#### [1.0.17] - 2022-04-25
|
|
4
|
-
|
|
5
|
-
- 支持 `scroll` 组件
|
|
6
|
-
- 支持 `maml` 组件(和`image`组件一致)
|
|
7
|
-
- 修复路径为变量时,未转换成绝对路径的问题
|
|
8
|
-
- `server` 命令新增 `--devtool` 配置参数
|
|
9
|
-
- 增加 `maskRepeat` 属性
|
|
10
|
-
- 增加 CSS 属性 `box-shadow`、`text-shadow` 和 `background-blend-mode`
|
|
11
|
-
|
|
12
3
|
#### [1.0.16] - 2022-12-02
|
|
13
4
|
|
|
14
5
|
- 支持打包应用服务 service 文件
|
package/README.md
CHANGED
|
@@ -41,15 +41,6 @@ npm run release
|
|
|
41
41
|
|
|
42
42
|
### 版本日志(详情请在 node_modules 中查看 CHANGELOG)
|
|
43
43
|
|
|
44
|
-
#### [1.0.17] - 2022-04-25
|
|
45
|
-
|
|
46
|
-
- 支持 `scroll` 组件
|
|
47
|
-
- 支持 `maml` 组件(和`image`组件一致)
|
|
48
|
-
- 修复路径为变量时,未转换成绝对路径的问题
|
|
49
|
-
- `server` 命令新增 `--devtool` 配置参数
|
|
50
|
-
- 增加 `maskRepeat` 属性
|
|
51
|
-
- 增加 CSS 属性 `box-shadow`、`text-shadow` 和 `background-blend-mode`
|
|
52
|
-
|
|
53
44
|
#### [1.0.16] - 2022-12-02
|
|
54
45
|
|
|
55
46
|
- 支持打包应用服务 service 文件
|
package/bin/index.js
CHANGED
|
@@ -118,7 +118,6 @@ program
|
|
|
118
118
|
.description('open server for project')
|
|
119
119
|
.option('--port <port>', 'specified port')
|
|
120
120
|
.option('--watch', 'recompile project while file changes')
|
|
121
|
-
.option('--devtool <value>', 'source map config')
|
|
122
121
|
.option('--clear-records', 'clear device records')
|
|
123
122
|
.option('--disable-adb', 'disable adb debug')
|
|
124
123
|
.option('--chrome-path <chrome-path>', 'support for a user specified chrome path')
|
|
@@ -45,14 +45,16 @@ exports.cleanup = function cleanup(BUILD_DIR, DIST_DIR) {
|
|
|
45
45
|
* 使用 node 原生模块给予警告
|
|
46
46
|
*/
|
|
47
47
|
exports.checkBuiltinModules = function checkBuiltinModules({ request }, callback) {
|
|
48
|
-
const packageJson = require(path.join(globalConfig.projectPath, 'package.json'))
|
|
49
48
|
// 提取 package.json 中的依赖
|
|
50
49
|
let projectDependencies = []
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
if (!globalConfig.aspectTemplate.isAspect) {
|
|
51
|
+
const packageJson = require(path.join(globalConfig.projectPath, 'package.json'))
|
|
52
|
+
if (packageJson.devDependencies) {
|
|
53
|
+
projectDependencies = Object.keys(packageJson.devDependencies)
|
|
54
|
+
}
|
|
55
|
+
if (packageJson.dependencies) {
|
|
56
|
+
projectDependencies = projectDependencies.concat(Object.keys(packageJson.dependencies))
|
|
57
|
+
}
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
// 枚举 node 原生模块
|
|
@@ -107,7 +109,12 @@ exports.checkBuiltinModules = function checkBuiltinModules({ request }, callback
|
|
|
107
109
|
* @param {boolean} disableScriptV8V65
|
|
108
110
|
*/
|
|
109
111
|
exports.setAdaptForV8Version = function setAdaptForV8Version(disableScriptV8V65, manifest, cwd) {
|
|
110
|
-
|
|
112
|
+
let packageJsonFile
|
|
113
|
+
if (globalConfig.aspectTemplate.isAspect) {
|
|
114
|
+
packageJsonFile = path.resolve(globalConfig.aspectTemplate.projectPath, 'package.json')
|
|
115
|
+
} else {
|
|
116
|
+
packageJsonFile = path.resolve(cwd, 'package.json')
|
|
117
|
+
}
|
|
111
118
|
const packageJson = readJson(packageJsonFile)
|
|
112
119
|
const minPlatformVersion = parseInt(manifest.minPlatformVersion)
|
|
113
120
|
if (fs.existsSync(packageJsonFile)) {
|
|
@@ -100,7 +100,7 @@ module.exports = function genWebpackConf(launchOptions, mode) {
|
|
|
100
100
|
// 是否需要设置全局的打包模式为mina-h5
|
|
101
101
|
const manifestFileTemp = path.resolve(cwd, 'manifest.json')
|
|
102
102
|
let isMinaH5 = false
|
|
103
|
-
if (fs.existsSync(manifestFileTemp)) {
|
|
103
|
+
if (fs.existsSync(manifestFileTemp) && !globalConfig.aspectTemplate.isAspect) {
|
|
104
104
|
const manifestTemp = readJson(manifestFileTemp)
|
|
105
105
|
const { deviceTypeList } = manifestTemp
|
|
106
106
|
const minaH5Type = ['tv', 'tv-h5']
|
|
@@ -133,18 +133,32 @@ module.exports = function genWebpackConf(launchOptions, mode) {
|
|
|
133
133
|
// 清理 BUILD_DIR DIST_DIR
|
|
134
134
|
cleanup(BUILD_DIR, DIST_DIR)
|
|
135
135
|
|
|
136
|
+
// 将aspect文件夹的config.json文件复制到build文件夹
|
|
137
|
+
if (globalConfig.aspectTemplate.isAspect && !globalConfig.aspectTemplate.isApp) {
|
|
138
|
+
const configJSON = path.join(cwd, 'config.json')
|
|
139
|
+
if (fs.existsSync(configJSON)) {
|
|
140
|
+
const sourceStream = fs.createReadStream(configJSON)
|
|
141
|
+
const targetStream = fs.createWriteStream(path.join(BUILD_DIR, path.basename(configJSON)))
|
|
142
|
+
|
|
143
|
+
sourceStream.pipe(targetStream)
|
|
144
|
+
} else {
|
|
145
|
+
colorconsole.log(`The path of project ,${configJSON} not exist`)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
136
149
|
let manifest
|
|
137
150
|
try {
|
|
138
151
|
manifest = readJson(manifestFile)
|
|
139
152
|
} catch (e) {
|
|
140
153
|
throw new KnownError('manifest.json parsing failed!')
|
|
141
154
|
}
|
|
155
|
+
if (!globalConfig.aspectTemplate.isApp) {
|
|
156
|
+
validateManifest(SRC_DIR, manifest, compileOptionsObject)
|
|
142
157
|
|
|
143
|
-
|
|
158
|
+
valiedateSitemap(SRC_DIR, manifest)
|
|
144
159
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
valiedateSkeleton(SRC_DIR, manifest)
|
|
160
|
+
valiedateSkeleton(SRC_DIR, manifest)
|
|
161
|
+
}
|
|
148
162
|
|
|
149
163
|
// 是否需要设置全局的打包模式为Mirtos
|
|
150
164
|
const { deviceTypeList } = manifest
|
|
@@ -381,15 +395,11 @@ module.exports = function genWebpackConf(launchOptions, mode) {
|
|
|
381
395
|
path: pathMap[dslName]
|
|
382
396
|
})
|
|
383
397
|
|
|
384
|
-
const {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
subpackages,
|
|
390
|
-
workers,
|
|
391
|
-
banner = ''
|
|
392
|
-
} = manifest
|
|
398
|
+
const { icon: appIcon, versionName, versionCode, subpackages, workers, banner = '' } = manifest
|
|
399
|
+
let appPackageName = manifest.package
|
|
400
|
+
if (globalConfig.aspectTemplate.isAspect) {
|
|
401
|
+
appPackageName = manifest.name
|
|
402
|
+
}
|
|
393
403
|
for (let i = 0, len = moduleList.length; i < len; i++) {
|
|
394
404
|
const fileConf = moduleList[i].path
|
|
395
405
|
if (fs.existsSync(fileConf)) {
|
|
@@ -3,9 +3,10 @@ const path = require('path')
|
|
|
3
3
|
const Ajv = require('ajv')
|
|
4
4
|
const AjvErrors = require('ajv-errors')
|
|
5
5
|
const manifestSchema = require('./manifest-schema')
|
|
6
|
-
const { colorconsole, KnownError } = require('@aiot-toolkit/shared-utils')
|
|
6
|
+
const { colorconsole, KnownError, readJson } = require('@aiot-toolkit/shared-utils')
|
|
7
7
|
const { compileOptionsMeta } = require('@aiot-toolkit/shared-utils/compilation-config')
|
|
8
8
|
const { getSkeletonConfig } = require('@aiot-toolkit/packager/lib/common/info')
|
|
9
|
+
const globalConfig = require('@aiot-toolkit/shared-utils/config')
|
|
9
10
|
|
|
10
11
|
// 主包保留名
|
|
11
12
|
const MAIN_PKG_NAME = compileOptionsMeta.MAIN_PKG_NAME
|
|
@@ -282,3 +283,31 @@ exports.valiedateSkeleton = function valiedateSkeleton(src, manifest) {
|
|
|
282
283
|
})
|
|
283
284
|
}
|
|
284
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* 校验aspect项目config.json
|
|
288
|
+
* @param {string} dirs 文件夹列表
|
|
289
|
+
*/
|
|
290
|
+
exports.validateConfigJson = function(dirs) {
|
|
291
|
+
dirs.forEach(async dir => {
|
|
292
|
+
const configPath = path.join(globalConfig.aspectTemplate.projectPath, dir, 'config.json')
|
|
293
|
+
if (dir !== 'app') {
|
|
294
|
+
const isExistConfig = fs.existsSync(configPath)
|
|
295
|
+
if (isExistConfig) {
|
|
296
|
+
const configJson = await readJson(configPath)
|
|
297
|
+
if (!configJson.name) {
|
|
298
|
+
colorconsole.error(`Configure file ${configPath} error: name is not exist, please check`)
|
|
299
|
+
}
|
|
300
|
+
if (!configJson.type) {
|
|
301
|
+
colorconsole.error(`Configure file ${configPath} error: type is not exist, please check`)
|
|
302
|
+
}
|
|
303
|
+
if (!configJson.virtualMachine) {
|
|
304
|
+
colorconsole.error(
|
|
305
|
+
`Configure file ${configPath} error: virtualMachine is not exist, please check`
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
} else {
|
|
309
|
+
colorconsole.error(`Configure file error: ${configPath} is not exist, please check`)
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
})
|
|
313
|
+
}
|
package/lib/commands/compile.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const webpack=require("webpack"),{setCustomConfig:setCustomConfig,colorconsole:colorconsole}=require("@aiot-toolkit/shared-utils"),genWebpackConf=require("../../gen-webpack-conf"),{summaryErrors:summaryErrors,summaryWarnings:summaryWarnings}=require("./utils");let watching=null;function showVersion(){const
|
|
1
|
+
"use strict";var _config=_interopRequireDefault(require("@aiot-toolkit/shared-utils/config"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const webpack=require("webpack"),{setCustomConfig:setCustomConfig,colorconsole:colorconsole,getProjectJson:getProjectJson,getManifest:getManifest}=require("@aiot-toolkit/shared-utils"),genWebpackConf=require("../../gen-webpack-conf"),{summaryErrors:summaryErrors,summaryWarnings:summaryWarnings,getAspectEntries:getAspectEntries,cleanOrCreateDir:cleanOrCreateDir}=require("./utils"),{copyBuildToNewBuild:copyBuildToNewBuild}=require("../utils"),{validateConfigJson:validateConfigJson}=require("../../gen-webpack-conf/validate"),path=require("path");let appName,watching=null,entries=[];function showVersion(){const e=require("../../package.json").version,o=require("@babel/core/package.json").version,t=require("webpack/package.json").version;colorconsole.info(`aiot-toolkit: ${e}; babel: ${o}; webpack: ${t};`)}function aspectProjectCompiler(e,o,t,r={}){let a=getManifest();appName=a.package||"demo",entries=getAspectEntries(_config.default.aspectTemplate.projectPath,a),validateConfigJson(entries);let i,n=_config.default.aspectTemplate.outputPath,s=_config.default.aspectTemplate.distPath;cleanOrCreateDir(n),cleanOrCreateDir(s);const c=[];return entries.forEach((a=>{_config.default.sourceRoot="./src",_config.default.aspectTemplate.isApp="app"===a,_config.default.aspectTemplate.isApp&&(_config.default.sourceRoot=""),r.cwd=path.join(_config.default.aspectTemplate.projectPath,a),i=singleCompiler(e,o,t,r),c.push(i)})),Promise.all(c)}function singleCompiler(e,o,t,r={}){const a=r.onerror;return new Promise(((i,n)=>{function s(e,o){if(e&&(a&&a(e),colorconsole.error(e)),o){if(o.hasErrors()||o.hasWarnings()){const e=summaryErrors(o),t=summaryWarnings(o);a&&a(e),colorconsole.error(e),colorconsole.warn(t)}o.hasErrors()&&(process.exitCode=1)}}colorconsole.attach(r.log),setCustomConfig(r.cwd),process.env.NODE_PLATFORM=e,process.env.NODE_PHASE=o;const c="prod"===o?"production":"development";try{const e=genWebpackConf(r,c);if(t){const o=webpack(e);watching=o.watch({aggregateTimeout:300},((e,o)=>{s(e,o),i({compileError:e,stats:o,watching:watching})}))}else webpack(e,((e,o)=>{s(e,o),i({compileError:e,stats:o})}))}catch(e){n(e)}}))}showVersion(),module.exports.compile=async function(e,o,t,r={}){var a;let i;return"distributed"===(null===(a=getProjectJson())||void 0===a?void 0:a.projectType)?(_config.default.aspectTemplate.isAspect=!0,i=await aspectProjectCompiler(e,o,t,r),await copyBuildToNewBuild(entries,appName)):i=await singleCompiler(e,o,t,r),i},module.exports.stopWatch=function(){return new Promise((e=>{watching?watching.close((()=>{watching=null,e({stopWatchError:null})})):e({stopWatchError:"no watching"})}))};
|
|
2
2
|
//# sourceMappingURL=compile.js.map
|
package/lib/commands/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatDate=formatDate,exports.summaryErrors=summaryErrors,exports.summaryWarnings=summaryWarnings,exports.getQuickappDebuggerUrl=getQuickappDebuggerUrl,exports.getQuickappPreviewUrl=getQuickappPreviewUrl,exports.downloadFile=downloadFile,exports.sendReq=sendReq,exports.getClients=getClients,exports.checkQuickappDir=checkQuickappDir,exports.getCardContent=getCardContent;var _fsExtra=_interopRequireDefault(require("fs-extra")),_path=_interopRequireDefault(require("path")),_request=_interopRequireDefault(require("request")),_http=_interopRequireDefault(require("http")),_recordClient=require("@aiot-toolkit/shared-utils/lib/record-client"),_config=require("@aiot-toolkit/shared-utils/config"),_sharedUtils=require("@aiot-toolkit/shared-utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function formatDate(e,t){let r,o,s,n,i,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatDate=formatDate,exports.summaryErrors=summaryErrors,exports.summaryWarnings=summaryWarnings,exports.getQuickappDebuggerUrl=getQuickappDebuggerUrl,exports.getQuickappPreviewUrl=getQuickappPreviewUrl,exports.downloadFile=downloadFile,exports.sendReq=sendReq,exports.getClients=getClients,exports.checkQuickappDir=checkQuickappDir,exports.getCardContent=getCardContent,exports.cleanOrCreateDir=cleanOrCreateDir,exports.getAspectEntries=getAspectEntries;var _fsExtra=_interopRequireDefault(require("fs-extra")),_path=_interopRequireDefault(require("path")),_request=_interopRequireDefault(require("request")),_http=_interopRequireDefault(require("http")),_recordClient=require("@aiot-toolkit/shared-utils/lib/record-client"),_config=require("@aiot-toolkit/shared-utils/config"),_sharedUtils=require("@aiot-toolkit/shared-utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const fsExtra=require("fs-extra");function formatDate(e,t){let r,o,s,n,a,i,l=e;return(e.indexOf("yyyy")>=0||e.indexOf("YYYYY")>=0)&&(r=t.getFullYear(),l=l.replace(/[yY]{4}/g,r)),e.indexOf("MM")>=0&&(o=t.getMonth()+1,l=l.replace(/MM/g,String(o).length<2?"0"+o:o)),e.indexOf("dd")>=0&&(s=t.getDate(),l=l.replace(/dd/g,String(s).length<2?"0"+s:s)),(e.indexOf("hh")>=0||e.indexOf("HH")>=0)&&(n=t.getHours(),l=l.replace(/[hH]{2}/g,String(n).length<2?"0"+n:n)),e.indexOf("mm")>=0&&(a=t.getMinutes(),l=l.replace(/mm/g,String(a).length<2?"0"+a:a)),(e.indexOf("ss")>=0||e.indexOf("SS")>=0)&&(i=t.getSeconds(),l=l.replace(/[sS]{2}/g,String(i).length<2?"0"+i:i)),l}function summaryErrors(e){const t=[];return e.compilation.errors.forEach((e=>{const r=e.message,o=/Can't resolve '(sass-loader|less-loader|stylus-loader)'/.exec(r);if("ModuleNotFoundError"===e.name&&o){let t=o[1];"less-loader"===t?t=`less ${t}`:"sass-loader"===t?t=`node-sass ${t}`:"stylus-loader"===t&&(t=`stylus ${t}`),e.message=` Missing dependency: ${t}, Please execute npm install -D ${t} to install the corresponding dependencies `}const s=e.module?e.module.resource:"";t.push(`${s}\r\n${e.message}`)})),t.join("\n\n")}function summaryWarnings(e){return e.compilation.warnings.map((e=>e.message)).join("\n\n")}const quickapp_url="https://statres.quickapp.cn/quickapp/quickapptool/release/platform/";function getQuickappDebuggerUrl(e){let t=e||"v1080";return _sharedUtils.colorconsole.log(`The version of the Quickapp debugger that started to download is: ${t}`),`${quickapp_url}quickapp_debugger_${t}.apk`}function getQuickappPreviewUrl(e){let t=e||"v1080";return _sharedUtils.colorconsole.log(`The version of the Quickapp debugger that started to download is: ${t}`),`${quickapp_url}quickapp_platform_preview_release_${t}.apk`}function downloadFile(e,t){return _sharedUtils.colorconsole.log(`Start downloading file:${t}, address:${e}`),new Promise((function(r,o){(0,_request.default)(e,(function(s,n,a){if(s||200!==n.statusCode)o(s||new Error(`Download failed, status code:${n.statusCode}`));else{const s=_path.default.join(__dirname,"./apk");_fsExtra.default.ensureDirSync(s);let n=_fsExtra.default.createWriteStream(_path.default.join(s,t));(0,_request.default)(e).pipe(n).on("close",(e=>{e?o(e):r(`Download file ${t} successfully`)}))}}))}))}async function sendReq(e,t,r){return new Promise((o=>{const s=`http://${e.ip}:${e.port}${t}`;let n={host:e.ip,port:e.port,path:t,timeout:3e3};r&&(n=Object.assign({},n,{headers:r}));const a=_http.default.request(n,(e=>{e.on("data",(e=>{_sharedUtils.colorconsole.log(`### App Server ### Request ${s} succeeded`),o(e.toString())}))})).on("error",(e=>{_sharedUtils.colorconsole.error(`### App Server ### Request ${s} error message: ${e.message}`)})).on("timeout",(function(){_sharedUtils.colorconsole.log(`### App Server ### Request ${s} timed out, please try again`),a.abort()}));a.end()}))}async function getClients(){return new Promise((e=>{if(_fsExtra.default.existsSync(_config.clientRecordPath)){const t=(0,_recordClient.getRecords)(_config.clientRecordPath),r=(0,_recordClient.getProjectClients)(t);r.length>0&&e(r)}e(null)}))}function checkQuickappDir(e,t="src"){const r=_path.default.join(e,t,"manifest.json");_fsExtra.default.existsSync(r)||(_sharedUtils.colorconsole.error("Please execute this command under the Quickapp project"),process.exit())}function getCardContent(e){const t=_path.default.join(e,"src","manifest.json"),r=(0,_sharedUtils.readJson)(t).router.widgets||null;return r||_sharedUtils.colorconsole.error("No card configuration in manifest.json"),r}function cleanOrCreateDir(e){try{_fsExtra.default.accessSync(e,_fsExtra.default.constants.F_OK),fsExtra.emptyDirSync(e)}catch(t){_fsExtra.default.mkdirSync(e,{recursive:!0})}}function getAspectEntries(e,t){let r=["app"],o=_fsExtra.default.readdirSync(e,{encoding:"utf8",withFileTypes:!0}).map((e=>e.name));const s=_path.default.join(e,"app","manifest.json");t.router||_sharedUtils.colorconsole.error(`Configuration file ${s} error: router is not exsist, please check`);const n=t.router.aspects||null;if(n){Object.keys(n).forEach((e=>{n[e].forEach((e=>{o.includes(e.path)?r.push(e.path):_sharedUtils.colorconsole.throw(`Configuration file ${s} error: ${e.path} is not exist in root directory`)}))}))}else _sharedUtils.colorconsole.error(`Configuration file ${s} error: router.aspect is null, please check`);return r}
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const path=require("path"),{colorconsole:colorconsole}=require("@aiot-toolkit/shared-utils"),{ENTRY_TYPE:ENTRY_TYPE}=require("@aiot-toolkit/packager/lib/common/utils"),{resolveFile:resolveFile}=require("@aiot-toolkit/packager/lib/common/info"),{isEmptyObject:isEmptyObject}=require("@aiot-toolkit/compiler/lib/utils");exports.resolveEntries=function(e,o,t){if(!e.router)throw Error("No routing configured in manifest.json!");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.copyBuildToNewBuild=copyBuildToNewBuild;var _fs=_interopRequireDefault(require("fs"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const path=require("path"),{colorconsole:colorconsole}=require("@aiot-toolkit/shared-utils"),{ENTRY_TYPE:ENTRY_TYPE,copyFiles:copyFiles,packFolderToApp:packFolderToApp}=require("@aiot-toolkit/packager/lib/common/utils"),{resolveFile:resolveFile}=require("@aiot-toolkit/packager/lib/common/info"),{isEmptyObject:isEmptyObject}=require("@aiot-toolkit/compiler/lib/utils"),globalConfig=require("@aiot-toolkit/shared-utils/config");async function copyBuildToNewBuild(e,o){const t=globalConfig.aspectTemplate.projectPath,i=globalConfig.aspectTemplate.outputPath,r=globalConfig.aspectTemplate.distPath;e.forEach((e=>{let o=path.join(t,e,"build"),s=path.join(i,e);_fs.default.existsSync(s)||_fs.default.mkdirSync(s),copyFiles(o,s);let l=path.join(t,e,"dist");copyFiles(l,r)})),await packFolderToApp(r,o)}exports.resolveEntries=function(e,o,t){if(!e.router)throw Error("No routing configured in manifest.json!");const i={},r=e.router.pages||{},s=[{confs:e.router.widgets||{},type:ENTRY_TYPE.CARD}];s.unshift({confs:r,type:ENTRY_TYPE.PAGE});let l="app";globalConfig.aspectTemplate.isAspect&&!globalConfig.aspectTemplate.isApp&&(l="aspect");const a=resolveFile(path.join(o,l));a||(colorconsole.error(`${l} file does not exist`),process.exit(1)),i[l]="./"+path.relative(t,a)+`?uxType=${ENTRY_TYPE.APP}`,s.forEach((({confs:e,type:r})=>{Object.keys(e).forEach((s=>{const l=e[s],a=path.join(s,l.component),c=resolveFile(path.join(o,a));c||colorconsole.throw(`Compilation failed: please confirm that the file path ${a} configured in manifest.json exists`),/^\//.test(s)&&colorconsole.throw(`Compilation failed: please confirm that '${s}' configured by router.pages in manifest.json is the directory name`);let n=path.relative(t,c);n="./"+n+`?uxType=${r}`,n=n.replace(/\\/g,"/"),i[a]=n}))}));const c=e.workers;c&&c.entries&&c.entries instanceof Array&&c.entries.filter((e=>e.file)).forEach((e=>{i[e.file.replace(/\.js$/,"")]="./src/"+e.file}));const n=e.services;if(!isEmptyObject(n))for(const e in n)Object.hasOwnProperty.call(n,e)&&(i["services/"+e]="./src/"+n[e].path+`?uxType=${ENTRY_TYPE.APP}`);return i};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiot-toolkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18-aspect-beta.1",
|
|
4
4
|
"description": "A command line toolkit for developing Aiot Quick Apps.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=8.0.0"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@aiot-toolkit/compiler": "1.0.
|
|
10
|
-
"@aiot-toolkit/debugger": "1.0.
|
|
11
|
-
"@aiot-toolkit/dsl-vue": "1.0.
|
|
12
|
-
"@aiot-toolkit/dsl-xvm": "1.0.
|
|
13
|
-
"@aiot-toolkit/packager": "1.0.
|
|
14
|
-
"@aiot-toolkit/server": "1.0.
|
|
15
|
-
"@aiot-toolkit/shared-utils": "1.0.
|
|
9
|
+
"@aiot-toolkit/compiler": "1.0.18-aspect-beta.1",
|
|
10
|
+
"@aiot-toolkit/debugger": "1.0.18-aspect-beta.1",
|
|
11
|
+
"@aiot-toolkit/dsl-vue": "1.0.18-aspect-beta.1",
|
|
12
|
+
"@aiot-toolkit/dsl-xvm": "1.0.18-aspect-beta.1",
|
|
13
|
+
"@aiot-toolkit/packager": "1.0.18-aspect-beta.1",
|
|
14
|
+
"@aiot-toolkit/server": "1.0.18-aspect-beta.1",
|
|
15
|
+
"@aiot-toolkit/shared-utils": "1.0.18-aspect-beta.1",
|
|
16
16
|
"@babel/core": "^7.9.6",
|
|
17
17
|
"@babel/plugin-syntax-jsx": "^7.8.3",
|
|
18
18
|
"@babel/preset-env": "^7.9.6",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"supertest": "^3.3.0",
|
|
53
53
|
"webpack-cli": "^4.3.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "14e2beab1e171bcd38efcb519ade86b0e6718b25"
|
|
56
56
|
}
|