obsidian-plugin-config 1.4.4 → 1.4.7
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 +61 -53
- package/templates/package.json +4 -2
- 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 +4 -1
package/.injection-info.json
CHANGED
package/.vscode/tasks.json
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"label": "Build",
|
|
6
|
+
"type": "shell",
|
|
7
|
+
"command": "yarn build",
|
|
8
|
+
"group": { "kind": "build", "isDefault": true },
|
|
9
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
10
|
+
"problemMatcher": ["$tsc"]
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"label": "Dev (watch)",
|
|
14
|
+
"type": "shell",
|
|
15
|
+
"command": "yarn dev",
|
|
16
|
+
"group": "build",
|
|
17
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
18
|
+
"problemMatcher": ["$tsc-watch"],
|
|
19
|
+
"isBackground": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"label": "Real (build to vault)",
|
|
23
|
+
"type": "shell",
|
|
24
|
+
"command": "yarn real",
|
|
25
|
+
"group": "build",
|
|
26
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
27
|
+
"problemMatcher": ["$tsc"]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"label": "Lint",
|
|
31
|
+
"type": "shell",
|
|
32
|
+
"command": "yarn lint",
|
|
33
|
+
"group": "test",
|
|
34
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
35
|
+
"problemMatcher": ["$eslint-stylish"]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"label": "Lint: Fix",
|
|
39
|
+
"type": "shell",
|
|
40
|
+
"command": "yarn lint:fix",
|
|
41
|
+
"group": "test",
|
|
42
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
43
|
+
"problemMatcher": ["$eslint-stylish"]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"label": "Prettier: Check",
|
|
47
|
+
"type": "shell",
|
|
48
|
+
"command": "yarn prettier",
|
|
49
|
+
"group": "test",
|
|
50
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
51
|
+
"problemMatcher": []
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"label": "Prettier: Fix",
|
|
55
|
+
"type": "shell",
|
|
56
|
+
"command": "yarn prettier:fix",
|
|
57
|
+
"group": "test",
|
|
58
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
59
|
+
"problemMatcher": []
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"label": "Update Exports",
|
|
63
|
+
"type": "shell",
|
|
64
|
+
"command": "yarn update-exports",
|
|
65
|
+
"group": "build",
|
|
66
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
67
|
+
"problemMatcher": []
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"label": "ACP (add, commit, push)",
|
|
71
|
+
"type": "shell",
|
|
72
|
+
"command": "yarn acp",
|
|
73
|
+
"group": "build",
|
|
74
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
75
|
+
"problemMatcher": []
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"label": "BACP (build + acp)",
|
|
79
|
+
"type": "shell",
|
|
80
|
+
"command": "yarn bacp",
|
|
81
|
+
"group": "build",
|
|
82
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
83
|
+
"problemMatcher": []
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"label": "Version update",
|
|
87
|
+
"type": "shell",
|
|
88
|
+
"command": "yarn v",
|
|
89
|
+
"group": "build",
|
|
90
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
91
|
+
"problemMatcher": []
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"label": "Upgrade All (yarn upgrade + sync templates)",
|
|
95
|
+
"type": "shell",
|
|
96
|
+
"command": "yarn upgrade-all",
|
|
97
|
+
"group": "build",
|
|
98
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
99
|
+
"problemMatcher": []
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"label": "NPM Publish",
|
|
103
|
+
"type": "shell",
|
|
104
|
+
"command": "yarn npm-publish",
|
|
105
|
+
"group": "build",
|
|
106
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
107
|
+
"problemMatcher": []
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"label": "Cleanup: Lint + Prettier + Build",
|
|
111
|
+
"dependsOrder": "sequence",
|
|
112
|
+
"dependsOn": ["Lint: Fix", "Prettier: Fix", "Build"],
|
|
113
|
+
"group": "build",
|
|
114
|
+
"presentation": { "reveal": "always", "panel": "shared" },
|
|
115
|
+
"problemMatcher": []
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
118
|
}
|
package/bin/obsidian-inject.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "obsidian-plugin-config",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7",
|
|
4
4
|
"description": "Système d'injection pour plugins Obsidian autonomes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
"real": "tsx scripts/esbuild.config.ts production real",
|
|
32
32
|
"lint": "eslint . --ext .ts",
|
|
33
33
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
34
|
+
"prettier": "npx prettier --check '**/*.{ts,json}'",
|
|
35
|
+
"prettier:fix": "npx prettier --write '**/*.{ts,json}'",
|
|
34
36
|
"inject-path": "tsx scripts/inject-path.ts",
|
|
35
37
|
"inject-sass": "tsx scripts/inject-path.ts --sass",
|
|
36
38
|
"inject-prompt": "tsx scripts/inject-prompt.ts",
|
package/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
|
+
});
|