@24i/smartapps-bigscreen-rnv-build-engine 0.12.2-alpha.1692 → 0.12.2-alpha.1693

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.
@@ -8,6 +8,13 @@ describe('resolveBaseUrl', () => {
8
8
  const bucketName = 'test-bucket';
9
9
  const flavour = 'test_flavour';
10
10
  const packageVersion = '1.0.0';
11
+ const expectEmptyStringOutputForEachPlatformAndSchemeByFlavour = (customFlavour) => {
12
+ Object.values(constants_1.Platforms).forEach((platform) => {
13
+ Object.values(constants_1.BuildSchemes).forEach((scheme) => {
14
+ expect((0, resolveBaseUrl_1.resolveBaseUrl)({ platform, scheme, flavour: customFlavour })).toBe('');
15
+ });
16
+ });
17
+ };
11
18
  afterEach(() => {
12
19
  jest.clearAllMocks();
13
20
  jest.resetAllMocks();
@@ -23,22 +30,14 @@ describe('resolveBaseUrl', () => {
23
30
  },
24
31
  },
25
32
  });
26
- Object.values(constants_1.Platforms).forEach((platform) => {
27
- Object.values(constants_1.BuildSchemes).forEach((scheme) => {
28
- expect((0, resolveBaseUrl_1.resolveBaseUrl)({ platform, scheme, flavour })).toBe('');
29
- });
30
- });
33
+ expectEmptyStringOutputForEachPlatformAndSchemeByFlavour(flavour);
31
34
  });
32
35
  it('returns empty string when c.buildConfig.common.deploy.aws3.bucketName is not set', () => {
33
36
  resolveGenericRnvConfig_1.getBaseConfig.mockReturnValue({
34
37
  runtime: {},
35
38
  buildConfig: { common: { packageVersion } },
36
39
  });
37
- Object.values(constants_1.Platforms).forEach((platform) => {
38
- Object.values(constants_1.BuildSchemes).forEach((scheme) => {
39
- expect((0, resolveBaseUrl_1.resolveBaseUrl)({ platform, scheme, flavour })).toBe('');
40
- });
41
- });
40
+ expectEmptyStringOutputForEachPlatformAndSchemeByFlavour(flavour);
42
41
  });
