@lightningjs/blits 0.6.9 → 0.6.10

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/bin/helpers.js +220 -0
  3. package/bin/index.js +141 -0
  4. package/boilerplate/common/eslint/husky/pre-commit +2 -0
  5. package/boilerplate/common/eslint/package.json +20 -0
  6. package/boilerplate/common/ide/.vscode/settings.json +10 -0
  7. package/boilerplate/js/default/.gitattributes +3 -0
  8. package/boilerplate/{package.json → js/default/package.json} +3 -3
  9. package/docs/getting_started.md +7 -7
  10. package/package.json +13 -5
  11. package/public/assets/fps_sprite.base64.js +1 -0
  12. package/public/assets/fps_sprite.png +0 -0
  13. package/scripts/postpublish.js +59 -0
  14. package/scripts/prepublishOnly.js +84 -0
  15. package/src/components/Circle.js +32 -3
  16. package/src/components/Circle.orig.js +31 -0
  17. package/src/components/FPScounter.js +1127 -0
  18. package/src/components/FPScounter.orig.js +122 -0
  19. package/src/components/Image.js +23 -2
  20. package/src/components/Image.orig.js +33 -0
  21. package/src/components/RouterView.js +22 -3
  22. package/src/components/RouterView.orig.js +51 -0
  23. package/src/components/Sprite.js +26 -3
  24. package/src/components/Sprite.orig.js +58 -0
  25. package/src/components/Text.js +56 -20
  26. package/src/components/Text.orig.js +79 -0
  27. package/src/launch.d.ts +10 -1
  28. package/src/launch.js +1 -0
  29. package/src/lib/precompiler/precompiler.js +64 -0
  30. package/src/lib/setup/base.js +2 -0
  31. package/vite/index.js +17 -0
  32. package/vite/preCompiler.js +19 -39
  33. package/bin/index.cjs +0 -25
  34. package/boilerplate/.vscode/settings.json +0 -10
  35. /package/boilerplate/{.editorconfig → common/eslint/.editorconfig} +0 -0
  36. /package/boilerplate/{.eslintignore → common/eslint/.eslintignore} +0 -0
  37. /package/boilerplate/{.eslintrc.cjs → common/eslint/.eslintrc.cjs} +0 -0
  38. /package/boilerplate/{.vscode → common/ide/.vscode}/extensions.json +0 -0
  39. /package/boilerplate/{.vscode → common/ide/.vscode}/launch.json +0 -0
  40. /package/boilerplate/{public → common/public}/assets/logo.png +0 -0
  41. /package/boilerplate/{public → common/public}/fonts/Lato-Regular.msdf.json +0 -0
  42. /package/boilerplate/{public → common/public}/fonts/Lato-Regular.msdf.png +0 -0
  43. /package/boilerplate/{public → common/public}/fonts/OpenSans-Medium.ttf +0 -0
  44. /package/boilerplate/{public → common/public}/fonts/Raleway-ExtraBold.msdf.json +0 -0
  45. /package/boilerplate/{public → common/public}/fonts/Raleway-ExtraBold.msdf.png +0 -0
  46. /package/boilerplate/{index.html → js/default/index.html} +0 -0
  47. /package/boilerplate/{src → js/default/src}/App.js +0 -0
  48. /package/boilerplate/{src → js/default/src}/components/Loader.js +0 -0
  49. /package/boilerplate/{src → js/default/src}/fontloader.js +0 -0
  50. /package/boilerplate/{src → js/default/src}/index.js +0 -0
  51. /package/boilerplate/{src → js/default/src}/pages/Home.js +0 -0
  52. /package/boilerplate/{src → js/default/src}/renderer.js +0 -0
  53. /package/boilerplate/{vite.config.js → js/default/vite.config.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ # v0.6.10
4
+
5
+ _2 feb 2024_
6
+
7
+ - Added FPS counter from Example App as a built-in Blits component (available as `<FPScounter />`)
8
+ - Added precompilation to all built-in Blits components for increased performance
9
+ - Updated flow to create a new App project with an interactive prompt of questions (`npx @lightningjs/blits@latest`)
10
+ - Upgraded to latest version of the Lightning 3 renderer (0.7.1)
11
+
3
12
  # v0.6.9
4
13
 
5
14
  _31 jan 2024_
package/bin/helpers.js ADDED
@@ -0,0 +1,220 @@
1
+ import { green, bold, red } from 'kolorist'
2
+ import path from 'path'
3
+ import { execa } from 'execa'
4
+ import fs from 'fs'
5
+ import replaceInFile from 'replace-in-file'
6
+ import ora from 'ora'
7
+ const spinner = ora()
8
+
9
+ /**
10
+ * This function copies Lightning fixtures to the target directory for creating a L3 application.
11
+ */
12
+
13
+ export const copyLightningFixtures = (config) => {
14
+ return new Promise((resolve) => {
15
+ const targetDir = config.appFolder || ''
16
+ if (config.appFolder && fs.existsSync(targetDir)) {
17
+ exit(red(bold('The target directory ' + targetDir + ' already exists')))
18
+ }
19
+ //this will be removed once ts support is added
20
+ fs.cpSync(path.join(path.join(config.fixturesBase, 'js'), 'default'), targetDir, {
21
+ recursive: true,
22
+ })
23
+ fs.cpSync(path.join(config.fixturesBase, 'common/public'), path.join(targetDir, 'public'), {
24
+ recursive: true,
25
+ })
26
+
27
+ resolve(targetDir)
28
+ })
29
+ }
30
+
31
+ /**
32
+ * This function adds eslint related configuration to the project folder to be created
33
+ * @param config
34
+ * @returns {boolean}
35
+ */
36
+ export const addESlint = (config) => {
37
+ // Make husky dir
38
+ fs.mkdirSync(path.join(config.targetDir, '.husky'), { recursive: true })
39
+
40
+ // Copy husky hook
41
+ fs.copyFileSync(
42
+ path.join(config.fixturesBase, 'common/eslint/husky/pre-commit'),
43
+ path.join(config.targetDir, '.husky/pre-commit')
44
+ )
45
+
46
+ // Copy editor config from common
47
+ fs.copyFileSync(
48
+ path.join(config.fixturesBase, 'common/eslint/.editorconfig'),
49
+ path.join(config.targetDir, '.editorconfig')
50
+ )
51
+
52
+ // Copy eslintignore from common
53
+ fs.copyFileSync(
54
+ path.join(config.fixturesBase, 'common/eslint/.eslintignore'),
55
+ path.join(config.targetDir, '.eslintignore')
56
+ )
57
+
58
+ // Copy eslintrc.js from fixtured specfic directory
59
+ fs.copyFileSync(
60
+ path.join(config.fixturesBase, 'common/eslint/.eslintrc.cjs'),
61
+ path.join(config.targetDir, '.eslintrc.cjs')
62
+ )
63
+
64
+ // Copy IDE stuff from fixture base
65
+ fs.cpSync(path.join(config.fixturesBase, 'common/ide'), path.join(config.targetDir), {
66
+ recursive: true,
67
+ })
68
+
69
+ // Copy and merge fixture specific package.json
70
+ const origPackageJson = JSON.parse(fs.readFileSync(path.join(config.targetDir, 'package.json')))
71
+ const eslintPackageJson = JSON.parse(
72
+ fs.readFileSync(path.join(config.fixturesBase, 'common/eslint/package.json'))
73
+ )
74
+ fs.writeFileSync(
75
+ path.join(config.targetDir, 'package.json'),
76
+ JSON.stringify(
77
+ {
78
+ ...origPackageJson,
79
+ ...eslintPackageJson,
80
+ devDependencies: {
81
+ ...(origPackageJson.devDependencies || {}),
82
+ ...(eslintPackageJson.devDependencies || {}),
83
+ },
84
+ },
85
+ null,
86
+ 2
87
+ )
88
+ )
89
+
90
+ return true
91
+ }
92
+
93
+ /**
94
+ * This function sets the version by fetching the latest blits version
95
+ * @param config
96
+ * @returns {Promise<unknown>}
97
+ */
98
+ export const setBlitsVersion = (config) => {
99
+ return new Promise((resolve, reject) => {
100
+ execa('npm', ['view', '@lightningjs/blits', 'version'])
101
+ .then(({ stdout }) => {
102
+ replaceInFile.sync({
103
+ files: config.targetDir + '/*',
104
+ from: /\{\$blitsVersion\}/g,
105
+ to: '^' + stdout,
106
+ })
107
+ resolve()
108
+ })
109
+ .catch((e) => {
110
+ spinnerMsg.fail(`Error occurred while setting blits version\n\n${e}`)
111
+ reject()
112
+ })
113
+ })
114
+ }
115
+
116
+ /**
117
+ * Display a message and start a spinner with the specified message.
118
+ *
119
+ * @param {string} msg - The message to display while starting the spinner.
120
+ */
121
+ export const spinnerMsg = {
122
+ start(msg) {
123
+ console.log(' ')
124
+ spinner.start(msg)
125
+ },
126
+ stop() {
127
+ spinner.stop()
128
+ },
129
+ succeed(msg) {
130
+ spinner.succeed(msg)
131
+ },
132
+ fail(msg) {
133
+ spinner.fail(msg)
134
+ console.log(' ')
135
+ },
136
+ warn(msg) {
137
+ spinner.warn(msg)
138
+ },
139
+ }
140
+
141
+ /**
142
+ * This function replaces placeholders like '{$appName}' and '{$appPackage}' in files within the target directory
143
+ * with the actual values from the configuration object.
144
+ *
145
+ * @param {Object} config - The configuration object containing application data.
146
+ */
147
+ export const setAppData = (config) => {
148
+ replaceInFile.sync({
149
+ files: config.targetDir + '/*',
150
+ from: /\{\$appPackage\}/g,
151
+ to: config.appPackage,
152
+ })
153
+
154
+ replaceInFile.sync({
155
+ files: config.targetDir + '/*',
156
+ from: /\{\$appName\}/g,
157
+ to: config.appName,
158
+ })
159
+ }
160
+
161
+ /**
162
+ * Display an error message and exit the program with an error status.
163
+ *
164
+ * @param {string} msg - The error message to display before exiting the program.
165
+ */
166
+ export const exit = (msg) => {
167
+ spinnerMsg.fail(msg)
168
+ process.exit()
169
+ }
170
+
171
+ /**
172
+ * Initialize an empty Git repository in the specified directory and copy a .gitignore file.
173
+ *
174
+ * @param {string} cwd - The current working directory where the Git repository will be created.
175
+ * @param {string} fixturesBase - The base directory for fixtures.
176
+ * @returns {Promise} A Promise that resolves when the Git initialization and file copying are completed successfully
177
+ */
178
+ export const gitInit = (cwd, fixturesBase) => {
179
+ spinnerMsg.start('Initializing empty GIT repository')
180
+ let msg
181
+ return execa('git', ['init'], { cwd })
182
+ .then(({ stdout }) => (msg = stdout))
183
+ .then(() => {
184
+ return fs.copyFileSync(
185
+ path.join(fixturesBase, 'common/git/.gitignore'),
186
+ path.join(cwd, '.gitignore')
187
+ )
188
+ })
189
+ .then(() => spinnerMsg.succeed(msg))
190
+ .catch((e) => spinnerMsg.fail(`Error occurred while creating git repository\n\n${e}`))
191
+ }
192
+
193
+ /**
194
+ * Checks whether the give path is valid
195
+ * @param path
196
+ * @returns {boolean}
197
+ */
198
+ export const isValidPath = (path) => {
199
+ try {
200
+ // Check if the path exists
201
+ fs.accessSync(path, fs.constants.F_OK)
202
+ return true
203
+ } catch (err) {
204
+ // The path does not exist or is not accessible
205
+ return false
206
+ }
207
+ }
208
+
209
+ export const done = (config) => {
210
+ console.log('')
211
+ console.log('--------------------------------------------------------------------')
212
+ console.log(' Your new boilerplate Lightning 3 App has been created! ⚡️')
213
+ console.log('--------------------------------------------------------------------')
214
+ console.log('')
215
+ console.log('Follow the steps below to get started:')
216
+ console.log('')
217
+ console.log(` ${green(bold(`cd ${config.appFolder}`))}`)
218
+ console.log(` ${green(bold('npm install'))}`)
219
+ console.log(` ${green(bold('npm run dev'))}`)
220
+ }
package/bin/index.js ADDED
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env node
2
+ import path from 'path'
3
+ import process from 'process'
4
+ import { dirname } from 'path'
5
+ import prompts from 'prompts'
6
+ import { fileURLToPath } from 'url'
7
+ import fs from 'fs'
8
+ import { red, bold } from 'kolorist'
9
+ import sequence from '../src/helpers/sequence.js'
10
+ import validatePackage from 'validate-npm-package-name'
11
+ import {
12
+ addESlint,
13
+ copyLightningFixtures,
14
+ setAppData,
15
+ setBlitsVersion,
16
+ gitInit,
17
+ done, spinnerMsg
18
+ } from './helpers.js'
19
+
20
+ const defaultBanner = `
21
+ --------------------------------------------------------------------
22
+ Welcome to Blits - The App development framework for Lightning 3 ⚡️
23
+ --------------------------------------------------------------------
24
+
25
+ Answer the questions below to set up a new Lightning 3 Blits App
26
+ `
27
+
28
+ console.log(defaultBanner)
29
+
30
+ const __filename = fileURLToPath(import.meta.url)
31
+ const __dirname = dirname(__filename)
32
+
33
+ const fixturesBase = path.join(
34
+ __dirname,
35
+ '../boilerplate')
36
+
37
+ const questions = [
38
+ {
39
+ type: 'text',
40
+ name: 'appName',
41
+ message: 'What is the name of your App?',
42
+ format: val => {
43
+ // Check if the provided application name is empty
44
+ if (!val.trim()) {
45
+ spinnerMsg.fail(red(bold("Please provide a name for the App")))
46
+ return process.exit(1)
47
+ } else {
48
+ return val
49
+ }
50
+ },
51
+ initial: 'My Blits App', // Default value for the application name
52
+ },
53
+ {
54
+ type: 'text',
55
+ name: 'appPackage',
56
+ message: 'What is the package name of your App?',
57
+ format: val => {
58
+ // Validate the package name using validate-npm-package-name
59
+ if (!validatePackage(val).validForNewPackages) {
60
+ spinnerMsg.fail(red(bold("Please provide a valid package name")))
61
+ return process.exit(1)
62
+ } else {
63
+ return val
64
+ }
65
+ },
66
+ initial: prev => `${prev.replace(/[\sA-Z]/g, str => str === ' ' ? '-' : str.toLowerCase())}`,
67
+ },
68
+ {
69
+ type: 'text',
70
+ name: 'appFolder',
71
+ message: 'In what folder (relative to the current location) should the App be generated?',
72
+ format: (val, prev) => {
73
+ // Regular expression to validate whether the path is Unix/Windows-based
74
+ const pathRegex = /([A-Za-z]:)?([\\/]+\w+)+/
75
+ // Check if the provided path matches the defined regex
76
+ if (pathRegex.test(val)) {
77
+ try {
78
+ // Check if the path exists
79
+ if (fs.statSync(val)) {
80
+ // Return the resolved file path using path.join
81
+ return `${path.join(val, prev.appPackage)}`
82
+ }
83
+ } catch (e) {
84
+ // Handle case where an error occurred during file system interaction
85
+ if (e.code === 'ENOENT') {
86
+ spinnerMsg.fail(red(bold("Entered directory path is invalid, please enter a valid directory!")))
87
+ process.exit()
88
+ }
89
+ }
90
+ } else if (val === prev.appPackage) {
91
+ return path.join(process.cwd(), prev.appPackage)
92
+ }
93
+ },
94
+ initial: (prev, val) => val.appPackage,
95
+ },
96
+ {
97
+ type: 'toggle',
98
+ name: 'esLint',
99
+ message: 'Do you want to enable eslint?',
100
+ initial: 'true',
101
+ active: 'Yes',
102
+ inactive: 'No',
103
+ },
104
+ {
105
+ type: 'toggle',
106
+ name: 'gitInit',
107
+ message: 'Do you want to generate an git repository?',
108
+ initial: 'true',
109
+ active: 'Yes',
110
+ inactive: 'No',
111
+ },
112
+ ]
113
+
114
+
115
+ const createApp = () => {
116
+ return new Promise(resolve => {
117
+ let config
118
+ sequence([
119
+ async () => {
120
+ const onCancel = () => {
121
+ process.exit()
122
+ }
123
+ config = await prompts(questions, { onCancel })
124
+ config.fixturesBase = fixturesBase
125
+ return config
126
+ },
127
+ () => {
128
+ spinnerMsg.start(`Generating new App "${config.appName}" ...`)
129
+ copyLightningFixtures(config).then(targetDir => (config.targetDir = targetDir))
130
+ spinnerMsg.succeed()
131
+ },
132
+ () => setAppData(config),
133
+ () => setBlitsVersion(config),
134
+ () => config.esLint && addESlint(config),
135
+ () => config.gitInit && gitInit(config.targetDir, config.fixturesBase),
136
+ () => done(config)
137
+ ])
138
+ })
139
+ }
140
+
141
+ createApp()
@@ -0,0 +1,2 @@
1
+ #!/bin/bash
2
+ npx lint-staged
@@ -0,0 +1,20 @@
1
+ {
2
+ "lint-staged": {
3
+ "*.js": [
4
+ "eslint --fix"
5
+ ]
6
+ },
7
+ "husky": {
8
+ "hooks": {
9
+ "pre-commit": "lint-staged"
10
+ }
11
+ },
12
+ "devDependencies": {
13
+ "eslint": "^8.8.0",
14
+ "eslint-config-prettier": "^8.3.0",
15
+ "eslint-plugin-prettier": "^4.0.0",
16
+ "husky": "^7.0.4",
17
+ "lint-staged": "^12.3.3",
18
+ "prettier": "^2.5.1"
19
+ }
20
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "editor.formatOnSave": false,
3
+ "eslint.validate": [
4
+ "javascript"
5
+ ],
6
+ "editor.codeActionsOnSave": {
7
+ "source.fixAll.eslint": true
8
+ },
9
+ "js/ts.implicitProjectConfig.checkJs": true
10
+ }
@@ -0,0 +1,3 @@
1
+ *.js text eol=lf
2
+ *.cjs text eol=lf
3
+ *.jsx text eol=lf
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "l3-app",
2
+ "name": "{$appPackage}",
3
3
  "version": "0.1.0",
4
- "description": "Lightning 3 App",
4
+ "description": "{$appName}",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
@@ -31,6 +31,6 @@
31
31
  "vite": "^4.0.4"
32
32
  },
