@atb-as/generate-assets 4.0.0-alpha.3 → 4.0.0-alpha.4
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.
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ThemeVariant } from '@atb-as/theme/lib/';
|
|
2
|
+
import { AssetTypes } from './utils';
|
|
3
|
+
export declare const vaildOrgIds: ThemeVariant[];
|
|
4
|
+
export declare const searchGlob = "**/*.{svg,png,jpg,jpeg,ico}";
|
|
5
|
+
declare type Options = {
|
|
6
|
+
patterns?: string | readonly string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function listAssets(orgId: ThemeVariant, assetType?: AssetTypes, opts?: Options): Promise<Promise<string>[]>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.listAssets = exports.searchGlob = exports.vaildOrgIds = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const lib_1 = require("@atb-as/theme/lib/");
|
|
9
|
+
const micromatch_1 = __importDefault(require("micromatch"));
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
exports.vaildOrgIds = [lib_1.ThemeVariant.AtB, lib_1.ThemeVariant.Nfk];
|
|
12
|
+
exports.searchGlob = '**/*.{svg,png,jpg,jpeg,ico}';
|
|
13
|
+
const defaultOpts = {};
|
|
14
|
+
async function listAssets(orgId, assetType = 'all', opts = defaultOpts) {
|
|
15
|
+
const assetDir = assetType == 'all' ? '{colors,mono}' : assetType;
|
|
16
|
+
const fromBase = (...p) => {
|
|
17
|
+
const fullPath = path_1.default.join(__dirname, '..', 'files', ...p, assetDir, exports.searchGlob);
|
|
18
|
+
console.log(fullPath);
|
|
19
|
+
return (0, utils_1.fgNormalizedForUnix)(fullPath);
|
|
20
|
+
};
|
|
21
|
+
if (!exports.vaildOrgIds.includes(orgId))
|
|
22
|
+
throw new Error(`Invalid orgId provided, valid orgIds are ${exports.vaildOrgIds}`);
|
|
23
|
+
// File paths are returned as UNIX type separators.
|
|
24
|
+
const commonFiles = await fromBase('common');
|
|
25
|
+
const orgFiles = await fromBase((0, utils_1.themeVariantAsString)(orgId));
|
|
26
|
+
const allFilesToBeCopied = (0, utils_1.mergeFiles)(assetType, commonFiles, orgFiles);
|
|
27
|
+
const potentiallyFiltered = opts.patterns
|
|
28
|
+
? (0, micromatch_1.default)(allFilesToBeCopied, opts.patterns)
|
|
29
|
+
: allFilesToBeCopied;
|
|
30
|
+
let allFiles = potentiallyFiltered.map(async (absolutePath) => {
|
|
31
|
+
return path_1.default.normalize((0, utils_1.getGeneralNameWithoutFullPath)(assetType, absolutePath));
|
|
32
|
+
});
|
|
33
|
+
return allFiles;
|
|
34
|
+
}
|
|
35
|
+
exports.listAssets = listAssets;
|
|
36
|
+
//# sourceMappingURL=list-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-files.js","sourceRoot":"","sources":["../src/list-files.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,4CAAgD;AAEhD,4DAAoC;AAEpC,mCAMiB;AAEJ,QAAA,WAAW,GAAG,CAAC,kBAAY,CAAC,GAAG,EAAE,kBAAY,CAAC,GAAG,CAAC,CAAC;AACnD,QAAA,UAAU,GAAG,6BAA6B,CAAC;AAKxD,MAAM,WAAW,GAAY,EAAE,CAAC;AAEzB,KAAK,UAAU,UAAU,CAC9B,KAAmB,EACnB,YAAwB,KAAK,EAC7B,OAAgB,WAAW;IAE3B,MAAM,QAAQ,GAAG,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC;IAClE,MAAM,QAAQ,GAAG,CAAC,G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": false,
|
|
5
5
|
"description": "OOS Design System generate-assets",
|
|
6
6
|
"license": "EUPL-1.2",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"normalize-path": "^3.0.0",
|
|
35
35
|
"stream-editor": "^1.11.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "748ffc29ca0e15d7271cf3cfd30d29d7f2f38851"
|
|
38
38
|
}
|