Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/generators/default-content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function run(templateData) {
replacementsPackage.locales += `,\n"${templateData.hyphenatedName}.serge.json"`;
}
copyFile(
`${__dirname}/templates/configured/_package.json`,
`${import.meta.dirname}/templates/configured/_package.json`,
`${getDestinationPath(templateData.hyphenatedName)}/package.json`
);
replaceText(`${getDestinationPath(templateData.hyphenatedName)}/package.json`, replacementsPackage);
Expand All @@ -29,34 +29,34 @@ export function run(templateData) {

if (templateData.description) replacementsREADME.description = `\n${templateData.description}\n`;
copyFile(
`${__dirname}/templates/configured/_README.md`,
`${import.meta.dirname}/templates/configured/_README.md`,
`${getDestinationPath(templateData.hyphenatedName)}/README.md`
);
replaceText(`${getDestinationPath(templateData.hyphenatedName)}/README.md`, replacementsREADME);

if (templateData.codeowners) {
copyFile(
`${__dirname}/templates/configured/_CODEOWNERS`,
`${import.meta.dirname}/templates/configured/_CODEOWNERS`,
`${getDestinationPath(templateData.hyphenatedName)}/.github/CODEOWNERS`
);
replaceText(`${getDestinationPath(templateData.hyphenatedName)}/.github/CODEOWNERS`, { codeowners: templateData.codeowners });
}

copyFile(
`${__dirname}/templates/configured/LICENSE`,
`${import.meta.dirname}/templates/configured/LICENSE`,
`${getDestinationPath(templateData.hyphenatedName)}/LICENSE`
);
replaceText(`${getDestinationPath(templateData.hyphenatedName)}/LICENSE`, { year: new Date().getFullYear().toString() });

copyFile(
`${__dirname}/templates/configured/_gitignore`,
`${import.meta.dirname}/templates/configured/_gitignore`,
`${getDestinationPath(templateData.hyphenatedName)}/.gitignore`
);

copyFile(
`${__dirname}/templates/configured/_npmrc`,
`${import.meta.dirname}/templates/configured/_npmrc`,
`${getDestinationPath(templateData.hyphenatedName)}/.npmrc`
);

copyFilesInDir(`${__dirname}/templates/static`, getDestinationPath(templateData.hyphenatedName));
copyFilesInDir(`${import.meta.dirname}/templates/static`, getDestinationPath(templateData.hyphenatedName));
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"devDependencies": {
"@brightspace-ui/stylelint-config": "^2",
"eslint": "^9",
"eslint-config-brightspace": "^3",
"eslint-config-brightspace": "^4",
"stylelint": "^17"
},
"files": [
Expand Down
6 changes: 3 additions & 3 deletions src/generators/demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { copyFile, getDestinationPath, mergeJSON, mergeText, replaceText, sortJS

export function run(templateData) {
mergeJSON(
`${__dirname}/templates/_package.json`,
`${import.meta.dirname}/templates/_package.json`,
`${getDestinationPath(templateData.hyphenatedName)}/package.json`
);
mergeText(
`${__dirname}/templates/_README.md`,
`${import.meta.dirname}/templates/_README.md`,
`${getDestinationPath(templateData.hyphenatedName)}/README.md`
);

copyFile(
`${__dirname}/templates/index.html`,
`${import.meta.dirname}/templates/index.html`,
`${getDestinationPath(templateData.hyphenatedName)}/demo/index.html`
);
replaceText(`${getDestinationPath(templateData.hyphenatedName)}/demo/index.html`, templateData);
Expand Down
4 changes: 2 additions & 2 deletions src/generators/localization/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export function run(templateData) {
}\n`
};

copyFilesInDir(`${__dirname}/templates/static`, getDestinationPath(templateData.hyphenatedName));
copyFilesInDir(`${import.meta.dirname}/templates/static`, getDestinationPath(templateData.hyphenatedName));
replaceText(`${getDestinationPath(templateData.hyphenatedName)}/${templateData.hyphenatedName}.js`, replacements);

copyFile(
`${__dirname}/templates/configured/_element.serge.json`,
`${import.meta.dirname}/templates/configured/_element.serge.json`,
`${getDestinationPath(templateData.hyphenatedName)}/${templateData.hyphenatedName}.serge.json`
);
replaceText(`${getDestinationPath(templateData.hyphenatedName)}/${templateData.hyphenatedName}.serge.json`, templateData);
Expand Down
4 changes: 2 additions & 2 deletions src/generators/release/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { copyFilesInDir, getDestinationPath, mergeText } from '../../helper.js';

export function run(templateData) {
mergeText(
`${__dirname}/templates/configured/_README.md`,
`${import.meta.dirname}/templates/configured/_README.md`,
`${getDestinationPath(templateData.hyphenatedName)}/README.md`
);

copyFilesInDir(`${__dirname}/templates/static`, getDestinationPath(templateData.hyphenatedName));
copyFilesInDir(`${import.meta.dirname}/templates/static`, getDestinationPath(templateData.hyphenatedName));
}
9 changes: 2 additions & 7 deletions src/generators/static-site/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
copyAndProcessDir,
getDestinationPath,
movePlugin,
replaceTextPlugin
} from '../../helper.js';
import { copyAndProcessDir, getDestinationPath, movePlugin, replaceTextPlugin } from '../../helper.js';
import path from 'path';

function genD2ldevReleaseTargetMessage(subdomain) {
Expand Down Expand Up @@ -42,7 +37,7 @@ export function run(templateData) {
d2ldevSubdomain
} = templateData;

const templateRoot = path.join(__dirname, 'templates');
const templateRoot = path.join(import.meta.dirname, 'templates');
const destinationRoot = getDestinationPath(hyphenatedName);

const releaseTargetMessage = d2ldevSubdomain
Expand Down
4 changes: 2 additions & 2 deletions src/generators/test-reporting/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ export function run(templateData) {
};

mergeText(
`${__dirname}/templates/configured/_gitignore`,
`${import.meta.dirname}/templates/configured/_gitignore`,
`${getDestinationPath(templateData.hyphenatedName)}/.gitignore`
);
copyFile(
`${__dirname}/templates/configured/_d2l-test-reporting.config.json`,
`${import.meta.dirname}/templates/configured/_d2l-test-reporting.config.json`,
`${getDestinationPath(templateData.hyphenatedName)}/d2l-test-reporting.config.json`
);
replaceText(`${getDestinationPath(templateData.hyphenatedName)}/d2l-test-reporting.config.json`, templateData);
Expand Down
14 changes: 7 additions & 7 deletions src/generators/test-unit-axe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@ import { copyFile, getDestinationPath, mergeJSON, mergeText, replaceText, sortJS

export function run(templateData) {
mergeJSON(
`${__dirname}/templates/configured/_package.json`,
`${import.meta.dirname}/templates/configured/_package.json`,
`${getDestinationPath(templateData.hyphenatedName)}/package.json`
);
mergeText(
`${__dirname}/templates/configured/_README.md`,
`${import.meta.dirname}/templates/configured/_README.md`,
`${getDestinationPath(templateData.hyphenatedName)}/README.md`
);
copyFile(
`${__dirname}/templates/configured/_element.test.js`,
`${import.meta.dirname}/templates/configured/_element.test.js`,
`${getDestinationPath(templateData.hyphenatedName)}/test/${templateData.hyphenatedName}.test.js`
);
copyFile(
`${__dirname}/templates/configured/_element.axe.js`,
`${import.meta.dirname}/templates/configured/_element.axe.js`,
`${getDestinationPath(templateData.hyphenatedName)}/test/${templateData.hyphenatedName}.axe.js`
);

if (templateData.testReporting) {
mergeJSON(
`${__dirname}/templates/configured/_d2l-test-reporting.config.json`,
`${import.meta.dirname}/templates/configured/_d2l-test-reporting.config.json`,
`${getDestinationPath(templateData.hyphenatedName)}/d2l-test-reporting.config.json`
);
copyFile(
`${__dirname}/templates/static/.github/workflows/ci-test-reporting.yml`,
`${import.meta.dirname}/templates/static/.github/workflows/ci-test-reporting.yml`,
`${getDestinationPath(templateData.hyphenatedName)}/.github/workflows/ci.yml`
);
} else {
copyFile(
`${__dirname}/templates/static/.github/workflows/ci.yml`,
`${import.meta.dirname}/templates/static/.github/workflows/ci.yml`,
`${getDestinationPath(templateData.hyphenatedName)}/.github/workflows/ci.yml`
);
}
Expand Down
14 changes: 7 additions & 7 deletions src/generators/test-vdiff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@ import { copyFile, getDestinationPath, mergeJSON, mergeText, replaceText, sortJS

export function run(templateData) {
mergeJSON(
`${__dirname}/templates/configured/_package.json`,
`${import.meta.dirname}/templates/configured/_package.json`,
`${getDestinationPath(templateData.hyphenatedName)}/package.json`
);
mergeText(
`${__dirname}/templates/_README.md`,
`${import.meta.dirname}/templates/_README.md`,
`${getDestinationPath(templateData.hyphenatedName)}/README.md`
);
mergeText(
`${__dirname}/templates/_gitignore`,
`${import.meta.dirname}/templates/_gitignore`,
`${getDestinationPath(templateData.hyphenatedName)}/.gitignore`
);

copyFile(
`${__dirname}/templates/_element.vdiff.js`,
`${import.meta.dirname}/templates/_element.vdiff.js`,
`${getDestinationPath(templateData.hyphenatedName)}/test/${templateData.hyphenatedName}.vdiff.js`
);
replaceText(`${getDestinationPath(templateData.hyphenatedName)}/test/${templateData.hyphenatedName}.vdiff.js`, templateData);

if (templateData.testReporting) {
mergeJSON(
`${__dirname}/templates/configured/_d2l-test-reporting.config.json`,
`${import.meta.dirname}/templates/configured/_d2l-test-reporting.config.json`,
`${getDestinationPath(templateData.hyphenatedName)}/d2l-test-reporting.config.json`
);
copyFile(
`${__dirname}/templates/static/.github/workflows/vdiff-test-reporting.yml`,
`${import.meta.dirname}/templates/static/.github/workflows/vdiff-test-reporting.yml`,
`${getDestinationPath(templateData.hyphenatedName)}/.github/workflows/vdiff.yml`
);
} else {
copyFile(
`${__dirname}/templates/static/.github/workflows/vdiff.yml`,
`${import.meta.dirname}/templates/static/.github/workflows/vdiff.yml`,
`${getDestinationPath(templateData.hyphenatedName)}/.github/workflows/vdiff.yml`
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/generators/wc-lit-element/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { copyFile, getDestinationPath, mergeJSON, replaceText, sortJSONMembers }

export function run(templateData) {
mergeJSON(
`${__dirname}/templates/configured/_package.json`,
`${import.meta.dirname}/templates/configured/_package.json`,
`${getDestinationPath(templateData.hyphenatedName)}/package.json`
);

Expand All @@ -14,7 +14,7 @@ export function run(templateData) {
templateDataElement.localizeResources = '';
}
copyFile(
`${__dirname}/templates/configured/_element.js`,
`${import.meta.dirname}/templates/configured/_element.js`,
`${getDestinationPath(templateData.hyphenatedName)}/${templateData.hyphenatedName}.js`
);
replaceText(`${getDestinationPath(templateData.hyphenatedName)}/${templateData.hyphenatedName}.js`, templateDataElement);
Expand Down