43
42
  describe('resolving baseUrl for configured schemes', () => {
44
43
  const bucketUrl = `http://${bucketName}.s3.amazonaws.com`;
@@ -52,7 +52,6 @@ describe('replaceTemplateString', () => {
52
52
  expect((0, replaceTemplateString_1.replaceTemplateString)(rnvC, '{{configProps.deploy.notExistingProp}}')).toBe('');
53
53
  });
54
54
  it('returns correct value from rnv c object for pattern on input', () => {
55
- expect((0, replaceTemplateString_1.replaceTemplateString)({ buildConfig: { projectName: 'prj' } }, '{{c.buildConfig.projectName}}')).toBe('prj');
56
55
  expect((0, replaceTemplateString_1.replaceTemplateString)({
57
56
  buildConfig: {
58
57
  projectName: '{{c.buildConfig.common.id}}',
@@ -40,7 +40,10 @@ const generateEngineExtensions = (platformExtensions) => {
40
40
  return output;
41
41
  };
42
42
  exports.default = {
43
- initializeRuntimeConfig: (c) => rnv_1.Config.initializeConfig(c),
43
+ initializeRuntimeConfig: (c) => {
44
+ rnv_1.FileUtils.configureFilesystem(rnv_1.Common.getConfigProp, rnv_1.Resolver.doResolve, rnv_1.Utils.isSystemWin);
45
+ return rnv_1.Config.initializeConfig(c);
46
+ },
44
47
  tasks: rnv_1.EngineManager.generateEngineTasks(engineTasks_1.engineTaskList),
45
48
  config: CNF,
46
49
  projectDirName: 'project',
@@ -44,6 +44,7 @@ const makeTableMarkdownByScheme = (rnvC, scheme) => {
44
44
  const formattedTableData = (0, formatTableDataSpaces_1.formatTableDataSpaces)(tableData);
45
45
  return tableDataToMarkdown(formattedTableData);
46
46
  };
47
+ const deployedEachTimeIntoTheSamePath = '> Deployed each time into the same path.';
47
48
  const makeMarkdownFileContentRows = (rnvC) => ([
48
49
  `# ${rnvC.buildConfig.projectName}`,
49
50
  '## Deploy URLs',
@@ -51,20 +52,20 @@ const makeMarkdownFileContentRows = (rnvC) => ([
51
52
  '---',
52
53
  '### Latest `development` builds',
53
54
  '> Latest builds against the development git branch.',
54
- '> Deployed each time into the same path.',
55
+ deployedEachTimeIntoTheSamePath,
55
56
  '',
56
57
  makeTableMarkdownByScheme(rnvC, constants_1.BuildSchemes.DEV_LATEST),
57
58
  '',
58
59
  '---',
59
60
  '### Latest `release candidate` builds',
60
61
  '> Latest builds against the release candidate git branch.',
61
- '> Deployed each time into the same path.',
62
+ deployedEachTimeIntoTheSamePath,
62
63
  '',
63
64
  makeTableMarkdownByScheme(rnvC, constants_1.BuildSchemes.RC_LATEST),
64
65
  '---',
65
66
  '### Latest `release` builds',
66
67
  '> Latest builds against the release git branch.',
67
- '> Deployed each time into the same path.',
68
+ deployedEachTimeIntoTheSamePath,
68
69
  '',
69
70
  makeTableMarkdownByScheme(rnvC, constants_1.BuildSchemes.RELEASE_LATEST),
70
71
  '---',
@@ -85,7 +85,7 @@ const runTizen = async (c, target) => {
85
85
  else {
86
86
  const isPortActive = await checkPortInUse(c, platform, c.runtime.port);
87
87
  const isDebuggerEnabledForPlatform = REMOTE_DEBUGGER_ENABLED_PLATFORMS.includes(platform);
88
- const isWeinreEnabled = isDebuggerEnabledForPlatform && !bundleAssets && !hosted;
88
+ const isWeinreEnabled = isDebuggerEnabledForPlatform && !hosted;
89
89
  if (!isPortActive) {
90
90
  logInfo(`Your ${chalk().white(platform)} devServer at port ${chalk().white(c.runtime.port)} is not running. Starting it up for you...`);
91
91
  (0, sdk_webpack_1.waitForWebpack)(c)
@@ -57,7 +57,7 @@ const runWebOS = async (c) => {
57
57
  else {
58
58
  const isPortActive = await checkPortInUse(c, platform, c.runtime.port);
59
59
  const isDebuggerEnabledForPlatform = REMOTE_DEBUGGER_ENABLED_PLATFORMS.includes(platform);
60
- const isWeinreEnabled = isDebuggerEnabledForPlatform && !bundleAssets && !hosted;
60
+ const isWeinreEnabled = isDebuggerEnabledForPlatform && !hosted;
61
61
  if (!isPortActive) {
62
62
  logInfo(`Your ${chalk().white(platform)} devServer at port ${chalk().white(c.runtime.port)} is not running. Starting it up for you...`);
63
63
  (0, sdk_webpack_1.waitForWebpack)(c)
@@ -3,17 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.customRnvPackageTask = void 0;
4
4
  const rnv_1 = require("rnv");
5
5
  const constants_1 = require("../constants");
6
- const { getConfigProp } = rnv_1.Common;
7
- const { configureFilesystem } = rnv_1.FileUtils;
8
- const { doResolve } = rnv_1.Resolver;
9
- const { isSystemWin } = rnv_1.Utils;
10
- const { logTask } = rnv_1.Logger;
11
6
  const { TASK_PACKAGE, TASK_CONFIGURE, PARAMS } = rnv_1.Constants;
12
- const { executeOrSkipTask } = rnv_1.TaskManager;
13
7
  const packageFn = async (c, parentTask, originTask) => {
14
- logTask('taskRnvPackage', `parent:${parentTask}`);
15
- configureFilesystem(getConfigProp, doResolve, isSystemWin);
16
- await executeOrSkipTask(c, TASK_CONFIGURE, TASK_PACKAGE, originTask);
8
+ rnv_1.Logger.logTask('taskRnvPackage', `parent:${parentTask}`);
9
+ await rnv_1.TaskManager.executeOrSkipTask(c, TASK_CONFIGURE, TASK_PACKAGE, originTask);
17
10
  return true;
18
11
  };
19
12
  const customRnvPackageTask = {
@@ -42,12 +42,23 @@ const patchEngineTemplatesPath = (c) => {
42
42
  engine.originalTemplatePlatformProjectDir = path.join(templatesPath, 'platforms', 'project');
43
43
  c.paths.project.platformTemplatesDirs[c.platform] = engine.originalTemplatePlatformsDir;
44
44
  };
45
+ const handleReset = async (c) => {
46
+ if (c.program.resetHard) {
47
+ logInfo(`You passed ${chalk().white('-R, --resetHard')} argument. "${chalk().white('./platformAssets')}" will be cleaned up first`);
48
+ await cleanPlaformAssets(c);
49
+ }
50
+ else if (c.program.resetAssets) {
51
+ logInfo(`You passed ${chalk().white('-a, --resetAssets')} argument. "${chalk().white('./platformAssets')}" will be cleaned up first`);
52
+ await cleanPlaformAssets(c);
53
+ }
54
+ };
45
55
  const projectConfigureFn = async (c, parentTask, originTask) => {
46
56
  logTask('taskRnvProjectConfigure');
47
57
  patchEngineTemplatesPath(c);
48
- if (c.paths.project.builds.dir && !fsExistsSync(c.paths.project.builds.dir)) {
49
- logInfo(`Creating folder ${c.paths.project.builds.dir} ...DONE`);
50
- fsMkdirSync(c.paths.project.builds.dir);
58
+ const buildsDirPath = c.paths.project.builds.dir;
59
+ if (buildsDirPath && !fsExistsSync(buildsDirPath)) {
60
+ logInfo(`Creating folder ${buildsDirPath} ...DONE`);
61
+ fsMkdirSync(buildsDirPath);
51
62
  }
52
63
  await updateRenativeConfigs(c);
53
64
  await checkIsRenativeProject(c);
@@ -80,14 +91,7 @@ const projectConfigureFn = async (c, parentTask, originTask) => {
80
91
  await configurePlugins(c);
81
92
  await configureRuntimeDefaults(c);
82
93
  if (!c.runtime.disableReset) {
83
- if (c.program.resetHard) {
84
- logInfo(`You passed ${chalk().white('-R, --resetHard')} argument. "${chalk().white('./platformAssets')}" will be cleaned up first`);
85
- await cleanPlaformAssets(c);
86
- }
87
- else if (c.program.resetAssets) {
88
- logInfo(`You passed ${chalk().white('-a, --resetAssets')} argument. "${chalk().white('./platformAssets')}" will be cleaned up first`);
89
- await cleanPlaformAssets(c);
90
- }
94
+ await handleReset(c);
91
95
  }
92
96
  await copyRuntimeAssets(c);
93
97
  await configureTemplateFiles(c);
@@ -43,79 +43,63 @@ const getAppContentPath = (baseUrl, isBuildHosted = false) => {
43
43
  ? `${baseUrl}/${relativePath}`
44
44
  : `./${relativePath}`;
45
45
  };
46
- function generateConfig(config) {
47
- const projectDir = path_1.default.resolve(config.currentDir, '../../');
48
- const platformBuildsDir = path_1.default.resolve(config.currentDir, '../');
49
- const appBuildDir = path_1.default.resolve(config.currentDir);
50
- const appBuildEngineProjectDir = path_1.default.resolve(config.currentDir, config.buildFolder);
51
- const appBuildEngineProjectPublicDir = path_1.default.resolve(appBuildEngineProjectDir, 'public');
52
- const platformSchemeAppIdObj = {
53
- platform: config.platform,
54
- scheme: config.scheme,
55
- flavour: config.appConfigId,
56
- };
57
- const buildVersion = smartapps_bigscreen_rnv_build_engine_1.Resolvers.resolveBuildVersion(platformSchemeAppIdObj);
58
- const baseUrl = smartapps_bigscreen_rnv_build_engine_1.Resolvers.resolveBaseUrl(platformSchemeAppIdObj);
59
- const devServerHost = config.devServerHost || '0.0.0.0';
60
- const isDevServer = appBuildEngineProjectDir.endsWith('/server');
61
- const { PLATFORM } = process.env;
62
- const isBuildHosted = config.isBuildHosted || false;
63
- const rules = {
64
- babel: {
65
- test: /\.[tj]sx?$/,
66
- exclude: (config.typescript?.exclude ?? []).map((exclusion) => (path_1.default.resolve(projectDir, exclusion))),
67
- use: [
68
- {
69
- loader: 'ts-loader',
70
- options: {
71
- transpileOnly: true,
72
- allowTsInNodeModules: true,
73
- },
74
- },
75
- ],
76
- },
77
- css: {
78
- test: /\.s?css$/,
79
- use: [
80
- isDevServer ? 'css-hot-loader' : null,
81
- mini_css_extract_plugin_1.default.loader,
82
- 'css-loader',
83
- {
84
- loader: 'sass-loader',
85
- options: {
86
- sourceMap: false,
87
- additionalData: (0, extendSass_1.extendSass)(config),
88
- },
89
- },
90
- ].filter(Boolean),
91
- },
92
- image: {
93
- test: /\.(gif|jpe?g|png|svg)$/,
94
- use: {
95
- loader: 'file-loader',
46
+ const makeRules = (config, projectDir, isDevServer) => ({
47
+ babel: {
48
+ test: /\.[tj]sx?$/,
49
+ exclude: (config.typescript?.exclude ?? []).map((exclusion) => (path_1.default.resolve(projectDir, exclusion))),
50
+ use: [
51
+ {
52
+ loader: 'ts-loader',
96
53
  options: {
97
- outputPath: 'content/assets/',
98
- publicPath: '../assets/',
54
+ transpileOnly: true,
55
+ allowTsInNodeModules: true,
99
56
  },
100
57
  },
101
- },
102
- fonts: {
103
- test: /\.(woff|woff2|eot|ttf|otf)(\?[\s\S]+)?$/,
104
- use: {
105
- loader: 'file-loader',
58
+ ],
59
+ },
60
+ css: {
61
+ test: /\.s?css$/,
62
+ use: [
63
+ isDevServer ? 'css-hot-loader' : null,
64
+ mini_css_extract_plugin_1.default.loader,
65
+ 'css-loader',
66
+ {
67
+ loader: 'sass-loader',
106
68
  options: {
107
- outputPath: 'content/fonts',
108
- publicPath: '../fonts/',
69
+ sourceMap: false,
70
+ additionalData: (0, extendSass_1.extendSass)(config),
109
71
  },
110
72
  },
73
+ ].filter(Boolean),
74
+ },
75
+ image: {
76
+ test: /\.(gif|jpe?g|png|svg)$/,
77
+ use: {
78
+ loader: 'file-loader',
79
+ options: {
80
+ outputPath: 'content/assets/',
81
+ publicPath: '../assets/',
82
+ },
111
83
  },
112
- sourcemap: {
113
- test: /\.[tj]sx$/,
114
- use: ['source-map-loader'],
115
- enforce: 'pre',
116
- exclude: [/node_modules/, /build/, /__test__/, /__tests__/],
84
+ },
85
+ fonts: {
86
+ test: /\.(woff|woff2|eot|ttf|otf)(\?[\s\S]+)?$/,
87
+ use: {
88
+ loader: 'file-loader',
89
+ options: {
90
+ outputPath: 'content/fonts',
91
+ publicPath: '../fonts/',
92
+ },
117
93
  },
118
- };
94
+ },
95
+ sourcemap: {
96
+ test: /\.[tj]sx$/,
97
+ use: ['source-map-loader'],
98
+ enforce: 'pre',
99
+ exclude: [/node_modules/, /build/, /__test__/, /__tests__/],
100
+ },
101
+ });
102
+ const makeAliases = (config, projectDir) => {
119
103
  const aliases = {
120
104
  '@24i/smartapps-bigscreen-device': config.environment === 'production'
121
105
  ? '@24i/smartapps-bigscreen-device'
@@ -132,6 +116,25 @@ function generateConfig(config) {
132
116
  }
133
117
  });
134
118
  }
119
+ return aliases;
120
+ };
121
+ function generateConfig(config) {
122
+ const projectDir = path_1.default.resolve(config.currentDir, '../../');
123
+ const platformBuildsDir = path_1.default.resolve(config.currentDir, '../');
124
+ const appBuildDir = path_1.default.resolve(config.currentDir);
125
+ const appBuildEngineProjectDir = path_1.default.resolve(config.currentDir, config.buildFolder);
126
+ const appBuildEngineProjectPublicDir = path_1.default.resolve(appBuildEngineProjectDir, 'public');
127
+ const platformSchemeAppIdObj = {
128
+ platform: config.platform,
129
+ scheme: config.scheme,
130
+ flavour: config.appConfigId,
131
+ };
132
+ const buildVersion = smartapps_bigscreen_rnv_build_engine_1.Resolvers.resolveBuildVersion(platformSchemeAppIdObj);
133
+ const baseUrl = smartapps_bigscreen_rnv_build_engine_1.Resolvers.resolveBaseUrl(platformSchemeAppIdObj);
134
+ const devServerHost = config.devServerHost || '0.0.0.0';
135
+ const isDevServer = appBuildEngineProjectDir.endsWith('/server');
136
+ const { PLATFORM } = process.env;
137
+ const isBuildHosted = config.isBuildHosted || false;
135
138
  const appContentPath = getAppContentPath(baseUrl, isBuildHosted);
136
139
  const copiedDirWithPublicContentPath = path_1.default.join(appBuildDir, `../${path_1.default.parse(appBuildDir).name}-public`);
137
140
  const plugins = {
@@ -203,30 +206,24 @@ function generateConfig(config) {
203
206
  },
204
207
  }),
205
208
  };
206
- const extensions = [
207
- ...generateFlavourJSExtensions(config),
208
- ...generateFlavourSCSSExtensions(config),
209
- ];
210
- const output = {
211
- filename: 'content/js/[name].js',
212
- publicPath: isBuildHosted ? `${baseUrl}/public` : '',
213
- path: appBuildEngineProjectPublicDir,
214
- };
215
- const devServer = {
216
- host: devServerHost,
217
- };
218
- const entry = {
219
- polyfill: path_1.default.resolve(projectDir, 'polyfill/index.ts'),
220
- bundle: path_1.default.resolve(projectDir, `${config.entryFile}.js`),
221
- };
222
209
  return {
223
- Rules: rules,
210
+ Rules: makeRules(config, projectDir, isDevServer),
211
+ extensions: [
212
+ ...generateFlavourJSExtensions(config),
213
+ ...generateFlavourSCSSExtensions(config),
214
+ ],
215
+ aliases: makeAliases(config, projectDir),
216
+ entry: {
217
+ polyfill: path_1.default.resolve(projectDir, 'polyfill/index.ts'),
218
+ bundle: path_1.default.resolve(projectDir, `${config.entryFile}.js`),
219
+ },
220
+ devServer: { host: devServerHost },
221
+ output: {
222
+ filename: 'content/js/[name].js',
223
+ publicPath: isBuildHosted ? `${baseUrl}/public` : '',
224
+ path: appBuildEngineProjectPublicDir,
225
+ },
224
226
  Plugins: plugins,
225
- extensions,
226
- aliases,
227
- entry,
228
- devServer,
229
- output,
230
227
  projectDir,
231
228
  platformBuildsDir,
232
229
  appBuildDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/smartapps-bigscreen-rnv-build-engine",
3
- "version": "0.12.2-alpha.1692+d30ad4aa",
3
+ "version": "0.12.2-alpha.1693+5ba1dfd9",
4
4
  "description": "Package with build engine for SmartApps BIGscreen projects...",
5
5
  "main": "dist/src/index.js",
6
6
  "scripts": {
@@ -63,5 +63,5 @@
63
63
  "keywords": [],
64
64
  "author": "24i",
65
65
  "license": "ISC",
66
- "gitHead": "d30ad4aa4a434b1919281d3926f50ef975cc57ba"
66
+ "gitHead": "5ba1dfd9109aedea738e0cef5af65edfcacc5689"
67
67
  }