@gjsify/create-app 0.1.7 → 0.1.9
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/lib/create.js +5 -5
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -0
- package/package.json +12 -4
- package/templates/{package.json.tmpl → package.json} +6 -7
- package/templates/src/index.ts +64 -0
- package/templates/src/index.ts.tmpl +0 -23
- /package/templates/{tsconfig.json.tmpl → tsconfig.json} +0 -0
package/lib/create.js
CHANGED
|
@@ -13,14 +13,14 @@ export async function createProject(projectName) {
|
|
|
13
13
|
mkdirSync(join(targetDir, 'src'), { recursive: true });
|
|
14
14
|
// Copy template files
|
|
15
15
|
const templatesDir = resolve(__dirname, '..', 'templates');
|
|
16
|
-
// Generate package.json from template
|
|
17
|
-
const packageJsonTemplate = readFileSync(join(templatesDir, 'package.json
|
|
18
|
-
const packageJson = packageJsonTemplate.replace(
|
|
16
|
+
// Generate package.json from template (replaces sentinel name with project name)
|
|
17
|
+
const packageJsonTemplate = readFileSync(join(templatesDir, 'package.json'), 'utf-8');
|
|
18
|
+
const packageJson = packageJsonTemplate.replace(/new-gjsify-app/g, projectName);
|
|
19
19
|
writeFileSync(join(targetDir, 'package.json'), packageJson);
|
|
20
20
|
// Copy tsconfig.json
|
|
21
|
-
cpSync(join(templatesDir, 'tsconfig.json
|
|
21
|
+
cpSync(join(templatesDir, 'tsconfig.json'), join(targetDir, 'tsconfig.json'));
|
|
22
22
|
// Copy src/index.ts
|
|
23
|
-
cpSync(join(templatesDir, 'src', 'index.ts
|
|
23
|
+
cpSync(join(templatesDir, 'src', 'index.ts'), join(targetDir, 'src', 'index.ts'));
|
|
24
24
|
console.log('');
|
|
25
25
|
console.log('Project created successfully!');
|
|
26
26
|
console.log('');
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export {};
|
|
2
|
+
export { createProject } from './create.js';
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/create-app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Create a new Gjsify project",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "lib/
|
|
6
|
+
"main": "lib/create.js",
|
|
7
|
+
"types": "lib/create.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/create.d.ts",
|
|
11
|
+
"import": "./lib/create.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
7
15
|
"bin": "./lib/index.js",
|
|
8
16
|
"scripts": {
|
|
9
17
|
"clear": "rm -rf lib tsconfig.tsbuildinfo || exit 0",
|
|
10
18
|
"check": "tsc --noEmit",
|
|
11
|
-
"build": "tsc && chmod +x ./lib/index.js",
|
|
19
|
+
"build": "node scripts/process-template.mjs && tsc && chmod +x ./lib/index.js",
|
|
12
20
|
"test": "echo 'nothing to do'"
|
|
13
21
|
},
|
|
14
22
|
"keywords": [
|
|
@@ -26,7 +34,7 @@
|
|
|
26
34
|
"yargs": "^18.0.0"
|
|
27
35
|
},
|
|
28
36
|
"devDependencies": {
|
|
29
|
-
"@types/node": "^25.
|
|
37
|
+
"@types/node": "^25.6.0",
|
|
30
38
|
"@types/yargs": "^17.0.35",
|
|
31
39
|
"typescript": "^6.0.2"
|
|
32
40
|
}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"version": "0.1.
|
|
2
|
+
"name": "new-gjsify-app",
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": true,
|
|
6
6
|
"scripts": {
|
|
7
|
+
"check": "tsc --noEmit",
|
|
7
8
|
"build": "gjsify build src/index.ts --outfile dist/index.js",
|
|
8
9
|
"start": "gjsify run dist/index.js",
|
|
9
10
|
"dev": "gjsify build src/index.ts --outfile dist/index.js && gjsify run dist/index.js"
|
|
10
11
|
},
|
|
11
12
|
"devDependencies": {
|
|
12
|
-
"@gjsify/cli": "^0.1.
|
|
13
|
-
"@types/node": "^25.
|
|
13
|
+
"@gjsify/cli": "^0.1.9",
|
|
14
|
+
"@types/node": "^25.6.0",
|
|
14
15
|
"typescript": "^6.0.2"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
|
-
"@girs/gtk-4.0": "^4.
|
|
18
|
-
"@gjsify/node-globals": "^0.1.0",
|
|
19
|
-
"@gjsify/node-polyfills": "^0.1.0"
|
|
18
|
+
"@girs/gtk-4.0": "^4.23.0-4.0.0-rc.2"
|
|
20
19
|
}
|
|
21
20
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import Gtk from 'gi://Gtk?version=4.0'
|
|
2
|
+
|
|
3
|
+
// Globals (process, crypto, Buffer, etc.) are automatically detected
|
|
4
|
+
// and injected by `gjsify build` via --globals auto (the default).
|
|
5
|
+
|
|
6
|
+
const app = new Gtk.Application({
|
|
7
|
+
applicationId: 'org.gjsify.example',
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
app.connect('activate', () => {
|
|
11
|
+
const window = new Gtk.ApplicationWindow({
|
|
12
|
+
application: app,
|
|
13
|
+
title: 'new-gjsify-app',
|
|
14
|
+
defaultWidth: 480,
|
|
15
|
+
defaultHeight: 280,
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const box = new Gtk.Box({
|
|
19
|
+
orientation: Gtk.Orientation.VERTICAL,
|
|
20
|
+
spacing: 16,
|
|
21
|
+
margin_top: 24,
|
|
22
|
+
margin_bottom: 24,
|
|
23
|
+
margin_start: 24,
|
|
24
|
+
margin_end: 24,
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Node.js — process API
|
|
28
|
+
const platformLabel = new Gtk.Label({
|
|
29
|
+
label: `Platform: ${process.platform} | PID: ${process.pid}`,
|
|
30
|
+
xalign: 0,
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
// Web Crypto API — UUID
|
|
34
|
+
const uuidLabel = new Gtk.Label({
|
|
35
|
+
label: 'UUID: —',
|
|
36
|
+
xalign: 0,
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// Node.js — Buffer API
|
|
40
|
+
const base64Label = new Gtk.Label({
|
|
41
|
+
label: 'Base64: —',
|
|
42
|
+
xalign: 0,
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
// Button wires everything together
|
|
46
|
+
const button = new Gtk.Button({ label: '↺ Generate UUID' })
|
|
47
|
+
button.connect('clicked', () => {
|
|
48
|
+
const uuid = crypto.randomUUID() // Web Crypto
|
|
49
|
+
const base64 = Buffer.from(uuid).toString('base64') // Node.js Buffer
|
|
50
|
+
uuidLabel.set_label(`UUID: ${uuid}`)
|
|
51
|
+
base64Label.set_label(`Base64: ${base64}`)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
box.append(platformLabel)
|
|
55
|
+
box.append(new Gtk.Separator({ orientation: Gtk.Orientation.HORIZONTAL }))
|
|
56
|
+
box.append(button)
|
|
57
|
+
box.append(uuidLabel)
|
|
58
|
+
box.append(base64Label)
|
|
59
|
+
|
|
60
|
+
window.set_child(box)
|
|
61
|
+
window.present()
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
app.run([])
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import Gtk from 'gi://Gtk?version=4.0'
|
|
2
|
-
|
|
3
|
-
const app = new Gtk.Application({
|
|
4
|
-
applicationId: 'org.gjsify.example',
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
app.connect('activate', () => {
|
|
8
|
-
const window = new Gtk.ApplicationWindow({
|
|
9
|
-
application: app,
|
|
10
|
-
title: 'Hello from Gjsify',
|
|
11
|
-
defaultWidth: 400,
|
|
12
|
-
defaultHeight: 300,
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
const label = new Gtk.Label({
|
|
16
|
-
label: 'Hello from Gjsify!',
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
window.setChild(label)
|
|
20
|
-
window.present()
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
app.run([])
|
|
File without changes
|