@24i/smartapps-bigscreen-rnv-build-engine 0.10.3-alpha.1565 → 0.10.3-alpha.1566
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.
|
@@ -30,7 +30,7 @@ describe('generatePngSpriteMap', () => {
|
|
|
30
30
|
},
|
|
31
31
|
buildConfig: {
|
|
32
32
|
common: {
|
|
33
|
-
|
|
33
|
+
pngIconPrefix: 'png-',
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
};
|
|
@@ -50,5 +50,13 @@ describe('generatePngSpriteMap', () => {
|
|
|
50
50
|
await (0, generatePngSpriteMap_1.generatePngSpriteMap)(rnvC);
|
|
51
51
|
expect(fs_1.default.existsSync(path_1.default.resolve(runtimeDir, 'png_icons.css'))).toBeTruthy();
|
|
52
52
|
expect(fs_1.default.existsSync(path_1.default.resolve(platformAssetsDir, 'png_icons.json'))).toBeTruthy();
|
|
53
|
+
const outputJsonPath = path_1.default.resolve(platformAssetsDir, 'png_icons.json');
|
|
54
|
+
expect(fs_1.default.existsSync(outputJsonPath)).toBe(true);
|
|
55
|
+
const outputJsonContent = JSON.parse(fs_1.default.readFileSync(outputJsonPath).toString());
|
|
56
|
+
expect(Object.keys(outputJsonContent)).toStrictEqual([
|
|
57
|
+
'png-icon1',
|
|
58
|
+
'png-icon2',
|
|
59
|
+
'png-icon3',
|
|
60
|
+
]);
|
|
53
61
|
});
|
|
54
62
|
});
|
|
@@ -7,7 +7,7 @@ exports.generatePngSpriteMap = void 0;
|
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const webpack_1 = __importDefault(require("webpack"));
|
|
9
9
|
const webpack_spritesmith_1 = __importDefault(require("webpack-spritesmith"));
|
|
10
|
-
const makeWebpackSpritesmithConfig = (projectDir, appBuildDir) => ({
|
|
10
|
+
const makeWebpackSpritesmithConfig = (projectDir, appBuildDir, iconPrefix) => ({
|
|
11
11
|
entry: {
|
|
12
12
|
polyfill: path_1.default.resolve(projectDir, 'polyfill/index.ts'),
|
|
13
13
|
bundle: path_1.default.resolve(projectDir, 'index.js'),
|
|
@@ -29,7 +29,7 @@ const makeWebpackSpritesmithConfig = (projectDir, appBuildDir) => ({
|
|
|
29
29
|
cssImageRef: 'sprite.png',
|
|
30
30
|
generateSpriteName: (fullPathToSourceFile) => {
|
|
31
31
|
const { name } = path_1.default.parse(fullPathToSourceFile);
|
|
32
|
-
return
|
|
32
|
+
return `${iconPrefix}${name}`;
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
}),
|
|
@@ -50,7 +50,8 @@ const runSpritesmith = (config) => (new Promise((resolve) => {
|
|
|
50
50
|
const generatePngSpriteMap = async (c) => {
|
|
51
51
|
const projectDir = c.paths.project.dir;
|
|
52
52
|
const rnvBuildDirPath = `${c.paths.project.builds.dir}/${c.runtime.appId}_${c.platform}`;
|
|
53
|
-
const
|
|
53
|
+
const iconPrefix = c.buildConfig?.common.pngIconPrefix || '';
|
|
54
|
+
const config = makeWebpackSpritesmithConfig(projectDir, rnvBuildDirPath, iconPrefix);
|
|
54
55
|
await runSpritesmith(config);
|
|
55
56
|
};
|
|
56
57
|
exports.generatePngSpriteMap = generatePngSpriteMap;
|
|
@@ -54,6 +54,7 @@ const generateSvgSpriteMap = (c) => {
|
|
|
54
54
|
cssOutput: '../../platformAssets/runtime/svg_icons.css',
|
|
55
55
|
jsonOutput: '../../platformAssets/svg_icons.json',
|
|
56
56
|
maskList: c.buildConfig?.common.svgIconsMaskList || [],
|
|
57
|
+
iconPrefix: c.buildConfig?.common.svgIconPrefix || '',
|
|
57
58
|
};
|
|
58
59
|
const projectPaths = c.paths.project;
|
|
59
60
|
const iconsPath = path_1.default.join(projectPaths.dir, config.iconsFolder);
|
|
@@ -85,7 +86,7 @@ const generateSvgSpriteMap = (c) => {
|
|
|
85
86
|
.filter((name) => name.endsWith('.svg'))
|
|
86
87
|
.map((fileName) => {
|
|
87
88
|
const maskListIncludesFileName = config.maskList.includes(fileName);
|
|
88
|
-
const spriteName =
|
|
89
|
+
const spriteName = `${config.iconPrefix}${fileName}`
|
|
89
90
|
.replace('.svg', '')
|
|
90
91
|
.replace(' ', '-')
|
|
91
92
|
.toLowerCase();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@24i/smartapps-bigscreen-rnv-build-engine",
|
|
3
|
-
"version": "0.10.3-alpha.
|
|
3
|
+
"version": "0.10.3-alpha.1566+9415bfeb",
|
|
4
4
|
"description": "Package with build engine for SmartApps BIGscreen projects... ",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"keywords": [],
|
|
62
62
|
"author": "24i",
|
|
63
63
|
"license": "ISC",
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "9415bfebfa0fb2ecd1c930d399acae2a862162d7"
|
|
65
65
|
}
|