create-glanceway-source 1.1.0 → 1.2.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/README.md +4 -4
- package/dist/index.js +7 -7
- package/package.json +1 -1
- package/templates/scripts/build.ts +8 -8
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ Example prompts:
|
|
|
53
53
|
cd my-source
|
|
54
54
|
npm install
|
|
55
55
|
|
|
56
|
-
# Build: compiles
|
|
56
|
+
# Build: compiles source, creates dist/latest.gwsrc
|
|
57
57
|
npm run build
|
|
58
58
|
|
|
59
59
|
# Test: executes source with mock API, validates emitted items
|
|
@@ -63,15 +63,15 @@ npm run test
|
|
|
63
63
|
npm run test -- --config API_TOKEN=xxx --config USERNAME=yyy
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
The `dist/latest.
|
|
66
|
+
The `dist/latest.gwsrc` file is the importable source package.
|
|
67
67
|
|
|
68
68
|
## Importing into Glanceway
|
|
69
69
|
|
|
70
70
|
1. Open **Glanceway**
|
|
71
71
|
2. Go to **Sources**
|
|
72
72
|
3. Click **Import from file**
|
|
73
|
-
4. Select `dist/latest.
|
|
73
|
+
4. Select `dist/latest.gwsrc`
|
|
74
74
|
|
|
75
75
|
## Submitting to glanceway-sources
|
|
76
76
|
|
|
77
|
-
To share your source with the community, [open an issue](https://github.com/
|
|
77
|
+
To share your source with the community, [open an issue](https://github.com/glanceway/glanceway-sources/issues) on glanceway-sources with a link to your project repository.
|
package/dist/index.js
CHANGED
|
@@ -168,13 +168,13 @@ function generateClaudeMd(options) {
|
|
|
168
168
|
|
|
169
169
|
## Project Overview
|
|
170
170
|
|
|
171
|
-
Glanceway source: "${options.name}" by ${options.author}. This is a standalone
|
|
171
|
+
Glanceway source: "${options.name}" by ${options.author}. This is a standalone JavaScript source for [Glanceway](https://glanceway.app), a macOS menu bar app that displays information items.
|
|
172
172
|
|
|
173
173
|
## Commands
|
|
174
174
|
|
|
175
175
|
\`\`\`bash
|
|
176
176
|
npm install # Install dependencies
|
|
177
|
-
npm run build # Build source into dist/ (compile +
|
|
177
|
+
npm run build # Build source into dist/ (compile + package)
|
|
178
178
|
npm run test # Test source (mock API execution + validation)
|
|
179
179
|
\`\`\`
|
|
180
180
|
|
|
@@ -190,7 +190,7 @@ There is no test framework. Build the source to verify it compiles. There is no
|
|
|
190
190
|
- \`src/index.ts\` — Source implementation (main logic)
|
|
191
191
|
- \`src/types.ts\` — GlancewayAPI type definitions (do not modify)
|
|
192
192
|
- \`manifest.yaml\` — Source metadata and config schema
|
|
193
|
-
- \`scripts/build.ts\` — Build script (esbuild compile +
|
|
193
|
+
- \`scripts/build.ts\` — Build script (esbuild compile + package)
|
|
194
194
|
- \`scripts/test.ts\` — Test script (mock API + validation)
|
|
195
195
|
|
|
196
196
|
## Source Development Constraints
|
|
@@ -351,7 +351,7 @@ config: # Optional: user-configurable values
|
|
|
351
351
|
|
|
352
352
|
## Source Lifecycle
|
|
353
353
|
|
|
354
|
-
|
|
354
|
+
JavaScript sources have two distinct phases:
|
|
355
355
|
|
|
356
356
|
1. **Start phase**: When the source is first loaded, the default export function (outer closure) runs. The app does **NOT** call \`refresh()\` at this point. Sources should perform their initial data fetch here by \`await\`ing their fetch function before returning.
|
|
357
357
|
2. **Refresh phase**: On each scheduled refresh interval, the app calls \`refresh()\`. This is the only time \`refresh()\` is invoked.
|
|
@@ -386,7 +386,7 @@ export default async (api: GlancewayAPI<Config>): Promise<SourceMethods> => {
|
|
|
386
386
|
- Always make full use of the \`subtitle\` field. If the API response contains summary, description, brief, or any descriptive text, map it to \`subtitle\` so users get maximum information at a glance.
|
|
387
387
|
- **Maximize items per fetch.** The app does not paginate, so each fetch should retrieve as many items as the API allows without hurting performance. The hard upper limit is **500 items** — never exceed this.
|
|
388
388
|
|
|
389
|
-
##
|
|
389
|
+
## Source Code Conventions
|
|
390
390
|
|
|
391
391
|
### File Structure Order
|
|
392
392
|
|
|
@@ -454,11 +454,11 @@ After building (\`npm run build\`), import into Glanceway:
|
|
|
454
454
|
1. Open Glanceway
|
|
455
455
|
2. Go to Sources
|
|
456
456
|
3. Click "Import from file"
|
|
457
|
-
4. Select \`dist/latest.
|
|
457
|
+
4. Select \`dist/latest.gwsrc\`
|
|
458
458
|
|
|
459
459
|
## Submitting to glanceway-sources
|
|
460
460
|
|
|
461
|
-
To share your source with the community, [open an issue](https://github.com/
|
|
461
|
+
To share your source with the community, [open an issue](https://github.com/glanceway/glanceway-sources/issues) on glanceway-sources with a link to your project repository.
|
|
462
462
|
`;
|
|
463
463
|
}
|
|
464
464
|
// ─── File Operations ───────────────────────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -81,18 +81,18 @@ async function main() {
|
|
|
81
81
|
fs.copyFileSync(manifestPath, distManifestPath);
|
|
82
82
|
console.log(" Created dist/manifest.yaml");
|
|
83
83
|
|
|
84
|
-
// Create versioned
|
|
85
|
-
const
|
|
86
|
-
await createZip(
|
|
84
|
+
// Create versioned .gwsrc package
|
|
85
|
+
const versionedPath = path.join(DIST_DIR, `${version}.gwsrc`);
|
|
86
|
+
await createZip(versionedPath, [
|
|
87
87
|
{ name: "manifest.yaml", content: manifestContent },
|
|
88
88
|
{ name: "index.js", content: compiledJs },
|
|
89
89
|
]);
|
|
90
|
-
console.log(` Created dist/${version}.
|
|
90
|
+
console.log(` Created dist/${version}.gwsrc`);
|
|
91
91
|
|
|
92
|
-
// Create latest.
|
|
93
|
-
const
|
|
94
|
-
fs.copyFileSync(
|
|
95
|
-
console.log(" Created dist/latest.
|
|
92
|
+
// Create latest.gwsrc
|
|
93
|
+
const latestPath = path.join(DIST_DIR, "latest.gwsrc");
|
|
94
|
+
fs.copyFileSync(versionedPath, latestPath);
|
|
95
|
+
console.log(" Created dist/latest.gwsrc");
|
|
96
96
|
|
|
97
97
|
console.log("\nBuild complete!");
|
|
98
98
|
}
|