@@ -3,8 +3,10 @@ import { ProjectType, supportedLangs } from "../../../commands";
3
3
import { UrlFormat } from "../../../lib" ;
4
4
5
5
import { runCli } from "@polywrap/cli-js" ;
6
+ import fs from "fs" ;
6
7
import rimraf from "rimraf" ;
7
8
import pjson from "../../../../package.json" ;
9
+ import path from "path" ;
8
10
9
11
const HELP = `Usage: polywrap create|c [options] [command]
10
12
@@ -17,7 +19,7 @@ Commands:
17
19
wasm [options] <language> <name> Create a Polywrap wasm wrapper. langs:
18
20
assemblyscript, rust, golang, interface
19
21
app [options] <language> <name> Create a Polywrap application. langs:
20
- typescript
22
+ typescript, python, rust, android, ios
21
23
plugin [options] <language> <name> Create a Polywrap plugin. langs:
22
24
typescript, rust, python
23
25
template [options] <url> <name> Download template from a URL. formats:
@@ -27,6 +29,12 @@ Commands:
27
29
28
30
const VERSION = pjson . version ;
29
31
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
+
30
38
const urlExamples = ( format : UrlFormat ) : string => {
31
39
if ( format === UrlFormat . git ) {
32
40
return "https://github.com/polywrap/logging.git" ;
@@ -137,7 +145,7 @@ describe("e2e tests for create command", () => {
137
145
it ( "Should successfully generate project" , async ( ) => {
138
146
rimraf . sync ( `${ __dirname } /test` ) ;
139
147
140
- const { exitCode : code , stdout : output } = await runCli ( {
148
+ const { exitCode : code , stdout : output , stderr : error } = await runCli ( {
141
149
args : [
142
150
"create" ,
143
151
project ,
@@ -156,6 +164,13 @@ describe("e2e tests for create command", () => {
156
164
}
157
165
} ) ;
158
166
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
+
159
174
expect ( code ) . toEqual ( 0 ) ;
160
175
expect ( clearStyle ( output ) ) . toContain (
161
176
"🔥 You are ready "
0 commit comments