33
33
  "dependencies": {
34
- "@lightningjs/blits": "^0.6.9"
34
+ "@lightningjs/blits": "{$blitsVersion}"
35
35
  }
36
36
  }
@@ -8,24 +8,24 @@ To begin with Blits, follow these simple steps to set up your development enviro
8
8
 
9
9
  1. Open your terminal or command prompt.
10
10
 
11
- 2. Run the following command to create a new Lightning 3 App project:
11
+ 2. Run the following command to start a new Blits Lightning 3 App project:
12
12
 
13
13
  ```bash
14
- npx @lightningjs/blits@latest my_lightning3_app
14
+ npx @lightningjs/blits@latest
15
15
  ```
16
16
 
17
- This will generate the necessary boilerplate code in the folder `my_lightning3_app` for you to start building your own Lightning 3 App.
17
+ You will be guide through a few short questions, to generate a new project with all the boilerplate code you need to start building your own Lightning 3 App.
18
18
 
19
19
  3. Navigate to the newly created project directory and install the project dependencies:
20
20
 
21
21
  ```bash
22
- cd my_lightning3_app
22
+ cd my_blits_app
23
23
  npm install
24
24
  ```
25
25
 
26
26
  ### Running Your App
27
27
 
28
- 1. After installing the dependencies, you can start your development server by running:
28
+ 4. After installing the dependencies, you can start your development server by running:
29
29
 
