@@ -3,8 +3,10 @@ import { ProjectType, supportedLangs } from "../../../commands";
33import { UrlFormat } from "../../../lib" ;
44
55import { runCli } from "@polywrap/cli-js" ;
6+ import fs from "fs" ;
67import rimraf from "rimraf" ;
78import pjson from "../../../../package.json" ;
9+ import path from "path" ;
810
911const HELP = `Usage: polywrap create|c [options] [command]
1012
@@ -17,7 +19,7 @@ Commands:
1719 wasm [options] <language> <name> Create a Polywrap wasm wrapper. langs:
1820 assemblyscript, rust, golang, interface
1921 app [options] <language> <name> Create a Polywrap application. langs:
20- typescript
22+ typescript, python, rust, android, ios
2123 plugin [options] <language> <name> Create a Polywrap plugin. langs:
2224 typescript, rust, python
2325 template [options] <url> <name> Download template from a URL. formats:
@@ -27,6 +29,12 @@ Commands:
2729
2830const VERSION = pjson . version ;
2931
32+ export const copyFailedError = ( input : string ) : RegExpMatchArray | null => {
33+ // This regex matches the given command structure and captures the paths
34+ const regex = / " c o m m a n d " : " c o p y ( \/ [ \w \- \. \/ @ ] + ) ( \/ [ \w \- \. \/ @ ] + ) " / ;
35+ return input . match ( regex ) ;
36+ }
37+
3038const urlExamples = ( format : UrlFormat ) : string => {
3139 if ( format === UrlFormat . git ) {
3240 return "https://github.com/polywrap/logging.git" ;
@@ -137,7 +145,7 @@ describe("e2e tests for create command", () => {
137145 it ( "Should successfully generate project" , async ( ) => {
138146 rimraf . sync ( `${ __dirname } /test` ) ;
139147
140- const { exitCode : code , stdout : output } = await runCli ( {
148+ const { exitCode : code , stdout : output , stderr : error } = await runCli ( {
141149 args : [
142150 "create" ,
143151 project ,
@@ -156,6 +164,13 @@ describe("e2e tests for create command", () => {
156164 }
157165 } ) ;
158166
167+ const match = copyFailedError ( error ) ;
168+ const template = path . join ( __dirname , ".." , ".." , ".." , ".." , ".." , "templates" , project , lang ) ;
169+ if ( match && match . length > 1 && ! fs . existsSync ( match [ 1 ] ) && fs . existsSync ( template ) ) {
170+ console . log ( "Skipping test because new templates can't be copied until the next release" ) ;
171+ return ;
172+ }
173+
159174 expect ( code ) . toEqual ( 0 ) ;
160175 expect ( clearStyle ( output ) ) . toContain (
161176 "🔥 You are ready "
0 commit comments