@intelligentgraphics/ig.gfx.packager 3.0.1 → 3.0.2

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.
@@ -1,5 +1,6 @@
1
1
  import * as path from 'path';
2
2
  import * as fs from 'fs';
3
+ import glob from 'glob';
3
4
  import { readWorkspaceNpmManifest, getWorkspaceLibPath } from '../lib/workspace.mjs';
4
5
  import { readPublishedPackageNpmManifest } from '../lib/publishedPackage.mjs';
5
6
  import { determineWorkspaceIGLibraries } from '../lib/dependencies.mjs';
@@ -14,21 +15,32 @@ const executePostInstall = workspace => {
14
15
  fs.mkdirSync(libPath, {
15
16
  recursive: true
16
17
  });
17
- const existingDefinitions = fs.readdirSync(libPath);
18
+ const existingDefinitions = glob.sync("**/*.d.ts", {
19
+ cwd: libPath,
20
+ absolute: true
21
+ });
18
22
 
19
23
  // delete all existing definition files that are managed by the packager.
20
24
  // we'll recreate all needed definitions in the next step.
21
- for (const existingDefinitionName of existingDefinitions) {
22
- const content = fs.readFileSync(path.join(libPath, existingDefinitionName), {
25
+ for (const existingDefinitionPath of existingDefinitions) {
26
+ const content = fs.readFileSync(existingDefinitionPath, {
23
27
  encoding: "utf-8"
24
28
  });
25
29
  if (content.startsWith(DEFINITION_FILE_HINT)) {
26
- fs.rmSync(path.join(libPath, existingDefinitionName));
30
+ fs.rmSync(existingDefinitionPath);
27
31
  }
28
32
  }
29
33
  const libraryLocations = determineWorkspaceIGLibraries(workspace);
30
34
  for (const location of libraryLocations) {
31
35
  const manifest = readPublishedPackageNpmManifest(location);
36
+ for (const existingDefinitionPath of existingDefinitions) {
37
+ const basename = path.basename(existingDefinitionPath);
38
+ if (basename === manifest.types) {
39
+ fs.rmSync(existingDefinitionPath, {
40
+ force: true
41
+ });
42
+ }
43
+ }
32
44
 
33
45
  // add a hint to the top of the file so we know it's managed by the packager.
34
46
  const content = `${DEFINITION_FILE_HINT}
@@ -1 +1 @@
1
- {"version":3,"file":"postinstall.mjs","sources":["../../src/commands/postinstall.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\n\nimport {\n\tgetWorkspaceLibPath,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n} from \"../lib/workspace\";\nimport { readPublishedPackageNpmManifest } from \"../lib/publishedPackage\";\nimport { determineWorkspaceIGLibraries } from \"../lib/dependencies\";\n\nconst DEFINITION_FILE_HINT =\n\t\"// This file is automatically managed by the ig.gfx.packager.\";\n\nexport const executePostInstall = (workspace: WorkspaceLocation) => {\n\tconst manifest = readWorkspaceNpmManifest(workspace);\n\n\tif (manifest === undefined) {\n\t\tthrow new Error(`Expected an npm manifest to exist.`);\n\t}\n\n\tconst libPath = getWorkspaceLibPath(workspace);\n\n\tfs.mkdirSync(libPath, { recursive: true });\n\n\tconst existingDefinitions = fs.readdirSync(libPath);\n\n\t// delete all existing definition files that are managed by the packager.\n\t// we'll recreate all needed definitions in the next step.\n\tfor (const existingDefinitionName of existingDefinitions) {\n\t\tconst content = fs.readFileSync(\n\t\t\tpath.join(libPath, existingDefinitionName),\n\t\t\t{ encoding: \"utf-8\" },\n\t\t);\n\n\t\tif (content.startsWith(DEFINITION_FILE_HINT)) {\n\t\t\tfs.rmSync(path.join(libPath, existingDefinitionName));\n\t\t}\n\t}\n\n\tconst libraryLocations = determineWorkspaceIGLibraries(workspace);\n\n\tfor (const location of libraryLocations) {\n\t\tconst manifest = readPublishedPackageNpmManifest(location);\n\n\t\t// add a hint to the top of the file so we know it's managed by the packager.\n\t\tconst content = `${DEFINITION_FILE_HINT}\n// This is a reference to version ${manifest.version}.\n// Run \"npm install\" to install the types if they are missing or not up to date.\n/// <reference types=\"${manifest.name}\" />`;\n\n\t\tfs.writeFileSync(\n\t\t\tpath.join(getWorkspaceLibPath(workspace), manifest.types),\n\t\t\tcontent,\n\t\t\t{\n\t\t\t\tencoding: \"utf8\",\n\t\t\t},\n\t\t);\n\t}\n};\n"],"names":["DEFINITION_FILE_HINT","executePostInstall","workspace","manifest","readWorkspaceNpmManifest","undefined","Error","libPath","getWorkspaceLibPath","fs","mkdirSync","recursive","existingDefinitions","readdirSync","existingDefinitionName","content","readFileSync","path","join","encoding","startsWith","rmSync","libraryLocations","determineWorkspaceIGLibraries","location","readPublishedPackageNpmManifest","version","name","writeFileSync","types"],"mappings":";;;;;;AAWA,MAAMA,oBAAoB,GACzB,+DAA+D,CAAA;AAEnDC,MAAAA,kBAAkB,GAAIC,SAA4B,IAAK;AACnE,EAAA,MAAMC,QAAQ,GAAGC,wBAAwB,CAACF,SAAS,CAAC,CAAA;EAEpD,IAAIC,QAAQ,KAAKE,SAAS,EAAE;AAC3B,IAAA,MAAM,IAAIC,KAAK,CAAE,CAAA,kCAAA,CAAmC,CAAC,CAAA;AACtD,GAAA;AAEA,EAAA,MAAMC,OAAO,GAAGC,mBAAmB,CAACN,SAAS,CAAC,CAAA;AAE9CO,EAAAA,EAAE,CAACC,SAAS,CAACH,OAAO,EAAE;AAAEI,IAAAA,SAAS,EAAE,IAAA;AAAK,GAAC,CAAC,CAAA;AAE1C,EAAA,MAAMC,mBAAmB,GAAGH,EAAE,CAACI,WAAW,CAACN,OAAO,CAAC,CAAA;;AAEnD;AACA;AACA,EAAA,KAAK,MAAMO,sBAAsB,IAAIF,mBAAmB,EAAE;AACzD,IAAA,MAAMG,OAAO,GAAGN,EAAE,CAACO,YAAY,CAC9BC,IAAI,CAACC,IAAI,CAACX,OAAO,EAAEO,sBAAsB,CAAC,EAC1C;AAAEK,MAAAA,QAAQ,EAAE,OAAA;AAAQ,KAAC,CACrB,CAAA;AAED,IAAA,IAAIJ,OAAO,CAACK,UAAU,CAACpB,oBAAoB,CAAC,EAAE;MAC7CS,EAAE,CAACY,MAAM,CAACJ,IAAI,CAACC,IAAI,CAACX,OAAO,EAAEO,sBAAsB,CAAC,CAAC,CAAA;AACtD,KAAA;AACD,GAAA;AAEA,EAAA,MAAMQ,gBAAgB,GAAGC,6BAA6B,CAACrB,SAAS,CAAC,CAAA;AAEjE,EAAA,KAAK,MAAMsB,QAAQ,IAAIF,gBAAgB,EAAE;AACxC,IAAA,MAAMnB,QAAQ,GAAGsB,+BAA+B,CAACD,QAAQ,CAAC,CAAA;;AAE1D;IACA,MAAMT,OAAO,GAAI,CAAA,EAAEf,oBAAqB,CAAA;AAC1C,kCAAoCG,EAAAA,QAAQ,CAACuB,OAAQ,CAAA;AACrD;AACA,sBAAwBvB,EAAAA,QAAQ,CAACwB,IAAK,CAAK,IAAA,CAAA,CAAA;AAEzClB,IAAAA,EAAE,CAACmB,aAAa,CACfX,IAAI,CAACC,IAAI,CAACV,mBAAmB,CAACN,SAAS,CAAC,EAAEC,QAAQ,CAAC0B,KAAK,CAAC,EACzDd,OAAO,EACP;AACCI,MAAAA,QAAQ,EAAE,MAAA;AACX,KAAC,CACD,CAAA;AACF,GAAA;AACD;;;;"}
1
+ {"version":3,"file":"postinstall.mjs","sources":["../../src/commands/postinstall.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport glob from \"glob\";\n\nimport {\n\tgetWorkspaceLibPath,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n} from \"../lib/workspace\";\nimport { readPublishedPackageNpmManifest } from \"../lib/publishedPackage\";\nimport { determineWorkspaceIGLibraries } from \"../lib/dependencies\";\n\nconst DEFINITION_FILE_HINT =\n\t\"// This file is automatically managed by the ig.gfx.packager.\";\n\nexport const executePostInstall = (workspace: WorkspaceLocation) => {\n\tconst manifest = readWorkspaceNpmManifest(workspace);\n\n\tif (manifest === undefined) {\n\t\tthrow new Error(`Expected an npm manifest to exist.`);\n\t}\n\n\tconst libPath = getWorkspaceLibPath(workspace);\n\n\tfs.mkdirSync(libPath, { recursive: true });\n\n\tconst existingDefinitions = glob.sync(\"**/*.d.ts\", {\n\t\tcwd: libPath,\n\t\tabsolute: true,\n\t});\n\n\t// delete all existing definition files that are managed by the packager.\n\t// we'll recreate all needed definitions in the next step.\n\tfor (const existingDefinitionPath of existingDefinitions) {\n\t\tconst content = fs.readFileSync(existingDefinitionPath, {\n\t\t\tencoding: \"utf-8\",\n\t\t});\n\n\t\tif (content.startsWith(DEFINITION_FILE_HINT)) {\n\t\t\tfs.rmSync(existingDefinitionPath);\n\t\t}\n\t}\n\n\tconst libraryLocations = determineWorkspaceIGLibraries(workspace);\n\n\tfor (const location of libraryLocations) {\n\t\tconst manifest = readPublishedPackageNpmManifest(location);\n\n\t\tfor (const existingDefinitionPath of existingDefinitions) {\n\t\t\tconst basename = path.basename(existingDefinitionPath);\n\n\t\t\tif (basename === manifest.types) {\n\t\t\t\tfs.rmSync(existingDefinitionPath, { force: true });\n\t\t\t}\n\t\t}\n\n\t\t// add a hint to the top of the file so we know it's managed by the packager.\n\t\tconst content = `${DEFINITION_FILE_HINT}\n// This is a reference to version ${manifest.version}.\n// Run \"npm install\" to install the types if they are missing or not up to date.\n/// <reference types=\"${manifest.name}\" />`;\n\n\t\tfs.writeFileSync(\n\t\t\tpath.join(getWorkspaceLibPath(workspace), manifest.types),\n\t\t\tcontent,\n\t\t\t{\n\t\t\t\tencoding: \"utf8\",\n\t\t\t},\n\t\t);\n\t}\n};\n"],"names":["DEFINITION_FILE_HINT","executePostInstall","workspace","manifest","readWorkspaceNpmManifest","undefined","Error","libPath","getWorkspaceLibPath","fs","mkdirSync","recursive","existingDefinitions","glob","sync","cwd","absolute","existingDefinitionPath","content","readFileSync","encoding","startsWith","rmSync","libraryLocations","determineWorkspaceIGLibraries","location","readPublishedPackageNpmManifest","basename","path","types","force","version","name","writeFileSync","join"],"mappings":";;;;;;;AAYA,MAAMA,oBAAoB,GACzB,+DAA+D,CAAA;AAEnDC,MAAAA,kBAAkB,GAAIC,SAA4B,IAAK;AACnE,EAAA,MAAMC,QAAQ,GAAGC,wBAAwB,CAACF,SAAS,CAAC,CAAA;EAEpD,IAAIC,QAAQ,KAAKE,SAAS,EAAE;AAC3B,IAAA,MAAM,IAAIC,KAAK,CAAE,CAAA,kCAAA,CAAmC,CAA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ACA,MAAMZ,OAAO,GAAI,CAAA,EAAElB,oBAAqB,CAAA;AAC1C,kCAAoCG,EAAAA,QAAQ,CAAC4B,OAAQ,CAAA;AACrD;AACA,sBAAwB5B,EAAAA,QAAQ,CAAC6B,IAAK,CAAK,IAAA,CAAA,CAAA;AAEzCvB,IAAAA,EAAE,CAACwB,aAAa,CACfL,IAAI,CAACM,IAAI,CAAC1B,mBAAmB,CAACN,SAAS,CAAC,EAAEC,QAAQ,CAAC0B,KAAK,CAAC,EACzDX,OAAO,EACP;AACCE,MAAAA,QAAQ,EAAE,MAAA;AACX,KAAC,CACD,CAAA;AACF,GAAA;AACD;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@intelligentgraphics/ig.gfx.packager",
3
- "version": "3.0.1",
4
- "description": "IG.GFX.Packager 3.0.1 (3.0.1.100)",
3
+ "version": "3.0.2",
4
+ "description": "IG.GFX.Packager 3.0.2 (3.0.2.100)",
5
5
  "author": "Michael Beier <mb@intelligentgraphics.biz>",
6
6
  "main": "build/index.mjs",
7
7
  "private": false,
package/readme.md CHANGED
@@ -326,6 +326,10 @@ The ts files have to adhere to a certain form to be processed.
326
326
 
327
327
  ## History
328
328
 
329
+ **IG.GFX.Packager 3.0.2**
330
+
331
+ - handle folders in lib directory
332
+
329
333
  **IG.GFX.Packager 3.0.0**
330
334
 
331
335
  - change packager to be installed globally (see [Migrating to ig.gfx.packager 3.0](#Migrating-to-ig.gfx.packager-3.0))