Skip to content

Commit

Permalink
feat: update template (#572)
Browse files Browse the repository at this point in the history
  • Loading branch information
hexqi authored Jun 11, 2024
1 parent 2bc0e42 commit 4e6064e
Show file tree
Hide file tree
Showing 30 changed files with 14,603 additions and 291 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion designer-demo/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import { registry } from './defineEntry.js'
import { init } from '@opentiny/tiny-engine'
import { initHook, HOOK_NAME } from '@opentiny/tiny-engine-entry'
import { configurators } from './configurators.js'
import { configurators } from './configurators/'
import 'virtual:svg-icons-register'
import '@opentiny/tiny-engine-theme'

Expand Down
26 changes: 0 additions & 26 deletions packages/engine-cli/src/commands/build.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/engine-cli/src/commands/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

export default function (name) {
const sourcePath = path.join(__dirname, '../../template')
const sourcePath = path.join(__dirname, '../../template/designer/')
const destPath = path.join(cwd(), name)
fs.copySync(sourcePath, destPath)
console.log(

Check failure on line 27 in packages/engine-cli/src/commands/create.js

View workflow job for this annotation

GitHub Actions / push-check

Unexpected console statement
Expand Down
33 changes: 0 additions & 33 deletions packages/engine-cli/src/commands/serve.js

This file was deleted.

29 changes: 0 additions & 29 deletions packages/engine-cli/src/common.js

This file was deleted.

33 changes: 0 additions & 33 deletions packages/engine-cli/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,18 @@
*/

import { fileURLToPath } from 'node:url'
import fs from 'fs-extra'
import * as globby from 'globby'
import { Command } from 'commander'
import * as path from 'path'
import chalk from 'chalk'
import create from './commands/create.js'
import serve from './commands/serve.js'
import build from './commands/build.js'

const __filename = fileURLToPath(import.meta.url)

const __dirname = path.dirname(__filename)
const program = new Command()

let commandsPath = []
let pkgVersion = ''
let pkgName = ''

// 获取当前包的信息
const getPkgInfo = () => {
const jsonPath = path.join(__dirname, '../package.json')
const jsonResult = fs.readJSONSync(jsonPath)
pkgVersion = jsonResult.version
return pkgVersion
}

program
.command('create <name>')
.description('创建一个新工程')
.action((name) => {
create(name)
})

program
.command('serve')
.description('开启服务')
.action(() => {
serve()
})

program
.command('build')
.description('构建')
.action(() => {
build()
})

program.parse(process.argv)
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,6 @@
<div><span></span></div>
</div>
</div>
<script type="module" src="./src/canvas.js"></script>
<script type="module" src="/src/canvas.js"></script>
</body>
</html>
12 changes: 12 additions & 0 deletions packages/engine-cli/template/designer/env/.env.alpha
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# alpha mode, used by the "build:alpha" script

NODE_ENV=production
VITE_CDN_DOMAIN=https://npm.onmicrosoft.cn
VITE_LOCAL_IMPORT_MAPS=false
VITE_LOCAL_BUNDLE_DEPS=false
# VITE_ORIGIN=

# 错误监控上报 url
VITE_ERROR_MONITOR_URL=/platform-center/api/platform/monitoring/event
# 是否开启错误监控
VITE_ERROR_MONITOR=false
8 changes: 8 additions & 0 deletions packages/engine-cli/template/designer/env/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# development mode, used by the "vite" command

NODE_ENV=development
VITE_CDN_DOMAIN=https://npm.onmicrosoft.cn
VITE_LOCAL_IMPORT_MAPS=false
VITE_LOCAL_BUNDLE_DEPS=false
# request data via alpha service
# VITE_ORIGIN=
7 changes: 7 additions & 0 deletions packages/engine-cli/template/designer/env/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# prod mode, used by the "build:prod" script

NODE_ENV=production
VITE_CDN_DOMAIN=https://npm.onmicrosoft.cn
VITE_LOCAL_IMPORT_MAPS=false
VITE_LOCAL_BUNDLE_DEPS=false
#VITE_ORIGIN=
File renamed without changes.
29 changes: 29 additions & 0 deletions packages/engine-cli/template/designer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "designer-demo",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "cross-env VITE_THEME=light vite",
"build": "cross-env VITE_THEME=light vite build"
},
"dependencies": {
"vue": "^3.4.21",
"@opentiny/tiny-engine": "latest",
"@opentiny/tiny-engine-entry": "latest",
"@opentiny/tiny-engine-configurator": "latest",
"@opentiny/tiny-engine-theme-dark": "latest",
"@opentiny/tiny-engine-theme-light": "latest",
"@opentiny/vue": "~3.14.0",
"@opentiny/vue-design-smb": "~3.14.0",
"@opentiny/vue-renderless": "~3.14.0",
"@opentiny/vue-theme": "~3.14.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"cross-env": "^7.0.3",
"vite": "^5.2.7",
"@opentiny/tiny-engine-vite-config": "latest",
"@opentiny/tiny-engine-vite-plugin-meta-comments": "latest"
}
}
13 changes: 13 additions & 0 deletions packages/engine-cli/template/designer/preview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Design Core Preview</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="./src/preview.js"></script>
</body>
</html>
Binary file not shown.
Loading

0 comments on commit 4e6064e

Please sign in to comment.