@farris/cli 2.1.8 → 2.2.0-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/bin/index.js +1 -1
- package/lib/commands/build-components.js +48 -39
- package/lib/commands/build-components.js.map +1 -1
- package/lib/commands/build-css.js +38 -38
- package/lib/commands/build-css.js.map +1 -1
- package/lib/commands/build-lib.js +25 -25
- package/lib/commands/build-lib.js.map +1 -1
- package/lib/commands/build.js +15 -14
- package/lib/commands/build.js.map +1 -1
- package/lib/commands/create-app.js +54 -54
- package/lib/commands/dev-serve.js +18 -18
- package/lib/commands/extract-i18n.js +74 -74
- package/lib/commands/extract-i18n.js.map +1 -1
- package/lib/commands/preview-serve.js +16 -16
- package/lib/common/component-file-name.js +4 -0
- package/lib/common/component-file-name.js.map +1 -0
- package/lib/common/constant.js +22 -64
- package/lib/common/constant.js.map +1 -1
- package/lib/common/generate-app.js +51 -44
- package/lib/common/generate-app.js.map +1 -1
- package/lib/common/get-dependencies.js +9 -9
- package/lib/common/get-farris-config.js +25 -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 +49 -105
- package/lib/common/get-vite-config.js.map +1 -1
- package/lib/common/lib-package-exports.js +21 -0
- package/lib/common/lib-package-exports.js.map +1 -0
- package/lib/common/list-lib-components.js +24 -0
- package/lib/common/list-lib-components.js.map +1 -0
- package/lib/common/template-manifest.js +17 -0
- package/lib/common/template-manifest.js.map +1 -0
- package/lib/config/vite-app.js +13 -13
- package/lib/config/vite-common.js +20 -20
- package/lib/config/vite-common.js.map +1 -1
- package/lib/config/vite-component.js +32 -30
- package/lib/config/vite-component.js.map +1 -1
- package/lib/config/vite-lib.js +26 -26
- package/lib/index.js +87 -175
- package/lib/index.js.map +1 -1
- package/lib/plugins/create-component-style.js +44 -44
- package/lib/plugins/create-package-json.js +48 -33
- package/lib/plugins/create-package-json.js.map +1 -1
- package/lib/plugins/dts.js +8 -8
- package/lib/plugins/html-system.js +9 -9
- package/lib/plugins/replace.js +17 -17
- package/lib/plugins/systemjs-bundle.js +15 -15
- package/lib/plugins/systemjs-bundle.js.map +1 -1
- package/package.json +9 -11
- package/templates/lib/.changeset/README.md +1 -0
- package/templates/lib/.changeset/config.json +11 -0
- package/templates/lib/README.md +17 -0
- package/templates/lib/components/button/index.ts +7 -0
- package/templates/lib/components/button/src/button.scss +10 -0
- package/templates/lib/components/button/src/button.vue +12 -0
- package/templates/lib/components/common/with-install.ts +9 -0
- package/templates/lib/components/index.ts +10 -0
- package/templates/lib/farris.config.mjs +13 -0
- package/templates/lib/package.json +21 -0
- package/templates/lib/tsconfig.json +7 -0
- package/templates/mobile/.changeset/README.md +4 -0
- package/templates/mobile/.changeset/config.json +11 -0
- package/templates/mobile/package.json +4 -1
- package/templates/web/.changeset/README.md +4 -0
- package/templates/web/.changeset/config.json +11 -0
- package/templates/web/package.json +4 -1
- package/lib/commands/generate/api.js +0 -188
- package/lib/commands/generate/api.js.map +0 -1
- package/lib/commands/generate/common.js +0 -101
- package/lib/commands/generate/common.js.map +0 -1
- package/lib/commands/generate/component.js +0 -164
- package/lib/commands/generate/component.js.map +0 -1
- package/lib/commands/generate/view.js +0 -198
- package/lib/commands/generate/view.js.map +0 -1
- package/lib/commands/workspace/add-app.js +0 -181
- package/lib/commands/workspace/add-app.js.map +0 -1
- package/lib/commands/workspace/create.js +0 -380
- package/lib/commands/workspace/create.js.map +0 -1
- package/lib/commands/workspace/inspect.js +0 -31
- package/lib/commands/workspace/inspect.js.map +0 -1
- package/lib/commands/workspace/verify.js +0 -39
- package/lib/commands/workspace/verify.js.map +0 -1
- package/lib/common/output.js +0 -95
- package/lib/common/output.js.map +0 -1
- package/lib/common/safety.js +0 -172
- package/lib/common/safety.js.map +0 -1
- package/lib/common/template-renderer.js +0 -115
- package/lib/common/template-renderer.js.map +0 -1
- package/lib/common/transaction.js +0 -84
- package/lib/common/transaction.js.map +0 -1
- package/lib/common/verifier.js +0 -151
- package/lib/common/verifier.js.map +0 -1
- package/templates/workspace/app/farris.config.mjs +0 -13
- package/templates/workspace/app/index.html +0 -12
- package/templates/workspace/app/package.json +0 -22
- package/templates/workspace/app/src/App.tsx +0 -11
- package/templates/workspace/app/src/locales/index.ts +0 -5
- package/templates/workspace/app/src/locales/zh-CN.json +0 -1
- package/templates/workspace/app/src/main.ts +0 -12
- package/templates/workspace/app/src/router/index.ts +0 -16
- package/templates/workspace/app/src/styles/index.css +0 -0
- package/templates/workspace/app/src/styles/index.scss +0 -0
- package/templates/workspace/app/src/views/home/composables/use-home.ts +0 -7
- package/templates/workspace/app/src/views/home/home.component.tsx +0 -15
- package/templates/workspace/app/src/views/home/index.ts +0 -4
- package/templates/workspace/app/tsconfig.json +0 -21
- package/templates/workspace/root/README.md +0 -28
- package/templates/workspace/root/package.json +0 -13
- package/templates/workspace/root/pnpm-workspace.yaml +0 -12
|
@@ -1,34 +1,49 @@
|
|
|
1
|
-
import { readFileSync } from
|
|
2
|
-
import { resolve } from
|
|
3
|
-
import { CWD } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { CWD } from '../common/constant.js';
|
|
4
|
+
import { listLibComponents } from '../common/list-lib-components.js';
|
|
5
|
+
import { buildLibPackageExports } from '../common/lib-package-exports.js';
|
|
6
|
+
export const createPackageJson = () => {
|
|
7
|
+
const seen = new Set();
|
|
8
|
+
return {
|
|
9
|
+
name: 'create-package-json',
|
|
10
|
+
generateBundle(outputOptions) {
|
|
11
|
+
if (outputOptions.format) {
|
|
12
|
+
seen.add(outputOptions.format === 'es' ? 'es' : outputOptions.format);
|
|
13
|
+
}
|
|
14
|
+
const pkg = JSON.parse(readFileSync(resolve(CWD, 'package.json'), 'utf-8'));
|
|
15
|
+
const result = {
|
|
16
|
+
name: '',
|
|
17
|
+
version: '',
|
|
18
|
+
private: false,
|
|
19
|
+
types: './types/index.d.ts',
|
|
20
|
+
style: './index.css'
|
|
21
|
+
};
|
|
22
|
+
if (seen.has('es')) {
|
|
23
|
+
result.module = './index.esm.js';
|
|
24
|
+
if (!seen.has('umd')) {
|
|
25
|
+
result.main = './index.esm.js';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (seen.has('umd')) {
|
|
29
|
+
result.main = './index.umd.js';
|
|
30
|
+
}
|
|
31
|
+
const exclude = ['scripts', 'devDependencies', 'private'];
|
|
32
|
+
Object.keys(pkg).forEach((key) => {
|
|
33
|
+
if (exclude.includes(key)) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
result[key] = pkg[key];
|
|
37
|
+
});
|
|
38
|
+
const extra = buildLibPackageExports(listLibComponents(process.cwd()), seen);
|
|
39
|
+
result.sideEffects = extra.sideEffects;
|
|
40
|
+
result.exports = extra.exports;
|
|
41
|
+
this.emitFile({
|
|
42
|
+
type: 'asset',
|
|
43
|
+
fileName: 'package.json',
|
|
44
|
+
source: JSON.stringify(result, null, 2)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
34
49
|
//# sourceMappingURL=create-package-json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-package-json.js","sourceRoot":"","sources":["../../src/plugins/create-package-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-package-json.js","sourceRoot":"","sources":["../../src/plugins/create-package-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAQ,EAAE;IACzC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO;QACL,IAAI,EAAE,qBAAqB;QAC3B,cAAc,CAAC,aAAkC;YAC/C,IAAI,aAAa,CAAC,MAAM,EAAE;gBACxB,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;aACvE;YACD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;YAC5E,MAAM,MAAM,GAAwB;gBAClC,IAAI,EAAE,EAAE;gBACR,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,oBAAoB;gBAC3B,KAAK,EAAE,aAAa;aACrB,CAAC;YACF,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;gBAClB,MAAM,CAAC,MAAM,GAAG,gBAAgB,CAAC;gBACjC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;oBACpB,MAAM,CAAC,IAAI,GAAG,gBAAgB,CAAC;iBAChC;aACF;YACD,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACnB,MAAM,CAAC,IAAI,GAAG,gBAAgB,CAAC;aAChC;YACD,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;YAC1D,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC/B,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;oBACzB,OAAO;iBACR;gBACD,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC,CAAC,CAAC;YACH,MAAM,KAAK,GAAG,sBAAsB,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;YAC7E,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;YACvC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;YAC/B,IAAI,CAAC,QAAQ,CAAC;gBACZ,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,cAAc;gBACxB,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;aACxC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
package/lib/plugins/dts.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import dts from "vite-plugin-dts";
|
|
2
|
-
export function generateTypes(entry, outDir) {
|
|
3
|
-
return dts({
|
|
4
|
-
entryRoot: entry,
|
|
5
|
-
outDir
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
;
|
|
1
|
+
import dts from "vite-plugin-dts";
|
|
2
|
+
export function generateTypes(entry, outDir) {
|
|
3
|
+
return dts({
|
|
4
|
+
entryRoot: entry,
|
|
5
|
+
outDir
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
;
|
|
9
9
|
//# sourceMappingURL=dts.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export const htmlSystemPlugin = () => {
|
|
2
|
-
return {
|
|
3
|
-
name: 'html-transform-system',
|
|
4
|
-
transformIndexHtml(html) {
|
|
5
|
-
const regexp = /<script.*type="module".*src="(.*?)"><\/script>/;
|
|
1
|
+
export const htmlSystemPlugin = () => {
|
|
2
|
+
return {
|
|
3
|
+
name: 'html-transform-system',
|
|
4
|
+
transformIndexHtml(html) {
|
|
5
|
+
const regexp = /<script.*type="module".*src="(.*?)"><\/script>/;
|
|
6
6
|
return html.replace(regexp, (str, p1) => `
|
|
7
7
|
<script src="https://cdn.bootcdn.net/ajax/libs/systemjs/6.15.1/system.js"></script>
|
|
8
|
-
<script >System.import("${p1}");</script>`);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
};
|
|
8
|
+
<script >System.import("${p1}");</script>`);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
12
|
//# sourceMappingURL=html-system.js.map
|
package/lib/plugins/replace.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { getPackageName } from '../common/constant.js';
|
|
2
|
-
export function replace(path) {
|
|
3
|
-
return {
|
|
4
|
-
name: 'farris-replace-path',
|
|
5
|
-
renderChunk(code, chunk) {
|
|
6
|
-
const fileNames = chunk.fileName.split('.');
|
|
7
|
-
const format = fileNames[fileNames.length - 2];
|
|
8
|
-
// const regExpress = new RegExp(/@farris\/mobile-ui-vue\/([\w-]+)/g);
|
|
9
|
-
const dynamicRegExp = new RegExp(`${getPackageName().replace(/\//g, '\\/')}\\/([\\w-]+)`, // 自动转义斜杠
|
|
10
|
-
'g');
|
|
11
|
-
return code.replace(dynamicRegExp, (match, captureGroup) => {
|
|
12
|
-
return path(format, [captureGroup]);
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
;
|
|
1
|
+
import { getPackageName } from '../common/constant.js';
|
|
2
|
+
export function replace(path) {
|
|
3
|
+
return {
|
|
4
|
+
name: 'farris-replace-path',
|
|
5
|
+
renderChunk(code, chunk) {
|
|
6
|
+
const fileNames = chunk.fileName.split('.');
|
|
7
|
+
const format = fileNames[fileNames.length - 2];
|
|
8
|
+
// const regExpress = new RegExp(/@farris\/mobile-ui-vue\/([\w-]+)/g);
|
|
9
|
+
const dynamicRegExp = new RegExp(`${getPackageName().replace(/\//g, '\\/')}\\/([\\w-]+)`, // 自动转义斜杠
|
|
10
|
+
'g');
|
|
11
|
+
return code.replace(dynamicRegExp, (match, captureGroup) => {
|
|
12
|
+
return path(format, [captureGroup]);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
;
|
|
18
18
|
//# sourceMappingURL=replace.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export function systemjsBundle() {
|
|
2
|
-
return {
|
|
3
|
-
name: 'systemjs-bundle',
|
|
4
|
-
outputOptions(options) {
|
|
5
|
-
if (options.format === 'systemjs') {
|
|
6
|
-
return {
|
|
7
|
-
...options,
|
|
8
|
-
name: undefined
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
return options;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
;
|
|
1
|
+
export function systemjsBundle() {
|
|
2
|
+
return {
|
|
3
|
+
name: 'systemjs-bundle',
|
|
4
|
+
outputOptions(options) {
|
|
5
|
+
if (options.format === 'systemjs') {
|
|
6
|
+
return {
|
|
7
|
+
...options,
|
|
8
|
+
name: undefined
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
return options;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
;
|
|
16
16
|
//# sourceMappingURL=systemjs-bundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"systemjs-bundle.js","sourceRoot":"","sources":["../../src/plugins/systemjs-bundle.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,aAAa,CAAC,OAAY;YACxB,IAAG,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE
|
|
1
|
+
{"version":3,"file":"systemjs-bundle.js","sourceRoot":"","sources":["../../src/plugins/systemjs-bundle.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,aAAa,CAAC,OAAY;YACxB,IAAG,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;gBAChC,OAAO;oBACL,GAAG,OAAO;oBACV,IAAI,EAAE,SAAS;iBAChB,CAAC;aACH;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC;AAAA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farris/cli",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.1
|
|
4
|
+
"version": "2.2.0-beta.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"bin": {
|
|
8
8
|
"farris-cli": "./bin/index.js"
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
|
-
"node": "
|
|
12
|
-
"pnpm": ">=9.0.0"
|
|
11
|
+
"node": ">=18.0.0"
|
|
13
12
|
},
|
|
14
13
|
"scripts": {
|
|
15
14
|
"build": "rimraf ./lib && tsc",
|
|
16
|
-
"test": "vitest run
|
|
15
|
+
"test": "vitest run"
|
|
17
16
|
},
|
|
18
17
|
"files": [
|
|
19
18
|
"lib",
|
|
@@ -28,19 +27,18 @@
|
|
|
28
27
|
"commander": "^9.4.0",
|
|
29
28
|
"esbuild": "^0.23.0",
|
|
30
29
|
"esbuild-sass-plugin": "^3.3.1",
|
|
31
|
-
"fs-extra": "^11.2.0",
|
|
32
|
-
"glob": "^10.4.5",
|
|
33
30
|
"inquirer": "^9.3.0",
|
|
34
31
|
"ora": "^8.0.1",
|
|
35
|
-
"typescript": "^
|
|
36
|
-
"vite": "^5.
|
|
32
|
+
"typescript": "^4.6.4",
|
|
33
|
+
"vite": "^4.5.10",
|
|
37
34
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
38
|
-
"vite-plugin-dts": "^3.9.1"
|
|
35
|
+
"vite-plugin-dts": "^3.9.1",
|
|
36
|
+
"glob": "11.0.3"
|
|
39
37
|
},
|
|
40
38
|
"devDependencies": {
|
|
41
|
-
"@types/fs-extra": "^11.0.4",
|
|
42
39
|
"@types/inquirer": "^9.0.7",
|
|
43
40
|
"rimraf": "^5.0.7",
|
|
44
|
-
"
|
|
41
|
+
"vitest": "^1.6.1",
|
|
42
|
+
"vue": "^3.2.37"
|
|
45
43
|
}
|
|
46
44
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Use `npm run changeset` then `npm run version`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
|
|
3
|
+
"changelog": "@changesets/cli/changelog",
|
|
4
|
+
"commit": false,
|
|
5
|
+
"fixed": [],
|
|
6
|
+
"linked": [],
|
|
7
|
+
"access": "public",
|
|
8
|
+
"baseBranch": "main",
|
|
9
|
+
"updateInternalDependencies": "patch",
|
|
10
|
+
"ignore": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# <%= name %>
|
|
2
|
+
|
|
3
|
+
## Scripts
|
|
4
|
+
|
|
5
|
+
- `npm run build` — `build-lib` then `build-css` (css after lib so Vite does not wipe `index.css`)
|
|
6
|
+
- `npm run changeset` — record a change
|
|
7
|
+
- `npm run version` — bump version and changelog
|
|
8
|
+
|
|
9
|
+
If the default branch is not `main`, edit `.changeset/config.json` `baseBranch`.
|
|
10
|
+
|
|
11
|
+
## Output
|
|
12
|
+
|
|
13
|
+
Artifacts go to `lib/` (`index.esm.js` / `index.umd.js` / `index.systemjs.js` depending on formats, plus `types/` and `index.css`).
|
|
14
|
+
|
|
15
|
+
## Add a component
|
|
16
|
+
|
|
17
|
+
Copy `components/button` to a new folder and re-export it from `components/index.ts`.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineOptions({ name: 'Button' });
|
|
3
|
+
defineProps<{
|
|
4
|
+
type?: 'primary' | 'default';
|
|
5
|
+
}>();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<button class="f-button" :class="{ 'f-button--primary': type === 'primary' }">
|
|
10
|
+
<slot />
|
|
11
|
+
</button>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { App, Component } from 'vue';
|
|
2
|
+
|
|
3
|
+
export function withInstall<T extends Component>(component: T) {
|
|
4
|
+
const c = component as T & { install(app: App): void };
|
|
5
|
+
c.install = function (app: App) {
|
|
6
|
+
app.component(c.name as string, component);
|
|
7
|
+
};
|
|
8
|
+
return c;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
packageName: '<%= name %>',
|
|
3
|
+
lib: {
|
|
4
|
+
entry: './components/index.ts',
|
|
5
|
+
name: '<%= libName %>',
|
|
6
|
+
formats: <%= formats %>,
|
|
7
|
+
fileName: (format) => (format === 'es' ? 'index.esm.js' : `index.${format}.js`)
|
|
8
|
+
},
|
|
9
|
+
outDir: './lib',
|
|
10
|
+
componentOutDir: './lib/components',
|
|
11
|
+
externalDependencies: true,
|
|
12
|
+
minify: true
|
|
13
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= name %>",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "farris-cli build-lib -ep && farris-cli build-components",
|
|
8
|
+
"changeset": "changeset",
|
|
9
|
+
"version": "changeset version"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"vue": "^3.4.29"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@changesets/cli": "^2.29.5",
|
|
16
|
+
"@farris/cli": "<%= cliVersion %>",
|
|
17
|
+
"@vue/tsconfig": "^0.5.1",
|
|
18
|
+
"typescript": "~5.4.0",
|
|
19
|
+
"vue": "^3.4.29"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
|
|
3
|
+
"changelog": "@changesets/cli/changelog",
|
|
4
|
+
"commit": false,
|
|
5
|
+
"fixed": [],
|
|
6
|
+
"linked": [],
|
|
7
|
+
"access": "restricted",
|
|
8
|
+
"baseBranch": "main",
|
|
9
|
+
"updateInternalDependencies": "patch",
|
|
10
|
+
"ignore": []
|
|
11
|
+
}
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
"build": "farris-cli build",
|
|
9
9
|
"preview": "farris-cli preview",
|
|
10
10
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
11
|
-
"format": "prettier --write src/"
|
|
11
|
+
"format": "prettier --write src/",
|
|
12
|
+
"changeset": "changeset",
|
|
13
|
+
"version": "changeset version"
|
|
12
14
|
},
|
|
13
15
|
"dependencies": {
|
|
14
16
|
"@farris/mobile-ui-vue": "latest",
|
|
@@ -16,6 +18,7 @@
|
|
|
16
18
|
"vue-router": "^4.3.0"
|
|
17
19
|
},
|
|
18
20
|
"devDependencies": {
|
|
21
|
+
"@changesets/cli": "^2.29.5",
|
|
19
22
|
"@farris/cli": "<%= cliVersion %>",
|
|
20
23
|
"@rushstack/eslint-patch": "^1.8.0",
|
|
21
24
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
|
|
3
|
+
"changelog": "@changesets/cli/changelog",
|
|
4
|
+
"commit": false,
|
|
5
|
+
"fixed": [],
|
|
6
|
+
"linked": [],
|
|
7
|
+
"access": "restricted",
|
|
8
|
+
"baseBranch": "main",
|
|
9
|
+
"updateInternalDependencies": "patch",
|
|
10
|
+
"ignore": []
|
|
11
|
+
}
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
"build": "farris-cli build",
|
|
9
9
|
"preview": "farris-cli preview",
|
|
10
10
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
11
|
-
"format": "prettier --write src/"
|
|
11
|
+
"format": "prettier --write src/",
|
|
12
|
+
"changeset": "changeset",
|
|
13
|
+
"version": "changeset version"
|
|
12
14
|
},
|
|
13
15
|
"dependencies": {
|
|
14
16
|
"@farris/ui-vue": "latest",
|
|
@@ -16,6 +18,7 @@
|
|
|
16
18
|
"vue-router": "^4.3.0"
|
|
17
19
|
},
|
|
18
20
|
"devDependencies": {
|
|
21
|
+
"@changesets/cli": "^2.29.5",
|
|
19
22
|
"@farris/cli": "<%= cliVersion %>",
|
|
20
23
|
"@rushstack/eslint-patch": "^1.8.0",
|
|
21
24
|
"@vue/eslint-config-prettier": "^9.0.0",
|