@duonghieu0712z/create-tauri-vue-template 0.0.23 → 0.1.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/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.
|
|
3
|
+
"version": "0.1.1",
|
|
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": {
|
|
@@ -82,16 +82,12 @@ jobs:
|
|
|
82
82
|
include:
|
|
83
83
|
- os: macos-latest
|
|
84
84
|
label: macos-aarch64
|
|
85
|
-
|
|
86
|
-
- os: macos-latest
|
|
85
|
+
- os: macos-15-intel
|
|
87
86
|
label: macos-x86_64
|
|
88
|
-
args: --target x86_64-apple-darwin
|
|
89
87
|
- os: ubuntu-latest
|
|
90
88
|
label: ubuntu
|
|
91
|
-
args: ''
|
|
92
89
|
- os: windows-latest
|
|
93
90
|
label: windows
|
|
94
|
-
args: ''
|
|
95
91
|
|
|
96
92
|
steps:
|
|
97
93
|
- name: Checkout repository
|
|
@@ -116,8 +112,6 @@ jobs:
|
|
|
116
112
|
|
|
117
113
|
- name: Setup Rust
|
|
118
114
|
uses: dtolnay/rust-toolchain@stable
|
|
119
|
-
with:
|
|
120
|
-
targets: ${{ matrix.os == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
|
121
115
|
|
|
122
116
|
- name: Rust cache
|
|
123
117
|
uses: swatinem/rust-cache@v2
|
|
@@ -137,4 +131,3 @@ jobs:
|
|
|
137
131
|
releaseBody: ${{ needs.changelog.outputs.body }}
|
|
138
132
|
releaseDraft: true
|
|
139
133
|
prerelease: false
|
|
140
|
-
args: ${{ matrix.args }}
|
|
@@ -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
|
-
}
|