File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,16 +84,20 @@ export async function handleGenerateShape(source) {
8484
8585export async function handleSetConfig ( field , value ) {
8686 if ( field === 'css-doodle' ) {
87- const { result, error } = await fetchCssDoodleSource ( value ) ;
88- if ( error ) {
89- return console . error ( error . message ) ;
90- }
91- try {
92- const libPath = path . join ( configDownloadPath , `css-doodle-${ value } .js` ) ;
93- fs . writeFileSync ( libPath , result ) ;
94- config [ field ] = libPath ;
95- } catch ( e ) {
96- return console . error ( `error: failed to fetch css-doodle@${ value } ` ) ;
87+ if ( fs . existsSync ( value ) ) {
88+ config [ field ] = path . resolve ( value ) ;
89+ } else {
90+ const { result, error } = await fetchCssDoodleSource ( value ) ;
91+ if ( error ) {
92+ return console . error ( error . message ) ;
93+ }
94+ try {
95+ const libPath = path . join ( configDownloadPath , `css-doodle-${ value } .js` ) ;
96+ fs . writeFileSync ( libPath , result ) ;
97+ config [ field ] = libPath ;
98+ } catch ( e ) {
99+ return console . error ( `error: failed to fetch css-doodle@${ value } ` ) ;
100+ }
97101 }
98102 } else {
99103 config [ field ] = value ;
Original file line number Diff line number Diff line change 11import { readFileSync } from 'node:fs' ;
2- import { createServer } from 'http' ;
2+ import { createServer } from 'node:http' ;
3+
34import { WebSocketServer } from 'ws' ;
45import watch from 'node-watch' ;
6+
57import { previewClient , getCssDoodleLib } from '../static.js' ;
68
79const sourceFile = process . argv [ 2 ] ;
You can’t perform that action at this time.
0 commit comments