@duonghieu0712z/create-tauri-vue-template 0.0.22 → 0.1.0
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/dist/cli/files.js +3 -0
- package/dist/cli/project.js +12 -6
- package/package.json +7 -2
- package/template/.github/workflows/release.yml +6 -2
- package/template/README.md +1 -1
- package/template/package.json +1 -1
- package/template/tsconfig.node.json +1 -0
- package/dist/cli/release-workflow.js +0 -13
package/dist/cli/files.js
CHANGED
|
@@ -9,6 +9,9 @@ export function replaceOne(content, pattern, replacement, description) {
|
|
|
9
9
|
if (!pattern.test(content)) {
|
|
10
10
|
throw new Error(`Could not update ${description}`);
|
|
11
11
|
}
|
|
12
|
+
if (typeof replacement === 'string') {
|
|
13
|
+
return content.replace(pattern, replacement);
|
|
14
|
+
}
|
|
12
15
|
return content.replace(pattern, replacement);
|
|
13
16
|
}
|
|
14
17
|
export async function updateText(path, replacements) {
|
package/dist/cli/project.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
2
|
import { readJson, updateText, writeJson } from './files.js';
|
|
3
|
-
import { updateReleaseWorkflow } from './release-workflow.js';
|
|
4
3
|
const initialProjectVersion = '0.0.1';
|
|
4
|
+
function literal(value) {
|
|
5
|
+
return () => value;
|
|
6
|
+
}
|
|
7
|
+
function tomlString(value) {
|
|
8
|
+
return JSON.stringify(value);
|
|
9
|
+
}
|
|
5
10
|
export async function renameProject(targetDir, identity) {
|
|
6
11
|
const packageJsonPath = resolve(targetDir, 'package.json');
|
|
7
12
|
const packageJson = await readJson(packageJsonPath);
|
|
@@ -37,26 +42,27 @@ export async function renameProject(targetDir, identity) {
|
|
|
37
42
|
}
|
|
38
43
|
await writeJson(tauriConfigPath, tauriConfig);
|
|
39
44
|
await updateText(resolve(targetDir, 'index.html'), [
|
|
40
|
-
[/<title>.*<\/title>/, `<title>${identity.appName}</title>`],
|
|
45
|
+
[/<title>.*<\/title>/, literal(`<title>${identity.appName}</title>`)],
|
|
46
|
+
]);
|
|
47
|
+
await updateText(resolve(targetDir, 'README.md'), [
|
|
48
|
+
[/^# .+$/m, literal(`# ${identity.appName}`)],
|
|
41
49
|
]);
|
|
42
|
-
await updateText(resolve(targetDir, 'README.md'), [[/^# .+$/m, `# ${identity.appName}`]]);
|
|
43
50
|
await updateText(resolve(targetDir, 'src-tauri', 'Cargo.toml'), [
|
|
44
51
|
[/^name = "([^"]+)"/m, `name = "${identity.crateName}"`],
|
|
45
52
|
[/^version = "([^"]+)"/m, `version = "${initialProjectVersion}"`],
|
|
46
53
|
[
|
|
47
54
|
/^description = "([^"]+)"/m,
|
|
48
|
-
`description =
|
|
55
|
+
literal(`description = ${tomlString(identity.description || identity.appName)}`),
|
|
49
56
|
],
|
|
50
57
|
[/^(\[lib\]\s+[\s\S]*?^name = )"([^"]+)"/m, `$1"${identity.crateLibName}"`],
|
|
51
58
|
]);
|
|
52
59
|
await updateText(resolve(targetDir, 'src-tauri', 'Cargo.toml'), [
|
|
53
60
|
[
|
|
54
61
|
/^authors = \[[^\]]*\]/m,
|
|
55
|
-
identity.author ? `authors = [
|
|
62
|
+
literal(identity.author ? `authors = [${tomlString(identity.author)}]` : 'authors = []'),
|
|
56
63
|
],
|
|
57
64
|
]);
|
|
58
65
|
await updateText(resolve(targetDir, 'src-tauri', 'src', 'main.rs'), [
|
|
59
66
|
[/[a-zA-Z0-9_]+_lib::run\(\)/, `${identity.crateLibName}::run()`],
|
|
60
67
|
]);
|
|
61
|
-
await updateReleaseWorkflow(resolve(targetDir, '.github', 'workflows', 'release.yml'), identity);
|
|
62
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duonghieu0712z/create-tauri-vue-template",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Create a Tauri 2 + Vue 3 desktop app from the tauri-vue-template starter.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,12 @@
|
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
14
|
-
"template"
|
|
14
|
+
"template",
|
|
15
|
+
"!template/node_modules",
|
|
16
|
+
"!template/dist",
|
|
17
|
+
"!template/dist-ssr",
|
|
18
|
+
"!template/src-tauri/target",
|
|
19
|
+
"!template/src-tauri/gen/schemas"
|
|
15
20
|
],
|
|
16
21
|
"type": "module",
|
|
17
22
|
"publishConfig": {
|
|
@@ -70,7 +70,7 @@ jobs:
|
|
|
70
70
|
RUBY
|
|
71
71
|
|
|
72
72
|
build:
|
|
73
|
-
name: Build release (${{ matrix.
|
|
73
|
+
name: Build release (${{ matrix.label }})
|
|
74
74
|
needs: changelog
|
|
75
75
|
permissions:
|
|
76
76
|
contents: write
|
|
@@ -81,12 +81,16 @@ jobs:
|
|
|
81
81
|
matrix:
|
|
82
82
|
include:
|
|
83
83
|
- os: macos-latest
|
|
84
|
+
label: macos-aarch64
|
|
84
85
|
args: --target aarch64-apple-darwin
|
|
85
86
|
- os: macos-latest
|
|
87
|
+
label: macos-x86_64
|
|
86
88
|
args: --target x86_64-apple-darwin
|
|
87
89
|
- os: ubuntu-latest
|
|
90
|
+
label: ubuntu
|
|
88
91
|
args: ''
|
|
89
92
|
- os: windows-latest
|
|
93
|
+
label: windows
|
|
90
94
|
args: ''
|
|
91
95
|
|
|
92
96
|
steps:
|
|
@@ -129,7 +133,7 @@ jobs:
|
|
|
129
133
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
130
134
|
with:
|
|
131
135
|
tagName: v__VERSION__
|
|
132
|
-
releaseName:
|
|
136
|
+
releaseName: v__VERSION__
|
|
133
137
|
releaseBody: ${{ needs.changelog.outputs.body }}
|
|
134
138
|
releaseDraft: true
|
|
135
139
|
prerelease: false
|
package/template/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Setup
|
|
4
4
|
|
|
5
|
-
Install Node.js, pnpm, Rust, and the Tauri system dependencies for your operating system. This project requires Node.js
|
|
5
|
+
Install Node.js, pnpm, Rust, and the Tauri system dependencies for your operating system. This project requires Node.js `>=22.12.0`.
|
|
6
6
|
|
|
7
7
|
On Ubuntu/Debian, install the Tauri Linux dependencies:
|
|
8
8
|
|
package/template/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { replaceOne } from './files.js';
|
|
3
|
-
export async function updateReleaseWorkflow(path, identity) {
|
|
4
|
-
let content = await readFile(path, 'utf8');
|
|
5
|
-
content = replaceOne(content, /^(\s*releaseName:\s*).*$/m, `$1${identity.appName} v__VERSION__`, path);
|
|
6
|
-
if (/^\s*releaseAssetNamePattern:\s*/m.test(content)) {
|
|
7
|
-
content = replaceOne(content, /^(\s*releaseAssetNamePattern:\s*).*$/m, `$1${identity.packageName}_[version]_[arch][setup][ext]`, path);
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
content = replaceOne(content, /^(\s*prerelease:\s*false)$/m, `$1\n releaseAssetNamePattern: ${identity.packageName}_[version]_[arch][setup][ext]`, path);
|
|
11
|
-
}
|
|
12
|
-
await writeFile(path, content);
|
|
13
|
-
}
|