MDL-87909 core: Include @moodlehq/design-system js
This commit also includes the @types/react, and teaches typescript how to consume the design system definition files.
This commit is contained in:
committed by
Adrian Greeve
parent
b46a8f8c3e
commit
780f9fff56
@@ -18,14 +18,23 @@ async function init() {
|
||||
|
||||
const DS_VERSION = getPackageVersion('@moodlehq/design-system');
|
||||
const nodeModuleRoot = path.join(rootDir, 'node_modules', '@moodlehq', 'design-system');
|
||||
const bundleRoot = path.join(rootDir, 'lib', 'js', 'bundles', 'design-system');
|
||||
const themeRoot = path.join(rootDir, 'public', 'theme', 'boost');
|
||||
const themeDesignSystemRoot = path.join(themeRoot, 'scss', 'design-system');
|
||||
|
||||
console.log(chalk.blue.bold.underline('Updating @moodlehq/design-system bundle to version %s from Node Modules'), DS_VERSION);
|
||||
console.log(chalk.blue('Removing old bundles...'));
|
||||
fs.removeSync(bundleRoot, { recursive: true, force: true });
|
||||
fs.removeSync(themeDesignSystemRoot, { recursive: true, force: true });
|
||||
console.log(chalk.green('Old bundles removed ✓'));
|
||||
|
||||
// Copy the JS bundles to the lib folder.
|
||||
fs.copySync(
|
||||
path.join(nodeModuleRoot, 'dist'),
|
||||
path.join(bundleRoot),
|
||||
);
|
||||
console.log(chalk.green(`→ @moodlehq/design-system:${DS_VERSION} JS bundles ✓`));
|
||||
|
||||
// Copy tokens into the themes.
|
||||
fs.copySync(
|
||||
path.join(nodeModuleRoot, 'tokens', 'scss'),
|
||||
@@ -35,10 +44,12 @@ async function init() {
|
||||
|
||||
// Create readme files in the package folders.
|
||||
console.log(chalk.green(`→ Creating readme_moodle.txt files ✓`));
|
||||
createPackageReadme(bundleRoot, '@moodlehq/design-system');
|
||||
createPackageReadme(themeDesignSystemRoot, '@moodlehq/design-system');
|
||||
|
||||
// And update the version in thirdpartylibs.xml.
|
||||
console.log(chalk.green(`→ Updating thirdpartylibs.xml files ✓`));
|
||||
updateThirdPartyLibsXml(path.join(rootDir, 'lib'), 'js/bundles/design-system', '@moodlehq/design-system', DS_VERSION);
|
||||
updateThirdPartyLibsXml(themeRoot, 'scss/design-system', '@moodlehq/design-system', DS_VERSION);
|
||||
|
||||
console.log("\nAll bundles saved" + chalk.green(" ✓"));
|
||||
|
||||
Reference in New Issue
Block a user