jsii-pacmak 1.78.0 → 1.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@ const jsii_rosetta_1 = require("jsii-rosetta");
6
6
  const yargs = require("yargs");
7
7
  const lib_1 = require("../lib");
8
8
  const logging_1 = require("../lib/logging");
9
+ const packaging_1 = require("../lib/packaging");
9
10
  const version_1 = require("../lib/version");
10
11
  (async function main() {
11
12
  const argv = await yargs
@@ -139,6 +140,12 @@ const version_1 = require("../lib/version");
139
140
  defaultDescription: 'A temporary directory is used.',
140
141
  default: undefined,
141
142
  hidden: true,
143
+ })
144
+ .option('pack-command', {
145
+ type: 'string',
146
+ desc: 'Configure a custom command to create package tarballs. Command must output the name of the tarball.',
147
+ default: packaging_1.DEFAULT_PACK_COMMAND,
148
+ hidden: true,
142
149
  })
143
150
  .option('validate-assemblies', {
144
151
  type: 'boolean',
package/generate.sh CHANGED
@@ -14,10 +14,10 @@ VERSION=$(node -p "require('./package.json').version.replace(/\\+[0-9a-f]+\$/, '
14
14
  cat > lib/version.ts <<HERE
15
15
  // Generated at $(date -u +"%Y-%m-%dT%H:%M:%SZ") by generate.sh
16
16
 
17
- /** The short version number for this JSII compiler (e.g: \`X.Y.Z\`) */
17
+ /** The short version number for this jsii-pacmak release (e.g: \`X.Y.Z\`) */
18
18
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
19
19
  export const VERSION: string = '${VERSION}';
20
20
 
21
- /** The qualified version number for this JSII compiler (e.g: \`X.Y.Z (build #######)\`) */
21
+ /** The qualified version number for this jsii-pacmak release (e.g: \`X.Y.Z (build #######)\`) */
22
22
  export const VERSION_DESC = '${VERSION} (build ${commit:0:7}${suffix:-})';
23
23
  HERE
package/lib/index.js CHANGED
@@ -46,7 +46,7 @@ async function pacmak({ argv = {}, clean = true, codeOnly = false, fingerprint =
46
46
  }
47
47
  await timers.recordAsync('npm pack', () => {
48
48
  logging.info('Packaging NPM bundles');
49
- return Promise.all(modulesToPackageFlat.map((m) => m.npmPack()));
49
+ return Promise.all(modulesToPackageFlat.map((m) => m.npmPack(argv['pack-command'])));
50
50
  });
51
51
  await timers.recordAsync('load jsii', () => {
52
52
  logging.info('Loading jsii assemblies and translations');
@@ -1,4 +1,5 @@
1
1
  import type { Assembly, TypeSystem } from 'jsii-reflect';
2
+ export declare const DEFAULT_PACK_COMMAND = "npm pack";
2
3
  export interface JsiiModuleOptions {
3
4
  /**
4
5
  * Name of the module
@@ -33,7 +34,7 @@ export declare class JsiiModule {
33
34
  /**
34
35
  * Prepare an NPM package from this source module
35
36
  */
36
- npmPack(): Promise<void>;
37
+ npmPack(packCommand?: string): Promise<void>;
37
38
  get tarball(): string;
38
39
  load(system: TypeSystem, validate?: boolean): Promise<Assembly>;
39
40
  get assembly(): Assembly;
package/lib/packaging.js CHANGED
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JsiiModule = void 0;
3
+ exports.JsiiModule = exports.DEFAULT_PACK_COMMAND = void 0;
4
+ const fs = require("fs-extra");
4
5
  const os = require("os");
5
6
  const path = require("path");
6
7
  const logging = require("../lib/logging");
7
8
  const util_1 = require("./util");
9
+ exports.DEFAULT_PACK_COMMAND = 'npm pack';
8
10
  class JsiiModule {
9
11
  constructor(options) {
10
12
  this.name = options.name;
@@ -16,22 +18,31 @@ class JsiiModule {
16
18
  /**
17
19
  * Prepare an NPM package from this source module
18
20
  */
19
- async npmPack() {
21
+ async npmPack(packCommand = exports.DEFAULT_PACK_COMMAND) {
20
22
  this._tarball = await util_1.Scratch.make(async (tmpdir) => {
21
- // Quoting (JSON-stringifying) the module directory in order to avoid
22
- // problems if there are spaces or other special characters in the path.
23
- const args = ['pack', JSON.stringify(this.moduleDirectory)];
24
- if (logging.level >= logging.LEVEL_VERBOSE) {
25
- args.push('--loglevel=verbose');
23
+ const args = [];
24
+ if (packCommand === exports.DEFAULT_PACK_COMMAND) {
25
+ // Quoting (JSON-stringifying) the module directory in order to avoid
26
+ // problems if there are spaces or other special characters in the path.
27
+ args.push(JSON.stringify(this.moduleDirectory));
28
+ if (logging.level >= logging.LEVEL_VERBOSE) {
29
+ args.push('--loglevel=verbose');
30
+ }
26
31
  }
27
- const out = await (0, util_1.shell)('npm', args, { cwd: tmpdir });
32
+ else {
33
+ // Ensure module is copied to tmpdir to ensure parallel execution does not content on generated tarballs
34
+ await fs.copy(this.moduleDirectory, tmpdir);
35
+ }
36
+ const out = await (0, util_1.shell)(packCommand, args, {
37
+ cwd: tmpdir,
38
+ });
28
39
  // Take only the last line of npm pack which should contain the
29
40
  // tarball name. otherwise, there can be a lot of extra noise there
30
41
  // from scripts that emit to STDOUT.
31
42
  const lines = out.trim().split(os.EOL);
32
43
  const lastLine = lines[lines.length - 1].trim();
33
44
  if (!lastLine.endsWith('.tgz') && !lastLine.endsWith('.tar.gz')) {
34
- throw new Error(`npm pack did not produce tarball from ${this.moduleDirectory} into ${tmpdir} (output was ${JSON.stringify(lines)})`);
45
+ throw new Error(`${packCommand} did not produce tarball from ${this.moduleDirectory} into ${tmpdir} (output was ${JSON.stringify(lines)})`);
35
46
  }
36
47
  return path.resolve(tmpdir, lastLine);
37
48
  });
@@ -5,6 +5,7 @@ const path = require("path");
5
5
  const xmlbuilder = require("xmlbuilder");
6
6
  const __1 = require("..");
7
7
  const logging = require("../../logging");
8
+ const version_1 = require("../../version");
8
9
  const dotnet_1 = require("../dotnet");
9
10
  const version_utils_1 = require("../version-utils");
10
11
  const nameutils_1 = require("./nameutils");
@@ -96,12 +97,10 @@ class FileGenerator {
96
97
  const itemGroup1 = rootNode.ele('ItemGroup');
97
98
  const embeddedResource = itemGroup1.ele('EmbeddedResource');
98
99
  embeddedResource.att('Include', this.tarballFileName);
99
- // Strip " (build abcdef)" from the jsii version
100
- const jsiiVersion = assembly.jsiiVersion.replace(/ .*$/, '');
101
100
  const itemGroup2 = rootNode.ele('ItemGroup');
102
101
  const packageReference = itemGroup2.ele('PackageReference');
103
102
  packageReference.att('Include', 'Amazon.JSII.Runtime');
104
- packageReference.att('Version', (0, version_utils_1.toNuGetVersionRange)(`^${jsiiVersion}`));
103
+ packageReference.att('Version', (0, version_utils_1.toNuGetVersionRange)(`^${version_1.VERSION}`));
105
104
  dependencies.forEach((value) => {
106
105
  if (value.partOfCompilation) {
107
106
  const dependencyReference = itemGroup2.ele('ProjectReference');
@@ -25,6 +25,7 @@ const logging_1 = require("../logging");
25
25
  const markdown_1 = require("../markdown");
26
26
  const target_1 = require("../target");
27
27
  const util_1 = require("../util");
28
+ const version_1 = require("../version");
28
29
  const _utils_1 = require("./_utils");
29
30
  const type_name_1 = require("./python/type-name");
30
31
  const util_2 = require("./python/util");
@@ -1428,8 +1429,6 @@ class Package {
1428
1429
  code.line(this.rootModule?.moduleDocumentation ??
1429
1430
  `${this.name}\n${'='.repeat(this.name.length)}`);
1430
1431
  code.closeFile('README.md');
1431
- // Strip " (build abcdef)" from the jsii version
1432
- const jsiiVersionSimple = (0, version_utils_1.toReleaseVersion)(this.metadata.jsiiVersion.replace(/ .*$/, ''), index_1.TargetName.PYTHON);
1433
1432
  const setupKwargs = {
1434
1433
  name: this.name,
1435
1434
  version: this.version,
@@ -1452,7 +1451,7 @@ class Package {
1452
1451
  package_data: packageData,
1453
1452
  python_requires: '~=3.7',
1454
1453
  install_requires: [
1455
- `jsii${(0, version_utils_1.toPythonVersionRange)(`^${jsiiVersionSimple}`)}`,
1454
+ `jsii${(0, version_utils_1.toPythonVersionRange)(`^${version_1.VERSION}`)}`,
1456
1455
  'publication>=0.0.3',
1457
1456
  'typeguard~=2.13.3',
1458
1457
  ]
package/lib/version.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- /** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
1
+ /** The short version number for this jsii-pacmak release (e.g: `X.Y.Z`) */
2
2
  export declare const VERSION: string;
3
- /** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
4
- export declare const VERSION_DESC = "1.78.0 (build 1041b18)";
3
+ /** The qualified version number for this jsii-pacmak release (e.g: `X.Y.Z (build #######)`) */
4
+ export declare const VERSION_DESC = "1.79.0 (build b22f628)";
5
5
  //# sourceMappingURL=version.d.ts.map
package/lib/version.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- // Generated at 2023-03-16T11:11:13Z by generate.sh
2
+ // Generated at 2023-03-23T12:00:13Z by generate.sh
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.VERSION_DESC = exports.VERSION = void 0;
5
- /** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
5
+ /** The short version number for this jsii-pacmak release (e.g: `X.Y.Z`) */
6
6
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
7
- exports.VERSION = '1.78.0';
8
- /** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
9
- exports.VERSION_DESC = '1.78.0 (build 1041b18)';
7
+ exports.VERSION = '1.79.0';
8
+ /** The qualified version number for this jsii-pacmak release (e.g: `X.Y.Z (build #######)`) */
9
+ exports.VERSION_DESC = '1.79.0 (build b22f628)';
10
10
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsii-pacmak",
3
- "version": "1.78.0",
3
+ "version": "1.79.0",
4
4
  "description": "A code generation framework for jsii backend languages",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,35 +37,35 @@
37
37
  "package": "package-js"
38
38
  },
39
39
  "dependencies": {
40
- "@jsii/check-node": "1.78.0",
41
- "@jsii/spec": "^1.78.0",
40
+ "@jsii/check-node": "1.79.0",
41
+ "@jsii/spec": "^1.79.0",
42
42
  "clone": "^2.1.2",
43
- "codemaker": "^1.78.0",
43
+ "codemaker": "^1.79.0",
44
44
  "commonmark": "^0.30.0",
45
45
  "escape-string-regexp": "^4.0.0",
46
46
  "fs-extra": "^10.1.0",
47
- "jsii-reflect": "^1.78.0",
48
- "jsii-rosetta": "^1.78.0",
47
+ "jsii-reflect": "^1.79.0",
48
+ "jsii-rosetta": "^1.79.0",
49
49
  "semver": "^7.3.8",
50
50
  "spdx-license-list": "^6.6.0",
51
51
  "xmlbuilder": "^15.1.1",
52
52
  "yargs": "^16.2.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@jsii/dotnet-runtime": "^1.78.0",
56
- "@jsii/java-runtime": "^1.78.0",
57
- "@jsii/go-runtime": "^1.78.0",
58
- "@scope/jsii-calc-lib": "^1.78.0",
55
+ "@jsii/dotnet-runtime": "^1.79.0",
56
+ "@jsii/java-runtime": "^1.79.0",
57
+ "@jsii/go-runtime": "^1.79.0",
58
+ "@scope/jsii-calc-lib": "^1.79.0",
59
59
  "@types/clone": "^2.1.1",
60
60
  "@types/diff": "^5.0.2",
61
61
  "@types/commonmark": "^0.27.5",
62
62
  "@types/fs-extra": "^9.0.13",
63
63
  "@types/semver": "^7.3.13",
64
64
  "diff": "^5.1.0",
65
- "jsii": "^1.78.0",
66
- "jsii-build-tools": "^1.78.0",
65
+ "jsii": "^1.79.0",
66
+ "jsii-build-tools": "^1.79.0",
67
67
  "jsii-calc": "^3.20.120",
68
- "pyright": "^1.1.296"
68
+ "pyright": "^1.1.300"
69
69
  },
70
70
  "keywords": [
71
71
  "jsii",