-
Notifications
You must be signed in to change notification settings - Fork 19
Update templates #381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update templates #381
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,4 @@ dist.js | |
| dist/ | ||
| build/ | ||
| docs/ | ||
| !templates/**/.vscode/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "type": "starlingmonkey", | ||
| "request": "launch", | ||
| "name": "Debug StarlingMonkey component", | ||
| "component": "${workspaceFolder}/dist/{{ project-name | kebab_case }}.wasm", | ||
| "program": "${workspaceFolder}/src/index.js", | ||
| "stopOnEntry": false, | ||
| "trace": true | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "starlingmonkey": { | ||
| "componentRuntime": { | ||
| "executable": "spin", | ||
| "options": [ | ||
| "up", | ||
| "-f", | ||
| "${workspaceFolder}", | ||
| ], | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // build.mjs | ||
| import { build } from 'esbuild'; | ||
| import path from 'path'; | ||
| import { SpinEsbuildPlugin } from "@spinframework/build-tools/plugins/esbuild/index.js"; | ||
| import fs from 'fs'; | ||
|
|
||
| const spinPlugin = await SpinEsbuildPlugin(); | ||
|
|
||
| // plugin to handle vendor files in node_modules that may not be bundled. | ||
| // Instead of generating a real source map for these files, it appends a minimal | ||
| // inline source map pointing to an empty source. This avoids errors and ensures | ||
| // source maps exist even for unbundled vendor code. | ||
| let SourceMapPlugin = { | ||
| name: 'excludeVendorFromSourceMap', | ||
| setup(build) { | ||
| build.onLoad({ filter: /node_modules/ }, args => { | ||
| return { | ||
| contents: fs.readFileSync(args.path, 'utf8') | ||
| + '\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==', | ||
| loader: 'default', | ||
| } | ||
| }) | ||
| }, | ||
| } | ||
|
|
||
| await build({ | ||
| entryPoints: ['./src/index.js'], | ||
| outfile: './build/bundle.js', | ||
| bundle: true, | ||
| format: 'esm', | ||
| platform: 'node', | ||
| sourcemap: true, | ||
| minify: false, | ||
| plugins: [spinPlugin, SourceMapPlugin], | ||
| logLevel: 'error', | ||
| loader: { | ||
| '.ts': 'ts', | ||
| '.tsx': 'tsx', | ||
| }, | ||
| resolveExtensions: ['.ts', '.tsx', '.js'], | ||
| sourceRoot: path.resolve(process.cwd(), 'src'), | ||
| }); |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "type": "starlingmonkey", | ||
| "request": "launch", | ||
| "name": "Debug StarlingMonkey component", | ||
| "component": "${workspaceFolder}/dist/{{ project-name | kebab_case }}.wasm", | ||
| "program": "${workspaceFolder}/src/index.ts", | ||
| "stopOnEntry": false, | ||
| "trace": true | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "starlingmonkey": { | ||
| "componentRuntime": { | ||
| "executable": "spin", | ||
| "options": [ | ||
| "up", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as for the |
||
| "-f", | ||
| "${workspaceFolder}", | ||
| ], | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // build.mjs | ||
| import { build } from 'esbuild'; | ||
| import path from 'path'; | ||
| import { SpinEsbuildPlugin } from "@spinframework/build-tools/plugins/esbuild/index.js"; | ||
| import fs from 'fs'; | ||
|
|
||
| const spinPlugin = await SpinEsbuildPlugin(); | ||
|
|
||
| // plugin to handle vendor files in node_modules that may not be bundled. | ||
| // Instead of generating a real source map for these files, it appends a minimal | ||
| // inline source map pointing to an empty source. This avoids errors and ensures | ||
| // source maps exist even for unbundled vendor code. | ||
| let SourceMapPlugin = { | ||
| name: 'excludeVendorFromSourceMap', | ||
| setup(build) { | ||
| build.onLoad({ filter: /node_modules/ }, args => { | ||
| return { | ||
| contents: fs.readFileSync(args.path, 'utf8') | ||
| + '\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==', | ||
| loader: 'default', | ||
| } | ||
| }) | ||
| }, | ||
| } | ||
|
|
||
| await build({ | ||
| entryPoints: ['./src/index.ts'], | ||
| outfile: './build/bundle.js', | ||
| bundle: true, | ||
| format: 'esm', | ||
| platform: 'node', | ||
| sourcemap: true, | ||
| minify: false, | ||
| plugins: [spinPlugin, SourceMapPlugin], | ||
| logLevel: 'error', | ||
| loader: { | ||
| '.ts': 'ts', | ||
| '.tsx': 'tsx', | ||
| }, | ||
| resolveExtensions: ['.ts', '.tsx', '.js'], | ||
| sourceRoot: path.resolve(process.cwd(), 'src'), | ||
| }); |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "type": "starlingmonkey", | ||
| "request": "launch", | ||
| "name": "Debug StarlingMonkey component", | ||
| "component": "${workspaceFolder}/dist/test-app.wasm", | ||
| "program": "${workspaceFolder}/src/index.ts", | ||
| "stopOnEntry": false, | ||
| "trace": true | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "starlingmonkey": { | ||
| "componentRuntime": { | ||
| "executable": "spin", | ||
| "options": [ | ||
| "up", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... and same here |
||
| "-f", | ||
| "${workspaceFolder}", | ||
| ], | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one thing to consider here is to change this to
watch. That'd probably require/enable other changes to the lifecycle, as the process wouldn't need to be restarted when content changes.