monaco-json-studio-double 0.0.0-stage → 1.0.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/bin/index.js +36 -0
- package/package.json +39 -4
- package/src/index.js +2 -0
- package/src/v1/index.js +42 -0
- package/README.md +0 -3
package/bin/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { HEADER_TYPES, FOOTER_TYPES } from 'monaco-json-studio-base';
|
|
3
|
+
import { createDoubleStudio } from '../src/index.js';
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
|
|
7
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
8
|
+
console.log(`
|
|
9
|
+
Monaco JSON Studio · Double
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
npx monaco-json-studio-double [pane1] [pane2]
|
|
13
|
+
|
|
14
|
+
Each pane uses <header>:<footer?> (defaults: file-picker:cursor):
|
|
15
|
+
header : ${HEADER_TYPES.join(' | ')}
|
|
16
|
+
footer : ${FOOTER_TYPES.join(' | ')}
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
npx monaco-json-studio-double
|
|
20
|
+
npx monaco-json-studio-double file-picker:cursor select:note
|
|
21
|
+
npx monaco-json-studio-double title:none
|
|
22
|
+
`);
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const pane1 = args[0] ?? 'file-picker:cursor';
|
|
27
|
+
const pane2 = args[1] ?? pane1;
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const targetDir = createDoubleStudio({ pane1, pane2 });
|
|
31
|
+
console.log(`Generated Double Studio (${pane1} | ${pane2}).`);
|
|
32
|
+
console.log(`Open: ${targetDir}/index.html`);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error(`Could not generate Double Studio: ${error.message}`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monaco-json-studio-double",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Two-pane Monaco JSON Studio built on monaco-json-studio-base.",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/keshavsoft/monaco-json-studio-double.git"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./src/index.js",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": "./src/index.js"
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"monaco-json-studio-double": "./bin/index.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"src",
|
|
22
|
+
"bin",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"test": "node --check src/index.js && node --check src/v1/index.js && node --check bin/index.js"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"monaco-json-studio-base": "^1.0.0"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"monaco",
|
|
34
|
+
"monaco-editor",
|
|
35
|
+
"json-studio",
|
|
36
|
+
"double-pane",
|
|
37
|
+
"keshavsoft"
|
|
38
|
+
],
|
|
39
|
+
"author": "KeshavSoft",
|
|
40
|
+
"license": "MIT"
|
|
41
|
+
}
|
package/src/index.js
ADDED
package/src/v1/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { generateStudio } from 'monaco-json-studio-base';
|
|
2
|
+
|
|
3
|
+
function parsePaneSpec(spec, defaultSpec) {
|
|
4
|
+
if (typeof spec === 'string') {
|
|
5
|
+
const [header = defaultSpec.header, footer = defaultSpec.footer] = spec.split(':');
|
|
6
|
+
return { header, footer };
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
header: spec?.header ?? defaultSpec.header,
|
|
10
|
+
footer: spec?.footer ?? defaultSpec.footer
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function createDoubleStudio({
|
|
15
|
+
pane1 = 'file-picker:cursor',
|
|
16
|
+
pane2 = 'file-picker:cursor',
|
|
17
|
+
outputDir
|
|
18
|
+
} = {}) {
|
|
19
|
+
const specs = [
|
|
20
|
+
parsePaneSpec(pane1, { header: 'file-picker', footer: 'cursor' }),
|
|
21
|
+
parsePaneSpec(pane2, { header: 'file-picker', footer: 'cursor' })
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const slug = specs
|
|
25
|
+
.map((s) => `${typeof s.header === 'string' ? s.header : s.header.type}-${typeof s.footer === 'string' ? s.footer : s.footer.type}`)
|
|
26
|
+
.join('_');
|
|
27
|
+
|
|
28
|
+
return generateStudio({
|
|
29
|
+
title: 'Monaco Studio · Double',
|
|
30
|
+
badge: 'double',
|
|
31
|
+
outputDir: outputDir ?? `./monaco-double-${slug}`,
|
|
32
|
+
panes: specs.map((spec, index) => ({
|
|
33
|
+
key: `pane${index + 1}`,
|
|
34
|
+
label: `Pane ${index + 1}`,
|
|
35
|
+
header: spec.header,
|
|
36
|
+
body: { type: 'monaco', language: 'json' },
|
|
37
|
+
footer: spec.footer
|
|
38
|
+
}))
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default createDoubleStudio;
|
package/README.md
DELETED