obsidian-plugin-config 1.4.4 → 1.4.6
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/.injection-info.json +5 -1
- package/.vscode/tasks.json +116 -116
- package/bin/obsidian-inject.js +1 -1
- package/package.json +3 -1
- package/scripts/acp.ts +64 -56
- package/scripts/build-npm.ts +152 -135
- package/scripts/esbuild.config.ts +221 -196
- package/scripts/inject-core.ts +613 -619
- package/scripts/inject-path.ts +144 -130
- package/scripts/inject-prompt.ts +85 -78
- package/scripts/sync-template-deps.ts +44 -44
- package/scripts/update-version-config.ts +117 -98
- package/scripts/utils.ts +121 -118
- package/templates/.vscode/settings.json +9 -9
- package/templates/.vscode/tasks.json +53 -53
- package/templates/package.json +3 -1
- package/templates/scripts/acp.ts +64 -56
- package/templates/scripts/esbuild.config.ts +268 -232
- package/templates/scripts/release.ts +78 -79
- package/templates/scripts/update-version.ts +129 -106
- package/templates/scripts/utils.ts +129 -126
- package/tsconfig.json +30 -41
- package/versions.json +3 -1
package/templates/scripts/acp.ts
CHANGED
|
@@ -1,75 +1,83 @@
|
|
|
1
|
-
import { execSync } from
|
|
2
|
-
import fs from
|
|
3
|
-
import path from
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from
|
|
5
|
+
askQuestion,
|
|
6
|
+
cleanInput,
|
|
7
|
+
createReadlineInterface,
|
|
8
|
+
gitExec,
|
|
9
|
+
ensureGitSync
|
|
10
|
+
} from './utils.js';
|
|
11
11
|
|
|
12
12
|
const rl = createReadlineInterface();
|
|
13
13
|
|
|
14
14
|
// Check if we're in the centralized config repo
|
|
15
15
|
function isInCentralizedRepo(): boolean {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
17
|
+
if (!fs.existsSync(packageJsonPath)) return false;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
20
|
+
return packageJson.name === 'obsidian-plugin-config';
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
async function main(): Promise<void> {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
try {
|
|
25
|
+
if (process.argv.includes('-b')) {
|
|
26
|
+
console.log('Building...');
|
|
27
|
+
gitExec('yarn build');
|
|
28
|
+
console.log('Build successful.');
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
// Only update exports if we're in the centralized repo and not explicitly disabled
|
|
32
|
+
if (
|
|
33
|
+
!process.argv.includes('-ne') &&
|
|
34
|
+
!process.argv.includes('--no-exports') &&
|
|
35
|
+
isInCentralizedRepo()
|
|
36
|
+
) {
|
|
37
|
+
console.log('Updating exports...');
|
|
38
|
+
gitExec('yarn run update-exports');
|
|
39
|
+
console.log('Exports updated.');
|
|
40
|
+
}
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
const input: string = await askQuestion('Enter commit message: ', rl);
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
const cleanedInput = cleanInput(input);
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
try {
|
|
47
|
+
gitExec('git add -A');
|
|
48
|
+
gitExec(`git commit -m "${cleanedInput}"`);
|
|
49
|
+
} catch {
|
|
50
|
+
console.log('Commit already exists or failed.');
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
// get current branch name
|
|
55
|
+
const currentBranch = execSync('git rev-parse --abbrev-ref HEAD')
|
|
56
|
+
.toString()
|
|
57
|
+
.trim();
|
|
52
58
|
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
// Ensure Git is synchronized before pushing
|
|
60
|
+
await ensureGitSync();
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
try {
|
|
63
|
+
gitExec(`git push origin ${currentBranch}`);
|
|
64
|
+
console.log('Commit and push successful.');
|
|
65
|
+
} catch {
|
|
66
|
+
// new branch
|
|
67
|
+
console.log(`New branch detected. Setting upstream for ${currentBranch}...`);
|
|
68
|
+
gitExec(`git push --set-upstream origin ${currentBranch}`);
|
|
69
|
+
console.log('Upstream branch set and push successful.');
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error('Error:', error instanceof Error ? error.message : String(error));
|
|
73
|
+
} finally {
|
|
74
|
+
rl.close();
|
|
75
|
+
}
|
|
70
76
|
}
|
|
71
77
|
|
|
72
|
-
main()
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
main()
|
|
79
|
+
.catch(console.error)
|
|
80
|
+
.finally(() => {
|
|
81
|
+
console.log('Exiting...');
|
|
82
|
+
process.exit();
|
|
83
|
+
});
|