-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
274 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
module.exports = { | ||
presets: [ | ||
['@babel/preset-env', {targets: {node: 'current'}}], | ||
['@babel/preset-typescript', {allowDeclareFields: true}], | ||
'@babel/react', | ||
['@babel/preset-typescript', { allowDeclareFields: true }] | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* This file is used to compile the TypeScript files in the assets/src directory | ||
* of each package. | ||
* | ||
* It allows each package to spawn its own rollup process, which is necessary | ||
* to keep memory usage down. | ||
*/ | ||
const { spawnSync } = require('child_process'); | ||
const glob = require('glob'); | ||
|
||
const files = [ | ||
...glob.sync('src/*/assets/src/*controller.ts'), | ||
]; | ||
|
||
files.forEach((file) => { | ||
const result = spawnSync('node', [ | ||
'node_modules/.bin/rollup', | ||
'-c', | ||
'--environment', | ||
`INPUT_FILE:${file}`, | ||
], { | ||
stdio: 'inherit', | ||
shell: true | ||
}); | ||
|
||
if (result.error) { | ||
console.error(`Error compiling ${file}:`, result.error); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Script to "build" the source CSS files to their final destination. | ||
*/ | ||
|
||
const glob = require('glob'); | ||
const { exec } = require('child_process'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
let pattern = 'src/*/assets/package.json'; | ||
|
||
// Use glob to find all matching package.json files | ||
glob(pattern, function (err, files) { | ||
if (err) { | ||
console.error('Error while finding package.json files:', err); | ||
process.exit(1); | ||
} | ||
|
||
// Loop over all files | ||
files.forEach(file => { | ||
// Read the package.json file | ||
const pkg = JSON.parse(fs.readFileSync(file, 'utf-8')); | ||
|
||
// Get the css source | ||
const cssSourceRelative = pkg.config && pkg.config.css_source; | ||
|
||
if (!cssSourceRelative) { | ||
return; | ||
} | ||
// Construct the output path | ||
const cssSource = path.join(path.dirname(file), cssSourceRelative); | ||
const outputDir = path.join(path.dirname(file), 'dist'); | ||
const outputFilename = path.basename(cssSource, '.css') + '.min.css'; | ||
const output = path.join(outputDir, outputFilename); | ||
|
||
// Run the clean-css-cli command | ||
exec(`yarn run cleancss -o ${output} ${cssSource}`, function (err) { | ||
if (err) { | ||
console.error(`Error while minifying ${cssSource}:`, err); | ||
return; | ||
} | ||
|
||
console.log(`Minified ${cssSource} to ${output}`); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.