Skip to content

Commit

Permalink
Remove jest dom config file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinTCoughlin committed Jun 18, 2019
1 parent d164d2e commit 0379d3c
Showing 1 changed file with 101 additions and 28 deletions.
129 changes: 101 additions & 28 deletions scripts/create-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (!newPackageName) {

// Convert any package names given in dash-case (e.g. my-new-package) to PascalCase (e.g. MyNewPackage)
// for display purposes in certain template files (e.g. README.md)
let pascalCasePackage = newPackageName.replace(/-[a-zA-Z]/g, function(match, index) {
let pascalCasePackage = newPackageName.replace(/-[a-zA-Z]/g, function (match, index) {
return newPackageName[index + 1].toUpperCase();
});
pascalCasePackage = pascalCasePackage[0].toUpperCase() + pascalCasePackage.substring(1);
Expand Down Expand Up @@ -51,31 +51,98 @@ if (!fs.existsSync(experimentsPackagePath)) {
const experimentsPackageJson = JSON.parse(fs.readFileSync(experimentsPackagePath, 'utf8'));

// Steps (mustache template names and output file paths)
const steps = [
{ template: 'NpmIgnore', output: '.npmignore' },
{ template: 'Npmrc', output: '.npmrc' },
{ template: 'ChangelogJson', output: 'CHANGELOG.json' },
{ template: 'ChangelogMarkdown', output: 'CHANGELOG.md' },
{ template: 'License', output: 'LICENSE' },
{ template: 'Readme', output: 'README.md' },
{ template: 'IndexHtml', output: 'index.html' },
{ template: 'JestConfig', output: 'jest.config.js' },
{ template: 'JestDomConfig', output: 'jest.dom.config.js' },
{ template: 'JsConfig', output: 'jsconfig.json' },
{ template: 'PackageJson', output: 'package.json' },
{ template: 'PrettierConfig', output: 'prettier.config.js' },
{ template: 'TsConfig', output: 'tsconfig.json' },
{ template: 'TsLint', output: 'tslint.json' },
{ template: 'WebpackConfig', output: 'webpack.config.js' },
{ template: 'WebpackServeConfig', output: 'webpack.serve.config.js' },
{ template: 'Tests', output: path.join('config', 'tests.js') },
{ template: 'PreCopy', output: path.join('config', 'pre-copy.json') },
{ template: 'Tests', output: path.join('src', 'common', 'tests.js') },
{ template: 'IndexTs', output: path.join('src', 'index.ts') },
{ template: 'Version', output: path.join('src', 'version.ts') },
{ template: 'AppDefinition', output: path.join('src', 'demo', 'AppDefinition.tsx') },
{ template: 'GettingStartedPage', output: path.join('src', 'demo', 'GettingStartedPage.tsx') },
{ template: 'Demo', output: path.join('src', 'demo', 'index.tsx') }
const steps = [{
template: 'NpmIgnore',
output: '.npmignore'
},
{
template: 'Npmrc',
output: '.npmrc'
},
{
template: 'ChangelogJson',
output: 'CHANGELOG.json'
},
{
template: 'ChangelogMarkdown',
output: 'CHANGELOG.md'
},
{
template: 'License',
output: 'LICENSE'
},
{
template: 'Readme',
output: 'README.md'
},
{
template: 'IndexHtml',
output: 'index.html'
},
{
template: 'JestConfig',
output: 'jest.config.js'
},
{
template: 'JsConfig',
output: 'jsconfig.json'
},
{
template: 'PackageJson',
output: 'package.json'
},
{
template: 'PrettierConfig',
output: 'prettier.config.js'
},
{
template: 'TsConfig',
output: 'tsconfig.json'
},
{
template: 'TsLint',
output: 'tslint.json'
},
{
template: 'WebpackConfig',
output: 'webpack.config.js'
},
{
template: 'WebpackServeConfig',
output: 'webpack.serve.config.js'
},
{
template: 'Tests',
output: path.join('config', 'tests.js')
},
{
template: 'PreCopy',
output: path.join('config', 'pre-copy.json')
},
{
template: 'Tests',
output: path.join('src', 'common', 'tests.js')
},
{
template: 'IndexTs',
output: path.join('src', 'index.ts')
},
{
template: 'Version',
output: path.join('src', 'version.ts')
},
{
template: 'AppDefinition',
output: path.join('src', 'demo', 'AppDefinition.tsx')
},
{
template: 'GettingStartedPage',
output: path.join('src', 'demo', 'GettingStartedPage.tsx')
},
{
template: 'Demo',
output: path.join('src', 'demo', 'index.tsx')
}
];

// Strings
Expand Down Expand Up @@ -141,8 +208,14 @@ function readFileCallback(error, data, templateName, outputFilePath, callback, r
// As of writing, @uifabric/experiments also depends on all the packages the template needs,
// so we grab the current versions from there and add tags for them in the view object.
const templatePackageJson = JSON.parse(data);
const deps = { ...templatePackageJson.devDependencies, ...templatePackageJson.dependencies };
const depVersions = { ...experimentsPackageJson.devDependencies, ...experimentsPackageJson.dependencies };
const deps = {
...templatePackageJson.devDependencies,
...templatePackageJson.dependencies
};
const depVersions = {
...experimentsPackageJson.devDependencies,
...experimentsPackageJson.dependencies
};
const packages = Object.keys(deps);
for (const package of packages) {
if (depVersions[package]) {
Expand Down

0 comments on commit 0379d3c

Please sign in to comment.