30
30
  ```bash
31
31
  npm run dev
@@ -33,8 +33,8 @@ npm run dev
33
33
 
34
34
  This command will create an application bundle and launch a development server using Vite.
35
35
 
36
- 2. Once the server is up and running, open your web browser and navigate to the URL displayed in the console. Congratulations! You now have your brand new Lightning 3 App up and running.
36
+ 2. Once the server is up and running, open your web browser and navigate to the URL displayed in the console. Congratulations! You now have your brand new Blits Lightning 3 App up and running.
37
37
 
38
38
  ### Next steps
39
39
 
40
- You are now ready to dive into the world of TV app development using Blits. In the following sections, we will explore the core concepts and guide you through building your TV applications step by step.
40
+ You are now ready to dive into the world of App development using Blits. In the following sections, we will explore the core concepts and guide you through building your TV applications step by step.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "0.6.9",
3
+ "version": "0.6.10",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
- "bin": "bin/index.cjs",
5
+ "bin": "bin/index.js",
6
6
  "exports": {
7
7
  ".": "./index.js",
8
8
  "./vite": "./vite/index.js",
@@ -13,7 +13,9 @@
13
13
  "test": "c8 npm run test:run",
14
14
  "test:run": "tape '{,!(node_modules)/**/}*.test.js' | tap-diff",
15
15
  "lint": "eslint '**/*.js'",
16
- "lint:fix": "eslint '**/*.js' --fix"
16
+ "lint:fix": "eslint '**/*.js' --fix",
17
+ "prepublishOnly": "node scripts/prepublishOnly.js",
18
+ "postpublish": "node scripts/postpublish.js"
17
19
  },
18
20
  "lint-staged": {
19
21
  "*.js": [
@@ -35,14 +37,20 @@
35
37
  "eslint-config-prettier": "^8.3.0",
36
38
  "eslint-plugin-prettier": "^4.0.0",
37
39
  "esm": "^3.2.25",
40
+ "execa": "^8.0.1",
38
41
  "husky": "^7.0.4",
42
+ "kolorist": "^1.8.0",
39
43
  "lint-staged": "^12.3.3",
44
+ "ora": "^7.0.1",
40
45
  "prettier": "^2.5.1",
46
+ "prompts": "^2.4.2",
47
+ "replace-in-file": "^6.1.0",
41
48
  "tap-diff": "^0.1.1",
42
- "tape": "^5.5.0"
49
+ "tape": "^5.5.0",
50
+ "validate-npm-package-name": "^5.0.0"
43
51
  },
44
52
  "dependencies": {
45
- "@lightningjs/renderer": "^0.7.0",
53
+ "@lightningjs/renderer": "^0.7.1",
46
54
  "@lightningjs/vite-plugin-import-chunk-url": "^0.3.0"
47
55
  },
48
56
  "repository": {
@@ -0,0 +1 @@
1
+ export default 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaMAAAAbCAYAAADRe+BYAAAAAXNSR0IArs4c6QAAGn9JREFUeF7tXQ1UVdWePxcWFg7ZA0sym5n0Tmk1z4+0YeVU4yo1h1jvPVBo1ETU8QvTdJlhsmKpi0he5jyXX0CKIWkpl3OlME3RGcdJixVEas+nJtq0sMwXN/kIgbxn1m+791n/ezifF0hr7lmrVV3O2Wfv/977//v//h/7uKTQFZJASAIhCYQkEJLADZaAy+j9iqIMkCRpliRJGeSeWkmSClwuV25X9VtRlOGSJI3m7wq6bd5Osqa/6OZSSZJKXC4X+h7UpSgKZABZQCbiKuHt4t+dvri8z5GG3E77rChKtCRJ9TY647ht0aaiKJAx5LCK/4Y5m23jneotiqJgvg84eCaYd6Cf4h/xqgo+ZwUO3h1wK5cx1oIYP/5eJUlSrsvl6tRakGUZbYr9tjQpKanL9lmw4w09F5LAzyUBXTDiih3KAspN76pwuVxjgu2koijYzGibbmg0tzQYoOPt5Zv0xydJ0hiXywWlYfviAAE5UBDSPu9YUep1QFEUvAdKWly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xP6ebTshz+/btf4qMjGSno5tcvqysrLMnT54ULl81A9FMYWs/FUGAmRkKRjVSvL7LyGhXi6H5kUPo9lKv1ztaABs9oikhIWHz9OnTWSYdZ7oU/E2PCeqOsXU1GPFTNMSHUANq0OyAkc19FbotJIGQBG5GCXAlK8oe6NEzOARUTcQpKir6qqysjH3ChJ/EbwqsNwKM0LGHHnoo9/77739Jm9INpt/Y2Fg+depU1P6JM9ICYtpmChttC8DR1M4wQ8GsYBcyrqqqOvDII48wb0R7ezsKaVf06NGjQJykITLlZs2aJY8bN47FbTWuQFbD5/V6dwmg4myKsWDBDFHUvGTJkphLly7hfhgHjCF119gcpHZbZtNRZrRz5876nTt3IpGGyTcERjej9gj1KSSBLpQAXFjt7e2qgtNruqGh4d20tDRxcoAdlyFthn5awK5OoezfMmak02fqljSSlpk7Wsts6fd5tNmu2uxQo76bufNVhqRx6dO2qIuX9k87H/S4Lz23cHeMjZE14voX80xlpZcBS9k87Sv1hDGDwe7C6cKtEWoqJIGQBG6EBHJzc5+vr69/Iy4ujh1lxK+S6urqquzsbLgzRZ2Mk7gXmrkRYIT3QhGKWiPqirbjhjVT2GhbgISegjUDUvQJCph+dgZuU7jb2AcUSQYyVch6BgB9D3XjqrEjyozInHbX2LoSjCAnjI/FjkLM6EZohNA7QxK4cRKAwlZrrQy64Si78MYNJfTmX5sEQszo1zajofGEJGAtAfHNHVGegSeQ2CD+sW4hdEdIAl0sgRAYdbFAQ82FJBCSQEgCIQk4l0AIjJzLLPRESAIhCYQkEJJAF0vg/wBMng85iZWBHAAAAABJRU5ErkJggg=='
Binary file
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Copyright 2023 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+
18
+ import fs from 'fs'
19
+ import path from 'path'
20
+
21
+ const currentDir = process.cwd()
22
+ const componentDirs = ['src/components']
23
+
24
+ function precompileCleanUp() {
25
+ for (const dir of componentDirs) {
26
+ const fullDir = path.resolve(currentDir, dir)
27
+ console.log(`Checking files in ${fullDir} for original files that precompiler created`)
28
+ processDirectory(fullDir)
29
+ }
30
+ console.log('Finished restoring original files after precompile')
31
+ }
32
+
33
+ function processDirectory(directory) {
34
+ const files = fs.readdirSync(directory)
35
+
36
+ for (const file of files) {
37
+ const filePath = path.join(directory, file)
38
+ const stat = fs.statSync(filePath)
39
+
40
+ if (stat.isDirectory()) {
41
+ processDirectory(filePath)
42
+ } else if (/\.(orig\.(js|ts))$/.test(file)) {
43
+ restoreOriginalFile(filePath)
44
+ }
45
+ }
46
+ }
47
+
48
+ function restoreOriginalFile(filePath) {
49
+ const originalFilePath = filePath.replace(/\.orig\.(j|t)s$/, '.$1s')
50
+ console.log(`Restoring original file ${originalFilePath}`)
51
+
52
+ // Restore the original file by copying the backup file over it
53
+ fs.copyFileSync(filePath, originalFilePath)
54
+
55
+ // Delete the backup file
56
+ fs.unlinkSync(filePath)
57
+ }
58
+
59
+ precompileCleanUp()