@sharpee/devkit 1.0.4 → 1.0.5
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/package.json +2 -2
- package/standalone/build-browser.d.ts +6 -4
- package/standalone/build-browser.d.ts.map +1 -1
- package/standalone/build-browser.js +96 -67
- package/standalone/build-browser.js.map +1 -1
- package/standalone/init-browser.d.ts +7 -5
- package/standalone/init-browser.d.ts.map +1 -1
- package/standalone/init-browser.js +81 -76
- package/standalone/init-browser.js.map +1 -1
- package/standalone/init.d.ts +11 -0
- package/standalone/init.d.ts.map +1 -1
- package/standalone/init.js +1 -0
- package/standalone/init.js.map +1 -1
- package/templates/browser/base.css +489 -0
- package/templates/browser/browser-entry.ts.template +79 -0
- package/templates/browser/decorations.css +152 -0
- package/templates/browser/index.html +119 -0
- package/templates/browser/styles.css +1988 -0
- package/templates/browser/themes/system-6/fonts/ChicagoFLF.woff2 +0 -0
- package/templates/browser/themes/system-6/fonts/FindersKeepers.woff2 +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/devkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "The Sharpee CLI engine — build/test/verify/scaffold orchestration (ADR-180). Provides the `sharpee` command; orchestrates, tsf compiles.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"sharpee": "./cli.js"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@sharpee/bootstrap": "^1.0.
|
|
11
|
+
"@sharpee/bootstrap": "^1.0.2",
|
|
12
12
|
"@sharpee/core": "^1.0.0",
|
|
13
13
|
"@sharpee/transcript-tester": "^1.0.0",
|
|
14
14
|
"fflate": "^0.8.2"
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI: sharpee build-browser
|
|
3
3
|
*
|
|
4
|
-
* Bundles a Sharpee story for
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
4
|
+
* Bundles a Sharpee story for the browser into dist/web/. The bundle (game.js)
|
|
5
|
+
* is esbuilt from src/browser-entry.ts; the HTML page and platform CSS
|
|
6
|
+
* (base/decorations/styles + theme fonts) are owned by the platform and copied
|
|
7
|
+
* fresh from devkit's bundled template every build. The author's only CSS
|
|
8
|
+
* surface is browser/<story-id>.css, loaded last so it wins the cascade.
|
|
8
9
|
*/
|
|
10
|
+
/** Run the build-browser command. */
|
|
9
11
|
export declare function runBuildBrowserCommand(args: string[], projectDirArg?: string): Promise<void>;
|
|
10
12
|
//# sourceMappingURL=build-browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-browser.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/devkit/src/standalone/build-browser.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"build-browser.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/devkit/src/standalone/build-browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgGH,qCAAqC;AACrC,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiGlG"}
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* CLI: sharpee build-browser
|
|
4
4
|
*
|
|
5
|
-
* Bundles a Sharpee story for
|
|
5
|
+
* Bundles a Sharpee story for the browser into dist/web/. The bundle (game.js)
|
|
6
|
+
* is esbuilt from src/browser-entry.ts; the HTML page and platform CSS
|
|
7
|
+
* (base/decorations/styles + theme fonts) are owned by the platform and copied
|
|
8
|
+
* fresh from devkit's bundled template every build. The author's only CSS
|
|
9
|
+
* surface is browser/<story-id>.css, loaded last so it wins the cascade.
|
|
6
10
|
*/
|
|
7
11
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
12
|
if (k2 === undefined) k2 = k;
|
|
@@ -42,11 +46,13 @@ exports.runBuildBrowserCommand = runBuildBrowserCommand;
|
|
|
42
46
|
const fs = __importStar(require("fs"));
|
|
43
47
|
const path = __importStar(require("path"));
|
|
44
48
|
const child_process_1 = require("child_process");
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
const init_1 = require("./init");
|
|
50
|
+
// In source: standalone/ → ../../templates. In npm publish: standalone/ → ../templates.
|
|
51
|
+
const TEMPLATES_DIR = fs.existsSync(path.join(__dirname, '..', 'templates', 'browser'))
|
|
52
|
+
? path.join(__dirname, '..', 'templates', 'browser')
|
|
53
|
+
: path.join(__dirname, '..', '..', 'templates', 'browser');
|
|
54
|
+
/** Read story id/title from package.json, falling back to src/index.ts. */
|
|
48
55
|
function getProjectInfo(projectDir) {
|
|
49
|
-
// Try package.json first
|
|
50
56
|
const packagePath = path.join(projectDir, 'package.json');
|
|
51
57
|
if (fs.existsSync(packagePath)) {
|
|
52
58
|
try {
|
|
@@ -57,10 +63,9 @@ function getProjectInfo(projectDir) {
|
|
|
57
63
|
};
|
|
58
64
|
}
|
|
59
65
|
catch {
|
|
60
|
-
// Fall through
|
|
66
|
+
// Fall through to index.ts.
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
|
-
// Try reading from src/index.ts
|
|
64
69
|
const indexPath = path.join(projectDir, 'src', 'index.ts');
|
|
65
70
|
if (fs.existsSync(indexPath)) {
|
|
66
71
|
const content = fs.readFileSync(indexPath, 'utf-8');
|
|
@@ -75,19 +80,53 @@ function getProjectInfo(projectDir) {
|
|
|
75
80
|
}
|
|
76
81
|
return null;
|
|
77
82
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Process template placeholders
|
|
80
|
-
*/
|
|
83
|
+
/** Substitute the story tokens index.html carries (the override stylesheet link). */
|
|
81
84
|
function processTemplate(content, info) {
|
|
82
85
|
return content
|
|
83
86
|
.replace(/\{\{STORY_ID\}\}/g, info.storyId)
|
|
84
87
|
.replace(/\{\{STORY_TITLE\}\}/g, info.storyTitle);
|
|
85
88
|
}
|
|
86
89
|
/**
|
|
87
|
-
*
|
|
90
|
+
* Generate src/version.ts (the author-project analog of the monorepo version
|
|
91
|
+
* stamp). browser-entry.ts imports STORY_VERSION/ENGINE_VERSION/BUILD_DATE from
|
|
92
|
+
* it; an author project never gets one from the platform build, so we write it
|
|
93
|
+
* fresh each browser build. The file is marked auto-generated.
|
|
88
94
|
*/
|
|
95
|
+
function stampVersion(projectDir, info) {
|
|
96
|
+
let storyVersion = '1.0.0';
|
|
97
|
+
try {
|
|
98
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(projectDir, 'package.json'), 'utf-8'));
|
|
99
|
+
if (pkg.version)
|
|
100
|
+
storyVersion = pkg.version;
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// Keep the default.
|
|
104
|
+
}
|
|
105
|
+
const engineVersion = (0, init_1.platformRanges)().sharpeeRange.replace(/^[\^~]/, '');
|
|
106
|
+
const buildDate = new Date().toISOString().replace(/\.\d+Z$/, 'Z');
|
|
107
|
+
fs.mkdirSync(path.join(projectDir, 'src'), { recursive: true });
|
|
108
|
+
fs.writeFileSync(path.join(projectDir, 'src', 'version.ts'), `/**
|
|
109
|
+
* Version information for ${info.storyId}
|
|
110
|
+
* Auto-generated by sharpee build-browser - DO NOT EDIT
|
|
111
|
+
*/
|
|
112
|
+
export const STORY_VERSION = '${storyVersion}';
|
|
113
|
+
export const BUILD_DATE = '${buildDate}';
|
|
114
|
+
export const ENGINE_VERSION = '${engineVersion}';
|
|
115
|
+
export const VERSION_INFO = { version: STORY_VERSION, buildDate: BUILD_DATE, engineVersion: ENGINE_VERSION } as const;
|
|
116
|
+
`);
|
|
117
|
+
}
|
|
118
|
+
/** Copy a platform asset from devkit's template into the output, warning if absent. */
|
|
119
|
+
function copyPlatformAsset(name, outDir) {
|
|
120
|
+
const src = path.join(TEMPLATES_DIR, name);
|
|
121
|
+
if (fs.existsSync(src)) {
|
|
122
|
+
fs.cpSync(src, path.join(outDir, name), { recursive: true });
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
console.warn(` ⚠ Template asset not found: ${name}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** Run the build-browser command. */
|
|
89
129
|
async function runBuildBrowserCommand(args, projectDirArg) {
|
|
90
|
-
// Check for help
|
|
91
130
|
if (args.includes('--help') || args.includes('-h')) {
|
|
92
131
|
showHelp();
|
|
93
132
|
return;
|
|
@@ -96,7 +135,6 @@ async function runBuildBrowserCommand(args, projectDirArg) {
|
|
|
96
135
|
const minify = !args.includes('--no-minify');
|
|
97
136
|
const sourcemap = !args.includes('--no-sourcemap');
|
|
98
137
|
console.log('\n🔨 Building browser bundle\n');
|
|
99
|
-
// Check if this is a Sharpee project
|
|
100
138
|
const info = getProjectInfo(projectDir);
|
|
101
139
|
if (!info) {
|
|
102
140
|
console.error('Error: This does not appear to be a Sharpee project.');
|
|
@@ -104,82 +142,75 @@ async function runBuildBrowserCommand(args, projectDirArg) {
|
|
|
104
142
|
process.exit(1);
|
|
105
143
|
}
|
|
106
144
|
console.log(` Story: ${info.storyTitle} (${info.storyId})`);
|
|
107
|
-
// Check for browser-entry.ts
|
|
108
145
|
const browserEntryPath = path.join(projectDir, 'src', 'browser-entry.ts');
|
|
109
146
|
if (!fs.existsSync(browserEntryPath)) {
|
|
110
147
|
console.error('\nError: src/browser-entry.ts not found.');
|
|
111
148
|
console.error('Run "sharpee init-browser" first to add browser support.');
|
|
112
149
|
process.exit(1);
|
|
113
150
|
}
|
|
114
|
-
// Create output directory
|
|
115
151
|
const outDir = path.join(projectDir, 'dist', 'web');
|
|
116
152
|
fs.mkdirSync(outDir, { recursive: true });
|
|
117
|
-
//
|
|
118
|
-
|
|
153
|
+
// browser-entry.ts imports ./version — stamp it fresh before bundling.
|
|
154
|
+
stampVersion(projectDir, info);
|
|
155
|
+
// Bundle browser-entry.ts → dist/web/game.js. The <script src="game.js"> in
|
|
156
|
+
// index.html depends on this exact name. esbuild runs with cwd=projectDir so it
|
|
157
|
+
// resolves @sharpee/* from the project's node_modules; --conditions=require picks
|
|
158
|
+
// the CJS branch of the platform packages' exports maps (matches the monorepo build).
|
|
159
|
+
console.log(' Bundling game.js...');
|
|
119
160
|
const esbuildArgs = [
|
|
161
|
+
'esbuild',
|
|
120
162
|
browserEntryPath,
|
|
121
163
|
'--bundle',
|
|
122
164
|
'--platform=browser',
|
|
123
165
|
'--target=es2020',
|
|
124
166
|
'--format=iife',
|
|
125
|
-
|
|
126
|
-
`--outfile=${path.join(outDir,
|
|
127
|
-
'--
|
|
128
|
-
'--define:process.env.
|
|
129
|
-
'--define:process.env.
|
|
167
|
+
'--global-name=SharpeeGame',
|
|
168
|
+
`--outfile=${path.join(outDir, 'game.js')}`,
|
|
169
|
+
'--conditions=require',
|
|
170
|
+
'--define:process.env.NODE_ENV="production"',
|
|
171
|
+
'--define:process.env.PARSER_DEBUG=undefined',
|
|
172
|
+
'--define:process.env.DEBUG_PRONOUNS=undefined',
|
|
130
173
|
];
|
|
131
|
-
if (minify)
|
|
174
|
+
if (minify)
|
|
132
175
|
esbuildArgs.push('--minify');
|
|
133
|
-
|
|
134
|
-
if (sourcemap) {
|
|
176
|
+
if (sourcemap)
|
|
135
177
|
esbuildArgs.push('--sourcemap');
|
|
136
|
-
}
|
|
137
178
|
try {
|
|
138
|
-
(0, child_process_1.
|
|
139
|
-
|
|
140
|
-
stdio: 'pipe',
|
|
141
|
-
});
|
|
142
|
-
console.log(` ✓ Built ${info.storyId}.js`);
|
|
179
|
+
(0, child_process_1.execFileSync)('npx', esbuildArgs, { cwd: projectDir, stdio: 'pipe' });
|
|
180
|
+
console.log(' ✓ Built game.js');
|
|
143
181
|
}
|
|
144
182
|
catch (error) {
|
|
145
183
|
console.error(' ✗ Build failed');
|
|
146
|
-
if (error.stderr)
|
|
184
|
+
if (error.stderr)
|
|
147
185
|
console.error(error.stderr.toString());
|
|
148
|
-
}
|
|
149
186
|
process.exit(1);
|
|
150
187
|
}
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
htmlContent = processTemplate(htmlContent, info);
|
|
158
|
-
fs.writeFileSync(path.join(outDir, 'index.html'), htmlContent);
|
|
159
|
-
console.log(' ✓ Copied index.html');
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
console.warn(' ⚠ HTML template not found');
|
|
188
|
+
// Platform-owned page + CSS + theme fonts: always copied fresh from devkit.
|
|
189
|
+
let html = fs.readFileSync(path.join(TEMPLATES_DIR, 'index.html'), 'utf-8');
|
|
190
|
+
fs.writeFileSync(path.join(outDir, 'index.html'), processTemplate(html, info));
|
|
191
|
+
console.log(' ✓ Copied index.html');
|
|
192
|
+
for (const asset of ['base.css', 'decorations.css', 'styles.css', 'themes']) {
|
|
193
|
+
copyPlatformAsset(asset, outDir);
|
|
163
194
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
195
|
+
console.log(' ✓ Copied platform CSS + themes');
|
|
196
|
+
// Author override stylesheet → dist/web/<story-id>.css. index.html links it last,
|
|
197
|
+
// so write an empty stub when the author hasn't added one (avoids a 404).
|
|
198
|
+
const overrideCss = path.join(projectDir, 'browser', `${info.storyId}.css`);
|
|
199
|
+
const overrideOut = path.join(outDir, `${info.storyId}.css`);
|
|
200
|
+
if (fs.existsSync(overrideCss)) {
|
|
201
|
+
fs.copyFileSync(overrideCss, overrideOut);
|
|
202
|
+
console.log(` ✓ Copied ${info.storyId}.css`);
|
|
171
203
|
}
|
|
172
204
|
else {
|
|
173
|
-
|
|
205
|
+
fs.writeFileSync(overrideOut, `/* ${info.storyTitle} — author overrides (none yet) */\n`);
|
|
174
206
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const sizeKb = (stats.size / 1024).toFixed(1);
|
|
180
|
-
console.log(`\n Bundle size: ${sizeKb} KB`);
|
|
207
|
+
const bundlePath = path.join(outDir, 'game.js');
|
|
208
|
+
if (!fs.existsSync(bundlePath) || fs.statSync(bundlePath).size === 0) {
|
|
209
|
+
console.error('\nError: dist/web/game.js is missing or empty after build.');
|
|
210
|
+
process.exit(1);
|
|
181
211
|
}
|
|
182
|
-
|
|
212
|
+
const sizeKb = (fs.statSync(bundlePath).size / 1024).toFixed(1);
|
|
213
|
+
console.log(`\n✅ Build complete! (game.js ${sizeKb} KB)\n`);
|
|
183
214
|
console.log(`Output: ${path.relative(projectDir, outDir)}/`);
|
|
184
215
|
console.log('');
|
|
185
216
|
console.log('To test locally:');
|
|
@@ -196,13 +227,11 @@ Options:
|
|
|
196
227
|
--no-minify Skip minification
|
|
197
228
|
--no-sourcemap Skip source map generation
|
|
198
229
|
|
|
199
|
-
Output:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
The bundle includes your story, the Sharpee engine, and all dependencies.
|
|
230
|
+
Output (dist/web/):
|
|
231
|
+
game.js Story + engine + browser client (one bundle)
|
|
232
|
+
index.html The page (platform-owned)
|
|
233
|
+
base.css, decorations.css, styles.css, themes/ Platform CSS
|
|
234
|
+
<story-id>.css Your overrides (from browser/<story-id>.css)
|
|
206
235
|
`);
|
|
207
236
|
}
|
|
208
237
|
//# sourceMappingURL=build-browser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-browser.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/devkit/src/standalone/build-browser.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"build-browser.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/devkit/src/standalone/build-browser.ts"],"names":[],"mappings":";AAAA;;;;;;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I,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;CAcb,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI: sharpee init-browser
|
|
3
3
|
*
|
|
4
|
-
* Adds browser client
|
|
4
|
+
* Adds a browser client to an existing Sharpee story project: the entry-point
|
|
5
|
+
* wiring (src/browser-entry.ts), an author override stylesheet
|
|
6
|
+
* (browser/<story-id>.css), the runtime dependencies the entry point imports,
|
|
7
|
+
* and a build:browser script. The HTML and platform CSS are owned by the
|
|
8
|
+
* platform and supplied at build time by `sharpee build-browser` — never seeded.
|
|
5
9
|
*/
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
export declare function runInitBrowserCommand(args: string[]): Promise<void>;
|
|
10
|
+
/** Run the init-browser command. */
|
|
11
|
+
export declare function runInitBrowserCommand(args: string[], projectDirArg?: string): Promise<void>;
|
|
10
12
|
//# sourceMappingURL=init-browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-browser.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/devkit/src/standalone/init-browser.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"init-browser.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/devkit/src/standalone/init-browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgGH,oCAAoC;AACpC,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6DjG"}
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* CLI: sharpee init-browser
|
|
4
4
|
*
|
|
5
|
-
* Adds browser client
|
|
5
|
+
* Adds a browser client to an existing Sharpee story project: the entry-point
|
|
6
|
+
* wiring (src/browser-entry.ts), an author override stylesheet
|
|
7
|
+
* (browser/<story-id>.css), the runtime dependencies the entry point imports,
|
|
8
|
+
* and a build:browser script. The HTML and platform CSS are owned by the
|
|
9
|
+
* platform and supplied at build time by `sharpee build-browser` — never seeded.
|
|
6
10
|
*/
|
|
7
11
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
12
|
if (k2 === undefined) k2 = k;
|
|
@@ -41,15 +45,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
41
45
|
exports.runInitBrowserCommand = runInitBrowserCommand;
|
|
42
46
|
const fs = __importStar(require("fs"));
|
|
43
47
|
const path = __importStar(require("path"));
|
|
44
|
-
|
|
48
|
+
const init_1 = require("./init");
|
|
49
|
+
// In source: standalone/ → ../../templates. In npm publish: standalone/ → ../templates.
|
|
45
50
|
const TEMPLATES_DIR = fs.existsSync(path.join(__dirname, '..', 'templates', 'browser'))
|
|
46
51
|
? path.join(__dirname, '..', 'templates', 'browser')
|
|
47
52
|
: path.join(__dirname, '..', '..', 'templates', 'browser');
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
/** Runtime packages browser-entry.ts imports that aren't already scaffold deps. */
|
|
54
|
+
const BROWSER_RUNTIME_DEPS = [
|
|
55
|
+
'@sharpee/engine',
|
|
56
|
+
'@sharpee/parser-en-us',
|
|
57
|
+
'@sharpee/lang-en-us',
|
|
58
|
+
'@sharpee/stdlib',
|
|
59
|
+
'@sharpee/platform-browser',
|
|
60
|
+
];
|
|
61
|
+
/** Read story id/title from package.json, falling back to src/index.ts. */
|
|
51
62
|
function getProjectInfo(projectDir) {
|
|
52
|
-
// Try package.json first
|
|
53
63
|
const packagePath = path.join(projectDir, 'package.json');
|
|
54
64
|
if (fs.existsSync(packagePath)) {
|
|
55
65
|
try {
|
|
@@ -60,10 +70,9 @@ function getProjectInfo(projectDir) {
|
|
|
60
70
|
};
|
|
61
71
|
}
|
|
62
72
|
catch {
|
|
63
|
-
// Fall through
|
|
73
|
+
// Fall through to index.ts.
|
|
64
74
|
}
|
|
65
75
|
}
|
|
66
|
-
// Try reading from src/index.ts
|
|
67
76
|
const indexPath = path.join(projectDir, 'src', 'index.ts');
|
|
68
77
|
if (fs.existsSync(indexPath)) {
|
|
69
78
|
const content = fs.readFileSync(indexPath, 'utf-8');
|
|
@@ -78,27 +87,52 @@ function getProjectInfo(projectDir) {
|
|
|
78
87
|
}
|
|
79
88
|
return null;
|
|
80
89
|
}
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
*/
|
|
84
|
-
function processTemplate(templatePath, info) {
|
|
85
|
-
const content = fs.readFileSync(templatePath, 'utf-8');
|
|
90
|
+
/** Substitute the story tokens a browser template file may carry. */
|
|
91
|
+
function processTemplate(content, info) {
|
|
86
92
|
return content
|
|
87
93
|
.replace(/\{\{STORY_ID\}\}/g, info.storyId)
|
|
88
94
|
.replace(/\{\{STORY_TITLE\}\}/g, info.storyTitle);
|
|
89
95
|
}
|
|
90
96
|
/**
|
|
91
|
-
*
|
|
97
|
+
* Add browser runtime deps + a build:browser script to the project's package.json.
|
|
98
|
+
* Deps pin to the platform major line this devkit shipped with (same source as
|
|
99
|
+
* `sharpee init`). Existing entries are left untouched.
|
|
92
100
|
*/
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
function updatePackageJson(projectDir) {
|
|
102
|
+
const packagePath = path.join(projectDir, 'package.json');
|
|
103
|
+
if (!fs.existsSync(packagePath)) {
|
|
104
|
+
console.warn(' ⚠ No package.json — skipped dependency wiring');
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
|
|
109
|
+
const { sharpeeRange } = (0, init_1.platformRanges)();
|
|
110
|
+
pkg.dependencies = pkg.dependencies || {};
|
|
111
|
+
for (const dep of BROWSER_RUNTIME_DEPS) {
|
|
112
|
+
if (!pkg.dependencies[dep])
|
|
113
|
+
pkg.dependencies[dep] = sharpeeRange;
|
|
114
|
+
}
|
|
115
|
+
pkg.devDependencies = pkg.devDependencies || {};
|
|
116
|
+
if (!pkg.devDependencies.esbuild)
|
|
117
|
+
pkg.devDependencies.esbuild = '^0.20.0';
|
|
118
|
+
pkg.scripts = pkg.scripts || {};
|
|
119
|
+
if (!pkg.scripts['build:browser'])
|
|
120
|
+
pkg.scripts['build:browser'] = 'sharpee build-browser';
|
|
121
|
+
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2) + '\n');
|
|
122
|
+
console.log(' ✓ Updated package.json (deps + build:browser)');
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
console.warn(' ⚠ Could not update package.json');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** Run the init-browser command. */
|
|
129
|
+
async function runInitBrowserCommand(args, projectDirArg) {
|
|
95
130
|
if (args.includes('--help') || args.includes('-h')) {
|
|
96
131
|
showHelp();
|
|
97
132
|
return;
|
|
98
133
|
}
|
|
99
|
-
const projectDir = process.cwd();
|
|
134
|
+
const projectDir = projectDirArg || process.cwd();
|
|
100
135
|
console.log('\n🌐 Adding browser client to your Sharpee project\n');
|
|
101
|
-
// Check if this is a Sharpee project
|
|
102
136
|
const info = getProjectInfo(projectDir);
|
|
103
137
|
if (!info) {
|
|
104
138
|
console.error('Error: This does not appear to be a Sharpee project.');
|
|
@@ -107,86 +141,57 @@ async function runInitBrowserCommand(args) {
|
|
|
107
141
|
process.exit(1);
|
|
108
142
|
}
|
|
109
143
|
console.log(` Story: ${info.storyTitle} (${info.storyId})`);
|
|
110
|
-
//
|
|
144
|
+
// Entry point — the one wiring file authors may customize.
|
|
111
145
|
const browserEntryPath = path.join(projectDir, 'src', 'browser-entry.ts');
|
|
112
146
|
if (fs.existsSync(browserEntryPath)) {
|
|
113
147
|
console.error('\nError: src/browser-entry.ts already exists.');
|
|
114
148
|
console.error('Remove it first if you want to regenerate.');
|
|
115
149
|
process.exit(1);
|
|
116
150
|
}
|
|
117
|
-
// Create browser directory for templates (optional, for customization)
|
|
118
|
-
const browserDir = path.join(projectDir, 'browser');
|
|
119
|
-
fs.mkdirSync(browserDir, { recursive: true });
|
|
120
|
-
// Copy browser-entry.ts template
|
|
121
151
|
const browserEntryTemplate = path.join(TEMPLATES_DIR, 'browser-entry.ts.template');
|
|
122
|
-
if (fs.existsSync(browserEntryTemplate)) {
|
|
123
|
-
const content = processTemplate(browserEntryTemplate, info);
|
|
124
|
-
fs.writeFileSync(browserEntryPath, content);
|
|
125
|
-
console.log(' ✓ Created src/browser-entry.ts');
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
152
|
+
if (!fs.existsSync(browserEntryTemplate)) {
|
|
128
153
|
console.error(' ✗ Template not found: browser-entry.ts.template');
|
|
129
154
|
process.exit(1);
|
|
130
155
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
console.log(
|
|
143
|
-
}
|
|
144
|
-
// Update package.json to add esbuild dev dependency and build script
|
|
145
|
-
const packagePath = path.join(projectDir, 'package.json');
|
|
146
|
-
if (fs.existsSync(packagePath)) {
|
|
147
|
-
try {
|
|
148
|
-
const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
|
|
149
|
-
// Add esbuild to devDependencies
|
|
150
|
-
pkg.devDependencies = pkg.devDependencies || {};
|
|
151
|
-
if (!pkg.devDependencies.esbuild) {
|
|
152
|
-
pkg.devDependencies.esbuild = '^0.20.0';
|
|
153
|
-
}
|
|
154
|
-
// Add build:browser script
|
|
155
|
-
pkg.scripts = pkg.scripts || {};
|
|
156
|
-
if (!pkg.scripts['build:browser']) {
|
|
157
|
-
pkg.scripts['build:browser'] = 'sharpee build-browser';
|
|
158
|
-
}
|
|
159
|
-
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2) + '\n');
|
|
160
|
-
console.log(' ✓ Updated package.json');
|
|
161
|
-
}
|
|
162
|
-
catch (e) {
|
|
163
|
-
console.warn(' ⚠ Could not update package.json');
|
|
164
|
-
}
|
|
156
|
+
fs.writeFileSync(browserEntryPath, processTemplate(fs.readFileSync(browserEntryTemplate, 'utf-8'), info));
|
|
157
|
+
console.log(' ✓ Created src/browser-entry.ts');
|
|
158
|
+
// Author override stylesheet — the sole CSS customization surface. The platform
|
|
159
|
+
// CSS (base/decorations/styles) and index.html are pulled fresh from devkit at build.
|
|
160
|
+
const browserDir = path.join(projectDir, 'browser');
|
|
161
|
+
fs.mkdirSync(browserDir, { recursive: true });
|
|
162
|
+
const overrideCssPath = path.join(browserDir, `${info.storyId}.css`);
|
|
163
|
+
if (!fs.existsSync(overrideCssPath)) {
|
|
164
|
+
fs.writeFileSync(overrideCssPath, `/* ${info.storyTitle} — author stylesheet.\n` +
|
|
165
|
+
` * Loaded after the platform CSS, so any rule here overrides the defaults.\n` +
|
|
166
|
+
` * Add your own styles below. */\n`);
|
|
167
|
+
console.log(` ✓ Created browser/${info.storyId}.css`);
|
|
165
168
|
}
|
|
169
|
+
updatePackageJson(projectDir);
|
|
166
170
|
console.log('\n✅ Browser client added!\n');
|
|
167
171
|
console.log('Next steps:');
|
|
168
|
-
console.log(' npm install
|
|
169
|
-
console.log(' npm run build
|
|
170
|
-
console.log('');
|
|
171
|
-
console.log('Output will be in dist/web/');
|
|
172
|
+
console.log(' npm install # Install the browser runtime deps');
|
|
173
|
+
console.log(' npm run build # Build the story');
|
|
174
|
+
console.log(' npm run build:browser # Build the web bundle → dist/web/');
|
|
172
175
|
console.log('');
|
|
173
|
-
console.log('Customize
|
|
174
|
-
console.log(' browser
|
|
175
|
-
console.log(
|
|
176
|
+
console.log('Customize:');
|
|
177
|
+
console.log(' src/browser-entry.ts # Engine + client wiring');
|
|
178
|
+
console.log(` browser/${info.storyId}.css # Your style overrides`);
|
|
176
179
|
console.log('');
|
|
177
180
|
}
|
|
178
181
|
function showHelp() {
|
|
179
182
|
console.log(`
|
|
180
|
-
sharpee init-browser - Add browser client to a Sharpee project
|
|
183
|
+
sharpee init-browser - Add a browser client to a Sharpee project
|
|
181
184
|
|
|
182
185
|
Usage: sharpee init-browser
|
|
183
186
|
|
|
184
|
-
|
|
185
|
-
|
|
187
|
+
Adds the files needed to build a web version of your story:
|
|
188
|
+
|
|
189
|
+
src/browser-entry.ts Engine + browser-client wiring
|
|
190
|
+
browser/<story-id>.css Author style overrides (loaded last)
|
|
186
191
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
192
|
+
Also adds the browser runtime dependencies and a build:browser script to
|
|
193
|
+
package.json. The HTML page and platform CSS are supplied at build time by
|
|
194
|
+
"sharpee build-browser".
|
|
190
195
|
|
|
191
196
|
Run this in the root of your Sharpee project directory.
|
|
192
197
|
`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-browser.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/devkit/src/standalone/init-browser.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"init-browser.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/devkit/src/standalone/init-browser.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGH,sDA6DC;AA5JD,uCAAyB;AACzB,2CAA6B;AAC7B,iCAAwC;AAExC,wFAAwF;AACxF,MAAM,aAAa,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IACrF,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,CAA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