1- import { ensureString , exportPages , importPages } from "./deps.ts" ;
1+ import { assertString , exportPages , importPages } from "./deps.ts" ;
22
33const sid = Deno . env . get ( "SID" ) ;
44const exportingProjectName = Deno . env . get ( "SOURCE_PROJECT_NAME" ) ; //インポート元(本来はprivateプロジェクト)
55const importingProjectName = Deno . env . get ( "DESTINATION_PROJECT_NAME" ) ; //インポート先(publicプロジェクト)
66const shouldDuplicateByDefault =
77 Deno . env . get ( "SHOULD_DUPLICATE_BY_DEFAULT" ) === "True" ;
88
9- ensureString ( sid ) ;
10- ensureString ( exportingProjectName ) ;
11- ensureString ( importingProjectName ) ;
9+ assertString ( sid ) ;
10+ assertString ( exportingProjectName ) ;
11+ assertString ( importingProjectName ) ;
1212
1313console . log ( `Exporting a json file from "/${ exportingProjectName } "...` ) ;
1414const result = await exportPages ( exportingProjectName , {
@@ -17,11 +17,11 @@ const result = await exportPages(exportingProjectName, {
1717} ) ;
1818if ( ! result . ok ) {
1919 const error = new Error ( ) ;
20- error . name = `${ result . name } when exporting a json file` ;
21- error . message = result . message ;
20+ error . name = `${ result . value . name } when exporting a json file` ;
21+ error . message = result . value . message ;
2222 throw error ;
2323}
24- const { pages } = result ;
24+ const { pages } = result . value ;
2525console . log ( `Export ${ pages . length } pages:` ) ;
2626for ( const page of pages ) {
2727 console . log ( `\t${ page . title } ` ) ;
@@ -50,9 +50,9 @@ if (importingPages.length === 0) {
5050 } ) ;
5151 if ( ! result . ok ) {
5252 const error = new Error ( ) ;
53- error . name = `${ result . name } when importing pages` ;
54- error . message = result . message ;
53+ error . name = `${ result . value . name } when importing pages` ;
54+ error . message = result . value . message ;
5555 throw error ;
5656 }
57- console . log ( result . message ) ;
57+ console . log ( result . value ) ;
5858}
0 commit comments