@widget-js/cli 1.2.9-rc.3 → 1.2.9-rc.5
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/index.js
CHANGED
|
@@ -20,7 +20,7 @@ program.command("dependencies").description("Set @widget-js dependencies to loca
|
|
|
20
20
|
await dependencies.default(options);
|
|
21
21
|
});
|
|
22
22
|
program.command("init").description("Initialize widget-js project").action(async () => {
|
|
23
|
-
const init = await import("./init-
|
|
23
|
+
const init = await import("./init-RLKWBXN2.js");
|
|
24
24
|
await init.init();
|
|
25
25
|
});
|
|
26
26
|
var typeOption = new Option("-t, --type <type>").choices(["ftp", "oss"]);
|
|
@@ -18,6 +18,9 @@ import consola from "consola";
|
|
|
18
18
|
import chalk from "chalk";
|
|
19
19
|
import ora from "ora";
|
|
20
20
|
import { scanWidgetPackage } from "@widget-js/utils";
|
|
21
|
+
import { fileURLToPath } from "url";
|
|
22
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
23
|
+
var __dirname = path.dirname(__filename);
|
|
21
24
|
var spinner = ora("Loading");
|
|
22
25
|
async function init() {
|
|
23
26
|
await addDependencies();
|
|
@@ -89,7 +92,7 @@ async function createRouter() {
|
|
|
89
92
|
const widgetRouterPath = path.join(rootDir, "widget-router.ts");
|
|
90
93
|
const routerContent = fs.readFileSync(path.join(__dirname, "../template/widget-router.ts"), "utf8");
|
|
91
94
|
fs.writeFileSync(widgetRouterPath, routerContent);
|
|
92
|
-
const vueRouterPath = path.join(process.cwd(), "./router/index.ts");
|
|
95
|
+
const vueRouterPath = path.join(process.cwd(), "./src/router/index.ts");
|
|
93
96
|
spinner.info("\u4FEE\u6539VueRouter\u914D\u7F6E");
|
|
94
97
|
if (fs.existsSync(vueRouterPath)) {
|
|
95
98
|
let vueRouterContent = fs.readFileSync(vueRouterPath, "utf8");
|
package/package.json
CHANGED
package/src/createWidget.ts
CHANGED
|
@@ -13,7 +13,6 @@ import {EJSUtils} from './utils/EJSUtils'
|
|
|
13
13
|
import {WidgetPackageUtils} from "./utils/WidgetPackageUtils";
|
|
14
14
|
// import vm from "vm";
|
|
15
15
|
const __filename = fileURLToPath(import.meta.url)
|
|
16
|
-
|
|
17
16
|
const __dirname = path.dirname(__filename)
|
|
18
17
|
|
|
19
18
|
interface RenderOptions {
|
package/src/init/init.ts
CHANGED
|
@@ -10,7 +10,9 @@ import ora from 'ora'
|
|
|
10
10
|
import {PrettierUtils} from '../utils/PrettierUtils'
|
|
11
11
|
import {scanWidgetPackage} from '@widget-js/utils'
|
|
12
12
|
import {WidgetPackageUtils} from '../utils/WidgetPackageUtils'
|
|
13
|
-
|
|
13
|
+
import {fileURLToPath} from "url";
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
15
|
+
const __dirname = path.dirname(__filename)
|
|
14
16
|
const spinner = ora('Loading')
|
|
15
17
|
|
|
16
18
|
export async function init() {
|
|
@@ -96,7 +98,7 @@ async function createRouter() {
|
|
|
96
98
|
const routerContent = fs.readFileSync(path.join(__dirname, '../template/widget-router.ts'), 'utf8')
|
|
97
99
|
fs.writeFileSync(widgetRouterPath, routerContent)
|
|
98
100
|
|
|
99
|
-
const vueRouterPath = path.join(process.cwd(), './router/index.ts')
|
|
101
|
+
const vueRouterPath = path.join(process.cwd(), './src/router/index.ts')
|
|
100
102
|
spinner.info('修改VueRouter配置')
|
|
101
103
|
if (fs.existsSync(vueRouterPath)) {
|
|
102
104
|
let vueRouterContent = fs.readFileSync(vueRouterPath, 'utf8')
|