Skip to content

Commit 51576d3

Browse files
committed
add -W option (skip WithInit)
1 parent 49e9a99 commit 51576d3

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.3.22 (2023-04-26)
4+
5+
- Add `-W` option to skip `WithInit` generation.
6+
37
## 0.3.21 (2023-02-17)
48

59
- Generate `WithInit` contract variant for abstract but fully implemented contracts.

src/cli.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ interface Options {
1919
initializablePath?: string;
2020
buildInfo?: string;
2121
deleteOriginals: boolean;
22+
skipWithInit: boolean;
2223
exclude: string[];
2324
publicInitializers: string[];
2425
}
@@ -30,10 +31,12 @@ function readCommandFlags(resolveRootRelative: (p: string) => string): Options {
3031
p: publicInitializers = [],
3132
D: deleteOriginals = false,
3233
x: exclude = [],
34+
W: skipWithInit = false,
3335
} = minimist(process.argv.slice(2));
3436
return {
3537
buildInfo,
3638
deleteOriginals,
39+
skipWithInit,
3740
initializablePath: initializablePath && resolveRootRelative(initializablePath),
3841
publicInitializers: ensureArray(publicInitializers).map(resolveRootRelative),
3942
exclude: ensureArray(exclude).map(p =>

src/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ interface TranspileOptions {
4242
exclude?: string[];
4343
publicInitializers?: string[];
4444
solcVersion?: string;
45+
skipWithInit?: boolean;
4546
}
4647

4748
function getExtraOutputPaths(
@@ -120,11 +121,13 @@ export async function transpile(
120121
fileName: path.basename(outputPaths.initializable),
121122
});
122123

123-
outputFiles.push({
124-
source: generateWithInit(transform, outputPaths.withInit, options?.solcVersion),
125-
path: outputPaths.withInit,
126-
fileName: path.basename(outputPaths.withInit),
127-
});
124+
if (!options?.skipWithInit) {
125+
outputFiles.push({
126+
source: generateWithInit(transform, outputPaths.withInit, options?.solcVersion),
127+
path: outputPaths.withInit,
128+
fileName: path.basename(outputPaths.withInit),
129+
});
130+
}
128131

129132
return outputFiles;
130133
}

0 commit comments

Comments
 (0)