-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: Package name collisions Fixes: cdk8s-team/cdk8s#273 Signed-off-by: campionfellin <[email protected]> * chore: Update jsii version to 1.6 Signed-off-by: campionfellin <[email protected]> * fix: fallback to hash for default packageName and fix hyphens in python package names Signed-off-by: campionfellin <[email protected]> * fix: hypens to underscores for python package names Signed-off-by: campionfellin <[email protected]> * chore: sync up dependencies with projen Signed-off-by: campionfellin <[email protected]> * chore: clean up snapshots Signed-off-by: campionfellin <[email protected]> * Revert "chore: sync up dependencies with projen" This reverts commit 58e1784. * Revert "chore: Update jsii version to 1.6" This reverts commit 824bb84. * fix: remove weird characters from snapshot Signed-off-by: campionfellin <[email protected]> * fix: back to yarn.lock from mainline Signed-off-by: campionfellin <[email protected]> * fix: Respond to comments Signed-off-by: campionfellin <[email protected]> * fix: Update test utils to ignore all jsii.tgz binary files Signed-off-by: campionfellin <[email protected]> * fix: update snapshots Signed-off-by: campionfellin <[email protected]> * fix: snapshots Signed-off-by: campionfellin <[email protected]> * fix: snapshots Signed-off-by: campionfellin <[email protected]> * fix: snapshots Signed-off-by: campionfellin <[email protected]> * fix: validate input options for python module name and java package Signed-off-by: campionfellin <[email protected]> Co-authored-by: Elad Ben-Israel <[email protected]>
- Loading branch information
1 parent
6b1f015
commit 766de96
Showing
9 changed files
with
115 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import * as fs from 'fs-extra'; | ||
import * as path from 'path'; | ||
import { exec } from './util'; | ||
import { exec, validateOptions } from './util'; | ||
import { Options } from './options'; | ||
import * as crypto from 'crypto'; | ||
|
||
const compilerModule = require.resolve('jsii/bin/jsii'); | ||
|
||
/** | ||
* Compiles the source files in `workdir` with jsii. | ||
*/ | ||
export async function compile(workdir: string, options: Options) { | ||
validateOptions(options); | ||
|
||
const args = [ '--silence-warnings', 'reserved-word' ]; | ||
const entrypoint = options.entrypoint ?? 'index.ts'; | ||
|
||
|
@@ -23,6 +26,8 @@ export async function compile(workdir: string, options: Options) { | |
// path to entrypoint without extension | ||
const basepath = path.join(path.dirname(entrypoint), path.basename(entrypoint, '.ts')); | ||
|
||
const moduleKey = options.moduleKey?.replace(/\./g, '').replace(/\//g, '') ?? crypto.createHash('sha256').update(basepath, 'utf8').digest('hex'); | ||
|
||
// jsii modules to include | ||
const moduleDirs = options.deps ?? []; | ||
|
||
|
@@ -46,9 +51,8 @@ export async function compile(workdir: string, options: Options) { | |
} | ||
} | ||
|
||
|
||
const pkg = { | ||
name: 'generated', | ||
name: moduleKey, | ||
version: '0.0.0', | ||
author: '[email protected]', | ||
main: `${basepath}.js`, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.