inskea 0.0.0-stage → 2.1.3
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 +26 -2
- package/assets/inskea-mime.xml +8 -0
- package/assets/inskea.desktop +10 -0
- package/assets/inskea.png +0 -0
- package/bin/inskea.js +87 -0
- package/package.json +30 -3
- package/scripts/postinstall.js +87 -0
- package/scripts/preuninstall.js +55 -0
package/README.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Inskea
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Infinite-canvas vector drawing application for sketching shapes, freehand strokes, and text.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g inskea
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Run
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
inskea
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or open a specific drawing:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
inskea my-sketch.skea
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Instant Trial (No install)
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx inskea
|
|
27
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
|
3
|
+
<mime-type type="application/x-inskea">
|
|
4
|
+
<comment>Inskea drawing</comment>
|
|
5
|
+
<icon name="inskea"/>
|
|
6
|
+
<glob pattern="*.skea"/>
|
|
7
|
+
</mime-type>
|
|
8
|
+
</mime-info>
|
|
Binary file
|
package/bin/inskea.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const key = `${process.platform}-${process.arch}`;
|
|
8
|
+
|
|
9
|
+
// Resolve platform package name from optionalDependencies in package.json
|
|
10
|
+
let pkgName;
|
|
11
|
+
try {
|
|
12
|
+
const rootPkg = require(path.join(__dirname, '..', 'package.json'));
|
|
13
|
+
const optionalDeps = Object.keys(rootPkg.optionalDependencies || {});
|
|
14
|
+
pkgName = optionalDeps.find(name => name.endsWith(`-${key}`));
|
|
15
|
+
} catch (_) {}
|
|
16
|
+
|
|
17
|
+
if (!pkgName) {
|
|
18
|
+
pkgName = `@quippy/inskea-${key}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (process.platform !== 'linux' && process.platform !== 'win32') {
|
|
22
|
+
console.error(`[inskea] Unsupported platform: ${process.platform}`);
|
|
23
|
+
console.error('Currently supported platforms: linux-x64, win32-x64');
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function resolveBinary() {
|
|
28
|
+
const binaryName = process.platform === 'win32' ? 'inskea.exe' : 'inskea';
|
|
29
|
+
|
|
30
|
+
// 1. Try require.resolve for the scoped platform package
|
|
31
|
+
try {
|
|
32
|
+
const pkgJson = require.resolve(`${pkgName}/package.json`);
|
|
33
|
+
const candidate = path.join(path.dirname(pkgJson), 'bin', binaryName);
|
|
34
|
+
if (fs.existsSync(candidate)) {
|
|
35
|
+
return candidate;
|
|
36
|
+
}
|
|
37
|
+
} catch (_) {}
|
|
38
|
+
|
|
39
|
+
// 2. Search common node_modules layouts (flat, hoisted, or nested)
|
|
40
|
+
const searchPaths = [
|
|
41
|
+
path.join(__dirname, '..', 'node_modules', pkgName, 'bin', binaryName),
|
|
42
|
+
path.join(__dirname, '..', '..', pkgName, 'bin', binaryName),
|
|
43
|
+
path.join(__dirname, '..', '..', '..', pkgName, 'bin', binaryName),
|
|
44
|
+
path.join(__dirname, '..', '..', '..', '..', pkgName, 'bin', binaryName)
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
for (const candidate of searchPaths) {
|
|
48
|
+
if (fs.existsSync(candidate)) {
|
|
49
|
+
return candidate;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const binaryPath = resolveBinary();
|
|
57
|
+
if (!binaryPath) {
|
|
58
|
+
console.error(
|
|
59
|
+
`[inskea] Could not locate native executable for ${key}.\n` +
|
|
60
|
+
`Expected package "${pkgName}" to be installed. Please try reinstalling with:\n` +
|
|
61
|
+
` npm install -g inskea`
|
|
62
|
+
);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Ensure execution permissions on Unix
|
|
67
|
+
if (process.platform !== 'win32') {
|
|
68
|
+
try {
|
|
69
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
70
|
+
} catch (_) {}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const isCliCheck = process.argv.some(arg =>
|
|
74
|
+
arg === '--help' || arg === '-h' || arg === '--version' || arg === '-V'
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
78
|
+
stdio: isCliCheck ? 'inherit' : 'ignore',
|
|
79
|
+
detached: !isCliCheck
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
if (!isCliCheck) {
|
|
83
|
+
child.unref();
|
|
84
|
+
process.exit(0);
|
|
85
|
+
} else {
|
|
86
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
|
87
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inskea",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "2.1.3",
|
|
4
|
+
"description": "Inskea - infinite-canvas vector illustration app",
|
|
5
|
+
"bin": {
|
|
6
|
+
"inskea": "bin/inskea.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node scripts/postinstall.js",
|
|
10
|
+
"preuninstall": "node scripts/preuninstall.js"
|
|
11
|
+
},
|
|
12
|
+
"optionalDependencies": {
|
|
13
|
+
"@quippy/inskea-linux-x64": "2.1.3",
|
|
14
|
+
"@quippy/inskea-win32-x64": "2.1.3"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"inskea",
|
|
18
|
+
"drawing",
|
|
19
|
+
"vector",
|
|
20
|
+
"canvas",
|
|
21
|
+
"illustration",
|
|
22
|
+
"sketch",
|
|
23
|
+
"tauri",
|
|
24
|
+
"desktop"
|
|
25
|
+
],
|
|
26
|
+
"author": "Quippy22",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/Quippy22/Inskea"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/Quippy22/Inskea#readme"
|
|
6
33
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const os = require('os');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
function installLinux() {
|
|
9
|
+
// If running with root/sudo, install to standard system-wide /usr/local/share so it is available to ALL users on the machine.
|
|
10
|
+
// Otherwise, install to standard user-level ~/.local/share.
|
|
11
|
+
const isRoot = typeof process.getuid === 'function' && process.getuid() === 0;
|
|
12
|
+
const baseDir = isRoot ? '/usr/local/share' : path.join(os.homedir(), '.local', 'share');
|
|
13
|
+
|
|
14
|
+
const appsDir = path.join(baseDir, 'applications');
|
|
15
|
+
const iconsDir = path.join(baseDir, 'icons', 'hicolor', '128x128', 'apps');
|
|
16
|
+
const mimeDir = path.join(baseDir, 'mime', 'packages');
|
|
17
|
+
|
|
18
|
+
fs.mkdirSync(appsDir, { recursive: true });
|
|
19
|
+
fs.mkdirSync(iconsDir, { recursive: true });
|
|
20
|
+
fs.mkdirSync(mimeDir, { recursive: true });
|
|
21
|
+
|
|
22
|
+
const assetsDir = path.join(__dirname, '..', 'assets');
|
|
23
|
+
|
|
24
|
+
// Copy icon
|
|
25
|
+
const iconSrc = path.join(assetsDir, 'inskea.png');
|
|
26
|
+
const iconDest = path.join(iconsDir, 'inskea.png');
|
|
27
|
+
if (fs.existsSync(iconSrc)) {
|
|
28
|
+
fs.copyFileSync(iconSrc, iconDest);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Copy MIME XML
|
|
32
|
+
const mimeSrc = path.join(assetsDir, 'inskea-mime.xml');
|
|
33
|
+
const mimeDest = path.join(mimeDir, 'inskea.xml');
|
|
34
|
+
if (fs.existsSync(mimeSrc)) {
|
|
35
|
+
fs.copyFileSync(mimeSrc, mimeDest);
|
|
36
|
+
try {
|
|
37
|
+
execSync(`update-mime-database "${path.join(baseDir, 'mime')}"`, { stdio: 'ignore' });
|
|
38
|
+
} catch (_) {}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Copy .desktop file
|
|
42
|
+
const desktopSrc = path.join(assetsDir, 'inskea.desktop');
|
|
43
|
+
const desktopDest = path.join(appsDir, 'inskea.desktop');
|
|
44
|
+
if (fs.existsSync(desktopSrc)) {
|
|
45
|
+
fs.copyFileSync(desktopSrc, desktopDest);
|
|
46
|
+
try {
|
|
47
|
+
execSync(`update-desktop-database "${appsDir}"`, { stdio: 'ignore' });
|
|
48
|
+
} catch (_) {}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
console.log(`[inskea] Registered desktop launcher in ${appsDir}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function installWindows() {
|
|
55
|
+
const appData = process.env.APPDATA;
|
|
56
|
+
if (!appData) return;
|
|
57
|
+
|
|
58
|
+
const startMenuDir = path.join(appData, 'Microsoft', 'Windows', 'Start Menu', 'Programs');
|
|
59
|
+
if (!fs.existsSync(startMenuDir)) return;
|
|
60
|
+
|
|
61
|
+
const shortcutPath = path.join(startMenuDir, 'Inskea.lnk');
|
|
62
|
+
const npmCmd = path.join(appData, 'npm', 'inskea.cmd');
|
|
63
|
+
|
|
64
|
+
const psCommand = `
|
|
65
|
+
$ws = New-Object -ComObject WScript.Shell;
|
|
66
|
+
$s = $ws.CreateShortcut('${shortcutPath.replace(/'/g, "''")}');
|
|
67
|
+
$s.TargetPath = '${npmCmd.replace(/'/g, "''")}';
|
|
68
|
+
$s.Description = 'Inskea vector illustration app';
|
|
69
|
+
$s.Save();
|
|
70
|
+
`.replace(/\r?\n\s*/g, ' ');
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
execSync(`powershell -NoProfile -Command "${psCommand}"`, { stdio: 'ignore' });
|
|
74
|
+
console.log('[inskea] Registered Windows Start Menu shortcut');
|
|
75
|
+
} catch (_) {}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
if (process.platform === 'linux') {
|
|
80
|
+
installLinux();
|
|
81
|
+
} else if (process.platform === 'win32') {
|
|
82
|
+
installWindows();
|
|
83
|
+
}
|
|
84
|
+
} catch (err) {
|
|
85
|
+
// Never fail npm install if desktop integration encounters permission/missing command warnings
|
|
86
|
+
console.warn('[inskea] Notice: Could not register desktop shortcut automatically:', err.message);
|
|
87
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const os = require('os');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
function removeLinux() {
|
|
9
|
+
const dirs = [
|
|
10
|
+
'/usr/local/share',
|
|
11
|
+
path.join(os.homedir(), '.local', 'share')
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
for (const baseDir of dirs) {
|
|
15
|
+
const desktopFile = path.join(baseDir, 'applications', 'inskea.desktop');
|
|
16
|
+
const iconFile = path.join(baseDir, 'icons', 'hicolor', '128x128', 'apps', 'inskea.png');
|
|
17
|
+
const mimeFile = path.join(baseDir, 'mime', 'packages', 'inskea.xml');
|
|
18
|
+
|
|
19
|
+
if (fs.existsSync(desktopFile)) {
|
|
20
|
+
try {
|
|
21
|
+
fs.unlinkSync(desktopFile);
|
|
22
|
+
execSync(`update-desktop-database "${path.join(baseDir, 'applications')}"`, { stdio: 'ignore' });
|
|
23
|
+
} catch (_) {}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (fs.existsSync(iconFile)) {
|
|
27
|
+
try { fs.unlinkSync(iconFile); } catch (_) {}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (fs.existsSync(mimeFile)) {
|
|
31
|
+
try {
|
|
32
|
+
fs.unlinkSync(mimeFile);
|
|
33
|
+
execSync(`update-mime-database "${path.join(baseDir, 'mime')}"`, { stdio: 'ignore' });
|
|
34
|
+
} catch (_) {}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function removeWindows() {
|
|
40
|
+
const appData = process.env.APPDATA;
|
|
41
|
+
if (!appData) return;
|
|
42
|
+
|
|
43
|
+
const shortcutPath = path.join(appData, 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Inskea.lnk');
|
|
44
|
+
if (fs.existsSync(shortcutPath)) {
|
|
45
|
+
try { fs.unlinkSync(shortcutPath); } catch (_) {}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
if (process.platform === 'linux') {
|
|
51
|
+
removeLinux();
|
|
52
|
+
} else if (process.platform === 'win32') {
|
|
53
|
+
removeWindows();
|
|
54
|
+
}
|
|
55
|
+
} catch (_) {}
|