@skirtle/create-vue-lib 0.0.0 → 0.0.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/README.md +2 -0
- package/dist/index.cjs +174 -14
- package/dist/template/base/config/package.json.ejs +22 -1
- package/dist/template/base/config/packages/@projectName@/package.json +7 -12
- package/dist/template/base/config/packages/@projectName@/vite.config.mts +12 -7
- package/dist/template/base/config/tsconfig.json +1 -1
- package/dist/template/base/examples/packages/@projectName@/src/components/{Example.vue → ExampleComponent.vue} +1 -1
- package/dist/template/base/examples/packages/@projectName@/src/index.ts +1 -1
- package/dist/template/eslint/config/eslint.config.mts.ejs +33 -0
- package/dist/template/gh-pages/config/.github/workflows/pages.yml +0 -2
- package/dist/template/playground/config/packages/playground/env.d.ts +2 -1
- package/dist/template/playground/config/packages/playground/package.json +3 -2
- package/dist/template/playground/config/packages/playground/vite.config.mts +2 -2
- package/dist/template/playground/examples/packages/playground/src/App.vue +1 -1
- package/dist/template/vitepress/config/packages/docs/env.d.ts +2 -1
- package/dist/template/vitepress/config/packages/docs/package.json +6 -3
- package/dist/template/vitepress/config/packages/docs/tsconfig.app.json +8 -1
- package/dist/template/vitepress/config/packages/docs/tsconfig.node.json +1 -8
- package/dist/template/vitepress/examples/packages/docs/src/index.md +1 -1
- package/dist/template/vitepress/examples/packages/docs/src/introduction.md +1 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ A command-line utility for scaffolding a Vite project to build a Vue-based libra
|
|
|
4
4
|
|
|
5
5
|
⚠️ This is currently work-in-progress. It is not yet usable.
|
|
6
6
|
|
|
7
|
+
Documentation: <https://skirtles-code.github.io/create-vue-lib/>
|
|
8
|
+
|
|
7
9
|
## Thanks
|
|
8
10
|
|
|
9
11
|
This project is inspired by the official [create-vue](https://github.com/vuejs/create-vue) scaffolding tool and wouldn't be possible without it. Many thanks to [Haoqun Jiang](https://github.com/haoqunjiang) for all the hard work he puts in to maintaining that project.
|
package/dist/index.cjs
CHANGED
|
@@ -5610,8 +5610,65 @@ var require_ejs = __commonJS({
|
|
|
5610
5610
|
// src/index.ts
|
|
5611
5611
|
var fs = __toESM(require("fs"), 1);
|
|
5612
5612
|
var path = __toESM(require("path"), 1);
|
|
5613
|
+
var import_node_util = require("util");
|
|
5613
5614
|
var import_prompts = __toESM(require_prompts3(), 1);
|
|
5614
5615
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
5616
|
+
|
|
5617
|
+
// package.json
|
|
5618
|
+
var package_default = {
|
|
5619
|
+
name: "@skirtle/create-vue-lib",
|
|
5620
|
+
version: "0.0.1",
|
|
5621
|
+
author: "skirtle",
|
|
5622
|
+
license: "MIT",
|
|
5623
|
+
description: "Create a library using Vue and Vite",
|
|
5624
|
+
keywords: ["vue", "library", "scaffold", "vite", "build"],
|
|
5625
|
+
homepage: "https://skirtles-code.github.io/create-vue-lib/",
|
|
5626
|
+
bugs: "https://github.com/skirtles-code/create-vue-lib/issues",
|
|
5627
|
+
repository: {
|
|
5628
|
+
type: "git",
|
|
5629
|
+
url: "git+https://github.com/skirtles-code/create-vue-lib.git"
|
|
5630
|
+
},
|
|
5631
|
+
funding: "https://github.com/sponsors/skirtles-code",
|
|
5632
|
+
type: "module",
|
|
5633
|
+
packageManager: "pnpm@9.15.4",
|
|
5634
|
+
engines: {
|
|
5635
|
+
node: ">=v18.3.0"
|
|
5636
|
+
},
|
|
5637
|
+
bin: {
|
|
5638
|
+
"create-vue-lib": "dist/index.cjs"
|
|
5639
|
+
},
|
|
5640
|
+
files: [
|
|
5641
|
+
"dist"
|
|
5642
|
+
],
|
|
5643
|
+
devDependencies: {
|
|
5644
|
+
"@tsconfig/node22": "^22.0.0",
|
|
5645
|
+
"@types/ejs": "^3.1.5",
|
|
5646
|
+
"@types/node": "^22.13.0",
|
|
5647
|
+
"@types/prompts": "^2.4.9",
|
|
5648
|
+
copyfiles: "^2.4.1",
|
|
5649
|
+
ejs: "^3.1.10",
|
|
5650
|
+
"lint-staged": "^15.4.3",
|
|
5651
|
+
"npm-run-all2": "^7.0.2",
|
|
5652
|
+
prompts: "^2.4.2",
|
|
5653
|
+
rimraf: "^6.0.1",
|
|
5654
|
+
"simple-git-hooks": "^2.11.1",
|
|
5655
|
+
tsup: "^8.3.6",
|
|
5656
|
+
typescript: "^5.7.3"
|
|
5657
|
+
},
|
|
5658
|
+
scripts: {
|
|
5659
|
+
clean: "rimraf dist",
|
|
5660
|
+
build: "run-s clean build:copy build:ts",
|
|
5661
|
+
"build:copy": 'copyfiles -u 1 -a "src/template/**" dist',
|
|
5662
|
+
"build:ts": "tsup src/index.ts --format cjs --target node18",
|
|
5663
|
+
"build:dts": "tsup src/index.ts --dts --format cjs --target node18",
|
|
5664
|
+
start: "node ./dist/index.cjs",
|
|
5665
|
+
"docs:dev": "pnpm run --filter ./docs -r dev",
|
|
5666
|
+
"docs:build": "pnpm run --filter ./docs -r build",
|
|
5667
|
+
preinstall: "npx only-allow pnpm"
|
|
5668
|
+
}
|
|
5669
|
+
};
|
|
5670
|
+
|
|
5671
|
+
// src/index.ts
|
|
5615
5672
|
async function prompt(options) {
|
|
5616
5673
|
try {
|
|
5617
5674
|
const result = await (0, import_prompts.default)(
|
|
@@ -5648,18 +5705,95 @@ async function togglePrompt(message, initial = false, active = "Yes", inactive =
|
|
|
5648
5705
|
inactive
|
|
5649
5706
|
});
|
|
5650
5707
|
}
|
|
5708
|
+
async function textPromptIf(condition, message, initial) {
|
|
5709
|
+
return condition ? textPrompt(message, initial) : initial ?? "";
|
|
5710
|
+
}
|
|
5711
|
+
async function togglePromptIf(condition, message, initial = false, active = "Yes", inactive = "No") {
|
|
5712
|
+
return condition ? togglePrompt(message, initial, active, inactive) : initial;
|
|
5713
|
+
}
|
|
5714
|
+
var helpMessage = `Usage: create-vue-lib [OPTIONS...]
|
|
5715
|
+
|
|
5716
|
+
Create a new Vite project to build a Vue-based library.
|
|
5717
|
+
|
|
5718
|
+
Options:
|
|
5719
|
+
--extended, -x
|
|
5720
|
+
Prompt for extra configuration options.
|
|
5721
|
+
--help, -h
|
|
5722
|
+
Display this help message.
|
|
5723
|
+
--version, -v
|
|
5724
|
+
Display the version number for create-vue-lib.
|
|
5725
|
+
|
|
5726
|
+
Full documentation at https://skirtles-code.github.io/create-vue-lib/
|
|
5727
|
+
`;
|
|
5728
|
+
function processArgs() {
|
|
5729
|
+
let argValues = {};
|
|
5730
|
+
const options = {
|
|
5731
|
+
extended: {
|
|
5732
|
+
short: "x",
|
|
5733
|
+
type: "boolean"
|
|
5734
|
+
},
|
|
5735
|
+
help: {
|
|
5736
|
+
short: "h",
|
|
5737
|
+
type: "boolean"
|
|
5738
|
+
},
|
|
5739
|
+
version: {
|
|
5740
|
+
short: "v",
|
|
5741
|
+
type: "boolean"
|
|
5742
|
+
}
|
|
5743
|
+
};
|
|
5744
|
+
try {
|
|
5745
|
+
const args = (0, import_node_util.parseArgs)({
|
|
5746
|
+
options
|
|
5747
|
+
});
|
|
5748
|
+
argValues = args.values;
|
|
5749
|
+
} catch (err) {
|
|
5750
|
+
if (err.code === "ERR_PARSE_ARGS_UNKNOWN_OPTION") {
|
|
5751
|
+
console.log("Error:");
|
|
5752
|
+
console.log(err.message);
|
|
5753
|
+
console.log("See --help for valid options");
|
|
5754
|
+
process.exit(1);
|
|
5755
|
+
} else {
|
|
5756
|
+
throw err;
|
|
5757
|
+
}
|
|
5758
|
+
}
|
|
5759
|
+
if (argValues.help) {
|
|
5760
|
+
console.log(helpMessage);
|
|
5761
|
+
process.exit(0);
|
|
5762
|
+
}
|
|
5763
|
+
if (argValues.version) {
|
|
5764
|
+
console.log(`${package_default.name} v${package_default.version}`);
|
|
5765
|
+
process.exit(0);
|
|
5766
|
+
}
|
|
5767
|
+
return {
|
|
5768
|
+
extended: !!argValues.extended
|
|
5769
|
+
};
|
|
5770
|
+
}
|
|
5771
|
+
function isValidPackageName(packageName) {
|
|
5772
|
+
return /^(@[a-z0-9-*~][a-z0-9-*_.~]*\/)?[a-z_][a-z0-9-_.~]*$/.test(packageName);
|
|
5773
|
+
}
|
|
5774
|
+
function isValidDirName(dirName) {
|
|
5775
|
+
return /^[a-zA-Z_][\w-.~ ]*$/.test(dirName);
|
|
5776
|
+
}
|
|
5651
5777
|
async function init() {
|
|
5652
5778
|
const cwd = process.cwd();
|
|
5653
|
-
const
|
|
5654
|
-
|
|
5779
|
+
const { extended } = processArgs();
|
|
5780
|
+
console.log();
|
|
5781
|
+
console.log(`Welcome to ${package_default.name} v${package_default.version}`);
|
|
5782
|
+
console.log();
|
|
5783
|
+
console.log("This tool will help you to scaffold a Vite project for your Vue-based library.");
|
|
5784
|
+
console.log();
|
|
5785
|
+
console.log("It is recommended to use a scoped package name for your library.");
|
|
5786
|
+
console.log("e.g. @username/package-name");
|
|
5787
|
+
console.log("To learn more about scopes see: https://docs.npmjs.com/about-scopes");
|
|
5788
|
+
console.log();
|
|
5789
|
+
const scopedPackageName = await textPrompt("Package name", "");
|
|
5790
|
+
if (!isValidPackageName(scopedPackageName)) {
|
|
5655
5791
|
console.log("Invalid package name: " + scopedPackageName);
|
|
5656
5792
|
process.exit(1);
|
|
5657
5793
|
}
|
|
5658
5794
|
const unscopedPackageName = scopedPackageName.replace(/.*\//, "");
|
|
5659
|
-
const shortUnscopedPackageName = unscopedPackageName.replace(/^vue-/, "");
|
|
5660
|
-
const projectName = unscopedPackageName.replace(/-+/g, " ").trim().split(" ").map((s) => s[0].toUpperCase() + s.slice(1)).join(" ");
|
|
5661
5795
|
const targetDirName = await textPrompt("Target directory", unscopedPackageName);
|
|
5662
|
-
if (targetDirName !== "." &&
|
|
5796
|
+
if (targetDirName !== "." && !isValidDirName(targetDirName)) {
|
|
5663
5797
|
console.log("Invalid directory name: " + targetDirName);
|
|
5664
5798
|
process.exit(1);
|
|
5665
5799
|
}
|
|
@@ -5673,25 +5807,48 @@ async function init() {
|
|
|
5673
5807
|
console.log("Target directory already exists");
|
|
5674
5808
|
}
|
|
5675
5809
|
}
|
|
5676
|
-
const mainPackageDirName = await
|
|
5677
|
-
if (
|
|
5810
|
+
const mainPackageDirName = await textPromptIf(extended, "Main package directory", unscopedPackageName);
|
|
5811
|
+
if (!isValidDirName(mainPackageDirName)) {
|
|
5678
5812
|
console.log("Invalid directory name: " + mainPackageDirName);
|
|
5679
5813
|
process.exit(1);
|
|
5680
5814
|
}
|
|
5681
|
-
const
|
|
5815
|
+
const defaultGlobalVariableName = unscopedPackageName.replace(/\W+/g, " ").trim().split(" ").map((s) => s[0].toUpperCase() + s.slice(1)).join("");
|
|
5816
|
+
const globalVariableName = await textPromptIf(extended, "Global variable name", defaultGlobalVariableName);
|
|
5682
5817
|
if (!/^[a-zA-Z$_][\w$]*$/.test(globalVariableName)) {
|
|
5683
5818
|
console.log("Invalid variable name: " + globalVariableName);
|
|
5684
5819
|
process.exit(1);
|
|
5685
5820
|
}
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5821
|
+
console.log();
|
|
5822
|
+
console.log("The GitHub path you provide below is used to generate various URLs.");
|
|
5823
|
+
console.log("For example, if you intended to have your repo at https://github.com/vuejs/core then the path would be vuejs/core.");
|
|
5824
|
+
console.log();
|
|
5825
|
+
const rawGithubPath = await textPrompt("GitHub path (optional)");
|
|
5826
|
+
const githubPath = rawGithubPath.replace(/^(https:\/\/github.com\/|\/)/, "");
|
|
5827
|
+
if (rawGithubPath && !/^[^\/]+\/[^\/]+$/.test(githubPath)) {
|
|
5828
|
+
console.log("Invalid GitHub path: " + rawGithubPath);
|
|
5689
5829
|
process.exit(1);
|
|
5690
5830
|
}
|
|
5831
|
+
const includeEsLint = await togglePrompt("Include ESLint?", true);
|
|
5832
|
+
const includeEsLintStylistic = await togglePromptIf(includeEsLint, "Include ESLint Stylistic for formatting?", includeEsLint);
|
|
5691
5833
|
const includeDocs = await togglePrompt("Include VitePress for documentation?", true);
|
|
5692
5834
|
const includeGithubPages = includeDocs && await togglePrompt("Include GitHub Pages config for documentation?");
|
|
5693
5835
|
const includePlayground = await togglePrompt("Include playground application for development?", true);
|
|
5694
5836
|
const includeExamples = await togglePrompt("Include example code?", true, "Yes", "No, just configs");
|
|
5837
|
+
function suggestExtended() {
|
|
5838
|
+
if (!extended) {
|
|
5839
|
+
console.log(`Use the --extended flag to configure the directory name separately.`);
|
|
5840
|
+
}
|
|
5841
|
+
}
|
|
5842
|
+
if (includeDocs && mainPackageDirName === "docs") {
|
|
5843
|
+
console.log(`The directory name 'docs' is reserved for the documentation, please choose a different name.`);
|
|
5844
|
+
suggestExtended();
|
|
5845
|
+
process.exit(1);
|
|
5846
|
+
}
|
|
5847
|
+
if (includePlayground && mainPackageDirName === "playground") {
|
|
5848
|
+
console.log(`The directory name 'playground' is reserved for the playground, please choose a different name.`);
|
|
5849
|
+
suggestExtended();
|
|
5850
|
+
process.exit(1);
|
|
5851
|
+
}
|
|
5695
5852
|
const [githubUserName, githubRepoName] = (githubPath || "/").split("/");
|
|
5696
5853
|
const githubUrl = githubPath ? `https://github.com/${githubPath}` : "";
|
|
5697
5854
|
const githubIssues = githubPath ? `${githubUrl}/issues` : "";
|
|
@@ -5703,8 +5860,6 @@ async function init() {
|
|
|
5703
5860
|
const config = {
|
|
5704
5861
|
scopedPackageName,
|
|
5705
5862
|
unscopedPackageName,
|
|
5706
|
-
shortUnscopedPackageName,
|
|
5707
|
-
projectName,
|
|
5708
5863
|
globalVariableName,
|
|
5709
5864
|
targetDirName,
|
|
5710
5865
|
targetDirPath,
|
|
@@ -5720,7 +5875,9 @@ async function init() {
|
|
|
5720
5875
|
includeDocs,
|
|
5721
5876
|
includeGithubPages,
|
|
5722
5877
|
includePlayground,
|
|
5723
|
-
includeExamples
|
|
5878
|
+
includeExamples,
|
|
5879
|
+
includeEsLint,
|
|
5880
|
+
includeEsLintStylistic
|
|
5724
5881
|
};
|
|
5725
5882
|
copyTemplate("base", config);
|
|
5726
5883
|
if (config.includeDocs) {
|
|
@@ -5732,6 +5889,9 @@ async function init() {
|
|
|
5732
5889
|
if (config.includePlayground) {
|
|
5733
5890
|
copyTemplate("playground", config);
|
|
5734
5891
|
}
|
|
5892
|
+
if (config.includeEsLint) {
|
|
5893
|
+
copyTemplate("eslint", config);
|
|
5894
|
+
}
|
|
5735
5895
|
console.log("Project created");
|
|
5736
5896
|
console.log("Note: pnpm must be used as the package manager");
|
|
5737
5897
|
console.log();
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": true,
|
|
3
3
|
"type": "module",
|
|
4
|
+
"packageManager": "pnpm@9.15.4",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=v18.3.0"
|
|
7
|
+
},
|
|
4
8
|
"scripts": {
|
|
5
9
|
"clean": "pnpm run -r clean",
|
|
6
10
|
"build": "pnpm run -r build",
|
|
7
11
|
"type-check": "pnpm run -r type-check",
|
|
8
|
-
|
|
12
|
+
<%_ if (config.includeEsLint) { _%>
|
|
13
|
+
"lint": "eslint",
|
|
14
|
+
"lint:fix": "eslint --fix",
|
|
15
|
+
<%_ } _%>
|
|
9
16
|
<%_ if (config.includePlayground) { _%>
|
|
10
17
|
"dev": "pnpm run --filter ./packages/playground -r dev",
|
|
11
18
|
<%_ } _%>
|
|
@@ -18,18 +25,32 @@
|
|
|
18
25
|
"preinstall": "node scripts/preinstall.js",
|
|
19
26
|
"postinstall": "simple-git-hooks"
|
|
20
27
|
},
|
|
28
|
+
<%_ if (config.includeEsLint) { _%>
|
|
21
29
|
"simple-git-hooks": {
|
|
22
30
|
"pre-commit": "pnpm run type-check && pnpm exec lint-staged"
|
|
23
31
|
},
|
|
24
32
|
"lint-staged": {
|
|
25
33
|
"*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": "eslint --fix"
|
|
26
34
|
},
|
|
35
|
+
<%_ } else { _%>
|
|
36
|
+
"simple-git-hooks": {
|
|
37
|
+
"pre-commit": "pnpm run type-check"
|
|
38
|
+
},
|
|
39
|
+
<%_ } _%>
|
|
27
40
|
"devDependencies": {
|
|
41
|
+
<%_ if (config.includeEsLint) { _%>
|
|
42
|
+
"@eslint/compat": "^1.2.6",
|
|
43
|
+
<%_ if (config.includeEsLintStylistic) { _%>
|
|
44
|
+
"@stylistic/eslint-plugin": "^4.0.0",
|
|
45
|
+
<%_ } _%>
|
|
28
46
|
"@typescript-eslint/parser": "^8.23.0",
|
|
47
|
+
"@vitest/eslint-plugin": "1.1.25",
|
|
29
48
|
"@vue/eslint-config-typescript": "^14.3.0",
|
|
30
49
|
"eslint": "^9.18.0",
|
|
31
50
|
"eslint-plugin-vue": "^9.32.0",
|
|
51
|
+
"jiti": "^2.4.2",
|
|
32
52
|
"lint-staged": "^15.4.3",
|
|
53
|
+
<%_ } _%>
|
|
33
54
|
"simple-git-hooks": "^2.11.1"
|
|
34
55
|
}
|
|
35
56
|
}
|
|
@@ -43,31 +43,26 @@
|
|
|
43
43
|
"@vue/test-utils": "^2.4.6",
|
|
44
44
|
"@vue/tsconfig": "^0.7.0",
|
|
45
45
|
"jsdom": "^26.0.0",
|
|
46
|
+
"npm-run-all2": "^7.0.2",
|
|
46
47
|
"rimraf": "^5.0.1",
|
|
47
48
|
"typescript": "~5.7.3",
|
|
48
49
|
"vite": "^6.0.11",
|
|
49
50
|
"vite-plugin-dts": "^4.5.0",
|
|
50
51
|
"vitest": "^3.0.2",
|
|
51
52
|
"vue": "^3.5.13",
|
|
52
|
-
"vue-tsc": "^2.2.0"
|
|
53
|
-
|
|
54
|
-
"@vitest/eslint-plugin": "1.1.25",
|
|
55
|
-
"@vue/eslint-config-typescript": "^14.3.0",
|
|
56
|
-
"eslint": "^9.18.0",
|
|
57
|
-
"eslint-plugin-vue": "^9.32.0",
|
|
58
|
-
"jiti": "^2.4.2",
|
|
59
|
-
"npm-run-all2": "^7.0.2",
|
|
60
|
-
"vite-plugin-vue-devtools": "^7.7.0"
|
|
53
|
+
"vue-tsc": "^2.2.0"
|
|
61
54
|
},
|
|
62
55
|
"scripts": {
|
|
63
|
-
"clean": "rimraf dist
|
|
56
|
+
"clean": "rimraf dist coverage",
|
|
57
|
+
"clean:dist": "rimraf dist",
|
|
64
58
|
"test:unit": "vitest --environment jsdom",
|
|
65
59
|
"coverage": "vitest run --coverage --environment jsdom",
|
|
66
|
-
"build": "
|
|
60
|
+
"build": "run-s clean:dist build-only type-check",
|
|
61
|
+
"build-only": "run-s build-dev build-neutral build-prod",
|
|
67
62
|
"build-dev": "vite build --mode development",
|
|
68
63
|
"build-neutral": "vite build --mode neutral",
|
|
69
64
|
"build-prod": "vite build --mode production",
|
|
70
|
-
"type-check": "vue-tsc --
|
|
65
|
+
"type-check": "vue-tsc --build",
|
|
71
66
|
"preinstall": "node ../../scripts/preinstall.js"
|
|
72
67
|
}
|
|
73
68
|
}
|
|
@@ -11,10 +11,12 @@ export default defineConfig(({ mode }) => {
|
|
|
11
11
|
throw new Error(`Unknown mode: ${mode}`)
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const dtsPlugin = mode === 'neutral'
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const dtsPlugin = mode === 'neutral'
|
|
15
|
+
? dts({
|
|
16
|
+
rollupTypes: true,
|
|
17
|
+
tsconfigPath: './tsconfig.app.json'
|
|
18
|
+
})
|
|
19
|
+
: null
|
|
18
20
|
|
|
19
21
|
return {
|
|
20
22
|
plugins: [
|
|
@@ -47,15 +49,18 @@ export default defineConfig(({ mode }) => {
|
|
|
47
49
|
|
|
48
50
|
if (format === 'iife') {
|
|
49
51
|
name += '.global'
|
|
50
|
-
}
|
|
52
|
+
}
|
|
53
|
+
else if (format === 'es') {
|
|
51
54
|
name += '.esm-' + (mode === 'neutral' ? 'bundler' : 'browser')
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
if (mode === 'production') {
|
|
55
58
|
name += '.prod'
|
|
56
|
-
}
|
|
59
|
+
}
|
|
60
|
+
else if (mode === 'development') {
|
|
57
61
|
name += '.dev'
|
|
58
|
-
}
|
|
62
|
+
}
|
|
63
|
+
else if (mode === 'neutral') {
|
|
59
64
|
extension = format === 'cjs' ? 'cjs' : 'mjs'
|
|
60
65
|
}
|
|
61
66
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as
|
|
1
|
+
export { default as ExampleComponent } from './components/ExampleComponent.vue'
|
|
2
2
|
export { default as MyPanel } from './components/MyPanel.vue'
|
|
3
3
|
export { default as MyPanelSection } from './components/MyPanelSection.vue'
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
|
|
4
|
+
import { includeIgnoreFile } from '@eslint/compat'
|
|
5
|
+
import pluginVue from 'eslint-plugin-vue'
|
|
6
|
+
<%_ if (config.includeEsLintStylistic) { _%>
|
|
7
|
+
import stylistic from '@stylistic/eslint-plugin'
|
|
8
|
+
<%_ } _%>
|
|
9
|
+
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
|
|
10
|
+
import pluginVitest from '@vitest/eslint-plugin'
|
|
11
|
+
|
|
12
|
+
export default defineConfigWithVueTs(
|
|
13
|
+
{
|
|
14
|
+
name: 'app/files-to-lint',
|
|
15
|
+
files: ['**/*.{ts,mts,vue}']
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
includeIgnoreFile(path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore')),
|
|
19
|
+
|
|
20
|
+
pluginVue.configs['flat/essential'],
|
|
21
|
+
vueTsConfigs.recommended,
|
|
22
|
+
|
|
23
|
+
<%_ if (config.includeEsLintStylistic) { _%>
|
|
24
|
+
stylistic.configs.customize({
|
|
25
|
+
commaDangle: 'never'
|
|
26
|
+
}),
|
|
27
|
+
<%_ } _%>
|
|
28
|
+
|
|
29
|
+
{
|
|
30
|
+
...pluginVitest.configs.recommended,
|
|
31
|
+
files: ['src/**/__tests__/*']
|
|
32
|
+
}
|
|
33
|
+
)
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"private": true,
|
|
3
3
|
"scripts": {
|
|
4
4
|
"dev": "vite --port 5051",
|
|
5
|
-
"type-check": "vue-tsc --
|
|
5
|
+
"type-check": "vue-tsc --build",
|
|
6
6
|
"build-only": "vite build",
|
|
7
|
-
"build": "
|
|
7
|
+
"build": "run-p -c type-check \"build-only {@}\" --",
|
|
8
8
|
"preview": "vite preview --port 4051",
|
|
9
9
|
"clean": "rimraf dist"
|
|
10
10
|
},
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"@types/node": "^22.10.7",
|
|
17
17
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
18
18
|
"@vue/tsconfig": "^0.7.0",
|
|
19
|
+
"npm-run-all2": "^7.0.2",
|
|
19
20
|
"rimraf": "^5.0.1",
|
|
20
21
|
"typescript": "~5.7.3",
|
|
21
22
|
"vite": "^6.0.11",
|
|
@@ -7,13 +7,13 @@ import vueDevTools from 'vite-plugin-vue-devtools'
|
|
|
7
7
|
export default defineConfig(({ mode }) => ({
|
|
8
8
|
plugins: [
|
|
9
9
|
vue(),
|
|
10
|
-
vueDevTools()
|
|
10
|
+
vueDevTools()
|
|
11
11
|
],
|
|
12
12
|
resolve: {
|
|
13
13
|
alias: {
|
|
14
14
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
15
15
|
'@scopedPackageName@': fileURLToPath(new URL('../@projectName@/src/index.ts', import.meta.url))
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
},
|
|
18
18
|
|
|
19
19
|
define: {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": true,
|
|
3
3
|
"scripts": {
|
|
4
|
-
"clean": "rimraf dist
|
|
4
|
+
"clean": "rimraf dist .vitepress/cache",
|
|
5
5
|
"dev": "vitepress dev .",
|
|
6
|
-
"type-check": "
|
|
6
|
+
"type-check": "run-p -c type-check:*",
|
|
7
|
+
"type-check:code": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
|
|
8
|
+
"type-check:config": "vue-tsc --noEmit -p tsconfig.node.json --composite false",
|
|
7
9
|
"build-only": "vitepress build .",
|
|
8
|
-
"build": "
|
|
10
|
+
"build": "run-p -c type-check \"build-only {@}\" --",
|
|
9
11
|
"preview": "vitepress preview .",
|
|
10
12
|
"preinstall": "node ../../scripts/preinstall.js"
|
|
11
13
|
},
|
|
@@ -16,6 +18,7 @@
|
|
|
16
18
|
"@tsconfig/node22": "^22.0.0",
|
|
17
19
|
"@types/node": "^22.13.0",
|
|
18
20
|
"@vue/tsconfig": "^0.7.0",
|
|
21
|
+
"npm-run-all2": "^7.0.2",
|
|
19
22
|
"rimraf": "^6.0.1",
|
|
20
23
|
"typescript": "~5.7.3",
|
|
21
24
|
"vitepress": "^1.6.3",
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
3
|
-
"include": [
|
|
3
|
+
"include": [
|
|
4
|
+
"env.d.ts",
|
|
5
|
+
"src/**/*",
|
|
6
|
+
"src/**/*.vue",
|
|
7
|
+
".vitepress/theme/**/*",
|
|
8
|
+
".vitepress/theme/**/*.vue",
|
|
9
|
+
"src/**/*.md"
|
|
10
|
+
],
|
|
4
11
|
"compilerOptions": {
|
|
5
12
|
"tsBuildInfoFile": "../../node_modules/.tmp/tsconfig.docs.app.tsbuildinfo",
|
|
6
13
|
"paths": {
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@tsconfig/node22/tsconfig.json",
|
|
3
|
-
"include": [
|
|
4
|
-
"vite.config.*",
|
|
5
|
-
"vitest.config.*",
|
|
6
|
-
"cypress.config.*",
|
|
7
|
-
"nightwatch.conf.*",
|
|
8
|
-
"playwright.config.*",
|
|
9
|
-
"eslint.config.*"
|
|
10
|
-
],
|
|
3
|
+
"include": [".vitepress/config.*"],
|
|
11
4
|
"compilerOptions": {
|
|
12
5
|
"noEmit": true,
|
|
13
6
|
"tsBuildInfoFile": "../../node_modules/.tmp/tsconfig.docs.node.tsbuildinfo",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skirtle/create-vue-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"author": "skirtle",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Create a library using Vue and Vite",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"vite",
|
|
12
12
|
"build"
|
|
13
13
|
],
|
|
14
|
-
"homepage": "https://
|
|
14
|
+
"homepage": "https://skirtles-code.github.io/create-vue-lib/",
|
|
15
15
|
"bugs": "https://github.com/skirtles-code/create-vue-lib/issues",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"copyfiles": "^2.4.1",
|
|
37
37
|
"ejs": "^3.1.10",
|
|
38
38
|
"lint-staged": "^15.4.3",
|
|
39
|
+
"npm-run-all2": "^7.0.2",
|
|
39
40
|
"prompts": "^2.4.2",
|
|
40
41
|
"rimraf": "^6.0.1",
|
|
41
42
|
"simple-git-hooks": "^2.11.1",
|
|
@@ -44,11 +45,13 @@
|
|
|
44
45
|
},
|
|
45
46
|
"scripts": {
|
|
46
47
|
"clean": "rimraf dist",
|
|
47
|
-
"build": "
|
|
48
|
+
"build": "run-s clean build:copy build:ts",
|
|
48
49
|
"build:copy": "copyfiles -u 1 -a \"src/template/**\" dist",
|
|
49
50
|
"build:ts": "tsup src/index.ts --format cjs --target node18",
|
|
50
51
|
"build:dts": "tsup src/index.ts --dts --format cjs --target node18",
|
|
51
52
|
"start": "node ./dist/index.cjs",
|
|
53
|
+
"docs:dev": "pnpm run --filter ./docs -r dev",
|
|
54
|
+
"docs:build": "pnpm run --filter ./docs -r build",
|
|
52
55
|
"preinstall": "npx only-allow pnpm"
|
|
53
56
|
}
|
|
54
57
|
}
|