@gjsify/create-app 0.1.7 → 0.1.8

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 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.tmpl'), 'utf-8');
18
- const packageJson = packageJsonTemplate.replace(/\{\{projectName\}\}/g, projectName);
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.tmpl'), join(targetDir, '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.tmpl'), join(targetDir, '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
@@ -16,3 +16,4 @@ void yargs(hideBin(process.argv))
16
16
  })
17
17
  .help()
18
18
  .argv;
19
+ export { createProject } from './create.js';
package/package.json CHANGED
@@ -1,14 +1,22 @@
1
1
  {
2
2
  "name": "@gjsify/create-app",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Create a new Gjsify project",
5
5
  "type": "module",
6
- "main": "lib/index.js",
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": [
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "new-gjsify-app",
3
+ "version": "0.1.8",
4
+ "type": "module",
5
+ "private": true,
6
+ "scripts": {
7
+ "check": "tsc --noEmit",
8
+ "build": "gjsify build src/index.ts --outfile dist/index.js --globals fetch,Buffer,process,URL,crypto,structuredClone,AbortController",
9
+ "start": "gjsify run dist/index.js",
10
+ "dev": "gjsify build src/index.ts --outfile dist/index.js --globals fetch,Buffer,process,URL,crypto,structuredClone,AbortController && gjsify run dist/index.js"
11
+ },
12
+ "devDependencies": {
13
+ "@gjsify/cli": "^0.1.8",
14
+ "@types/node": "^25.5.2",
15
+ "typescript": "^6.0.2"
16
+ },
17
+ "dependencies": {
18
+ "@girs/gtk-4.0": "^4.23.0-4.0.0-rc.1"
19
+ }
20
+ }
@@ -0,0 +1,66 @@
1
+ import Gtk from 'gi://Gtk?version=4.0'
2
+
3
+ // Globals injected via --globals in the build script:
4
+ // process → Node.js process API (@gjsify/process)
5
+ // crypto → Web Crypto API (@gjsify/webcrypto)
6
+ // Buffer → Node.js Buffer API (@gjsify/buffer)
7
+
8
+ const app = new Gtk.Application({
9
+ applicationId: 'org.gjsify.example',
10
+ })
11
+
12
+ app.connect('activate', () => {
13
+ const window = new Gtk.ApplicationWindow({
14
+ application: app,
15
+ title: 'new-gjsify-app',
16
+ defaultWidth: 480,
17
+ defaultHeight: 280,
18
+ })
19
+
20
+ const box = new Gtk.Box({
21
+ orientation: Gtk.Orientation.VERTICAL,
22
+ spacing: 16,
23
+ margin_top: 24,
24
+ margin_bottom: 24,
25
+ margin_start: 24,
26
+ margin_end: 24,
27
+ })
28
+
29
+ // Node.js — process API
30
+ const platformLabel = new Gtk.Label({
31
+ label: `Platform: ${process.platform} | PID: ${process.pid}`,
32
+ xalign: 0,
33
+ })
34
+
35
+ // Web Crypto API — UUID
36
+ const uuidLabel = new Gtk.Label({
37
+ label: 'UUID: —',
38
+ xalign: 0,
39
+ })
40
+
41
+ // Node.js — Buffer API
42
+ const base64Label = new Gtk.Label({
43
+ label: 'Base64: —',
44
+ xalign: 0,
45
+ })
46
+
47
+ // Button wires everything together
48
+ const button = new Gtk.Button({ label: '↺ Generate UUID' })
49
+ button.connect('clicked', () => {
50
+ const uuid = crypto.randomUUID() // Web Crypto
51
+ const base64 = Buffer.from(uuid).toString('base64') // Node.js Buffer
52
+ uuidLabel.set_label(`UUID: ${uuid}`)
53
+ base64Label.set_label(`Base64: ${base64}`)
54
+ })
55
+
56
+ box.append(platformLabel)
57
+ box.append(new Gtk.Separator({ orientation: Gtk.Orientation.HORIZONTAL }))
58
+ box.append(button)
59
+ box.append(uuidLabel)
60
+ box.append(base64Label)
61
+
62
+ window.set_child(box)
63
+ window.present()
64
+ })
65
+
66
+ app.run([])
@@ -1,21 +0,0 @@
1
- {
2
- "name": "{{projectName}}",
3
- "version": "0.1.0",
4
- "type": "module",
5
- "private": true,
6
- "scripts": {
7
- "build": "gjsify build src/index.ts --outfile dist/index.js",
8
- "start": "gjsify run dist/index.js",
9
- "dev": "gjsify build src/index.ts --outfile dist/index.js && gjsify run dist/index.js"
10
- },
11
- "devDependencies": {
12
- "@gjsify/cli": "^0.1.0",
13
- "@types/node": "^25.5.0",
14
- "typescript": "^6.0.2"
15
- },
16
- "dependencies": {
17
- "@girs/gtk-4.0": "^4.22.1-4.0.0-beta.42",
18
- "@gjsify/node-globals": "^0.1.0",
19
- "@gjsify/node-polyfills": "^0.1.0"
20
- }
21
- }
@@ -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