@farris/cli 2.0.1 → 2.0.2
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/bin/index.js +2 -2
- package/lib/commands/build-components.js +39 -38
- package/lib/commands/build-components.js.map +1 -1
- package/lib/commands/build-css.js +38 -27
- package/lib/commands/build-css.js.map +1 -1
- package/lib/commands/build-lib.js +25 -27
- package/lib/commands/build-lib.js.map +1 -1
- package/lib/commands/build.js +15 -15
- package/lib/commands/build.js.map +1 -1
- package/lib/commands/create-app.js +54 -54
- package/lib/commands/dev-serve.js +18 -23
- package/lib/commands/dev-serve.js.map +1 -1
- package/lib/commands/extract-i18n.js +75 -0
- package/lib/commands/extract-i18n.js.map +1 -0
- package/lib/commands/preview-serve.js +16 -16
- package/lib/common/constant.js +22 -18
- package/lib/common/constant.js.map +1 -1
- package/lib/common/generate-app.js +44 -44
- package/lib/common/get-dependencies.js +9 -9
- package/lib/common/get-farris-config.js +11 -11
- package/lib/common/get-farris-config.js.map +1 -1
- package/lib/common/get-version.js +6 -6
- package/lib/common/get-vite-config.js +48 -40
- package/lib/common/get-vite-config.js.map +1 -1
- package/lib/config/vite-app.js +13 -14
- package/lib/config/vite-app.js.map +1 -1
- package/lib/config/vite-common.js +21 -0
- package/lib/config/vite-common.js.map +1 -0
- package/lib/config/vite-component.js +30 -32
- package/lib/config/vite-component.js.map +1 -1
- package/lib/config/vite-lib.js +26 -27
- package/lib/config/vite-lib.js.map +1 -1
- package/lib/index.js +83 -65
- package/lib/index.js.map +1 -1
- package/lib/plugins/create-component-style.js +45 -44
- package/lib/plugins/create-component-style.js.map +1 -1
- package/lib/plugins/create-package-json.js +33 -33
- package/lib/plugins/dts.js +8 -8
- package/lib/plugins/html-system.js +11 -11
- package/lib/plugins/replace.js +17 -13
- package/lib/plugins/replace.js.map +1 -1
- package/lib/plugins/systemjs-bundle.js +15 -15
- package/package.json +42 -40
- package/templates/mobile/.eslintrc.cjs +15 -15
- package/templates/mobile/.prettierrc.json +7 -7
- package/templates/mobile/farris.config.mjs +24 -24
- package/templates/mobile/index.html +12 -12
- package/templates/mobile/package.json +28 -28
- package/templates/mobile/src/App.vue +80 -80
- package/templates/mobile/src/components/TheButton.vue +3 -3
- package/templates/mobile/src/main.ts +12 -12
- package/templates/mobile/src/router/index.ts +23 -23
- package/templates/mobile/src/views/AboutView.vue +15 -15
- package/templates/mobile/src/views/HomeView.vue +9 -9
- package/templates/mobile/tsconfig.json +17 -17
- package/templates/web/.eslintrc.cjs +15 -15
- package/templates/web/.prettierrc.json +7 -7
- package/templates/web/farris.config.mjs +24 -24
- package/templates/web/index.html +12 -12
- package/templates/web/package.json +28 -28
- package/templates/web/src/App.vue +80 -80
- package/templates/web/src/components/TheButton.vue +3 -3
- package/templates/web/src/main.ts +10 -10
- package/templates/web/src/router/index.ts +23 -23
- package/templates/web/src/views/AboutView.vue +15 -15
- package/templates/web/src/views/HomeView.vue +9 -9
- package/templates/web/tsconfig.json +17 -17
package/bin/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
import '../lib/index.js';
|
1
|
+
#!/usr/bin/env node
|
2
|
+
import '../lib/index.js';
|
@@ -1,39 +1,40 @@
|
|
1
|
-
import { readdirSync, lstatSync, existsSync } from "node:fs";
|
2
|
-
import { resolve } from "node:path";
|
3
|
-
import ora from 'ora';
|
4
|
-
import { buildCommon } from "./build.js";
|
5
|
-
import { buildCss } from "./build-css.js";
|
6
|
-
import { CWD } from "../common/constant.js";
|
7
|
-
const excludeComponents = ['property-panel', 'dynamic-resolver', 'dynamic-view'];
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
components.
|
17
|
-
|
18
|
-
const
|
19
|
-
const
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
}
|
38
|
-
|
1
|
+
import { readdirSync, lstatSync, existsSync } from "node:fs";
|
2
|
+
import { resolve } from "node:path";
|
3
|
+
import ora from 'ora';
|
4
|
+
import { buildCommon } from "./build.js";
|
5
|
+
import { buildCss } from "./build-css.js";
|
6
|
+
import { CWD } from "../common/constant.js";
|
7
|
+
const excludeComponents = ['property-panel', 'dynamic-resolver', 'dynamic-view'];
|
8
|
+
const BaseEntry = './components';
|
9
|
+
const BaseOutDir = './package/components';
|
10
|
+
export async function buildComponents(options) {
|
11
|
+
const components = readdirSync("./components").filter((name) => {
|
12
|
+
const componentDir = resolve(CWD, `./components`, name);
|
13
|
+
const isDir = lstatSync(componentDir).isDirectory();
|
14
|
+
return isDir && readdirSync(componentDir).includes("index.ts");
|
15
|
+
}).filter(name => !excludeComponents.includes(name));
|
16
|
+
const spinner = ora(`build components begin`).start();
|
17
|
+
components.forEach(async (component) => {
|
18
|
+
const entry = resolve(CWD, `${BaseEntry}/${component}/index.ts`);
|
19
|
+
const outDir = resolve(CWD, `${BaseOutDir}/${component}`);
|
20
|
+
const config = {
|
21
|
+
publicDir: '',
|
22
|
+
build: {
|
23
|
+
lib: {
|
24
|
+
entry
|
25
|
+
},
|
26
|
+
outDir
|
27
|
+
}
|
28
|
+
};
|
29
|
+
spinner.text = `building ${component}`;
|
30
|
+
await buildCommon({ ...options, config, type: 'component' });
|
31
|
+
spinner.succeed(`build ${component} success`);
|
32
|
+
const cssEntry = `${BaseEntry}/${component}/src/${component}.scss`;
|
33
|
+
if (!existsSync(cssEntry)) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
await buildCss({ ...options, entry: cssEntry, outfile: `${BaseOutDir}/${component}/index.css`, showSpinner: false });
|
37
|
+
});
|
38
|
+
}
|
39
|
+
;
|
39
40
|
//# sourceMappingURL=build-components.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"build-components.js","sourceRoot":"","sources":["../../src/commands/build-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAsB,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,iBAAiB,GAAG,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,CAAC,CAAC;AAEjF,MAAM,CAAC,
|
1
|
+
{"version":3,"file":"build-components.js","sourceRoot":"","sources":["../../src/commands/build-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAsB,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,iBAAiB,GAAG,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,CAAC,CAAC;AAEjF,MAAM,SAAS,GAAG,cAAc,CAAC;AACjC,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAA2B;IAE/D,MAAM,UAAU,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7D,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,CAAC,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AC,CAAC;IACrH,CAAC,CAAC,CAAC;AAEL,CAAC;AAAA,CAAC"}
|
@@ -1,28 +1,39 @@
|
|
1
|
-
import { build } from "esbuild";
|
2
|
-
import { sassPlugin } from 'esbuild-sass-plugin';
|
3
|
-
import path from 'node:path';
|
4
|
-
import { CWD } from "../common/constant.js";
|
5
|
-
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
|
11
|
-
};
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
1
|
+
import { build } from "esbuild";
|
2
|
+
import { sassPlugin } from 'esbuild-sass-plugin';
|
3
|
+
import path from 'node:path';
|
4
|
+
import { CWD } from "../common/constant.js";
|
5
|
+
import ora from "ora";
|
6
|
+
const replaceUrl = (source, pathname, entry) => {
|
7
|
+
const basedir = path.dirname(pathname);
|
8
|
+
const entrydir = path.resolve(CWD, path.dirname(entry));
|
9
|
+
const relativedir = path.relative(entrydir, basedir);
|
10
|
+
const regExp = /(url\(['"]?)(\.\.?\/[^'")]+['"]?)(\))/g;
|
11
|
+
return source.replace(regExp, (substring, ...args) => `url(./${path.join(relativedir, args[1]).replaceAll('\\', '/')})`);
|
12
|
+
};
|
13
|
+
export async function buildCss(options) {
|
14
|
+
const { entry, outfile, minify = false, showSpinner = true } = options;
|
15
|
+
const spinner = ora(`build css begin`).start();
|
16
|
+
spinner.text = `building css`;
|
17
|
+
if (!showSpinner) {
|
18
|
+
spinner.stop();
|
19
|
+
}
|
20
|
+
await build({
|
21
|
+
entryPoints: [entry],
|
22
|
+
outfile,
|
23
|
+
minify,
|
24
|
+
bundle: true,
|
25
|
+
logLevel: 'error',
|
26
|
+
plugins: [sassPlugin({
|
27
|
+
precompile(source, pathname) {
|
28
|
+
return replaceUrl(source, pathname, entry);
|
29
|
+
}
|
30
|
+
})],
|
31
|
+
loader: {
|
32
|
+
'.ttf': 'dataurl'
|
33
|
+
}
|
34
|
+
});
|
35
|
+
if (showSpinner) {
|
36
|
+
spinner.succeed(`build css success`);
|
37
|
+
}
|
38
|
+
}
|
28
39
|
//# sourceMappingURL=build-css.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"build-css.js","sourceRoot":"","sources":["../../src/commands/build-css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;
|
1
|
+
{"version":3,"file":"build-css.js","sourceRoot":"","sources":["../../src/commands/build-css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,QAAgB,EAAE,KAAa,EAAC,EAAE;IACpE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IACxD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,wCAAwC,CAAC;IACxD,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,GAAG,IAAI,EAAC,EAAE,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1H,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAAY;IACzC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,WAAW,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAEvE,MAAM,OAAO,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE,CAAC;IAC/C,OAAO,CAAC,IAAI,GAAG,cAAc,CAAC;IAE9B,IAAG,CAAC,WAAW,EAAE;QACf,OAAO,CAAC,IAAI,EAAE,CAAC;KAChB;IAGD,MAAM,KAAK,CAAC;QACV,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,OAAO;QACP,MAAM;QACN,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,OAAO;QACjB,OAAO,EAAE,CAAC,UAAU,CAAC;gBACnB,UAAU,CAAC,MAAM,EAAE,QAAQ;oBACzB,OAAO,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;gBAC7C,CAAC;aACF,CAAC,CAAC;QACH,MAAM,EAAE;YACN,MAAM,EAAE,SAAS;SAClB;KACF,CAAC,CAAC;IAEH,IAAG,WAAW,EAAE;QACd,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;KACtC;AACH,CAAC"}
|
@@ -1,28 +1,26 @@
|
|
1
|
-
import ora from 'ora';
|
2
|
-
import { buildCommon } from "./build.js";
|
3
|
-
import { generateTypes } from "../plugins/dts.js";
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
}
|
27
|
-
;
|
1
|
+
import ora from 'ora';
|
2
|
+
import { buildCommon } from "./build.js";
|
3
|
+
import { generateTypes } from "../plugins/dts.js";
|
4
|
+
// import { buildCss } from './build-css.js';
|
5
|
+
import { createPackageJson } from '../plugins/create-package-json.js';
|
6
|
+
export async function buildLib(options) {
|
7
|
+
const { dts = true, emitPackage } = options;
|
8
|
+
const config = {
|
9
|
+
publicDir: '',
|
10
|
+
plugins: [
|
11
|
+
dts && generateTypes("./components", "./package/types"),
|
12
|
+
emitPackage && createPackageJson()
|
13
|
+
]
|
14
|
+
};
|
15
|
+
const spinner = ora(`build lib begin`).start();
|
16
|
+
spinner.text = `building lib`;
|
17
|
+
await buildCommon({ ...options, config, type: 'lib' });
|
18
|
+
// const { css } = libConfig.build;
|
19
|
+
// if (existsSync(css.entry)) {
|
20
|
+
// spinner.text = `building css`;
|
21
|
+
// await buildCss({ entry: css.entry, outfile: css.outfile });
|
22
|
+
// }
|
23
|
+
spinner.succeed(`build lib success`);
|
24
|
+
}
|
25
|
+
;
|
28
26
|
//# sourceMappingURL=build-lib.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"build-lib.js","sourceRoot":"","sources":["../../src/commands/build-lib.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,WAAW,EAAsB,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"build-lib.js","sourceRoot":"","sources":["../../src/commands/build-lib.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,WAAW,EAAsB,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,6CAA6C;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAQtE,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAAwB;IAErD,MAAM,EAAE,GAAG,GAAG,IAAI,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAC5C,MAAM,MAAM,GAAG;QACb,SAAS,EAAE,EAAE;QACb,OAAO,EAAE;YACP,GAAG,IAAI,aAAa,CAAC,cAAc,EAAE,iBAAiB,CAAC;YACvD,WAAW,IAAI,iBAAiB,EAAE;SACnC;KACF,CAAC;IACF,MAAM,OAAO,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE,CAAC;IAE/C,OAAO,CAAC,IAAI,GAAG,cAAc,CAAC;IAE9B,MAAM,WAAW,CAAC,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAEvD,mCAAmC;IAEnC,+BAA+B;IAC/B,mCAAmC;IACnC,gEAAgE;IAChE,IAAI;IAEJ,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACvC,CAAC;AAAA,CAAC"}
|
package/lib/commands/build.js
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
import { build, mergeConfig, loadConfigFromFile } from 'vite';
|
2
|
-
import { getViteConfig } from '../common/get-vite-config.js';
|
3
|
-
export async function buildCommon(options, loadFile = true) {
|
4
|
-
const { configFile, config = {}, type } = options;
|
5
|
-
if (!loadFile) {
|
6
|
-
await build(config);
|
7
|
-
return config;
|
8
|
-
}
|
9
|
-
const viteConfig = await loadConfigFromFile({ command: 'build', mode: 'production' },
|
10
|
-
const defaultConfig = await getViteConfig(type);
|
11
|
-
const libConfig = mergeConfig(mergeConfig(defaultConfig, viteConfig ? viteConfig.config : {}), config);
|
12
|
-
await build(libConfig);
|
13
|
-
return libConfig;
|
14
|
-
}
|
15
|
-
;
|
1
|
+
import { build, mergeConfig, loadConfigFromFile } from 'vite';
|
2
|
+
import { getViteConfig } from '../common/get-vite-config.js';
|
3
|
+
export async function buildCommon(options, loadFile = true) {
|
4
|
+
const { configFile, viteConfigFile, config = {}, type } = options;
|
5
|
+
if (!loadFile) {
|
6
|
+
await build(config);
|
7
|
+
return config;
|
8
|
+
}
|
9
|
+
const viteConfig = await loadConfigFromFile({ command: 'build', mode: 'production' }, viteConfigFile);
|
10
|
+
const defaultConfig = await getViteConfig(type, configFile);
|
11
|
+
const libConfig = mergeConfig(mergeConfig(defaultConfig, viteConfigFile && viteConfig?.config ? viteConfig.config : {}), config);
|
12
|
+
await build(libConfig);
|
13
|
+
return libConfig;
|
14
|
+
}
|
15
|
+
;
|
16
16
|
//# sourceMappingURL=build.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAc,MAAM,MAAM,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAc,MAAM,MAAM,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAS7D,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAA2B,EAAE,QAAQ,GAAG,IAAI;IAC5E,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAElE,IAAG,CAAC,QAAQ,EAAE;QACZ,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC;KACf;IAED,MAAM,UAAU,GAAG,MAAM,kBAAkB,CAAC,EAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAC,EAAE,cAAc,CAAC,CAAC;IAEpG,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAE5D,MAAM,SAAS,GAAE,WAAW,CAAC,WAAW,CAAC,aAAa,EAAE,cAAc,IAAI,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAEhI,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC;IAEvB,OAAO,SAAS,CAAC;AACnB,CAAC;AAAA,CAAC"}
|
@@ -1,55 +1,55 @@
|
|
1
|
-
import { generateApp } from "../common/generate-app.js";
|
2
|
-
import inquirer from "inquirer";
|
3
|
-
const prompt = inquirer.createPromptModule();
|
4
|
-
const questions = [
|
5
|
-
{
|
6
|
-
type: "input",
|
7
|
-
name: "name",
|
8
|
-
message: "What is your project name?",
|
9
|
-
default: "my-project",
|
10
|
-
},
|
11
|
-
{
|
12
|
-
type: "list",
|
13
|
-
name: "type",
|
14
|
-
message: "What type of project is this?",
|
15
|
-
choices: ["app", "lib"],
|
16
|
-
},
|
17
|
-
{
|
18
|
-
type: "list",
|
19
|
-
name: "platform",
|
20
|
-
message: "What platform of project is this?",
|
21
|
-
choices: ["web", "mobile"],
|
22
|
-
when: (response) => {
|
23
|
-
const { type } = response;
|
24
|
-
return type === 'app';
|
25
|
-
}
|
26
|
-
},
|
27
|
-
{
|
28
|
-
type: "checkbox",
|
29
|
-
name: "formats",
|
30
|
-
message: "What output format of project is this?",
|
31
|
-
choices: ["es", "umd", "systemjs"],
|
32
|
-
default: ["es", "umd"],
|
33
|
-
when: (response) => {
|
34
|
-
const { type } = response;
|
35
|
-
return type === 'lib';
|
36
|
-
}
|
37
|
-
},
|
38
|
-
{
|
39
|
-
type: "list",
|
40
|
-
name: "format",
|
41
|
-
message: "What output format of project is this?",
|
42
|
-
choices: ["es", "umd", "systemjs"],
|
43
|
-
default: ["es"],
|
44
|
-
when: (response) => {
|
45
|
-
const { type } = response;
|
46
|
-
return type === 'app';
|
47
|
-
}
|
48
|
-
}
|
49
|
-
];
|
50
|
-
export async function createApp() {
|
51
|
-
const response = await prompt(questions);
|
52
|
-
generateApp(response);
|
53
|
-
}
|
54
|
-
;
|
1
|
+
import { generateApp } from "../common/generate-app.js";
|
2
|
+
import inquirer from "inquirer";
|
3
|
+
const prompt = inquirer.createPromptModule();
|
4
|
+
const questions = [
|
5
|
+
{
|
6
|
+
type: "input",
|
7
|
+
name: "name",
|
8
|
+
message: "What is your project name?",
|
9
|
+
default: "my-project",
|
10
|
+
},
|
11
|
+
{
|
12
|
+
type: "list",
|
13
|
+
name: "type",
|
14
|
+
message: "What type of project is this?",
|
15
|
+
choices: ["app", "lib"],
|
16
|
+
},
|
17
|
+
{
|
18
|
+
type: "list",
|
19
|
+
name: "platform",
|
20
|
+
message: "What platform of project is this?",
|
21
|
+
choices: ["web", "mobile"],
|
22
|
+
when: (response) => {
|
23
|
+
const { type } = response;
|
24
|
+
return type === 'app';
|
25
|
+
}
|
26
|
+
},
|
27
|
+
{
|
28
|
+
type: "checkbox",
|
29
|
+
name: "formats",
|
30
|
+
message: "What output format of project is this?",
|
31
|
+
choices: ["es", "umd", "systemjs"],
|
32
|
+
default: ["es", "umd"],
|
33
|
+
when: (response) => {
|
34
|
+
const { type } = response;
|
35
|
+
return type === 'lib';
|
36
|
+
}
|
37
|
+
},
|
38
|
+
{
|
39
|
+
type: "list",
|
40
|
+
name: "format",
|
41
|
+
message: "What output format of project is this?",
|
42
|
+
choices: ["es", "umd", "systemjs"],
|
43
|
+
default: ["es"],
|
44
|
+
when: (response) => {
|
45
|
+
const { type } = response;
|
46
|
+
return type === 'app';
|
47
|
+
}
|
48
|
+
}
|
49
|
+
];
|
50
|
+
export async function createApp() {
|
51
|
+
const response = await prompt(questions);
|
52
|
+
generateApp(response);
|
53
|
+
}
|
54
|
+
;
|
55
55
|
//# sourceMappingURL=create-app.js.map
|
@@ -1,24 +1,19 @@
|
|
1
|
-
import { createServer, mergeConfig } from 'vite';
|
2
|
-
import { getViteConfig } from '../common/get-vite-config.js';
|
3
|
-
export const devServe = async (options) => {
|
4
|
-
const { port = 1337, host = true } = options;
|
5
|
-
const config = await getViteConfig();
|
6
|
-
const devConfig = mergeConfig({
|
7
|
-
configFile: false,
|
8
|
-
mode: 'dev',
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
}, config);
|
20
|
-
const server = await createServer(devConfig);
|
21
|
-
await server.listen();
|
22
|
-
server.printUrls();
|
23
|
-
};
|
1
|
+
import { createServer, mergeConfig } from 'vite';
|
2
|
+
import { getViteConfig } from '../common/get-vite-config.js';
|
3
|
+
export const devServe = async (options) => {
|
4
|
+
const { port = 1337, host = true } = options;
|
5
|
+
const config = await getViteConfig();
|
6
|
+
const devConfig = mergeConfig(config, {
|
7
|
+
configFile: false,
|
8
|
+
mode: 'dev',
|
9
|
+
server: {
|
10
|
+
port,
|
11
|
+
host,
|
12
|
+
hmr: true
|
13
|
+
}
|
14
|
+
});
|
15
|
+
const server = await createServer(devConfig);
|
16
|
+
await server.listen();
|
17
|
+
server.printUrls();
|
18
|
+
};
|
24
19
|
//# sourceMappingURL=dev-serve.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dev-serve.js","sourceRoot":"","sources":["../../src/commands/dev-serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAO7D,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,OAAqB,EAAE,EAAE;IACtD,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAE7C,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;IAErC,MAAM,SAAS,GAAG,WAAW,CAAC;
|
1
|
+
{"version":3,"file":"dev-serve.js","sourceRoot":"","sources":["../../src/commands/dev-serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAO7D,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,OAAqB,EAAE,EAAE;IACtD,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAE7C,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;IAErC,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,EAAE;QACpC,UAAU,EAAE,KAAK;QACjB,IAAI,EAAE,KAAK;QACX,MAAM,EAAE;YACN,IAAI;YACJ,IAAI;YACJ,GAAG,EAAE,IAAI;SACV;KACF,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,SAAS,CAAC,CAAC;IAC7C,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;IAEtB,MAAM,CAAC,SAAS,EAAE,CAAC;AACrB,CAAC,CAAC"}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import { writeFileSync, mkdirSync, existsSync, readFileSync } from 'fs';
|
2
|
+
import { join, basename, dirname, resolve } from 'path';
|
3
|
+
import { sync } from 'glob';
|
4
|
+
import { pathToFileURL } from 'url';
|
5
|
+
/**
|
6
|
+
* 抽取国际化资源到JSON文件
|
7
|
+
*/
|
8
|
+
async function loadConfig(configPath) {
|
9
|
+
const defaultConfigPath = resolve(process.cwd(), 'farris.i18n.mjs');
|
10
|
+
const finalPath = configPath || defaultConfigPath;
|
11
|
+
if (!existsSync(finalPath)) {
|
12
|
+
throw new Error(`配置文件不存在: ${finalPath}`);
|
13
|
+
}
|
14
|
+
const fileUrl = pathToFileURL(finalPath).href;
|
15
|
+
const config = (await import(fileUrl)).default;
|
16
|
+
return config;
|
17
|
+
}
|
18
|
+
async function extractByType(type, config, options) {
|
19
|
+
console.log(`正在提取 ${type} 资源...`);
|
20
|
+
const outputDir = options.outDir || config.outDir;
|
21
|
+
const localeMap = {};
|
22
|
+
// Process each include pattern
|
23
|
+
for (const pattern of config.include) {
|
24
|
+
const localeFiles = sync(pattern, {
|
25
|
+
cwd: process.cwd(),
|
26
|
+
absolute: true,
|
27
|
+
ignore: config.exclude
|
28
|
+
});
|
29
|
+
// Process each locale file
|
30
|
+
localeFiles.forEach(file => {
|
31
|
+
const componentName = basename(dirname(dirname(dirname(dirname(file)))));
|
32
|
+
const localeName = basename(file, '.json');
|
33
|
+
const content = readFileSync(file, 'utf8');
|
34
|
+
if (!content) {
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
const resources = JSON.parse(content);
|
38
|
+
if (!localeMap[localeName]) {
|
39
|
+
localeMap[localeName] = {};
|
40
|
+
}
|
41
|
+
// Add component translations under component namespace
|
42
|
+
Object.assign(localeMap[localeName], resources);
|
43
|
+
});
|
44
|
+
}
|
45
|
+
// Ensure output directory exists
|
46
|
+
if (!existsSync(outputDir)) {
|
47
|
+
mkdirSync(outputDir, { recursive: true });
|
48
|
+
}
|
49
|
+
// Write each locale to a separate file
|
50
|
+
Object.entries(localeMap).forEach(([locale, translations]) => {
|
51
|
+
const outputFile = join(outputDir, `${locale}.json`);
|
52
|
+
const content = config.minify
|
53
|
+
? JSON.stringify(translations)
|
54
|
+
: JSON.stringify(translations, null, 2);
|
55
|
+
writeFileSync(outputFile, content);
|
56
|
+
});
|
57
|
+
console.log(`${type} 资源提取完成!`);
|
58
|
+
}
|
59
|
+
export async function extractI18n(options = {}) {
|
60
|
+
console.log('正在抽取国际化资源...');
|
61
|
+
try {
|
62
|
+
const config = await loadConfig(options.configFile);
|
63
|
+
// 否则提取所有配置的类型
|
64
|
+
for (const [type, typeConfig] of Object.entries(config.extract)) {
|
65
|
+
if (typeConfig) {
|
66
|
+
await extractByType(type, typeConfig, options);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
catch (error) {
|
71
|
+
console.error(error);
|
72
|
+
process.exit(1);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
//# sourceMappingURL=extract-i18n.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"extract-i18n.js","sourceRoot":"","sources":["../../src/commands/extract-i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAsBpC;;GAEG;AACH,KAAK,UAAU,UAAU,CAAC,UAAmB;IACzC,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC;IACpE,MAAM,SAAS,GAAG,UAAU,IAAI,iBAAiB,CAAC;IAElD,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC,YAAY,SAAS,EAAE,CAAC,CAAC;KAC5C;IACD,MAAM,OAAO,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;IAC9C,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/C,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,IAAY,EAAE,MAAqB,EAAE,OAA2B;IACzF,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC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AAI,CAAC,SAAS,EAAE,GAAG,MAAM,OAAO,CAAC,CAAC;QACrD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM;YACzB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;YAC9B,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC5C,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,UAA8B,EAAE;IAC9D,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC5B,IAAI;QACA,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACpD,cAAc;QACd,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;YAC7D,IAAI,UAAU,EAAE;gBACZ,MAAM,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;aAClD;SACJ;KACJ;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACnB;AACL,CAAC"}
|
@@ -1,17 +1,17 @@
|
|
1
|
-
import { preview, mergeConfig } from 'vite';
|
2
|
-
import { getViteConfig } from '../common/get-vite-config.js';
|
3
|
-
export const previewServe = async (options) => {
|
4
|
-
const { port = 4137, host = true } = options;
|
5
|
-
const config = await getViteConfig();
|
6
|
-
const previewConfig = mergeConfig({
|
7
|
-
configFile: false,
|
8
|
-
preview: {
|
9
|
-
port,
|
10
|
-
host,
|
11
|
-
open: true
|
12
|
-
}
|
13
|
-
}, config);
|
14
|
-
const server = await preview(previewConfig);
|
15
|
-
server.printUrls();
|
16
|
-
};
|
1
|
+
import { preview, mergeConfig } from 'vite';
|
2
|
+
import { getViteConfig } from '../common/get-vite-config.js';
|
3
|
+
export const previewServe = async (options) => {
|
4
|
+
const { port = 4137, host = true } = options;
|
5
|
+
const config = await getViteConfig();
|
6
|
+
const previewConfig = mergeConfig({
|
7
|
+
configFile: false,
|
8
|
+
preview: {
|
9
|
+
port,
|
10
|
+
host,
|
11
|
+
open: true
|
12
|
+
}
|
13
|
+
}, config);
|
14
|
+
const server = await preview(previewConfig);
|
15
|
+
server.printUrls();
|
16
|
+
};
|
17
17
|
//# sourceMappingURL=preview-serve.js.map
|
package/lib/common/constant.js
CHANGED
@@ -1,19 +1,23 @@
|
|
1
|
-
import { existsSync } from 'node:fs';
|
2
|
-
import { fileURLToPath } from 'node:url';
|
3
|
-
import { join, dirname } from 'node:path';
|
4
|
-
function findRootDir(dir) {
|
5
|
-
if (existsSync(join(dir, 'farris.config.js'))) {
|
6
|
-
return dir;
|
7
|
-
}
|
8
|
-
const parentDir = dirname(dir);
|
9
|
-
if (dir === parentDir) {
|
10
|
-
return dir;
|
11
|
-
}
|
12
|
-
return findRootDir(parentDir);
|
13
|
-
}
|
14
|
-
export const getDirname = (url) => fileURLToPath(new URL('.', url));
|
15
|
-
// Root paths
|
16
|
-
export const CWD = process.cwd();
|
17
|
-
export const ROOT = findRootDir(CWD);
|
18
|
-
export const FAARIS_CONFIG_FILE = join(CWD, 'farris.config.mjs');
|
1
|
+
import { existsSync } from 'node:fs';
|
2
|
+
import { fileURLToPath } from 'node:url';
|
3
|
+
import { join, dirname } from 'node:path';
|
4
|
+
function findRootDir(dir) {
|
5
|
+
if (existsSync(join(dir, 'farris.config.js'))) {
|
6
|
+
return dir;
|
7
|
+
}
|
8
|
+
const parentDir = dirname(dir);
|
9
|
+
if (dir === parentDir) {
|
10
|
+
return dir;
|
11
|
+
}
|
12
|
+
return findRootDir(parentDir);
|
13
|
+
}
|
14
|
+
export const getDirname = (url) => fileURLToPath(new URL('.', url));
|
15
|
+
// Root paths
|
16
|
+
export const CWD = process.cwd();
|
17
|
+
export const ROOT = findRootDir(CWD);
|
18
|
+
export const FAARIS_CONFIG_FILE = join(CWD, 'farris.config.mjs');
|
19
|
+
export const getPackageName = () => {
|
20
|
+
const { PackageName = '@components' } = process.env;
|
21
|
+
return PackageName;
|
22
|
+
};
|
19
23
|
//# sourceMappingURL=constant.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../../src/common/constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,SAAS,WAAW,CAAC,GAAW;IAC9B,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,EAAE;QAC7C,OAAO,GAAG,CAAC;KACZ;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,GAAG,KAAK,SAAS,EAAE;QACrB,OAAO,GAAG,CAAC;KACZ;IAED,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;AAChC,CAAC;AACD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAC,EAAE,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE3E,aAAa;AAEb,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC"}
|
1
|
+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